/* * Function: ccUnload * * Description: * - deinit portable runtime. * - Cleanup call control modules, GSM and SIp Stack * * Parameters: none * * Returns: none * */ void ccUnload (void) { static const char fname[] = "ccUnload"; DEF_DEBUG(DEB_F_PREFIX"ccUnload called..\n", DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname)); if (platform_initialized == FALSE) { TNP_DEBUG(DEB_F_PREFIX"system is not loaded, ignore unload\n", DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname)); return; } /* * We are going to send an unload msg to each of the thread, which on * receiving the msg, will kill itself. */ send_task_unload_msg(CC_SRC_SIP); send_task_unload_msg(CC_SRC_GSM); if (FALSE == gHardCodeSDPMode) { send_task_unload_msg(CC_SRC_MISC_APP); } send_task_unload_msg(CC_SRC_CCAPP); cprSleep(200); gStopTickTask = TRUE; }
/* * This function finds month (0 to 11) from month name * listed above in month_ar[]. This is used to convert the * date header from CCM to derive time/date. */ static boolean set_month_from_str (char *month_str) { boolean ret_val = FALSE; const char * fname = "set_month_from_str"; int i; if (month_str) { if (strncmp(month_str, last_month_str, 3) != 0) { for (i = 0; i < 12; i++) { if (strncmp(month_str, month_ar[i], 3) == 0) { sstrncpy(last_month_str, month_str, sizeof(last_month_str)); last_month = i; ret_val = TRUE; break; } } } else { ret_val = TRUE; } } else { TNP_DEBUG(DEB_F_PREFIX "Input month_str is NULL!!!! \n", DEB_F_PREFIX_ARGS(PLAT_API, fname)); } return (ret_val); }
/** * Get active mac address if required * * @param addr - mac address string (OUTPUT) * * @return none */ void platform_get_active_mac_address (unsigned char *addr) { config_get_value(CFGID_MY_ACTIVE_MAC_ADDR, addr, 6); TNP_DEBUG(DEB_F_PREFIX"ActiveMacAddr:from Get Val: %04x:%04x:%04x", DEB_F_PREFIX_ARGS(PLAT_API, "platform_get_mac_address"), addr[0] * 256 + addr[1], addr[2] * 256 + addr[3], addr[4] * 256 + addr[5]); }
int TickerTask (void *a) { TNP_DEBUG(DEB_F_PREFIX"Ticker Task initialized..\n", DEB_F_PREFIX_ARGS(SIP_CC_INIT, "TickerTask")); while (FALSE == gStopTickTask) { cprSleep(20); MAIN0Timer(); } return 0; }
void send_protocol_config_msg (void) { const char *fname = "send_protocol_config_msg"; char *msg; TNP_DEBUG(DEB_F_PREFIX"send TCP_DONE message to sip thread..\n", DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname)); msg = (char *) SIPTaskGetBuffer(4); if (msg == NULL) { TNP_DEBUG(DEB_F_PREFIX"failed to allocate message..\n", DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname)); return; } /* send a config done message to the SIP Task */ if (SIPTaskSendMsg(TCP_PHN_CFG_TCP_DONE, msg, 0, NULL) == CPR_FAILURE) { err_msg("%s: notify SIP stack ready failed", fname); cpr_free(msg); } gsm_set_initialized(); PHNChangeState(STATE_CONNECTED); }
/* * sip_config_get_keepalive_expires() * * Returns the keepalive expires configured. * The minimum allowed value is returned if * configured value is less than the minimum * allowed value.If the configured value is * greater than the maximum allowed then the * maximum allowed value is returned. * */ int sip_config_get_keepalive_expires() { int keepalive_interval = 0; config_get_value(CFGID_TIMER_KEEPALIVE_EXPIRES, &keepalive_interval, sizeof(keepalive_interval)); if (keepalive_interval < MIN_KEEPALIVE_EXPIRES) { keepalive_interval = MIN_KEEPALIVE_EXPIRES; TNP_DEBUG(DEB_F_PREFIX"Keepalive interval less than minimum acceptable.Resetting it to %d", DEB_F_PREFIX_ARGS(SIP_KA, "sip_config_get_keepalive_expires"), keepalive_interval); } else if (keepalive_interval > MAX_KEEPALIVE_EXPIRES) { keepalive_interval = MAX_KEEPALIVE_EXPIRES; TNP_DEBUG(DEB_F_PREFIX"Keepalive interval more than maximum acceptable.Resetting it to %d", DEB_F_PREFIX_ARGS(SIP_KA, "sip_config_get_keepalive_expires"), keepalive_interval); } return keepalive_interval; }
/* * rm_show * * Description: * Utility function used to dump the contents of the resource manager. * * Parameters: * rm_p - pointer to the resource manager. * * Returns: * none */ void rm_show (resource_manager_t *rm_p) { static const char fname[] = "rm_show"; int16_t element = 0; uint16_t i, j; if (!rm_p) { PLAT_ERROR(PLAT_COMMON_F_PREFIX"null resource manager received.\n", fname); return; } for (i = 0; i < rm_p->max_index; i++) { for (j = 0; j < RM_NUM_ELEMENTS_PER_MAP; j++) { if (rm_p->table[i] & (1 << j)) { element = (i * RM_NUM_ELEMENTS_PER_MAP) + j; TNP_DEBUG(DEB_F_PREFIX"rm map: %d\n", DEB_F_PREFIX_ARGS(RM, fname), element); } } } }
int ccInit () { TNP_DEBUG(DEB_F_PREFIX"started init of SIP call control\n", DEB_F_PREFIX_ARGS(SIP_CC_INIT, "ccInit")); platInit(); /* * below should move to cprPreInit. keep it here until then */ #ifdef _WIN32 cprTimerSystemInit(); #endif /* Initialize threads, queues etc. */ (void) thread_init(); platform_initialized = TRUE; return 0; }