📄 custom_config.c
字号:
*
* DESCRIPTION
* This routine configure
*
* a. system total memory usage
* Task's stack, external queue, control buffer entries etc.
* Any one who attempts to create new task or enlarge control
* buffer size should fine tune the value!
*
* b. system total debug memory usage
* Valid for DEBUG_KAL + DEBUG_[some items, ITC, BUF etc]
*
* PARAMETERS
* system_mem_sz - system all memory usage
* debug_mem_sz - system all debug memory usage
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
#if defined(DEBUG_KAL)
#define GLOBAL_MEM_SIZE (280*1024)
#define GLOBAL_DEBUG_MEM_SIZE (100*1024) /* For DEBUG_KAL only */
#else
#define GLOBAL_MEM_SIZE (280*1024)
#define GLOBAL_DEBUG_MEM_SIZE 0
#endif /* DEBUG_KAL */
/* Use static array to check memory usage at compile time with corresponding scatter file. */
static kal_uint32 System_Mem_Pool[GLOBAL_MEM_SIZE/sizeof(kal_uint32)];
#if defined(DEBUG_KAL)
static kal_uint32 Debug_Mem_Pool[GLOBAL_DEBUG_MEM_SIZE/sizeof(kal_uint32)];
#endif /* DEBUG_KAL */
void
custom_configmem(kal_uint32 *system_mem_sz, kal_uint32** system_mem_addr,
kal_uint32 *debug_mem_sz, kal_uint32** debug_mem_addr)
{
*system_mem_sz = GLOBAL_MEM_SIZE;
*system_mem_addr = System_Mem_Pool;
*debug_mem_sz = GLOBAL_DEBUG_MEM_SIZE;
#if defined(DEBUG_KAL)
*debug_mem_addr = Debug_Mem_Pool;
#else
*debug_mem_addr = (kal_uint32 *)0;
#endif
}
/*************************************************************************
* FUNCTION
* custom_config_ctrl_buff_info()
*
* DESCRIPTION
* This routine configure control buffer pool information (run time
* memory allocation usage)
*
* PARAMETERS
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
void
custom_config_ctrl_buff_info(void)
{
/* These constants defined in adaptation\include\ctrl_buff_pool.h */
ctrl_buff_pool_info_g[0].size = CTRL_BUFF_POOL_SIZE08;
ctrl_buff_pool_info_g[0].no_of_buff = NUM_CTRL_BUFF_POOL_SIZE08;
ctrl_buff_pool_info_g[1].size = CTRL_BUFF_POOL_SIZE16;
ctrl_buff_pool_info_g[1].no_of_buff = NUM_CTRL_BUFF_POOL_SIZE16;
ctrl_buff_pool_info_g[2].size = CTRL_BUFF_POOL_SIZE32;
ctrl_buff_pool_info_g[2].no_of_buff = NUM_CTRL_BUFF_POOL_SIZE32;
ctrl_buff_pool_info_g[3].size = CTRL_BUFF_POOL_SIZE64;
ctrl_buff_pool_info_g[3].no_of_buff = NUM_CTRL_BUFF_POOL_SIZE64;
ctrl_buff_pool_info_g[4].size = CTRL_BUFF_POOL_SIZE128;
ctrl_buff_pool_info_g[4].no_of_buff = NUM_CTRL_BUFF_POOL_SIZE128;
ctrl_buff_pool_info_g[5].size = CTRL_BUFF_POOL_SIZE256;
ctrl_buff_pool_info_g[5].no_of_buff = NUM_CTRL_BUFF_POOL_SIZE256;
ctrl_buff_pool_info_g[6].size = CTRL_BUFF_POOL_SIZE512;
ctrl_buff_pool_info_g[6].no_of_buff = NUM_CTRL_BUFF_POOL_SIZE512;
ctrl_buff_pool_info_g[7].size = CTRL_BUFF_POOL_SIZE1024;
ctrl_buff_pool_info_g[7].no_of_buff = NUM_CTRL_BUFF_POOL_SIZE1024;
ctrl_buff_pool_info_g[8].size = CTRL_BUFF_POOL_SIZE2048;
ctrl_buff_pool_info_g[8].no_of_buff = NUM_CTRL_BUFF_POOL_SIZE2048;
ctrl_buff_pool_info_g[9].size = CTRL_BUFF_POOL_SIZE4096;
ctrl_buff_pool_info_g[9].no_of_buff = NUM_CTRL_BUFF_POOL_SIZE4096;
ctrl_buff_pool_info_g[10].size = CTRL_BUFF_POOL_SIZE8192;
ctrl_buff_pool_info_g[10].no_of_buff = NUM_CTRL_BUFF_POOL_SIZE8192;
ctrl_buff_pool_info_g[11].size = CTRL_BUFF_POOL_SIZE16384;
ctrl_buff_pool_info_g[11].no_of_buff = NUM_CTRL_BUFF_POOL_SIZE16384;
ctrl_buff_pool_info_g[12].size = CTRL_BUFF_POOL_SIZE32768;
ctrl_buff_pool_info_g[12].no_of_buff = NUM_CTRL_BUFF_POOL_SIZE32768;
ctrl_buff_pool_info_g[13].size = CTRL_BUFF_POOL_SIZE65536;
ctrl_buff_pool_info_g[13].no_of_buff = NUM_CTRL_BUFF_POOL_SIZE65536;
}
/*************************************************************************
* FUNCTION
* customization_check
*
* DESCRIPTION
* Checking system customization, including number of tasks, modules,
* message ID and SAP.
*
* PARAMETERS
*
* RETURNS
*
* GLOBALS AFFECTED
*
*************************************************************************/
void
customization_check(void)
{
/* Check if customer tasks exceeding limitation */
if ( (RPS_CUSTOM_TASKS_END - RPS_CUSTOM_TASKS_BEGIN) > MAX_CUSTOM_TASKS )
kal_fatal_error_handler((kal_char*)"Customer creates too many tasks",
KAL_ERROR_CUSTOMER_TASK_ID_EXCEED_UPPER_BOUND,
(kal_uint32)(RPS_CUSTOM_TASKS_BEGIN-RPS_CUSTOM_TASKS_END)
);
/* Check if customer module ID exceeding limitation */
if ( (MOD_CUSTOM_END - MOD_CUSTOM_BEGIN) > MAX_CUSTOM_TASKS )
kal_fatal_error_handler((kal_char*)"Customer defines too many module IDs",
KAL_ERROR_CUSTOMER_MOD_ID_EXCEED_UPPER_BOUND,
(kal_uint32)(MOD_CUSTOM_END - MOD_CUSTOM_BEGIN)
);
/* Check if customer message ID exceeding limitation */
if ( (MSG_ID_END - CUSTOM_MSG_CODE_BEGIN) > MAX_CUSTOM_MESSAGE_ID )
kal_fatal_error_handler((kal_char*)"Customer define too many message IDs",
KAL_ERROR_CUSTOMER_MEESAGE_ID_EXCEED_UPPER_BOUND,
(kal_uint32)(MSG_ID_END - CUSTOM_MSG_CODE_BEGIN)
);
/* Check if customer tasks exceeding limitation */
if ( (LAST_SAP_CODE - CUSTOM_SAP_BEGIN - 1) > MAX_CUSTOM_SAP_ID )
kal_fatal_error_handler((kal_char*)"Customer defines too many SAPs",
KAL_ERROR_CUSTOMER_SAP_ID_EXCEED_UPPER_BOUND,
(kal_uint32)(LAST_SAP_CODE - CUSTOM_SAP_BEGIN - 1)
);
}
/*************************************************************************
* FUNCTION
* custom_config_task_stack_size
*
* DESCRIPTION
* This function dedicates to specify one task's stack size.
* Note: Each task's stack size is originally defined in the task
* configuration table (in sys_comp_config_tbl[]). When allocating
* stack for each task, system will invoke this function. If the
* return value is zero, system will use the original stack-size
* setting for the task. Otherwise, system will use the return value
* as the task's stack size IF AND ONLY IF the return value is larger
* than the original settting.
*
* PARAMETERS
* task_indx - task index of task to configure
*
* RETURNS
* Task's stack size (in bytes). Zero value implies that system uses
* the original setting to allocate stack for the task.
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 custom_config_task_stack_size(task_indx_type task_indx)
{
switch (task_indx) {
/*
* Return a non-zero value for the task you are interesting.
* For example,
* case INDX_MMI:
* // configure MMI's stack size as 8KB
* return 8096;
*/
default:
return 0;
}
return 0;
}
/*************************************************************************
* FUNCTION
* custom_config_task_extq_size
*
* DESCRIPTION
* This function dedicates to specify one task's external queue size.
* Note: Each task's external queue size is originally defined in the task
* configuration table (in sys_comp_config_tbl[]). When allocating
* queue for each task, system will invoke this function. If the
* return value is zero, system will use the original queue-size
* setting for the task. Otherwise, system will use the return value
* as the task's external queue size IF AND ONLY IF the return value
* is larger than the original settting.
*
* PARAMETERS
* task_indx - task index of task to configure
*
* RETURNS
* Task's external queue size (number of entries). Zero value implies that
* system uses the original setting to allocate queue for the task.
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 custom_config_task_extq_size(task_indx_type task_indx)
{
switch (task_indx) {
/*
* Return a non-zero value for the task you are interesting.
* For example,
* case INDX_MMI:
* // configure MMI's external queue size as 40
* return 30;
*/
default:
return 0;
}
return 0;
}
/*************************************************************************
* FUNCTION
* custom_irda_create
*
* DESCRIPTION
* Customize irda create function.
* Return KAL_FALSE directly if irda should not be created.
*
* PARAMETERS
*
* RETURNS
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_bool custom_irda_create(comptask_handler_struct **handle)
{
#ifdef __IRDA_SUPPORT__
return irda_create(handle);
#else
return KAL_FALSE;
#endif
}
/*************************************************************************
* FUNCTION
* custom_dummy_irda_ap_create
*
* DESCRIPTION
* Customize dummy irda create function.
* Return KAL_FALSE directly if dummy irda should not be created.
*
* PARAMETERS
*
* RETURNS
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_bool custom_dummy_irda_ap_create(comptask_handler_struct **handle)
{
#ifdef __IRDA_SUPPORT__
return dummy_irda_ap_create(handle);
#else
return KAL_FALSE;
#endif
}
/*************************************************************************
* FUNCTION
* custom_obex_create
*
* DESCRIPTION
* Customize obex create function.
* Return KAL_FALSE directly if obex should not be created.
*
* PARAMETERS
*
* RETURNS
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_bool custom_obex_create(comptask_handler_struct **handle)
{
#if defined(__IRDA_SUPPORT__) && !defined(OBEX_NOT_PRESENT)
return obex_create(handle);
#else
return KAL_FALSE;
#endif
}
/*************************************************************************
* FUNCTION
* custom_ircomm_create
*
* DESCRIPTION
* Customize ircomm create function.
* Return KAL_FALSE directly if ircomm should not be created.
*
* PARAMETERS
*
* RETURNS
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_bool custom_ircomm_create(comptask_handler_struct **handle)
{
#if defined(__IRDA_SUPPORT__) && !defined(IRCOMM_NOT_PRESENT)
return ircomm_create(handle);
#else
return KAL_FALSE;
#endif
}
/*************************************************************************
* FUNCTION
* custom_usb_create
*
* DESCRIPTION
* Customize usb create function.
* Return KAL_FALSE directly if usb should not be created.
*
* PARAMETERS
*
* RETURNS
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_bool custom_usb_create(comptask_handler_struct **handle)
{
#ifdef __USB_ENABLE__
return usb_create(handle);
#else
return KAL_FALSE;
#endif
}
/*************************************************************************
* FUNCTION
* custom_abm_create
*
* DESCRIPTION
* Customize ABM create function.
* Return KAL_FALSE directly if ABM should not be created.
*
* PARAMETERS
*
* RETURNS
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_bool custom_abm_create(comptask_handler_struct **handle)
{
#ifdef ABM_NOT_PRESENT
return KAL_FALSE;
#else
return abm_create(handle);
#endif /* ABM_NOT_PRESENT */
}
/*************************************************************************
* FUNCTION
* custom_ppp_create
*
* DESCRIPTION
* Customize PPP create function.
* Return KAL_FALSE directly if PPP should not be created.
*
* PARAMETERS
*
* RETURNS
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_bool custom_ppp_create(comptask_handler_struct **handle)
{
#ifdef PPP_NOT_PRESENT
return KAL_FALSE;
#else
return ppp_create(handle);
#endif /* PPP_NOT_PRESENT */
}
/*************************************************************************
* FUNCTION
* custom_tcpip_create
*
* DESCRIPTION
* Customize TCPIP create function.
* Return KAL_FALSE directly if TCPIP should not be created.
*
* PARAMETERS
*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -