static kal_uint32 ccci_inst_init(void){ #if defined (__CCCI_PERF_PROFILING__) dl_prof_id = 0; ul_prof_id = 0; kal_mem_set(&dl_prof, 0, sizeof(ccci_profile_dl_t)*CCCI_PERF_REC_CNT); kal_mem_set(&ul_prof, 0, sizeof(ccci_profile_ul_t)*CCCI_PERF_REC_CNT); #endif ccci_trace(CCCI_TRACE, CCCI_MOD_HMU, CCCI_ISNT_INIT); kal_mem_set(&ccci_ctrl_pool, 0, CCCI_MAX_CHANNEL*sizeof(CCCI_CTRL_T)*CCCI_PEER_ID_MAX); //#if defined (__HIF_SDIO_SUPPORT__) // ccci_init_handshake_phase1(); // /* Please note that MT6290 only support Normal mode for now */ // /* TODO: Meta Mode boot up flow */ // ccci_init_handshake_phase2(CCCI_NORMAL_MODE); //#endif ccci_hif_init(); #if defined (__CCCI_LB_IT__) /* in hif_ccci.mak */ ccci_it_init(); #endif ccci_lb_it_init(); ccci_debug_init(); return 0; }
/***************************************************************************** * FUNCTION * custom_em_thermal_red_ccci_hisr_callback * DESCRIPTION * reduce TX power * PARAMETERS * value [IN] tx reduction unit, byte 3: reserved, byte 2: reserved, byte 1: 3G, byte 0: 2G * RETURNS * void *****************************************************************************/ void custom_em_thermal_red_ccci_hisr_callback(kal_uint32 value) { kal_uint8 gsm_tx_pwr_reduction_tbl[4][2][4]; kal_uint8 umts_tx_pwr_reduction_tbl[20][2]; kal_uint8 gsm_val = value & 0x000000FF; kal_uint8 umts_val = (value & 0x0000FF00) >> 8; kal_bool gsm_valid = KAL_FALSE, umts_valid = KAL_FALSE; rmmi_common_context_struct *rmmi_comm_ptr = RMMI_COMM_PTR; kal_mem_set((void*)gsm_tx_pwr_reduction_tbl, gsm_val, 4*2*4); kal_mem_set((void*)umts_tx_pwr_reduction_tbl, umts_val, 20*2); if (kal_mem_cmp((void *)gsm_tx_pwr_reduction_tbl, (void*)rmmi_comm_ptr->gsm_tx_pwr_reduction_tbl, 4*2*4) != 0) { gsm_valid = KAL_TRUE; kal_mem_set((void *)rmmi_comm_ptr->gsm_tx_pwr_reduction_tbl, gsm_val, 4*2*4); } if (kal_mem_cmp((void *)umts_tx_pwr_reduction_tbl, (void*)rmmi_comm_ptr->umts_tx_pwr_reduction_tbl, 20*2) != 0) { umts_valid = KAL_TRUE; kal_mem_set((void *)rmmi_comm_ptr->umts_tx_pwr_reduction_tbl, umts_val, 20*2); } l4c_l1_max_tx_pwr_red_req((kal_uint8)L4C_SRC, 1, gsm_valid, (kal_uint8***)gsm_tx_pwr_reduction_tbl, umts_valid, (kal_uint8**)umts_tx_pwr_reduction_tbl); }
/* --------------------------------------------------------------------------------- DESCRIPTION return FAT area base address PARAMETER NULL RETURN NULL --------------------------------------------------------------------------------- */ void FOTA_InitNFBControl(FOTA_NFB_Control *fota_ctrl) { ASSERT(fota_ctrl != NULL); kal_mem_set(FUE_Map_Table, 0xFF, FOTA_MAUI_MAPPING_TABLE_SIZE); kal_mem_set(FUE_NFB_Mapping_Block, 0xFF, (FOTA_MAUI_IMAGE_AMOUNT+1)<<2); kal_mem_set(FUE_NFB_Session_Record, 0xFF, (FOTA_MAUI_IMAGE_AMOUNT+1)<<2); kal_mem_set(FUE_NFB_Mapping_Session, 0xFF, (FOTA_MAUI_IMAGE_AMOUNT+1)<<2); kal_mem_set(FUE_NFB_Mapping_Page, 0xFF, (FOTA_MAUI_IMAGE_AMOUNT+1)<<2); kal_mem_set(FUE_NFB_Next_Available_Page, 0xFF, (FOTA_MAUI_IMAGE_AMOUNT+1)<<2); kal_mem_set(FUE_NFB_Area, 0xFF, sizeof(Nand_Update_Area_ST)*(FOTA_MAUI_IMAGE_AMOUNT+1)); kal_mem_set(FUE_Update_Alloc_info, 0xFF, sizeof(FOTA_Flash_Alloc_Range_st)*(FOTA_MAUI_IMAGE_AMOUNT+1)); kal_mem_set(FUE_Update_Image_area, 0xFF, sizeof(FOTA_Image_Area_st)*(FOTA_MAUI_IMAGE_AMOUNT+1)); fota_ctrl->FOTA_NFB_LTP_Table = FUE_Map_Table; fota_ctrl->FOTA_NFB_Area = FUE_NFB_Area; fota_ctrl->NFB_Mapping_Block = FUE_NFB_Mapping_Block; fota_ctrl->NFB_Session_Record = FUE_NFB_Session_Record; fota_ctrl->NFB_Mapping_Session = FUE_NFB_Mapping_Session; fota_ctrl->NFB_Mapping_Page = FUE_NFB_Mapping_Page; fota_ctrl->NFB_Next_Available_Page = FUE_NFB_Next_Available_Page; fota_ctrl->NFB_FUE_Info.m_update_alloc = FUE_Update_Alloc_info; fota_ctrl->NFB_FUE_Info.m_update_area = FUE_Update_Image_area; }
static int MS_MountDevice(int DeviceType) { kal_uint8 *sector = (kal_uint8*)MSDC_Sector; FS_MasterBootRecord *MBR; FS_BootRecord *PBR; int status; kal_bool IsMBRExist; kal_uint8 type = 0; kal_uint8 c = gMS.Capacity; // get index for MS_MBR => (type) is the index while((c >>= 1) != 2) type++; IsMBRExist = KAL_FALSE; // read MBR at sector 0 status = ReadSectors(NULL,0,1,(void*)sector); MBR = (FS_MasterBootRecord*)sector; PBR = (FS_BootRecord*)sector; if( MBR->Signature == 0xAA55 && MBR->PTable[0].BootIndicator == 0x80) { IsMBRExist = KAL_TRUE; } if(!IsMBRExist) { // create MBR kal_mem_set((void*)MBR,0,sizeof(MBR)); kal_mem_cpy((void*)&(MBR->PTable[0]),MS_MBR[type],MS_MBR_SIZE); MBR->Signature = 0xAA55; status = WriteSectors(NULL,0,1,(void*)sector); if(status < NO_ERROR) return FS_MSDC_MOUNT_ERROR; // create PBR FS_CreateBootSector((void*)sector, (FS_PartitionRecord*)MS_MBR[type], (BYTE)MSDC_MEDIA_DESCRIPTOR, (UINT)gMS.PagesPerBlk, (gMS.Capacity < 128)?FS_FMT_FAT_12:FS_FMT_FAT_16); PBR->NearJump[0] = 0xE9; PBR->NearJump[1] = 0x00; PBR->NearJump[2] = 0x00; kal_mem_set((void*)PBR->BP.OEMName,0x20,8); PBR->BP.SectorsPerCluster = gMS.PagesPerBlk; PBR->BP.DirEntries = 0x200; PBR->BP.E._16.BPB.PhysicalDiskNumber = 0; PBR->BP.E._16.BPB.CurrentHead = 0; PBR->BP.E._16.BPB.SerialNumber = 0; kal_mem_set((void*)PBR->BP.E._16.BPB.Label,0x20,11); status = WriteSectors(NULL, PBR->BP.NumberOfHiddenSectors,1,(void*)sector); if(status < NO_ERROR) return FS_MSDC_MOUNT_ERROR; } return FS_NO_ERROR; }
/***************************************************************************** * FUNCTION * applib_file_delete_folder * DESCRIPTION * This function is used to remove one folder. * PARAMETERS * foldername [IN] The foldername * RETURNS * void *****************************************************************************/ kal_bool applib_file_delete_folder(kal_wchar *foldername) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ int h = -1; /* save temp. file handle for find */ FS_DOSDirEntry info; kal_wchar path[200]; kal_wchar filename[100]; kal_wchar wildcard[6]; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ if (foldername == NULL) { return KAL_FALSE; } else if (app_ucs2_strlen((kal_int8*) foldername) > 97) { return KAL_FALSE; } else { kal_mem_set(path, 0, 400); app_ucs2_strcpy((kal_int8*) path, (kal_int8*) foldername); kal_wsprintf(wildcard, "\\*"); app_ucs2_strcat((kal_int8*) path, (kal_int8*) wildcard); h = FS_FindFirst(path, 0, 0, &info, filename, 200); if (h < 0) { return KAL_FALSE; } do { /* filter out folder results */ if (!(info.Attributes & FS_ATTR_DIR)) { kal_mem_set(path, 0, 400); app_ucs2_strcpy((kal_int8*) path, (kal_int8*) foldername); kal_wsprintf(wildcard, "\\"); app_ucs2_strcat((kal_int8*) path, (kal_int8*) wildcard); app_ucs2_strcat((kal_int8*) path, (kal_int8*) filename); FS_Delete(path); kal_mem_set(filename, 0x00, 200); } } while (FS_FindNext(h, &info, filename, 200) == FS_NO_ERROR); FS_FindClose(h); } return KAL_TRUE; }
/***************************************************************************** * FUNCTION * l4c_init * DESCRIPTION * This is l4c_init function of L4C module. * will be called when stack init * PARAMETERS * void * RETURNS * void *****************************************************************************/ kal_bool l4c_init() { kal_bool ret_val = KAL_FALSE; kal_int8 i = 1; for (i = L4_MAX_SIM_NUM-1; i >= 0; i--) { l4c_ptr_g = &l4c_cntxt_g[i]; kal_mem_set((kal_uint8*) L4C_PTR, (kal_uint32) 0, (kal_uint32) sizeof(l4c_context_struct)); l4c_current_mod_id = L4_MODULE(MOD_L4C, i); #if !defined(__MMI_FMI__) && defined(__GEMINI__) l4c_ptr_g->dual_sim_mode_setting_command = RMMI_EDSIM_NORMAL; // for AT+EDSIM set mode #endif /* no __MMI_FMI__ */ ret_val = l4c_init_context(); #ifdef __HOMEZONE_SUPPORT__ HZ_PTR = &l4c_hz_cntxt_g[i]; kal_mem_set((kal_uint8*) HZ_PTR, (kal_uint32) 0, (kal_uint32) sizeof(l4c_hz_context_struct)); l4c_hz_init_context(); #endif L4C_PTR->event_scheduler_ptr = evshed_create("L4CTIMER", l4c_current_mod_id, 0, 0); //evshed_create, mtk02285, 20110328 } /* For GPRS_FLC_UT MAUI_02419672 mtk02126 */ #if 0 #if !defined(__MTK_TARGET__) && defined(__RMMI_UT__) && defined(__MOD_TCM__) /* under construction !*/ /* under construction !*/ #endif /*~ __MOD_TCM__*/ #endif l4c_comm_ptr_g = &l4c_comm_cntxt_g; ret_val = l4c_init_common_context(); #if defined(__GEMINI__) l4c_root_ptr_g = &l4c_root_cntxt_g; ret_val = l4c_init_root_context(); #endif #if defined(__MTK_TARGET__) && defined(DRV_GPIO_FOR_LED_AND_15_SEGMENT) gpio_led_init(); gpio_15_segment_led_init(); #endif return ret_val; }
/***************************************************************************** * FUNCTION * mmi_ssc_show_imei * DESCRIPTION * Display IMEI Number * PARAMETERS * void * RETURNS * void *****************************************************************************/ static void mmi_ssc_show_imei(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ #ifdef __COSMOS_MMI_PACKAGE__ vcp_dialer_imei_pupup((WCHAR *)gstrIMEI, mmi_ssc_main_screen_g); #else mmi_frm_scrn_enter(mmi_frm_group_get_active_id(), SCR_ENTER_SSC, NULL, mmi_ssc_show_imei, MMI_FRM_FULL_SCRN); #ifdef __MMI_IMEISV_SUPPORT__ ShowCategory7Screen( SSC_SCR_IMEI_CAPTION_ID, 0, 0, 0, STR_GLOBAL_BACK, 0, (U8*) gstrIMEI, NULL); #else /* __MMI_IMEISV_SUPPORT__ */ ShowCategory152Screen( SSC_SCR_IMEI_CAPTION_ID, 0, 0, 0, STR_GLOBAL_BACK, 0, (U8*) gstrIMEI, NULL); #endif /* __MMI_IMEISV_SUPPORT__ */ /* Delete previous one because it might be shown from idle dialpad and then from call management dial pad. */ #ifdef __MMI_IMEISV_SUPPORT__ kal_mem_set(gstrIMEI,0,MAX_IMEISV_DISPLAY_LEN * MMI_MAX_SIM_NUM * ENCODING_LENGTH); #else kal_mem_set(gstrIMEI,0,((MAX_IMEI_LEN + 1) * MMI_MAX_SIM_NUM + 1)* ENCODING_LENGTH); #endif SetRightSoftkeyFunction(mmi_frm_scrn_close_active_id, KEY_EVENT_UP); #endif /* __COSMOS_MMI_PACKAGE__ */ }
void pfm_garbage_filter_register_parser(void *buf, kal_uint32 filter_cnt, kal_bool uplink) { kal_uint32 idx; pfm_garbage_filter_t *raw_filters = (pfm_garbage_filter_t *)buf; ipc_filter_rules_t rules; for (idx = 0; idx < filter_cnt; idx++) { kal_mem_set(&rules, 0, sizeof(rules)); if (PFM_FILTER_STRUCT_MAGIC_CODE != raw_filters[idx].magic_code) { hif_trace_error(PFM_TR_GARBAGE_FILTER_WRONG_MAGIC_CODE, idx); return; } hif_trace_info(PFM_TR_GARBAGE_FILTER_REG_PARSER, raw_filters[idx].filter_id, raw_filters[idx].ip_type, raw_filters[idx].protocol, raw_filters[idx].dst_port); rules.features = IPC_FILTER_FEATURE_BWM; rules.priority = raw_filters[idx].filter_id + IPC_DL_FILTER_PRIORITY_PFM_GARBAGE_FILTER_BEGIN; rules.valid_fields = IPC_FILTER_BY_PROTOCOL | IPC_FILTER_BY_DST_PORT; rules.ip_type = raw_filters[idx].ip_type; rules.protocol = raw_filters[idx].protocol; rules.dst_port = raw_filters[idx].dst_port; if (PFM_GARBAGE_FILTER_MAX_FILTER < raw_filters[idx].filter_id) { hif_trace_error(PFM_TR_GARBAGE_FILTER_INVALID_FILTER_ID); PFM_ASSERT(KAL_FALSE); } else { pfm_register_filter_cbk(PFM_GARBAGE_FILTER_SET_ID, raw_filters[idx].filter_id, KAL_FALSE, &rules, NULL, NULL); } } kal_mem_set(&rules, 0, sizeof(rules)); rules.features = IPC_FILTER_FEATURE_WC; rules.priority = IPC_DL_FILTER_PRIORITY_PFM_GARBAGE_FILTER_WC; pfm_register_filter_with_info_cbk(PFM_GARBAGE_FILTER_SET_ID, PFM_GARBAGE_FILTER_MAX_FILTER, KAL_FALSE, &rules, pfm_ipc_dl_filter_with_info_cb, NULL); }
/****************************************************************************** * Get the address of the atom at the tail of the ring buffer and comsume one item. * * Context: * * Side effect: ******************************************************************************/ kal_bool VideoCoreRemoveFromTailofRingBufferAddr( VIDEO_CORE_RING_BUFFER_MGR_T *prBufferMgr, // The ring buffer manager, allocated by user kal_uint8 *pu1NewAtom // A new atom to obtain the tail of the ring buffer ) { kal_uint8 *pu1Atom; F_REENTRY_ENTER(VIDEO_CORE_REMOVE_FROM_TAIL_OF_RING_BUFFER_ADDR); if ((pu1NewAtom != NULL) &&(prBufferMgr != NULL) &&(prBufferMgr->fgInitialized == KAL_TRUE)) { pu1Atom = VideoCoreGetTailofRingBufferAddr(prBufferMgr); if (pu1Atom != NULL) { kal_mem_cpy((void*)(pu1NewAtom), (void*)(pu1Atom), prBufferMgr->u4SizeOfAnAtom); // Store new atom kal_mem_set((void*)(pu1Atom), 0, prBufferMgr->u4SizeOfAnAtom); // Set memory with 0 VideoCoreConsumeTailofRingBuffer(prBufferMgr); F_REENTRY_EXIT(VIDEO_CORE_REMOVE_FROM_TAIL_OF_RING_BUFFER_ADDR); return KAL_TRUE; } } else { ASSERT(0); F_REENTRY_EXIT(VIDEO_CORE_REMOVE_FROM_TAIL_OF_RING_BUFFER_ADDR); return KAL_FALSE; } F_REENTRY_EXIT(VIDEO_CORE_REMOVE_FROM_TAIL_OF_RING_BUFFER_ADDR); return KAL_FALSE; }
static void uart_core_task_main(task_entry_struct* task_entry_ptr) { ilm_struct current_ilm; kal_uint32 rt_event, uart_event=0; kal_uint32 count = 0; kal_set_active_module_id(MOD_UARTCORE); kal_mem_set(¤t_ilm, 0, sizeof(ilm_struct)); while(1) { //dbg_print("=========>uartcore_task_main\r\n"); // msg_receive_extq will block, therefore we poll if any message exist first while(msg_get_extq_messages() > 0) { if(msg_receive_extq(¤t_ilm) != KAL_TRUE) { break; } switch (current_ilm.msg_id) { default: break; } destroy_ilm(¤t_ilm); } // wait some open uart port first time; if(uart_open_event <= 0){ uart_event = hmu_hifeg_wait(HIF_DRV_EG_UART_IND_EVENT); } if((HIF_DRV_EG_UART_IND_EVENT & uart_event) || uart_open_event>0){ // Wait someone notify HMU to wake up HIF. rt_event = hmu_hifeg_wait(HIF_DRV_EG_HIF_TICK_EVENT_UART); if((HIF_DRV_EG_HIF_TICK_EVENT_UART & rt_event)) { count++; if(0 == (count % 1) ) { if(uart_tgpd_head[uart_port1] != uart_tgpd_tail[uart_port1]) uart_en_q_de_q_with_mutex(uart_port1, UART_TX, UART_DE_Q, NULL, NULL); if(uart_rgpd_head[uart_port1] != uart_rgpd_tail[uart_port1]) uart_en_q_de_q_with_mutex(uart_port1, UART_RX, UART_DE_Q, NULL, NULL); #if defined(__FLAVOR_MULTI_MODE_ROUTER__) || defined(__FLAVOR_SINGLE_MODE_ROUTER__) //in Router product. SUART0 is AP own, so it should not be init here. #else if(uart_tgpd_head[uart_port2] != uart_tgpd_tail[uart_port2]) uart_en_q_de_q_with_mutex(uart_port2, UART_TX, UART_DE_Q, NULL, NULL); if(uart_rgpd_head[uart_port2] != uart_rgpd_tail[uart_port2]) uart_en_q_de_q_with_mutex(uart_port2, UART_RX, UART_DE_Q, NULL, NULL); #endif } } } } }
/*-----------------------------------*/ static int GetDiskGeometry(void * DriveData, FS_PartitionRecord * DiskGeometry, BYTE * MediaDescriptor) { #if defined(__SIM_PLUS__) sd_select_enum sel; if((MSDC_HANDLE *)DriveData == &MSDC_Blk[0]) sel = SD_EXT; else sel = SD_SIM; MSDC_Switch_Card(sel); #endif if(gMSDC_Handle->mIsPresent && gMSDC_Handle->mIsInitialized) { kal_mem_set((void*)DiskGeometry, 0, sizeof * DiskGeometry); DiskGeometry->Sectors = gSD->mCSD.capacity/512; // 0xF8 is the standard value for fixed media, 0xF0 is for removable media. // The important point is whatever value is put in here must also be put in the first // byte of he FAT[0]. *MediaDescriptor = MSDC_MEDIA_DESCRIPTOR; if(gSD->mWPEnabled) return FS_WRITE_PROTECTION; return FS_NO_ERROR; } else { return FS_MSDC_NOT_PRESENT; } }
static lcdTearErrorCode lcdTear_SetSyncModeSupportCapability_6260(kal_uint32 port_id) { //Implement this function for each chip, if need. //The following is an example. lcdTearCtrlBlk *pCtrlBlk; if (port_id > ATTACHED_LCM_COUNT) ASSERT(0); pCtrlBlk = &lcdTear_cnxt[port_id]; kal_mem_set(pCtrlBlk->lcdSyncModeSupportCap, 0, sizeof(pCtrlBlk->lcdSyncModeSupportCap)); if (LCDTEAR_PORT0 == port_id) { if ((pCtrlBlk->hwTESyncSupport) && (LCM_TE_NONE != pCtrlBlk->lcmSyncSignalMode)) { pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_HW_VSYNC_MODE] = KAL_TRUE; pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_HW_VHSYNC_MODE] = KAL_FALSE; pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_HW_VSYNC_HW_DELAY_TIME_MODE] = KAL_TRUE; if (pCtrlBlk->lcmFrameMarkSupport) { pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_HW_VSYNC_HW_FRAME_MARKER_MODE] = KAL_TRUE; } pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_HW_VSYNC_SW_DELAY_TIME_MODE] = KAL_TRUE; } if ((pCtrlBlk->swTESyncSupport) && (!pCtrlBlk->hwTESyncSupport)) { pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_HW_EINT_VSYNC_SW_DELAY_TIME_MODE] = KAL_TRUE; } pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_HW_SCAN_LINE_MODE] = KAL_TRUE; pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_NO_SYNC] = KAL_TRUE; return LCDTEAR_ERROR_NONE; } #ifdef DUAL_LCD else if (LCDTEAR_PORT1 == port_id) { if ((pCtrlBlk->hwTESyncSupport) && (LCM_TE_NONE != pCtrlBlk->lcmSyncSignalMode)) { pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_HW_VSYNC_MODE] = KAL_TRUE; pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_HW_VHSYNC_MODE] = KAL_FALSE; pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_HW_VSYNC_HW_DELAY_TIME_MODE] = KAL_FALSE; if (pCtrlBlk->lcmFrameMarkSupport) { pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_HW_VSYNC_HW_FRAME_MARKER_MODE] = KAL_TRUE; } pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_HW_VSYNC_SW_DELAY_TIME_MODE] = KAL_TRUE; } if ((pCtrlBlk->swTESyncSupport) && (!pCtrlBlk->hwTESyncSupport)) { pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_HW_EINT_VSYNC_SW_DELAY_TIME_MODE] = KAL_TRUE; } pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_HW_SCAN_LINE_MODE] = KAL_FALSE; pCtrlBlk->lcdSyncModeSupportCap[LCDTEAR_NO_SYNC] = KAL_TRUE; return LCDTEAR_ERROR_NONE; } #endif //#ifdef DUAL_LCD return LCDTEAR_ERROR_NONE; }
DCL_STATUS DclSIM_Initialize(void) { kal_uint32 maskedValue; kal_uint32 loopIndex; maskedValue = SaveAndSetIRQMask(); if(KAL_FALSE == fgSIMInit) { fgSIMInit = KAL_FALSE; RestoreIRQMask(maskedValue); kal_mem_set(simResource, 0, sizeof(DCL_SIM_RESOURCE) * DCL_SIM_MAX_INTERFACE); dclSimArb = kal_create_sem("SIM_DCL", 1); for(loopIndex = 0; DCL_SIM_MAX_INTERFACE > loopIndex; loopIndex ++) { simResource[loopIndex].guardHead = SIM_RESOURCE_HEAD; simResource[loopIndex].guardTail = SIM_RESOURCE_TAIL; simResource[loopIndex].driverHandle = SIM_RSC_HANDLE_UDEF; } sim_init_all_cb(); #ifdef MEUT_ON_FPGA MT6302_test(); #endif } else { RestoreIRQMask(maskedValue); } return STATUS_OK; }
/***************************************************************************** * FUNCTION * phb_det_delete * DESCRIPTION * Delete `position'th element of table of det * PARAMETERS * det [IN] The data-entry-table * position [IN] The position * RETURNS * KAL_TRUE if success, KAL_FALSE else. *****************************************************************************/ kal_bool phb_det_delete(data_entry_table_type *det, kal_uint16 position) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ kal_trace(TRACE_INFO, FUNC_PHB_DET_DELETE, position, det->used_count); ASSERT(det != NULL); if (position > (det->used_count - 1)) { return KAL_FALSE; } table_shift( &det->used_count, &det->slots, det->table, sizeof(data_entry_struct), shift_up, (kal_uint16) (position + 1)); kal_mem_set(&det->table[--det->used_count], (kal_uint8) PHB_INVALID_VALUE, sizeof(data_entry_struct)); return KAL_TRUE; } /* end of phb_pindex_delete */
/************************************************************************* * FUNCTION * stack_config * * DESCRIPTION * This function implements to get system date time * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *************************************************************************/ void RTFAPI RTFSYSGetDateTime(RTFDOSDateTime * TimeDate) { RTC_CTRL_GET_TIME_T rtc_time; // Always zero rtc_time, in case of unsupported RTC platforms. kal_mem_set(&rtc_time, 0, sizeof(RTC_CTRL_GET_TIME_T)); /* * Get a RTC handle in the first time. * This handle will not be closed in the future. */ if (DCL_HANDLE_INVALID == rtc_handler) rtc_handler = DclRTC_Open(DCL_RTC, FLAGS_NONE); DclRTC_Control(rtc_handler, RTC_CMD_GET_TIME, (DCL_CTRL_DATA_T*)&rtc_time); TimeDate->Day = rtc_time.u1Day; TimeDate->Hour = rtc_time.u1Hour; TimeDate->Minute = rtc_time.u1Min; TimeDate->Month = rtc_time.u1Mon; TimeDate->Second2 = rtc_time.u1Sec >> 1; // Second only contain 5 bits TimeDate->Year1980 = rtc_time.u1Year + 20; // Adapt to windows is 1980 base while RTC is 2000 base }
/***************************************************************************** * FUNCTION * jbt_cmd_queue_init * DESCRIPTION * * PARAMETERS * void * RETURNS * void *****************************************************************************/ void jbt_cmd_queue_init(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ kal_uint8 i = 0; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ jbt_cmd_sem = kal_create_sem("jbt_cmd_sem", 1); jbt_cmd_process_sem = kal_create_sem("jbt_cmd_process_sem", 1); jbt_cmd_kick_sem = kal_create_sem("jbt_cmd_kick_sem", 1); kal_mem_set((kal_uint8*) & jbt_cmd_queue_context, 0, sizeof(jbt_cmd_queue_context)); jbt_cmd_list_init(&jbt_cmd_queue_context.empty_list); jbt_cmd_list_init(&jbt_cmd_queue_context.cmd_list); jbt_cmd_queue_context.queue_kick_off = 0; for (i = 0; i < JBT_MAX_COMMAND_QUEUE; i++) { jbt_cmd_list_init(&jbt_cmd_queue_context.cmd_node[i]); jbt_cmd_list_insert_tail(&jbt_cmd_queue_context.empty_list, &jbt_cmd_queue_context.cmd_node[i]); } }
/* initialize the global variable gUsbDevice */ void USB_Init_Device_Status(void) { kal_uint8 index = 0; kal_mem_set(&gUsbDevice.cfg_info, 0, sizeof(Usb_Config_Info)); for( index = 0; index < USB_MAX_INTERFACE; index++) { kal_mem_set(&gUsbDevice.if_info[index], 0, sizeof(Usb_Interface_Info)); } for( index = 0; index < USB_MAX_EP_BULK_IN; index++) { kal_mem_set(&gUsbDevice.ep_bulkin_info[index], 0, sizeof(Usb_Ep_Info)); } for( index = 0; index < USB_MAX_EP_BULK_OUT; index++) { kal_mem_set(&gUsbDevice.ep_bulkout_info[index], 0, sizeof(Usb_Ep_Info)); } for( index = 0; index < USB_MAX_EP_INTR; index++) { kal_mem_set(&gUsbDevice.ep_intr_info[index], 0, sizeof(Usb_Ep_Info)); } for( index = 0; index < USB_MAX_STRING; index++) { gUsbDevice.resource_string[index] = NULL; } gUsbDevice.conf = NULL; gUsbDevice.device_type = USB_UNKOWN; gUsbDevice.nDevState = DEVSTATE_DEFAULT; gUsbDevice.remoteWk = KAL_FALSE; gUsbDevice.self_powered = KAL_FALSE; gUsbDevice.config_num = 0; gUsbDevice.interface_num = 0; gUsbDevice.ep0_rx_handler = NULL; // gUsbDevice.ep0_class_cmd_handler.b_enable = KAL_FALSE; gUsbDevice.resource_ep_bulkin_number = 0; gUsbDevice.resource_ep_bulkout_number = 0; gUsbDevice.resource_ep_intr_number = 0; gUsbDevice.resource_interface_number = 0; gUsbDevice.resource_string_number = 0; }
/***************************************************************************** * FUNCTION * l4c_med_ctm_connected_ind_hdlr * DESCRIPTION * * PARAMETERS * local_para_ptr [?] * peer_buff_ptr [?] * RETURNS * void *****************************************************************************/ void l4c_med_ctm_connected_ind_hdlr(local_para_struct *local_para_ptr, peer_buff_struct *peer_buff_ptr) { //MAUI_02580295 media_ctm_connected_ind_struct *msg_ptr; kal_bool ret_val = KAL_FALSE; kal_uint8 temp_call_id; l4c_call_entry_struct call_info; kal_uint8 which_sim; l4c_context_struct *l4c_ptr = L4C_PTR; //for slim //MAUI_02580295 msg_ptr = (media_ctm_connected_ind_struct*) local_para_ptr; kal_mem_set(&call_info,0,sizeof(l4c_call_entry_struct)); /* Currently, we always let L4C_1 to handle CTM */ #if defined(__GEMINI__) /* for GEMINI, find sim2...simN call */ for (which_sim = 0; which_sim < L4_MAX_SIM_NUM; which_sim++) { module_type this_l4c = L4_MODULE(MOD_L4C, which_sim); l4c_context_struct* this_l4c_ptr = get_l4c_ptr_by_mod(this_l4c); if (this_l4c_ptr->call_exist == KAL_TRUE) { kal_brief_trace(TRACE_INFO, INFO_SWITCH_CSM_CONTEXT, which_sim); csmcc_context_selection(which_sim); } } #endif ret_val = l4ccsm_cc_get_active_call(&temp_call_id); if((ret_val == KAL_TRUE) && (l4ccsm_cc_get_call_info(temp_call_id, &call_info, NULL) == KAL_TRUE)) { if (call_info.src_id == LMMI_SRC) { l4c_ctm_connected_lind(); } #if defined(__CTM_AT_CMD_SUPPORT__) else { l4c_ctm_connected_rind(); } #endif l4c_ptr->is_ctm_connected = KAL_TRUE; l4c_ptr->connected_src_id = call_info.src_id; kal_brief_trace(L4C_CTM_TRC, CTM_CURRENT, l4c_ptr->ctm_current_action, l4c_ptr->ctm_user); kal_brief_trace(L4C_CTM_TRC, CTM_CONTEXT, l4c_ptr->is_ctm_connected, l4c_ptr->connected_src_id, l4c_ptr->is_gpio_plug); } #if defined(__GEMINI__) kal_brief_trace(TRACE_INFO, INFO_SWITCH_CSM_CONTEXT,SIM1); csmcc_context_selection(SIM1); #endif }
/*-----------------------------------*/ static int GetDiskGeometry(void * DriveData, FS_PartitionRecord * DiskGeometry, BYTE * MediaDescriptor) { kal_mem_set((void*)DiskGeometry, 0, sizeof * DiskGeometry); DiskGeometry->Sectors = gSD2->mCSD.capacity/512; *MediaDescriptor = MSDC_MEDIA_DESCRIPTOR; if(gSD2->mWPEnabled) return FS_WRITE_PROTECTION; return FS_NO_ERROR; }
/*------------------------------------------------------------------------------ Function name: H264SwDecMemset Purpose: Example implementation of H264SwDecMemset function. Prototype of this function is given in H264SwDecApi.h. This implementation uses library function memset to set content of memory area pointed by ptr. ------------------------------------------------------------------------------*/ static void VideoH264DecMemset(void *ptr, int c, unsigned int size) { void *rv = NULL; if (ptr != NULL) { rv = kal_mem_set(ptr, (kal_int32)c, (kal_uint32)size); } return; }
/***************************************************************************** * FUNCTION * applib_async_file_task_start * DESCRIPTION * * PARAMETERS * op [?] * mod_id [IN] * filename [?] * access_mode [IN] * es [?] * callback [IN] * return_arg [?] * RETURNS * *****************************************************************************/ kal_bool applib_async_file_task_start( applib_async_file_task_struct *op, module_type mod_id, kal_wchar *filename, applib_async_file_mode_enum access_mode, event_scheduler *es, applib_aysnc_file_task_callback_fn callback, void *return_arg) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ int fileHandle; int openMode; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ if (op == NULL || filename == NULL) { return KAL_FALSE; } kal_mem_set(op, 0, sizeof(applib_async_file_task_struct)); switch (access_mode) { case APPLIB_ASYNC_FILE_MODE_READ: openMode = APPLIB_ASYNC_FILE_READ | FS_NONBLOCK_MODE | FS_OPEN_SHARED; break; case APPLIB_ASYNC_FILE_MODE_READ_WRITE: case APPLIB_ASYNC_FILE_MODE_WRITE: openMode = APPLIB_ASYNC_FILE_WRITE | APPLIB_ASYNC_FILE_CREATE | FS_NONBLOCK_MODE; break; default: openMode = APPLIB_ASYNC_FILE_WRITE | APPLIB_ASYNC_FILE_CREATE | FS_NONBLOCK_MODE; break; } fileHandle = FS_Open(filename, openMode); if (fileHandle < 0) { return KAL_FALSE; } op->mod_id = mod_id; op->isFSopen = KAL_TRUE; op->fileHandle = fileHandle; op->es = es; op->callback = callback; op->arg_in_callback = return_arg; return KAL_TRUE; }
/************************************************************************* * FUNCTION * ds_mdci_mailbox_write_and_wait * * DESCRIPTION * This function writes data through a mailbox channel. * * PARAMETERS * channel - logical channel * id - mailbox id * ticks - max ticks to wait * * RETURNS * MDIF error code. * *************************************************************************/ kal_int32 mdci_mailbox_write_and_wait(MDCI_CHANNEL_T channel, kal_uint32 id, kal_uint32 ticks) { MDCI_BUFF_T buff; /* initialize a MDIF channel buffer */ kal_mem_set(&buff, 0, sizeof(MDCI_BUFF_T)); MDCI_INIT_MAILBOX(&buff, id); /* write */ return mdci_write_and_wait(channel, &buff, ticks); }
/************************************************************************* * FUNCTION * ds_mdci_stream_write_and_wait * * DESCRIPTION * This function writes data through a stream channel. * * PARAMETERS * channel - logical channel * addr - start address of the user buffer * len - lenght of the user buffer * * RETURNS * MDIF error code. * *************************************************************************/ kal_int32 mdci_stream_write_and_wait(MDCI_CHANNEL_T channel, kal_uint32 addr, kal_uint32 len, kal_uint32 ticks) { MDCI_BUFF_T buff; /* initialize a MDIF channel buffer */ kal_mem_set(&buff, 0, sizeof(MDCI_BUFF_T)); MDCI_INIT_STREAM(&buff, addr, len); /* write */ return mdci_write_and_wait(channel, &buff,ticks); }
/* * FUNCTION * IMGPROC_Close * * DESCRIPTION * Release the ownership of IMGPORC * * CALLS * * PARAMETERS * * RETURNS * None * * GLOBALS AFFECTED * imgproc_dcb.owner */ kal_int32 API IMGPROC_Close(MMDI_SCENERIO_ID owner) { #if (defined(DRV_IDP_6219_SERIES)) ASSERT(imgproc_dcb.owner == owner); IMGPROC_Stop(owner); IMGPROC_RESET(); IMGPROC_DISABLE_INT(); kal_mem_set(&imgproc_dcb,0,sizeof(IMGPROC_DCB_STRUCT)); DRVPDN_Enable(DRVPDN_CON3,DRVPDN_CON3_IMGPROC,PDN_IMGPROC); #endif return NO_ERROR; }
tdmb_demux_t* construct_cyberlink_tdmb_demux() { cyberlink_tdmb_demux_t* pthis = (cyberlink_tdmb_demux_t*) med_alloc_ext_mem(sizeof(cyberlink_tdmb_demux_t)); ASSERT(pthis); kal_mem_set(pthis, 0, sizeof(*pthis)); pthis->itf.open = cyberlink_tdmb_demux_open; pthis->itf.send = cyberlink_tdmb_demux_send; pthis->itf.close = cyberlink_tdmb_demux_close; pthis->itf.destroy = cyberlink_tdmb_demux_destroy; return &pthis->itf; }
/************************************************************************* * FUNCTION * mdci_mailbox_write_with_reserved * * DESCRIPTION * This function writes data through a mailbox channel. * * PARAMETERS * channel - logical channel * id - mailbox id * * RETURNS * MDIF error code. * *************************************************************************/ kal_int32 mdci_mailbox_write_with_reserved(MDCI_CHANNEL_T channel, kal_uint32 id,kal_uint32 reserved) { MDCI_BUFF_T buff; /* initialize a MDIF channel buffer */ kal_mem_set(&buff, 0, sizeof(MDCI_BUFF_T)); MDCI_INIT_MAILBOX(&buff, id); buff.reserved = reserved; /* write */ return mdci_write(channel, &buff); }
/************************************************************************* * FUNCTION * mdci_stream_write_with_reserved * * DESCRIPTION * This function writes data through a stream channel. * * PARAMETERS * channel - logical channel * addr - start address of the user buffer * len - lenght of the user buffer * * RETURNS * MDIF error code. * *************************************************************************/ kal_int32 mdci_stream_write_with_reserved(MDCI_CHANNEL_T channel, kal_uint32 addr, kal_uint32 len,kal_uint32 reserved) { MDCI_BUFF_T buff; /* initialize a MDIF channel buffer */ kal_mem_set(&buff, 0, sizeof(MDCI_BUFF_T)); MDCI_INIT_STREAM(&buff, addr, len); buff.reserved = reserved; /* KC add for FS_MDIF */ /* write */ return mdci_write(channel, &buff); }
static kal_bool custom_em_init(kal_bool is_reset) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ //kal_uint32 Ret, len; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ kal_mem_set(&g_em_context, 0, sizeof(custom_em_param_context_struct)); g_is_custom_em_init = KAL_TRUE; return KAL_TRUE; }
/******************************************************************************* * * Utility Functions * *******************************************************************************/ void _FT_ALLOC_MSG(ilm_struct* ilm_ptr, kal_uint16 size, kal_bool IsFtMsg) { ilm_ptr->local_para_ptr = NULL; ilm_ptr->peer_buff_ptr = NULL; if( 0 < size ) { if( NULL == (ilm_ptr->local_para_ptr=construct_local_para(size, TD_RESET)) ) { ASSERT(0); // assert it! } } if( KAL_TRUE == IsFtMsg ) { // reset content of FT primitive first kal_mem_set(((char *)ilm_ptr->local_para_ptr)+sizeof(FT_H), 0, size-sizeof(FT_H)); } }
/*-----------------------------------*/ static int GetDiskGeometry(void * DriveData, FS_PartitionRecord * DiskGeometry, BYTE * MediaDescriptor) { kal_mem_set((void*)DiskGeometry, 0, sizeof * DiskGeometry); DiskGeometry->Sectors = gMSP.user_block*gMSP.block_size; //DiskGeometry->Sectors = gSD.mBKNum; // 0xF8 is the standard value for fixed media, 0xF0 is for removable media. // The important point is whatever value is put in here must also be put in the first // byte of he FAT[0]. *MediaDescriptor = MSDC_MEDIA_DESCRIPTOR; if(gMSP.is_wp) return FS_WRITE_PROTECTION; return FS_NO_ERROR; }