sys_conf.h

来自「PPPoE协议在Psos中的实现源代码」· C头文件 代码 · 共 350 行 · 第 1/2 页

H
350
字号

#if defined(__cplusplus)
extern "C" {
#endif

#ifndef _SYS_CONF_H
#define _SYS_CONF_H

/***********************************************************************/
/*                                                                     */
/*  These symbols are used to define other symbols in this file.       */
/*  They should never be changed.                                      */
/*                                                                     */
/***********************************************************************/
#define YES     1
#define NO      0


/*---------------------------------------------------------------------*/
/* User- installable callback functions:                               */
/*                                                                     */
/* The following macros can be used for installing functions to be     */
/* called at the following events:                                     */
/*                                                                     */
/*      KC_FATAL       at fatal error                                  */
/*      KC_STARTCO     at task start                                   */
/*      KC_DELETECO    at task deletion                                */
/*      KC_SWITCHCO    at task switch                                  */
/*                                                                     */
/* The required prototypes of the callback functions are as shown      */
/* below. The names of the callback functions may be altered.          */
/* When enabled, the implementations of the callback function must be  */
/* provided elsewhere. For instance, a fatal error handler might be    */
/* enabled by adding the following code to e.g. root.c, and changing   */
/* the corresponding '#if 0' below to an '#if 1":                      */
/*                                                                     */
/*       extern void MyFatalHandler(                                   */
/*                 long   error                                        */
/*                 long   node                                         */
/*                     )                                               */
/*       {                                                             */
/*           printf("pSOS execution terminated due to"                 */
/*                  " fatal error 0x%08x on node %d\n",                */
/*                  error, node );                                     */
/*       }                                                             */
/*                                                                     */
/* NOTE1: The functions KC_STARTCO, KC_DELETECO, and KC_SWITCHCO       */
/*        identify the started-, deleted, and switched tasks by means  */
/*        of both their task id (tid, as returned by t_create), and    */
/*        pointers to their task control blocks (tcb). The useful      */
/*        contents of the task control blocks can be obtained by       */
/*        the pseudo psos function t_taskinfo, and therefore the       */
/*        tcb pointers should not be used.                             */
/*                                                                     */
/* NOTE2: The functions KC_STARTCO, KC_DELETECO, and KC_SWITCHCO are   */
/*        called in kernel context, which is to be treated similar to  */
/*        interrupt service routines. For this reason, no calls to     */
/*        functions that might block are allowed. More specifically,   */
/*        calls to printf etc are not allowed. DP is allowed, and so   */
/*        is t_taskinfo.                                               */
/*                                                                     */
/*---------------------------------------------------------------------*/ 
#if 1      
         extern void MyFatalHandler(                                 
                 long   error,                                       
                 long   node                                         
                       );                                            
                  
         #define KC_FATAL        MyFatalHandler                             
#endif        
/*---------------------------------------------------------------------*/
#if 0                                                         
         extern void MySwitchHandler (                               
                 long   entering_tid,                                
                 void*  entering_tcb,                                
                 long   leaving_tid,                                 
                 void*  leaving_tcb                                  
                       );      
                                      
         #define KC_SWITCHCO     MySwitchHandler                            
#endif        
/*---------------------------------------------------------------------*/
#if 0      
         extern void MyStartHandler (                                
                 long   starting_tid,                                
                 void*  starting_tcb                                 
                       );     
                                       
         #define KC_STARTCO      MyStartHandler                             
#endif        
/*---------------------------------------------------------------------*/ 
#if 0      
         extern void MyDeleteHandler (              
                 long   starting_tid,                                
                 void*  starting_tcb                                 
                       );    
                                        
         #define KC_DELETECO     MyDeleteHandler                            
#endif        
/*---------------------------------------------------------------------*/ 




/***********************************************************************/
/*                                                                     */
/* C O M P O N E N T   C O N F I G U R A T I O N   P A R A M E T E R S */
/*                                                                     */
/*  These parameters should work as is for this application.  You      */
/*  may want to change some of them if you start customizing this      */
/*  application.                                                       */
/*                                                                     */
/***********************************************************************/

/*---------------------------------------------------------------------*/
/* pSOS+ configuration parameters                                      */
/*---------------------------------------------------------------------*/
#define KC_RN0USIZE    0x100    /* region 0 unit size */
#define KC_NTASK       12       /* max number of tasks */
#define KC_NQUEUE      10       /* max number of message queues */
#define KC_NSEMA4      30       /* max number of semaphores */
#define KC_NMSGBUF     100      /* max number of message buffers */
#define KC_NTIMER      10       /* max number of timers */
#define KC_NLOCOBJ     50       /* max number of local objects */
#define KC_TICKS2SEC   100      /* clock tick interrupt frequency */
#define KC_TICKS2SLICE 10       /* time slice quantum, in ticks */
#define KC_ROOTSSTK    0x10000  /* ROOT supervisor stack size */
#define KC_ROOTUSTK    0x10000  /* ROOT user stack size */
#define KC_ROOTMODE    0x2000   /* ROOT initial mode */
#define KC_ROOTPRI     230      /* ROOT task priority */




/*---------------------------------------------------------------------*/
/* pSOS memory management                                              */
/*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*/
/* Stack overflow check. The following macro defines the number of     */
/* bytes at the end of the stack (of each task) which will be filled   */
/* with a known pattern, and which will be checked for being           */
/* overwritten at each system call. In case overwrite is detected,     */
/* then pSOS execution will abort with fatal error FAT_STKOVF (0xF30)  */
/* SC_STACK_OVF_CHECK will be truncated to an integral number of words.*/
/* It has a default of 8 bytes (but set to a slightly higher value     */
/* below).		                                               */
/*---------------------------------------------------------------------*/
#define SC_STACK_OVF_CHECK   24 


/*---------------------------------------------------------------------*/
/*    TCS_MALLOC_USE:   When YES, do *not* map malloc/free on          */
/*                      rn_getseg/rn_free from region 0, as is standard*/
/*                      in pSOS. Instead, use the TCS memory manager   */
/*                      instead.                                       */
/*                      The pSOS region manager might be more          */
/*                      predictable in its real-time behavior, but this*/
/*                      at the cost of larger unit sizes (see          */
/*                      KC_RN0USIZE). Also, the pSOS region manager    */
/*                      cannot hold more than 32K units, which is 8M   */
/*                      with the current KC_RN0USIZE, but              */
/*                      proportionally less when the unit size is      */
/*                      decreased.                                     */
/*                      If this option is enabled, then define         */
/*                      TCS_REGION0_SIZE such that region 0 does not   */
/*                      occupy all free memory.                        */
/*---------------------------------------------------------------------*/
#define TCS_MALLOC_USE            NO


/*---------------------------------------------------------------------*/
/*    TCS_REGION0_SIZE: When *not* defined, then all free memory       */
/*                      (limited to 32K units) is given to region 0.   */
/*                      otherwise, region 0 is created with the        */
/*                      specifiedsize, but limited to 32K units; all   */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?