void tb1(void) { timer_test_bsm_rx = osal_timer_create("tm-tb",timer_test_bsm_rx_callback,NULL,\ MS_TO_TICK(2400),RT_TIMER_FLAG_PERIODIC); osal_timer_start(timer_test_bsm_rx); }
static void cyclic_tetris_def(void) { OSAL_T_CTIM t_dalm; if(OSAL_INVALID_ID == GAME_CYCLIC_ID) { t_dalm.callback = cyclic_tetris_handler; t_dalm.type = TIMER_CYCLIC; t_dalm.time = TimeDelay[Speed - 1]; GAME_CYCLIC_ID = osal_timer_create(&t_dalm); } }
/* wcn_core_dump_init - create core dump sys * @ timeout - core dump time out value * * Return object pointer if success, else NULL */ P_WCN_CORE_DUMP_T wcn_core_dump_init(UINT32 timeout) { #define KBYTES (1024*sizeof(char)) #define L1_BUF_SIZE (32*KBYTES) #define L2_BUF_SIZE (512*KBYTES) P_WCN_CORE_DUMP_T core_dmp = NULL; core_dmp = (P_WCN_CORE_DUMP_T)osal_malloc(sizeof(WCN_CORE_DUMP_T)); if (!core_dmp) { STP_DBG_ERR_FUNC("alloc mem failed!\n"); goto fail; } osal_memset(core_dmp, 0, sizeof(WCN_CORE_DUMP_T)); core_dmp->compressor = wcn_compressor_init("core_dump_compressor", L1_BUF_SIZE, L2_BUF_SIZE); if (!core_dmp->compressor) { STP_DBG_ERR_FUNC("create compressor failed!\n"); goto fail; } wcn_compressor_reset(core_dmp->compressor, 1, GZIP); core_dmp->dmp_timer.timeoutHandler = core_dump_timeout_handler; core_dmp->dmp_timer.timeroutHandlerData = (ULONG)core_dmp; osal_timer_create(&core_dmp->dmp_timer); core_dmp->timeout = timeout; osal_sleepable_lock_init(&core_dmp->dmp_lock); core_dmp->sm = CORE_DUMP_INIT; STP_DBG_INFO_FUNC("create coredump object OK!\n"); return core_dmp; fail: if (core_dmp && core_dmp->compressor) { wcn_compressor_deinit(core_dmp->compressor); core_dmp->compressor = NULL; } if (core_dmp) { osal_free(core_dmp); } osal_sleepable_lock_deinit(&core_dmp->dmp_lock); return NULL; }
void test_rsa(int flag) { vam_envar_t *p_vam = &cms_envar.vam; osal_printf("rsatype = %d , %d\r\n", RSA_TYPE_SPEED_RESTRICTION, RSA_TYPE_MAX); if(flag && !p_vam->timer_send_rsa){ vam_stop(); p_vam->timer_send_rsa = osal_timer_create("tm_rsa", timer_send_rsa_callback, p_vam, SECOND_TO_TICK(1), 0x2); osal_timer_start(p_vam->timer_send_rsa); } else{ if(p_vam->timer_send_rsa){ osal_timer_stop(p_vam->timer_send_rsa); } } }
void vam_init(void) { int i; vam_envar_t *p_vam = &p_cms_envar->vam; uint8_t zero_pid[RCP_TEMP_ID_LEN] = {0}; p_vam_envar = p_vam; memset(p_vam, 0, sizeof(vam_envar_t)); memcpy(&p_vam->working_param, &p_cms_param->vam, sizeof(vam_config_t)); if (0 == memcmp(p_cms_param->pid, zero_pid, RCP_TEMP_ID_LEN)){ for (i=0; i<RCP_TEMP_ID_LEN; i++){ p_vam->local.pid[i] = des(RCP_TEMP_ID_LEN-1-i); } } else { memcpy(p_vam->local.pid, p_cms_param->pid, RCP_TEMP_ID_LEN); } OSAL_MODULE_DBGPRT(MODULE_NAME, OSAL_DEBUG_INFO, "PID: %02x %02x %02x %02x\r\n", \ p_vam->local.pid[0], p_vam->local.pid[1], p_vam->local.pid[2], p_vam->local.pid[3]); INIT_LIST_HEAD(&p_vam->neighbour_list); INIT_LIST_HEAD(&p_vam->sta_free_list); for(i = 0;i< VAM_NEIGHBOUR_MAXNUM;i++){ list_add_tail(&p_vam->remote[i].list, &p_vam->sta_free_list); } /* os object for vam */ p_vam->queue_vam = osal_queue_create("q-vam", VAM_QUEUE_SIZE); osal_assert(p_vam->queue_vam != RT_NULL); p_vam->task_vam = osal_task_create("t-vam", vam_thread_entry, p_vam, RT_VAM_THREAD_STACK_SIZE, RT_VAM_THREAD_PRIORITY); osal_assert(p_vam->task_vam != RT_NULL) p_vam->timer_send_bsm = osal_timer_create("tm-sb",timer_send_bsm_callback,p_vam,\ BSM_SEND_PERIOD_DEFAULT, RT_TIMER_FLAG_PERIODIC); osal_assert(p_vam->timer_send_bsm != NULL); p_vam->timer_bsm_pause = osal_timer_create("tm-bp",timer_bsm_pause_callback,p_vam,\ BSM_PAUSE_HOLDTIME_DEFAULT,RT_TIMER_FLAG_ONE_SHOT); osal_assert(p_vam->timer_bsm_pause != RT_NULL); p_vam->timer_send_evam = osal_timer_create("tm-se",timer_send_evam_callback, p_vam,\ EVAM_SEND_PERIOD_DEFAULT,RT_TIMER_FLAG_PERIODIC); osal_assert(p_vam->timer_send_evam != RT_NULL); p_vam->timer_gps_life = osal_timer_create("tm-gl",timer_gps_life_callback,p_vam,\ BSM_GPS_LIFE_DEFAULT, RT_TIMER_FLAG_ONE_SHOT); osal_assert(p_vam->timer_gps_life != RT_NULL); p_vam->timer_neighbour_life = osal_timer_create("tm-nl",timer_neigh_time_callback,p_vam,\ NEIGHBOUR_LIFE_ACCUR, RT_TIMER_FLAG_PERIODIC); osal_assert(p_vam->timer_neighbour_life != RT_NULL); p_vam->sem_sta = osal_sem_create("s-sta", 1); osal_assert(p_vam->sem_sta != RT_NULL); OSAL_MODULE_DBGPRT(MODULE_NAME, OSAL_DEBUG_INFO, "module initial\n"); }