int main() { UartPrintf(); while(1) { } }
static void __irq Eint0Isr( void ) { Delay( 1000 ); UartPrintf( "EINT0 is occurred.\n" ); ClearPending( BIT_EINT0 ); }
/**************************************************************************** NAME handleAppInit DESCRIPTION Handles the application initialised message. */ static void handleAppInitCfm(void) { mvdAppState app_state = the_app->app_state; switch( app_state ) { case AppStateInitialising: { /* ConnectionWriteClassOfDevice(AV_MAJOR_DEVICE_CLASS | AV_MINOR_HIFI | AV_COD_CAPTURE);*/ ConnectionWriteClassOfDevice(0x40020C); /* handset */ /* now allow buttons */ pioInit(&the_app->pio_states, &the_app->task ) ; the_app->audioAdaptorPoweredOn = TRUE; /* initSync();*/ setAppState(AppStateIdle); UartPrintf("\r\nReady\r\n"); break; } default: { unexpectedAppMessage(APP_INIT_CFM, app_state); } } }
static void __irq Eint4Isr( void ) { Delay( 1000 ); UartPrintf( "EINT4 is occurred.\n" ); ClearPending( BIT_EINT4_7 ); ClearExtPending( BIT_EXT_EINT4 ); }
/***************************************************************************** NAME headsetHandleUserConfirmationInd DESCRIPTION This function is called on receipt on an CL_SM_USER_CONFIRMATION_REQ_IND RETURNS void */ void headsetHandleUserConfirmationInd(const CL_SM_USER_CONFIRMATION_REQ_IND_T* ind) { if (AuthCanHeadsetPair()) { #if 1 theHeadset.confirmation = TRUE; AUTH_DEBUG(("auth: can confirm %ld\n", ind->numeric_value)); /* should use text to speech here */ theHeadset.confirmation_addr = (bdaddr*)PanicUnlessMalloc(sizeof(bdaddr)); *theHeadset.confirmation_addr = ind->bd_addr; #else ConnectionSmUserConfirmationResponse(&ind->bd_addr, TRUE); /* infor ssp numeric_value */ UartPrintf("\r\n+SSP=%ld\r\n",ind->numeric_value); #endif } else { /* reject the confirmation request */ AUTH_DEBUG(("auth: rejecting confirmation req\n")); ConnectionSmUserConfirmationResponse(&ind->bd_addr, FALSE); } }
void eemcDump() { UartPrintf("eemc_arg2 %p\n", eemc_arg2); UartPrintf("eemc_blksizecnt %p\n", eemc_blksizecnt); UartPrintf("eemc_arg1 %p\n", eemc_arg1); UartPrintf("eemc_cmdtm %p\n", eemc_cmdtm); UartPrintf("eemc_resp0 %p\n", eemc_resp0); UartPrintf("eemc_resp1 %p\n", eemc_resp1); UartPrintf("eemc_resp2 %p\n", eemc_resp2); UartPrintf("eemc_resp3 %p\n", eemc_resp3); UartPrintf("eemc_data %p\n", eemc_data); UartPrintf("eemc_status %p\n", eemc_status); UartPrintf("eemc_control0 %p\n", eemc_control0); UartPrintf("eemc_control1 %p\n", eemc_control1); UartPrintf("eemc_interrupt %p\n", eemc_interrupt); UartPrintf("eemc_irpt_mask %p\n", eemc_irpt_mask); UartPrintf("eemc_irpt_en %p\n", eemc_irpt_en); UartPrintf("eemc_control2 %p\n", eemc_control2); UartPrintf("eemc_force_irpt %p\n", eemc_force_irpt); UartPrintf("eemc_boot_timeout %p\n", eemc_boot_timeout); UartPrintf("eemc_dbg_sel %p\n", eemc_dbg_sel); UartPrintf("eemc_exrdfifo_cfg %p\n", eemc_exrdfifo_cfg); UartPrintf("eemc_exrdfifo_en %p\n", eemc_exrdfifo_en); UartPrintf("eemc_tune_step %p\n", eemc_tune_step); UartPrintf("eemc_tune_steps_std %p\n", eemc_tune_steps_std); UartPrintf("eemc_tune_steps_ddr %p\n", eemc_tune_steps_ddr); UartPrintf("eemc_spi_int_spt %p\n", eemc_spi_int_spt); UartPrintf("eemc_slotisr_ver %p\n", eemc_slotisr_ver); }
int auto_test_protocol_data_dealwith(unsigned char* MemBuffer, int MemSize, int *pReadPos,int *pWritePos, int ByteToDo) { char *pData = NULL; char *pTemp = NULL; char *pTempParser = NULL; char *p = NULL; int ByteToDealWith = ByteToDo; int RealDoSize = 0; int Ret = 0; int Length = 0; int i = 0; if((MemBuffer == NULL) || (pReadPos == NULL) || (pWritePos == NULL) || (MemSize < *pReadPos) || (MemSize < ByteToDealWith) || (ByteToDealWith <= 0)) { log_printf("\nSK PROTOCOL, parameter error\n"); return -1; } if(*pReadPos == *pWritePos) { return -1; } log_printf("\nPROTOCOL, Read = %d, Write = %d\n",*pReadPos,*pWritePos); if(*pReadPos > *pWritePos) { if(((MemSize - *pReadPos) + *pWritePos) < ByteToDealWith) ByteToDealWith = (MemSize - *pReadPos) + *pWritePos; } else { if((*pWritePos - *pReadPos) < ByteToDealWith) ByteToDealWith = *pWritePos - *pReadPos; } pTemp = calloc(1,ByteToDealWith+1); if(pTemp == NULL) { UartPrintf("PROTOCOL, calloc error\n"); return -1; } pTempParser = calloc(1,ByteToDealWith+1); if(pTempParser == NULL) { log_printf("PROTOCOL, calloc error\n"); GxCore_Free(pTemp); return -1; } if((*pReadPos + ByteToDealWith) <= MemSize) { pData = (char*)MemBuffer + *pReadPos; memcpy(pTemp,pData,ByteToDealWith); } else { pData = (char*)MemBuffer + *pReadPos; memcpy(pTemp,pData,(MemSize - *pReadPos)); pData = (char*)MemBuffer; memcpy((pTemp + (MemSize - *pReadPos)),pData,(ByteToDealWith - (MemSize - *pReadPos))); } // do the data pData = pTemp; p = strstr((char*)pData,CMD_END_FLAG); if(p == NULL) { //pTemp += ByteToDealWith; log_printf("PROTOCOL, bad data...\n"); goto BACK; } while(1) { memset(pTempParser, 0, ByteToDealWith+1); Length = p - pData + (strlen(CMD_END_FLAG)); memcpy(pTempParser,pData,Length); for(i = 0; i < Length; i++) { if(pTempParser[i] == '\r') pTempParser[i] = ' '; } Ret = _auto_test_one_cmd_proccess(pTempParser,Length); if(Ret < 0) { //log_printf("\nPROTOCOL, parser cmd failed...\n"); //break; } pData += Length; p = strstr((char*)pData,CMD_END_FLAG); if(p == NULL) { log_printf("\nPROTOCOL, not enough data to deal with...\n"); break; } } BACK: // successfull, set the read position RealDoSize = pData - pTemp; if((*pReadPos + RealDoSize) > MemSize) { *pReadPos = (*pReadPos + RealDoSize) - MemSize; } else if((*pReadPos + RealDoSize) == MemSize) { *pReadPos = 0; } else { *pReadPos += RealDoSize; } GxCore_Free(pTemp); GxCore_Free(pTempParser); return 0; }
/**************************************************************************** NAME clMsgHandleLibMessage DESCRIPTION Handles the CL library messages and calls the relevant function. */ void clMsgHandleLibMessage(MessageId id, Message message) { switch(id) { case CL_INIT_CFM: { DEBUG_CL(("CL_INIT_CFM status = %u\n", ((CL_INIT_CFM_T *)message)->status)); handleClInitCfm((CL_INIT_CFM_T *)message); break; } case CL_DM_WRITE_INQUIRY_MODE_CFM: { DEBUG_CL(("CL_DM_WRITE_INQUIRY_MODE_CFM\n")); /* Read the local name to put in our EIR data */ ConnectionReadInquiryTx(&the_app->task); break; } case CL_DM_READ_INQUIRY_TX_CFM: { the_app->inquiry_tx = ((CL_DM_READ_INQUIRY_TX_CFM_T*)message)->tx_power; ConnectionReadLocalName(&the_app->task); break; } case CL_DM_LOCAL_NAME_COMPLETE: { DEBUG_CL(("CL_DM_LOCAL_NAME_COMPLETE\n")); /* Write EIR data and initialise the codec task */ scanWriteEirData((CL_DM_LOCAL_NAME_COMPLETE_T*)message); break; } case CL_DM_ACL_OPENED_IND: { DEBUG_CL(("CL_DM_ACL_OPENED_IND from: 0x%X 0x%X 0x%lX\n", ((CL_DM_ACL_OPENED_IND_T *)message)->bd_addr.nap, ((CL_DM_ACL_OPENED_IND_T *)message)->bd_addr.uap, ((CL_DM_ACL_OPENED_IND_T *)message)->bd_addr.lap)); /* Ignore this message for now */ DEBUG_CL((" - ignored\n")); break; } case CL_DM_ACL_CLOSED_IND: { DEBUG_CL(("CL_DM_ACL_CLOSED_IND from: 0x%X 0x%X 0x%lX\n", ((CL_DM_ACL_CLOSED_IND_T *)message)->bd_addr.nap, ((CL_DM_ACL_CLOSED_IND_T *)message)->bd_addr.uap, ((CL_DM_ACL_CLOSED_IND_T *)message)->bd_addr.lap)); /* Ignore this message for now */ DEBUG_CL((" - ignored\n")); break; } case CL_SM_PIN_CODE_IND: { DEBUG_CL(("CL_SM_PIN_CODE_IND from: 0x%X 0x%X 0x%lX\n", (uint16)((CL_SM_PIN_CODE_IND_T *)message)->bd_addr.nap, (uint16)((CL_SM_PIN_CODE_IND_T *)message)->bd_addr.uap, (uint32)((CL_SM_PIN_CODE_IND_T *)message)->bd_addr.lap)); handleClSmPinCodeInd((CL_SM_PIN_CODE_IND_T *)message); break; } case CL_SM_IO_CAPABILITY_REQ_IND: { DEBUG_CL(("CL_SM_IO_CAPABILITY_REQUEST_IND\n")); { CL_SM_IO_CAPABILITY_REQ_IND_T *prim = (CL_SM_IO_CAPABILITY_REQ_IND_T *)message; ConnectionSmIoCapabilityResponse(&prim->bd_addr, cl_sm_io_cap_no_input_no_output, FALSE, TRUE, FALSE, NULL, NULL); } break; } case CL_SM_USER_CONFIRMATION_REQ_IND: { DEBUG_CL(("CL_SM_USER_CONFIRMATION_REQ_IND\n")); /* Shouldn't get this so if we do reject it! */ ConnectionSmUserConfirmationResponse(&((CL_SM_USER_CONFIRMATION_REQ_IND_T*)message)->bd_addr, FALSE); break; } case CL_SM_AUTHORISE_IND: { DEBUG_CL(("CL_SM_AUTHORISE_IND\n")); { /* For now, blindly accept this request */ CL_SM_AUTHORISE_IND_T *prim = (CL_SM_AUTHORISE_IND_T *)message; ConnectionSmAuthoriseResponse(&prim->bd_addr, prim->protocol_id, prim->channel, prim->incoming, TRUE); } break; } case CL_SM_AUTHENTICATE_CFM: { DEBUG_CL(("CL_SM_AUTHENTICATE_CFM status = %u\n", ((CL_SM_AUTHENTICATE_CFM_T *)message)->status)); if ( ((CL_SM_AUTHENTICATE_CFM_T *)message)->status == auth_status_success ) { /* Pin code will be stored on a successful SLC/A2DP connection */ } break; } case CL_SM_SECURITY_LEVEL_CFM: { DEBUG_CL(("CL_SM_SECURITY_LEVEL_CFM success = %u\n", ((CL_SM_SECURITY_LEVEL_CFM_T *)message)->success)); break; } case CL_DM_INQUIRE_RESULT: { DEBUG_CL(("CL_DM_INQUIRE_RESULT status = %u\n", ((CL_DM_INQUIRE_RESULT_T *)message)->status)); handleClDmInquireResult((CL_DM_INQUIRE_RESULT_T *)message); break; } case CL_SDP_OPEN_SEARCH_CFM: { DEBUG_CL(("CL_SDP_OPEN_SEARCH_CFM status = %u\n", ((CL_SDP_OPEN_SEARCH_CFM_T *)message)->status)); handleClSdpOpenSearchCfm((CL_SDP_OPEN_SEARCH_CFM_T *)message); break; } case CL_SDP_CLOSE_SEARCH_CFM: { DEBUG_CL(("CL_SDP_CLOSE_SEARCH_CFM status = %u\n", ((CL_SDP_CLOSE_SEARCH_CFM_T *)message)->status)); handleClSdpCloseSearchCfm(); break; } case CL_SDP_SERVICE_SEARCH_CFM: { DEBUG_CL(("CL_SDP_SERVICE_SEARCH_CFM status = %u\n", ((CL_SDP_SERVICE_SEARCH_CFM_T *)message)->status)); handleClSdpServiceSearchCfm((CL_SDP_SERVICE_SEARCH_CFM_T *)message); break; } case CL_SM_SEC_MODE_CONFIG_CFM: { DEBUG_CL(("CL_SM_SEC_MODE_CONFIG_CFM\n")); DEBUG_CL((" - ignored\n")); break; } case CL_SM_REMOTE_IO_CAPABILITY_IND: { DEBUG_CL(("CL_SM_REMOTE_IO_CAPABILITY_IND\n")); DEBUG_CL((" - ignored\n")); break; } case CL_DM_LINK_SUPERVISION_TIMEOUT_IND: { DEBUG_CL(("CL_DM_LINK_SUPERVISION_TIMEOUT_IND:\n")); DEBUG_CL((" timeout:[0x%x] bdaddr:[0x%x%x%lx]\n", ((CL_DM_LINK_SUPERVISION_TIMEOUT_IND_T *)message)->timeout, ((CL_DM_LINK_SUPERVISION_TIMEOUT_IND_T *)message)->bd_addr.nap, ((CL_DM_LINK_SUPERVISION_TIMEOUT_IND_T *)message)->bd_addr.uap, ((CL_DM_LINK_SUPERVISION_TIMEOUT_IND_T *)message)->bd_addr.lap)); break; } case CL_DM_ROLE_IND: { DEBUG_CL(("CL_DM_ROLE_IND\n")); handleClRoleInd((CL_DM_ROLE_IND_T *)message); break; } case CL_DM_ROLE_CFM: { DEBUG_CL(("CL_DM_ROLE_CFM\n")); handleClRoleCfm((CL_DM_ROLE_CFM_T *)message); break; } case CL_DM_SNIFF_SUB_RATING_IND: { DEBUG_CL(("CL_DM_SNIFF_SUB_RATING_IND\n")); break; } case CL_DM_REMOTE_FEATURES_CFM: { DEBUG_CL(("CL_DM_REMOTE_FEATURES_CFM\n")); handleClDmRemoteFeaturesConfirm((CL_DM_REMOTE_FEATURES_CFM_T *)message); return; } case CL_DM_REMOTE_NAME_COMPLETE: { CL_DM_REMOTE_NAME_COMPLETE_T *name = (CL_DM_REMOTE_NAME_COMPLETE_T*)message; DEBUG_CL(("CL_DM_REMOTE_NAME_COMPLETE\n")); if(name->status == hci_success) { char *name_str = PanicUnlessMalloc(name->size_remote_name+1); memcpy(name_str,name->remote_name,name->size_remote_name); name_str[name->size_remote_name] = 0; UartPrintf("\r\n+RNM=%s\r\n",name_str); free(name_str); } else UartPrintf("\r\nERROR\r\n"); break; } case CL_DM_RSSI_CFM: { DEBUG_CL(("CL_DM_RSSI_CFM_T %d (%d)\n",((CL_DM_RSSI_CFM_T*)message)->status,((CL_DM_RSSI_CFM_T*)message)->rssi)); UartPrintf("\r\n+RSSI=%d\r\n",((CL_DM_RSSI_CFM_T*)message)->rssi); break; } default: { DEBUG_CL(("Unhandled CL message 0x%X\n", (uint16)id)); break; } } }