A272R版本优化
This commit is contained in:
@ -37,6 +37,8 @@
|
||||
#include "FreeRTOS_POSIX/errno.h"
|
||||
#include "FreeRTOS_POSIX/pthread.h"
|
||||
|
||||
#define ENABLE_TLS 1
|
||||
|
||||
/**
|
||||
* @brief Thread attribute object.
|
||||
*/
|
||||
@ -73,8 +75,9 @@ typedef struct pthread_internal
|
||||
StaticSemaphore_t xJoinBarrier; /**< Synchronizes the two callers of pthread_join. */
|
||||
StaticSemaphore_t xJoinMutex; /**< Ensures that only one other thread may join this thread. */
|
||||
void * xReturn; /**< Return value of pvStartRoutine. */
|
||||
|
||||
void** tls;
|
||||
#if ENABLE_TLS
|
||||
void** tls;//亿联内部又单独重新实现了pthread_create,会造成pthread_join里面释放tls分配的内存时奔溃,需要把这部分合并到亿联那边重新打包亿联的库
|
||||
#endif
|
||||
} pthread_internal_t;
|
||||
|
||||
/**
|
||||
@ -123,6 +126,12 @@ static void prvExitThread( void )
|
||||
}
|
||||
else
|
||||
{
|
||||
#if ENABLE_TLS
|
||||
if (pxThread->tls) {
|
||||
vPortFree(pxThread->tls);
|
||||
pxThread->tls = NULL;
|
||||
}
|
||||
#endif
|
||||
/* For a detached thread, perform cleanup of thread object. */
|
||||
vPortFree( pxThread );
|
||||
vTaskDelete( NULL );
|
||||
@ -311,7 +320,6 @@ int pthread_create( pthread_t * thread,
|
||||
iStatus = EAGAIN;
|
||||
} else {
|
||||
memset((void*)pxThread, 0, sizeof(pthread_internal_t));
|
||||
pxThread->tls = NULL;
|
||||
}
|
||||
|
||||
if( iStatus == 0 )
|
||||
@ -467,7 +475,12 @@ int pthread_join( pthread_t pthread,
|
||||
/* Release xJoinMutex and delete it. */
|
||||
( void ) xSemaphoreGive( ( SemaphoreHandle_t ) &pxThread->xJoinMutex );
|
||||
vSemaphoreDelete( ( SemaphoreHandle_t ) &pxThread->xJoinMutex );
|
||||
|
||||
#if ENABLE_TLS
|
||||
if (pxThread->tls) {
|
||||
vPortFree(pxThread->tls);
|
||||
pxThread->tls = NULL;
|
||||
}
|
||||
#endif
|
||||
/* Delete the FreeRTOS task that ran the thread. */
|
||||
vTaskDelete( pxThread->xTaskHandle );
|
||||
|
||||
@ -522,7 +535,12 @@ int pthread_detach(pthread_t pthread)
|
||||
/* Release xJoinMutex and delete it. */
|
||||
( void ) xSemaphoreGive( ( SemaphoreHandle_t ) &pxThread->xJoinMutex );
|
||||
vSemaphoreDelete( ( SemaphoreHandle_t ) &pxThread->xJoinMutex );
|
||||
|
||||
#if ENABLE_TLS
|
||||
if (pxThread->tls) {
|
||||
vPortFree(pxThread->tls);
|
||||
pxThread->tls = NULL;
|
||||
}
|
||||
#endif
|
||||
/* Thread has been finished */
|
||||
if ( pThreadState == eSuspended )
|
||||
{
|
||||
@ -627,6 +645,7 @@ int pthread_setspecific(pthread_key_t key, const void *value)
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
|
||||
int pthread_key_create(pthread_key_t *key, void (*destructor)(void*))
|
||||
{
|
||||
uint32_t index;
|
||||
@ -643,7 +662,7 @@ int pthread_key_create(pthread_key_t *key, void (*destructor)(void*))
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
return EAGAIN;
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
int pthread_key_delete(pthread_key_t key)
|
||||
@ -695,5 +714,63 @@ int pthread_once_ext(pthread_once_t *once_control, void (*init_routine)(void* ar
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pthread_getname_np (pthread_t __target_thread, char *__buf, size_t __buflen)
|
||||
{
|
||||
pthread_internal_t * pxThread = ( pthread_internal_t * ) __target_thread;
|
||||
char *name = NULL;
|
||||
int copy_len = 0;
|
||||
|
||||
if (pxThread == NULL || pxThread->xTaskHandle == NULL || __buf == NULL || __buflen <= 0) {
|
||||
//printf("pthread no handle\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
name = pcTaskGetName(pxThread->xTaskHandle);
|
||||
copy_len = strlen(name);
|
||||
|
||||
if (copy_len > __buflen - 1) {
|
||||
copy_len = __buflen - 1;
|
||||
}
|
||||
|
||||
memcpy(__buf, name, copy_len);
|
||||
__buf[copy_len] = '\0';
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
int pthread_setname_np (pthread_t __target_thread, const char *__name)
|
||||
{
|
||||
pthread_internal_t * pxThread = ( pthread_internal_t * ) __target_thread;
|
||||
char *name = NULL;
|
||||
int copy_len = 0;
|
||||
|
||||
if (pxThread == NULL || pxThread->xTaskHandle == NULL || __name == NULL) {
|
||||
//printf("pthread no handle\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
copy_len = strlen(__name);
|
||||
|
||||
if (copy_len <= 0) {
|
||||
//printf("pthread name is null \r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (copy_len > (configMAX_TASK_NAME_LEN - 1)) {
|
||||
copy_len = (configMAX_TASK_NAME_LEN - 1);
|
||||
}
|
||||
|
||||
name = pcTaskGetName(pxThread->xTaskHandle);
|
||||
|
||||
memcpy(name, __name, copy_len);
|
||||
|
||||
name[copy_len] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -204,7 +204,7 @@ void send_mul_touchscreen_x_y_2_carplay(
|
||||
unsigned short x2, unsigned short y2
|
||||
);
|
||||
/*
|
||||
* @brief 发送旋钮信息给苹果;
|
||||
* @brief 发送旋钮信息给苹果手机,不建议用这个;
|
||||
*/
|
||||
void KnobUpdate(char gSelectButtonPressed,
|
||||
char gHomeButtonPressed,
|
||||
@ -213,6 +213,15 @@ void KnobUpdate(char gSelectButtonPressed,
|
||||
double gYPosition,
|
||||
char gWheelPositionRelative
|
||||
);
|
||||
/*
|
||||
* @brief 发送旋钮信息给苹果手机;
|
||||
*/
|
||||
void sendKnobInfo( char gSelectButtonPressed,
|
||||
char gHomeButtonPressed,
|
||||
char gBackButtonPressed,
|
||||
char gXPosition,
|
||||
char gYPosition,
|
||||
char gWheelPositionRelative);
|
||||
|
||||
/*
|
||||
* @brief 请求iphone启动一个应用;
|
||||
@ -266,6 +275,8 @@ void process_record_stream(int handle, void *buffer, int len, int frames, unsign
|
||||
|
||||
int carplay_get_iphone_ip_addr(char *ipaddr);
|
||||
void carplay_wl_set_iphone_mac_addr(char bt_addr[6]);
|
||||
int carplay_get_connected_iphone_wifi_mac(char mac[18]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -131,6 +131,18 @@ typedef struct __carplay_cfg_info
|
||||
|
||||
}carplay_cfg_info;
|
||||
|
||||
typedef struct _carlink_flash_io
|
||||
{
|
||||
uint32_t (*get_data_arae_size)(void* ctx);
|
||||
uint32_t (*get_flash_block_erase_size)(void* ctx);
|
||||
int32_t (*op_flash)(void* flash_handle, void* ctx, int open);
|
||||
int32_t (*read_data)(void* flash_handle, void *data, uint32_t length, uint32_t offset, void* ctx);
|
||||
int32_t (*write_data)(void* flash_handle, void *data, uint32_t length, uint32_t offset, void* ctx);
|
||||
void* ctx;
|
||||
void* flash_handle;
|
||||
} carlink_flash_io;
|
||||
void register_carlink_flash_io_interface(carlink_flash_io *handle);
|
||||
|
||||
#if 0
|
||||
typedef struct __auto_cfg_info
|
||||
{
|
||||
|
BIN
MXC_A27-PCB4.5-270T/app/carlink/CP/lib/250517-carplay.a
Normal file
BIN
MXC_A27-PCB4.5-270T/app/carlink/CP/lib/250517-carplay.a
Normal file
Binary file not shown.
Binary file not shown.
@ -20,8 +20,10 @@
|
||||
#include "carlink_common.h"
|
||||
#include "board.h"
|
||||
|
||||
|
||||
#if CARLINK_CP
|
||||
|
||||
|
||||
struct carplay_ctx
|
||||
{
|
||||
struct ICalinkEventCallbacks carlinkEventCB;
|
||||
@ -35,6 +37,7 @@ struct carplay_ctx
|
||||
char mRemoteBTMac[6];
|
||||
char mIp[32];
|
||||
char mPhoneWifiMac[18];
|
||||
void* mVideoHandle;
|
||||
};
|
||||
|
||||
struct carplay_ctx g_cp_handle;
|
||||
@ -46,6 +49,85 @@ void start_mdnsd();
|
||||
void start_mdnsd_posix();
|
||||
void stop_mdnsd_posix();
|
||||
|
||||
#if DEVICE_TYPE_SELECT == SPI_NOR_FLASH
|
||||
#include "sfud.h"
|
||||
//根据spi nor flash实际使用情况分配
|
||||
#ifndef CARLINK_CP_OFFSET
|
||||
#define CARLINK_CP_OFFSET 0X39000
|
||||
#endif
|
||||
|
||||
#ifndef CARLINK_CP_SIZE
|
||||
#define CARLINK_CP_SIZE 0x2000
|
||||
#endif
|
||||
|
||||
static int g_sf_read_ptr;
|
||||
static int32_t cp_sf_op_flash(void* flash_handle, void* ctx, int open)
|
||||
{
|
||||
g_sf_read_ptr = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t cp_sf_read_data(void* flash_handle, void *data, uint32_t length, uint32_t offset, void* ctx)
|
||||
{
|
||||
printf("TRACE[%s][%d] start:len=%d\r\n", __func__ ,__LINE__,length);
|
||||
|
||||
int32_t ret = 0;
|
||||
char num[5] = {0};
|
||||
uint8_t* readData = NULL;
|
||||
|
||||
if (g_sf_read_ptr > CARLINK_CP_SIZE)
|
||||
return 0;
|
||||
|
||||
readData = malloc(CARLINK_CP_SIZE);
|
||||
memset(readData, 0, CARLINK_CP_SIZE);
|
||||
sfud_flash *sflash = sfud_get_device(0);
|
||||
if (SFUD_SUCCESS == sfud_read(sflash, CARLINK_CP_OFFSET, CARLINK_CP_SIZE, readData)) {
|
||||
memcpy(num, readData, 4);
|
||||
ret = atoi(num);
|
||||
if(ret > 0) {
|
||||
if (ret > length)
|
||||
ret = length;
|
||||
if (ret > CARLINK_CP_SIZE)
|
||||
ret = (CARLINK_CP_SIZE - 4);
|
||||
memcpy(data, readData + 4, ret);
|
||||
g_sf_read_ptr += CARLINK_CP_SIZE;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
|
||||
free(readData);
|
||||
printf("TRACE[%s][%d] end: ret=%d\r\n", __func__ ,__LINE__,ret);
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
static int32_t cp_sf_write_data(void* flash_handle, void *data, uint32_t length, uint32_t offset, void* ctx)
|
||||
{
|
||||
int ret = 0;
|
||||
char* writeData = NULL;
|
||||
|
||||
if ((length + 4) > CARLINK_CP_SIZE)
|
||||
length = CARLINK_CP_SIZE - 4;
|
||||
|
||||
writeData = malloc(length + 4);
|
||||
|
||||
printf("TRACE[%s][%d] start: len=%d\r\n", __func__ ,__LINE__, length);
|
||||
sprintf(writeData, "%04d", length);
|
||||
memcpy(writeData + 4, data, length);
|
||||
|
||||
sfud_flash *sflash = sfud_get_device(0);
|
||||
sfud_erase(sflash, CARLINK_CP_OFFSET, CARLINK_CP_SIZE);
|
||||
if (SFUD_SUCCESS == sfud_erase_write(sflash, CARLINK_CP_OFFSET, length + 4, (void*)writeData)) {
|
||||
ret = length;
|
||||
}
|
||||
|
||||
free(writeData);
|
||||
printf("TRACE[%s][%d] end:ret=%d\r\n", __func__ ,__LINE__,ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void carplay_notify_event(struct carlink_event *ev, enum CARLINK_EVENT_TYPE type, bool disable_filter)
|
||||
{
|
||||
ev->link_type = CARLINK_CARPLAY_WIRELESS;
|
||||
@ -54,8 +136,6 @@ static void carplay_notify_event(struct carlink_event *ev, enum CARLINK_EVENT_TY
|
||||
carlink_notify_event(ev);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void iap2_link_status(void *ctx, IAP2_LINK_STATUS status){}
|
||||
static int iap2_write_data(void *ctx, char *buf, int len)
|
||||
{
|
||||
@ -85,7 +165,7 @@ static void iap2_msg_identify(void *ctx, int type, int ok)
|
||||
start_mdnsd_posix();
|
||||
}
|
||||
}
|
||||
static void iap2_msg_wl_carplay_update(void *ctx, int status)//<EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD>"Carplay<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
static void iap2_msg_wl_carplay_update(void *ctx, int status)//手机端"Carplay车载"是否开启
|
||||
{
|
||||
struct carplay_ctx* pctx = (struct carplay_ctx*)ctx;
|
||||
|
||||
@ -147,9 +227,15 @@ static void audio_stop_callback_impl(void *ctx, int handle, int type)
|
||||
|
||||
static int video_start_callback_impl(void *ctx)
|
||||
{
|
||||
#if !DISABLE_CARLINK_H264_FRAME_BUF
|
||||
h264_dec_ctx_init();
|
||||
set_carlink_display_state(1);
|
||||
//key_value = 1;
|
||||
#else
|
||||
struct carplay_ctx* pctx = (struct carplay_ctx*)ctx;
|
||||
|
||||
pctx->mVideoHandle = h264_video_player_init();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -157,17 +243,24 @@ static void video_stop_callback_impl(void *ctx)
|
||||
{
|
||||
//key_value = 0;
|
||||
printf("%s:%d\r\n", __func__, __LINE__);
|
||||
#if !DISABLE_CARLINK_H264_FRAME_BUF
|
||||
set_carlink_display_state(0);
|
||||
#else
|
||||
struct carplay_ctx* pctx = (struct carplay_ctx*)ctx;
|
||||
|
||||
h264_video_player_uninit(pctx->mVideoHandle);
|
||||
#endif
|
||||
}
|
||||
static int video_proc_data_callback_impl(void *ctx, char *buf, int len)
|
||||
{
|
||||
#if !DISABLE_CARLINK_H264_FRAME_BUF
|
||||
video_frame_s* frame = NULL;
|
||||
//printf("video_proc_data len:%d\r\n", len);
|
||||
|
||||
get_retry:
|
||||
frame = get_h264_frame_buf();
|
||||
if (NULL == frame) {
|
||||
//printf("h264 frame is empty\r\n");
|
||||
printf("h264 frame is empty\r\n");
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
goto get_retry;
|
||||
//continue;
|
||||
@ -177,6 +270,10 @@ get_retry:
|
||||
frame->len = len;
|
||||
|
||||
notify_h264_frame_ready(&frame);
|
||||
#else
|
||||
struct carplay_ctx* pctx = (struct carplay_ctx*)ctx;
|
||||
h264_video_player_proc(pctx->mVideoHandle, buf, len);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
static void carplay_viewArea_update_notify(void *ctx, int index){}
|
||||
@ -229,48 +326,45 @@ static void carlink_cp_input_event_proc(const struct carlink_event *ev)
|
||||
bool pressed = (bool)ev->u.para[1];
|
||||
//printf("key %d %d\n", key, (int)pressed);
|
||||
|
||||
#if 0
|
||||
if (key == 19) {//right
|
||||
if (!pressed)
|
||||
KnobUpdate(0, 0, 0, 0, 0, 0);
|
||||
if (0) {
|
||||
} else if (key == 19) {
|
||||
/*if (!pressed)
|
||||
sendKnobInfo(0, 0, 0, 0, 0, 0);//up在主界面向上移动光标
|
||||
else
|
||||
KnobUpdate(0, 0, 0, 1.0, 0, 0);
|
||||
sendKnobInfo(0, 0, 0, 0, 1, 0);*/
|
||||
if (pressed) {//退后台,手机停止发送carplay视频流
|
||||
carplay_send_change_modes(CarplayTransferType_Take, CarplayTransferPriority_UserInitiated,
|
||||
CarplayConstraint_Never, CarplayConstraint_Never,
|
||||
0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
} else if (key == 20) {
|
||||
if (!pressed)
|
||||
KnobUpdate(0, 0, 0, 0, 0, 0);
|
||||
/*if (!pressed)
|
||||
sendKnobInfo(0, 0, 0, 0, 0, 0); //down在主界面向下移动光标
|
||||
else
|
||||
KnobUpdate(0, 0, 0, -1.0, 0, 0);
|
||||
}if (key == 18) {//up
|
||||
if (!pressed)
|
||||
KnobUpdate(0, 0, 0, 0, 0, 0);
|
||||
else
|
||||
KnobUpdate(0, 0, 0, 0, 1.0, 0);
|
||||
} else if (key == 17) {//down
|
||||
if (!pressed)
|
||||
KnobUpdate(0, 0, 0, 0, 0, 0);
|
||||
else
|
||||
KnobUpdate(0, 0, 0, 0, -1.0, 0);
|
||||
} else if (key == 27) {
|
||||
KnobUpdate(1, 0, 0, 0, 0, 0);
|
||||
}
|
||||
#else
|
||||
|
||||
if (key == 19) {//right
|
||||
if (!pressed)
|
||||
request_UI("maps:");
|
||||
} else if (key == 20) {
|
||||
if (!pressed)
|
||||
request_UI("music:");
|
||||
} else if (key == 18) {//left
|
||||
sendKnobInfo(0, 0, 0, 0, -1, 0);*/
|
||||
if (pressed) {//回前台,手机重新发送carplay视频流
|
||||
carplay_send_change_modes(CarplayTransferType_Untake,
|
||||
0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0);
|
||||
request_UI(NULL);
|
||||
}
|
||||
} else if (key == 18) {//previos
|
||||
if (pressed)
|
||||
KnobUpdate(0, 0, 0, 0, 0, 1);
|
||||
sendKnobInfo(0, 0, 0, 0, 0, 1);
|
||||
//else
|
||||
// sendKnobInfo(0, 0, 0, 0, 0, 0);
|
||||
|
||||
} else if (key == 17) {//right
|
||||
} else if (key == 17) {//next
|
||||
if (pressed)
|
||||
KnobUpdate(0, 0, 0, 0, 0, -1);
|
||||
sendKnobInfo(0, 0, 0, 0, 0, -1);
|
||||
//else
|
||||
// sendKnobInfo(0, 0, 0, 0, 0, 0);
|
||||
} else if (key == 27) {// enter
|
||||
if (pressed)
|
||||
sendKnobInfo(1, 0, 0, 0, 0, 0);
|
||||
else
|
||||
sendKnobInfo(0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static void onEventCarplay(void* ctx, const struct carlink_event *ev)
|
||||
@ -311,7 +405,7 @@ static void onEventCarplay(void* ctx, const struct carlink_event *ev)
|
||||
case CARLINK_EVENT_BT_DISCONNECT: {
|
||||
printf("bt disconnect, iap disconnect %d %d\r\n", pctx->mIapReady, pctx->mPhoneCarplayFlag);
|
||||
if (pctx->mIapReady && !pctx->mPhoneCarplayFlag) {
|
||||
//<EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD>"Carplay<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22>رգ<D8B1>ͬʱƻ<CAB1><C6BB><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD>ر<EFBFBD><D8B1>ˣ<EFBFBD>ִ<EFBFBD><D6B4>һ<EFBFBD><D2BB>carplay stop
|
||||
//手机端"Carplay车载"关闭,同时苹果手机蓝牙也关闭了,执行一下carplay stop
|
||||
carplay_stop();
|
||||
}
|
||||
pctx->mIapReady = false;
|
||||
@ -413,7 +507,7 @@ static void taskInitCarlinkCpProc(void* param)
|
||||
video_cbs.video_start_callback = video_start_callback_impl;
|
||||
video_cbs.video_stop_callback = video_stop_callback_impl;
|
||||
video_cbs.video_proc_data_callback = video_proc_data_callback_impl;
|
||||
video_cbs.ctx = NULL;
|
||||
video_cbs.ctx = (void*)pctx;
|
||||
video_register_callbacks((void *)(&video_cbs));
|
||||
|
||||
audio_callbacks_t audio_cbs;
|
||||
@ -504,13 +598,25 @@ static void carplay_init_parameter()
|
||||
|
||||
g_link_info->icurrent = 1000;
|
||||
g_link_info->enable_iap_carplay_sess = 1;
|
||||
#if DEVICE_TYPE_SELECT != EMMC_FLASH
|
||||
g_link_info->keychain_path_dir = "/sf";
|
||||
{
|
||||
static carlink_flash_io io = {0};
|
||||
io.op_flash = cp_sf_op_flash;
|
||||
io.read_data = cp_sf_read_data;
|
||||
io.write_data = cp_sf_write_data;
|
||||
//sfud_erase(sfud_get_device(0), CARLINK_CP_OFFSET, CARLINK_CP_SIZE);
|
||||
register_carlink_flash_io_interface(&io);
|
||||
}
|
||||
#else
|
||||
g_link_info->keychain_path_dir = DEVICE_PARTITION_NAME;
|
||||
#endif
|
||||
g_link_info->is_old_carplay_ver = 0;
|
||||
g_link_info->enable_single_ui = 1;
|
||||
|
||||
g_link_info->disable_carplay_audio = 1;//1. audio is stream to bt;
|
||||
|
||||
//g_link_info->mfi_ic_addr = 0x22; //cp2.0
|
||||
//g_link_info->mfi_ic_addr = 0x22; //cp2.0的地址由reset脚决定
|
||||
g_link_info->mfi_ic_addr = 0x20; //cp3.0
|
||||
g_link_info->mfi_ic_i2c_bus_num = 0;
|
||||
|
||||
|
@ -343,5 +343,3 @@ int ark_network_init()
|
||||
|
||||
return (int)ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -582,12 +582,15 @@ eDHCPCallbackAnswer_t xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase,
|
||||
|
||||
static BaseType_t carlink_wifi_init()
|
||||
{
|
||||
int status;
|
||||
static int wifi_sdio_status = MMCSD_HOST_UNPLUGED;
|
||||
|
||||
if (wifi_sdio_status == MMCSD_HOST_PLUGED)
|
||||
return 0;
|
||||
WIFI_Context_init();
|
||||
WIFI_RegisterEvent(eWiFiEventMax, carlink_wifi_event_handler);
|
||||
for (;;) {
|
||||
status = mmcsd_wait_sdio_ready((int32_t)portMAX_DELAY);
|
||||
if (status == MMCSD_HOST_PLUGED) {
|
||||
wifi_sdio_status = mmcsd_wait_sdio_ready((int32_t)portMAX_DELAY);
|
||||
if (wifi_sdio_status == MMCSD_HOST_PLUGED) {
|
||||
printf("detect sdio device\r\n");
|
||||
break;
|
||||
}
|
||||
@ -613,8 +616,14 @@ static void bt_set_support_carplay_android_auto()//auto + cp
|
||||
console_send_atcmd(cmd_str, strlen(cmd_str));
|
||||
}
|
||||
|
||||
static void taskInitCarlinkWlanThread(void* param)
|
||||
{
|
||||
carlink_start_wlan();
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
int carlink_bt_wifi_init()
|
||||
{
|
||||
int retry_count = 0;
|
||||
pthread_mutex_lock(&btwifiLocker);
|
||||
if (g_bt_wifi_init_flag) {
|
||||
pthread_mutex_unlock(&btwifiLocker);
|
||||
@ -627,14 +636,24 @@ int carlink_bt_wifi_init()
|
||||
//bt_set_support_carplay();
|
||||
bt_set_support_carplay_android_auto();
|
||||
carlink_bt_open_nolock();
|
||||
carlink_start_wlan();
|
||||
g_bt_wifi_init_flag = 1;
|
||||
lwip_tcpip_init_done_flag = 0;
|
||||
xTaskCreate(taskInitCarlinkWlanThread, "initThread", 2048 * 4, NULL, 1, NULL);
|
||||
|
||||
while(lwip_tcpip_init_done_flag == 0) {
|
||||
if (retry_count++ > 50)
|
||||
break;
|
||||
vTaskDelay(pdMS_TO_TICKS(300));
|
||||
}
|
||||
|
||||
if (lwip_tcpip_init_done_flag) {
|
||||
g_bt_wifi_init_flag = 1;
|
||||
printf("bt wlan init ok\r\n");
|
||||
} else {
|
||||
g_bt_wifi_init_flag = 0;
|
||||
printf("bt wlan init failed\r\n");
|
||||
}
|
||||
pthread_mutex_unlock(&btwifiLocker);
|
||||
printf("bt wlan init is ok\r\n");
|
||||
|
||||
// app_wifi_update_demo();
|
||||
wifi_update_init();
|
||||
printf("app wlan update init ok\r\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ void carlink_register_event_callbacks(const struct ICalinkEventCallbacks *pcb)
|
||||
|
||||
int carlink_common_init()
|
||||
{
|
||||
FF_Disk_t *sfdisk = NULL;
|
||||
//FF_Disk_t *sfdisk = NULL;
|
||||
BaseType_t ret = -1;
|
||||
|
||||
pthread_mutex_lock(&carlink_com_locker);
|
||||
@ -120,14 +120,14 @@ int carlink_common_init()
|
||||
}
|
||||
|
||||
pthread_key_system_init();
|
||||
|
||||
#if 0
|
||||
sfdisk = FF_SFDiskInit("/sf");
|
||||
if (!sfdisk) {
|
||||
printf("FF_SFDiskInit fail.\r\n");
|
||||
//return;
|
||||
}
|
||||
|
||||
ret = xTaskCreate(carlink_event_proc, "cl_ev_proc", 2048, NULL, configMAX_PRIORITIES / 5, NULL);
|
||||
#endif
|
||||
ret = xTaskCreate(carlink_event_proc, "cl_ev_proc", 2048, NULL, configMAX_PRIORITIES - 1, NULL);
|
||||
g_comm_init_flag = 1;
|
||||
|
||||
exit:
|
||||
|
@ -31,6 +31,11 @@ void set_carlink_display_info(int x, int y, int w, int h);//set carlink show are
|
||||
void set_carlink_display_state(int on); // on: 1.display carlink; 0. display native ui
|
||||
void set_carlink_active_video_info(int x, int y);//for android auto
|
||||
|
||||
|
||||
void* h264_video_player_init();
|
||||
void h264_video_player_uninit(void* h264_Handle);
|
||||
int h264_video_player_proc(void* h264_Handle, const char *h264_buf, int h264_buf_len);
|
||||
|
||||
#define WRITE_BE32(ptr, val) \
|
||||
do { \
|
||||
uint8_t* __ptr = (uint8_t*)(ptr); \
|
||||
|
@ -131,6 +131,19 @@ typedef struct __carplay_cfg_info
|
||||
|
||||
}carplay_cfg_info;
|
||||
|
||||
typedef struct _carlink_flash_io
|
||||
{
|
||||
uint32_t (*get_data_arae_size)(void* ctx);
|
||||
uint32_t (*get_flash_block_erase_size)(void* ctx);
|
||||
int32_t (*op_flash)(void* flash_handle, void* ctx, int open);
|
||||
int32_t (*read_data)(void* flash_handle, void *data, uint32_t length, uint32_t offset, void* ctx);
|
||||
int32_t (*write_data)(void* flash_handle, void *data, uint32_t length, uint32_t offset, void* ctx);
|
||||
void* ctx;
|
||||
void* flash_handle;
|
||||
} carlink_flash_io;
|
||||
void register_carlink_flash_io_interface(carlink_flash_io *handle);
|
||||
|
||||
#if 0
|
||||
typedef struct __auto_cfg_info
|
||||
{
|
||||
short width;//pixel
|
||||
@ -142,10 +155,10 @@ typedef struct __auto_cfg_info
|
||||
bool disable_carplay_audio;
|
||||
|
||||
} auto_cfg_info;
|
||||
|
||||
#endif
|
||||
|
||||
extern carplay_cfg_info *g_link_info;
|
||||
extern auto_cfg_info *g_auto_link_info;
|
||||
//extern auto_cfg_info *g_auto_link_info;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -68,6 +68,10 @@ void check_key(void)
|
||||
gs_keyDat[i].flag_Reset=1;
|
||||
gs_keyDat[i].keyCnt=0;
|
||||
// printf("LV_KEY_OPTION key long key\r\n");
|
||||
if(Get_sys_wifi_state()){
|
||||
printf("key carplay -----------------maps.\r\n");
|
||||
request_UI("maps:");
|
||||
}else
|
||||
Key_Distinction(KEY_LONG_ON,LV_KEY_OPTION);
|
||||
}
|
||||
if(i==1 && gs_keyDat[0].flag_Pressed==KEY_OFF)
|
||||
@ -75,6 +79,11 @@ void check_key(void)
|
||||
gs_keyDat[i].flag_Reset=1;
|
||||
gs_keyDat[i].keyCnt=0;
|
||||
// printf("LV_KEY_SELECT key long key\r\n");
|
||||
if(Get_sys_wifi_state()){
|
||||
printf("key carplay -----------------enter.\r\n");
|
||||
// KnobUpdate(1,0,0,0,0,0);
|
||||
sendKnobInfo(1, 0, 0, 0, 0, 0);
|
||||
}else
|
||||
Key_Distinction(KEY_LONG_ON,LV_KEY_SELECT);
|
||||
}
|
||||
|
||||
@ -100,6 +109,11 @@ void check_key(void)
|
||||
// // android_auto_send_knob_event(19,1);
|
||||
// // android_auto_send_knob_event(19,0);
|
||||
// }else
|
||||
if(Get_sys_wifi_state()){
|
||||
printf("key carplay -----------------previos.\r\n");
|
||||
// KnobUpdate(0,0,0,0,0,1);
|
||||
sendKnobInfo(0, 0, 0, 0, 0, 1);
|
||||
}else
|
||||
Key_Distinction(KEY_SHORT_ON,LV_KEY_OPTION);
|
||||
}
|
||||
else if(i==1 && gs_keyDat[0].flag_Pressed==KEY_OFF)
|
||||
@ -118,6 +132,11 @@ void check_key(void)
|
||||
// // android_auto_send_knob_event(20,1);
|
||||
// // android_auto_send_knob_event(20,0);
|
||||
// }else
|
||||
if(Get_sys_wifi_state()){
|
||||
printf("key carplay -----------------next.\r\n");
|
||||
// KnobUpdate(0,0,0,0,0,-1);
|
||||
sendKnobInfo(0, 0, 0, 0, 0, -1);
|
||||
}else
|
||||
Key_Distinction(KEY_SHORT_ON,LV_KEY_SELECT);
|
||||
}
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ alloc_socket(struct netconn *newconn, int accepted)
|
||||
LWIP_UNUSED_ARG(accepted);
|
||||
|
||||
/* allocate a new socket identifier */
|
||||
for (i = 0; i < NUM_SOCKETS; ++i) {
|
||||
for (i = 3; i < NUM_SOCKETS; ++i) {
|
||||
/* Protect socket array */
|
||||
SYS_ARCH_PROTECT(lev);
|
||||
if (!sockets[i].conn) {
|
||||
|
@ -395,7 +395,7 @@
|
||||
/* Maximum number of retransmissions of SYN segments. */
|
||||
#define TCP_SYNMAXRTX 4
|
||||
|
||||
#define LWIP_SOCKET_OFFSET 3
|
||||
// #define LWIP_SOCKET_OFFSET 3
|
||||
|
||||
#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
|
||||
#define LWIP_DBG_TYPES_ON LWIP_DBG_ON
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3573,6 +3573,9 @@
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\app\carlink\CP\src\carlink_cp_audio_impl.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\app\carlink\CP\include\mycommon.h</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>ec</name>
|
||||
|
@ -3796,6 +3796,9 @@
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\app\carlink\CP\src\carlink_cp_audio_impl.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\app\carlink\CP\include\mycommon.h</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>ec</name>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -137,7 +137,7 @@
|
||||
<RecentlyUsedMenus>1</RecentlyUsedMenus>
|
||||
<MenuShadows>1</MenuShadows>
|
||||
<ShowAllMenusAfterDelay>1</ShowAllMenusAfterDelay>
|
||||
<CommandsUsage>0B0A00008B0001DC00000300000002860000010000005786000001000000268400000300000019800000010000005984000002000000138600001701000021DE0000010000000880000001000000298100000C00000040E10000010000002CE10000020000007884000003000000048100000500000000DA000001000000158100000300000056840000010000002681000001000000108600004604000045810000010000003184000001000000AF0600000400000016B0000001000000239200000100000007E100000200000029E1000001000000018100000E000000878000000A000000D884000002000000009000000500000002B0000001000000ED800000010000005F8600000700000020810000010000000F8100000200000004E1000002000000A680000001000000EA800000010000001D920000010000000D8000000200000026DE0000020000001D8100000900000001E10000070000003F810000010000000C8100009701000003DC000004000000D185000002000000048600000100000009810000010000001A8F00000100000003840000050000000186000001000000568600000F0000002881000001000000178100000500000000DC00000100000014810000060000007784000002000000558400001800000047810000010000003384000001000000808C0000010000002BE100000B0000000084000003000000118400000100000007B00000020000008386000002000000228100000100000028E100000100000085840000010000008980000001000000EF800000010000000E840000010000000C860000030000000081000001000000098600000100000028DE000003000000978000000100000025E100002C010000EC800000010000005E8600001700000003E100000A0000001A860000030000000E810000010000001F8100006F01000000E1000002000000A5800000010000000B8100000E0000008E86000001000000E980000002000000D184000001000000038600000100000027840000010000002B8000000100000069860000010000005886000001000000058400000A000000148600000A01000002DC0000010000001681000001000000198F0000030000002A8F000002000000F4800000010000000086000001000000028400000300000027810000040000005586000002000000058100002000000011860000E9000000028100000100000074860000010000000BDE00000100000017B00000010000002AE1000001000000108400000D00000046810000EB0000005184000001000000A486000001000000888000000100000044D50000010000004381000001000000608600004B000000EE8000000100000003B00000010000002181000006000000D684000001000000A186000002000000EB800000010000005D860000060000001E8100000300000035E100000600000002E100000300000008860000020000000D8100001000000024E1000001000000058600000100000007840000010000000A81000002000000E880000001000000</CommandsUsage>
|
||||
<CommandsUsage>1A0A00008B0001DC00000300000002860000010000005786000001000000268400000300000019800000010000005984000002000000138600001701000021DE0000010000000880000001000000298100000C00000040E10000010000002CE10000020000007884000003000000048100000500000000DA000001000000158100000300000056840000010000002681000001000000108600004D04000045810000010000003184000001000000AF0600000400000016B0000001000000239200000100000007E100000200000029E1000001000000018100000E000000878000000A000000D884000002000000009000000500000002B0000001000000ED800000010000005F8600000700000020810000010000000F8100000200000004E1000002000000A680000001000000EA800000010000001D920000010000000D8000000200000026DE0000020000001D8100000900000001E10000070000003F810000010000000C8100009701000003DC000004000000D185000002000000048600000100000009810000010000001A8F00000100000003840000050000000186000001000000568600000F0000002881000001000000178100000500000000DC00000100000014810000060000007784000002000000558400001800000047810000010000003384000001000000808C0000010000002BE100000B0000000084000003000000118400000100000007B00000020000008386000002000000228100000100000028E100000100000085840000010000008980000001000000EF800000010000000E840000010000000C860000030000000081000001000000098600000100000028DE000003000000978000000100000025E100002C010000EC800000010000005E8600001700000003E100000A0000001A860000030000000E810000010000001F8100007101000000E1000002000000A5800000010000000B8100000E0000008E86000001000000E980000002000000D184000001000000038600000100000027840000010000002B8000000100000069860000010000005886000001000000058400000A000000148600000B01000002DC0000010000001681000001000000198F0000030000002A8F000002000000F4800000010000000086000001000000028400000300000027810000040000005586000002000000058100002000000011860000EA000000028100000100000074860000010000000BDE00000100000017B00000010000002AE1000001000000108400000D00000046810000EF0000005184000001000000A486000001000000888000000100000044D50000010000004381000001000000608600004B000000EE8000000100000003B00000010000002181000006000000D684000001000000A186000002000000EB800000010000005D860000060000001E8100000300000035E100000600000002E100000300000008860000020000000D8100001000000024E1000001000000058600000100000007840000010000000A81000002000000E880000001000000</CommandsUsage>
|
||||
</MFCToolBarParameters>
|
||||
<CommandManager>
|
||||
<CommandsWithoutImages>4A0008800000098000000A8000000B8000000C800000158000000A810000FFFFFFFF01E8000012810000D2840000D1850000D78600000C84000033840000788400001184000020DE000021DE000026DE000028DE000023DE000022DE000024DE000027DE000025DE000020920000289200002992000037920000389200003492000033920000259200001E92000000DC000001DC000002DC000003DC0000748600007784000007840000808C000044D50000838600005886000004DC000001B0000002B0000003B0000004B0000005B0000006B0000007B0000008B0000009B000000AB000000BB000000CB000000DB000000EB0000000B00000248100002AE10000008200001C8200000182000067860000008800000188000002880000038800000488000005880000</CommandsWithoutImages>
|
||||
@ -880,7 +880,7 @@
|
||||
</BasePane-34049>
|
||||
<MFCToolBar-34050>
|
||||
<Name>Main</Name>
|
||||
<Buttons>00200000010000002100FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000063000000FFFEFF000000000000000000000000000100000001000000018001E100000000000064000000FFFEFF000000000000000000000000000100000001000000018003E100000000000066000000FFFEFF0000000000000000000000000001000000010000000180008100000000000047000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E100000000000069000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004006B000000FFFEFF000000000000000000000000000100000001000000018022E10000000004006A000000FFFEFF000000000000000000000000000100000001000000018025E10000000000006D000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE100000000040070000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040071000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000000FFFFFFFFFFFEFF0000000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF0096000000000000000000018021810000000004005A000000FFFEFF000000000000000000000000000100000001000000018024E10000000000006C000000FFFEFF000000000000000000000000000100000001000000018028E10000000004006E000000FFFEFF000000000000000000000000000100000001000000018029E10000000000006F000000FFFEFF0000000000000000000000000001000000010000000180028100000000000049000000FFFEFF000000000000000000000000000100000001000000018029810000000000005E000000FFFEFF000000000000000000000000000100000001000000018027810000000000005C000000FFFEFF000000000000000000000000000100000001000000018028810000000000005D000000FFFEFF00000000000000000000000000010000000100000001801D8100000000040056000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040057000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B810000000000004D000000FFFEFF00000000000000000000000000010000000100000001800C810000000000004E000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000062000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001801F8100000000000058000000FFFEFF0000000000000000000000000001000000010000000180208100000000000059000000FFFEFF0000000000000000000000000001000000010000000180468100000000020060000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00FF020000</Buttons>
|
||||
<Buttons>00200000010000002100FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000064000000FFFEFF000000000000000000000000000100000001000000018001E100000000000065000000FFFEFF000000000000000000000000000100000001000000018003E100000000000067000000FFFEFF0000000000000000000000000001000000010000000180008100000000000048000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E10000000000006A000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004006C000000FFFEFF000000000000000000000000000100000001000000018022E10000000004006B000000FFFEFF000000000000000000000000000100000001000000018025E10000000000006E000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE100000000040071000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040072000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000000FFFFFFFFFFFEFF0000000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF0096000000000000000000018021810000000004005B000000FFFEFF000000000000000000000000000100000001000000018024E10000000000006D000000FFFEFF000000000000000000000000000100000001000000018028E10000000004006F000000FFFEFF000000000000000000000000000100000001000000018029E100000000000070000000FFFEFF000000000000000000000000000100000001000000018002810000000000004A000000FFFEFF000000000000000000000000000100000001000000018029810000000000005F000000FFFEFF000000000000000000000000000100000001000000018027810000000000005D000000FFFEFF000000000000000000000000000100000001000000018028810000000000005E000000FFFEFF00000000000000000000000000010000000100000001801D8100000000000057000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040058000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B810000000000004E000000FFFEFF00000000000000000000000000010000000100000001800C810000000000004F000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000063000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001801F8100000000000059000000FFFEFF000000000000000000000000000100000001000000018020810000000000005A000000FFFEFF0000000000000000000000000001000000010000000180468100000000020061000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00FF020000</Buttons>
|
||||
</MFCToolBar-34050>
|
||||
<Pane-34050>
|
||||
<ID>34050</ID>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<LeaveTargetRunning>_ 0</LeaveTargetRunning>
|
||||
</JLinkDriver>
|
||||
<DebugChecksum>
|
||||
<Checksum>2140416141</Checksum>
|
||||
<Checksum>3298284238</Checksum>
|
||||
</DebugChecksum>
|
||||
<Exceptions>
|
||||
<StopOnUncaught>_ 0</StopOnUncaught>
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user