⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_core.ls1

📁 ucos v2.62 安装程序 附带已移植到C8051F020的UCOS源码
💻 LS1
📖 第 1 页 / 共 5 页
字号:
                     637     ; */
                     638     ; 
                     639     ; #ifndef  OS_MASTER_FILE
                     640     ; #define  OS_GLOBALS
                     641     ; #include "includes.h"
                     642     ; #endif
                     643     ; 
                     644     ; /*
                     645     ; *****************************************************************************************
                             ****************
                     646     ; *                              MAPPING TABLE TO MAP BIT POSITION TO BIT MASK
                     647     ; *
                     648     ; * Note: Index into table is desired bit position, 0..7
A51 MACRO ASSEMBLER  OS_CORE                                                              04/04/2007 13:38:31 PAGE    11

                     649     ; *       Indexed value corresponds to bit mask
                     650     ; *****************************************************************************************
                             ****************
                     651     ; */
                     652     ; 
                     653     ; INT8U  const  OSMapTbl[8]   = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
                     654     ; 
                     655     ; /*
                     656     ; *****************************************************************************************
                             ****************
                     657     ; *                                       PRIORITY RESOLUTION TABLE
                     658     ; *
                     659     ; * Note: Index into table is bit pattern to resolve highest priority
                     660     ; *       Indexed value corresponds to highest priority bit position (i.e. 0..7)
                     661     ; *****************************************************************************************
                             ****************
                     662     ; */
                     663     ; 
                     664     ; INT8U  const  OSUnMapTbl[256] = {
                     665     ;     0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x00 to 0x0F                
                                          */
                     666     ;     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x10 to 0x1F                
                                          */
                     667     ;     5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x20 to 0x2F                
                                          */
                     668     ;     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x30 to 0x3F                
                                          */
                     669     ;     6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x40 to 0x4F                
                                          */
                     670     ;     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x50 to 0x5F                
                                          */
                     671     ;     5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x60 to 0x6F                
                                          */
                     672     ;     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x70 to 0x7F                
                                          */
                     673     ;     7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x80 to 0x8F                
                                          */
                     674     ;     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x90 to 0x9F                
                                          */
                     675     ;     5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0xA0 to 0xAF                
                                          */
                     676     ;     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0xB0 to 0xBF                
                                          */
                     677     ;     6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0xC0 to 0xCF                
                                          */
                     678     ;     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0xD0 to 0xDF                
                                          */
                     679     ;     5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0xE0 to 0xEF                
                                          */
                     680     ;     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0        /* 0xF0 to 0xFF                
                                          */
                     681     ; };
                     682     ; 
                     683     ; /*$PAGE*/
                     684     ; /*
                     685     ; *****************************************************************************************
                             ****************
                     686     ; *                                       FUNCTION PROTOTYPES
                     687     ; *****************************************************************************************
                             ****************
                     688     ; */
                     689     ; static  void  OS_InitEventList(void);
                     690     ; static  void  OS_InitMisc(void);
                     691     ; static  void  OS_InitRdyList(void);
                     692     ; static  void  OS_InitTaskIdle(void);
                     693     ; #if OS_TASK_STAT_EN > 0
A51 MACRO ASSEMBLER  OS_CORE                                                              04/04/2007 13:38:31 PAGE    12

                     694     ; static  void  OS_InitTaskStat(void);
                     695     ; #endif
                     696     ; static  void  OS_InitTCBList(void);
                     697     ; 
                     698     ; /*$PAGE*/
                     699     ; /*
                     700     ; *****************************************************************************************
                             ****************
                     701     ; *                         GET THE NAME OF A SEMAPHORE, MUTEX, MAILBOX or QUEUE
                     702     ; *
                     703     ; * Description: This function is used to obtain the name assigned to a semaphore, mutex, m
                             ailbox or queue.
                     704     ; *
                     705     ; * Arguments  : pevent    is a pointer to the event group.  'pevent' can point either to a
                              semaphore,
                     706     ; *                        a mutex, a mailbox or a queue.  Where this function is concerned
                             , the actual
                     707     ; *                        type is irrelevant.
                     708     ; *
                     709     ; *              pname     is a pointer to an ASCII string that will receive the name of th
                             e semaphore,
                     710     ; *                        mutex, mailbox or queue.  The string must be able to hold at lea
                             st 
                     711     ; *                        OS_EVENT_NAME_SIZE characters.
                     712     ; *
                     713     ; *              err       is a pointer to an error code that can contain one of the follow
                             ing values:
                     714     ; *
                     715     ; *                        OS_NO_ERR                  if the name was copied to 'pname'
                     716     ; *                        OS_ERR_EVENT_TYPE          if 'pevent' is not pointing to the pr
                             oper event 
                     717     ; *                                                   control block type.
                     718     ; *                        OS_ERR_PNAME_NULL          You passed a NULL pointer for 'pname'
                     719     ; *                        OS_ERR_PEVENT_NULL         if you passed a NULL pointer for 'pev
                             ent'
                     720     ; *
                     721     ; * Returns    : The length of the string or 0 if the 'pevent' is a NULL pointer.
                     722     ; *****************************************************************************************
                             ****************
                     723     ; */
                     724     ; 
                     725     ; #if OS_EVENT_NAME_SIZE > 0
                     726     ; INT8U  OSEventNameGet (OS_EVENT *pevent, char *pname, INT8U *err)
                     727     ; {
                     728     ; #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status regis
                             ter           */
                     729     ;     OS_CPU_SR  cpu_sr;
                     730     ; #endif
                     731     ;     INT8U      len;
                     732     ; 
                     733     ; 
                     734     ;     OS_ENTER_CRITICAL();
                     735     ; #if OS_ARG_CHK_EN > 0
                     736     ;     if (pevent == (OS_EVENT *)0) {               /* Is 'pevent' a NULL pointer?          
                                           */
                     737     ;         OS_EXIT_CRITICAL();                      /* Yes                                  
                                           */
                     738     ;         *err = OS_ERR_PEVENT_NULL;
                     739     ;         return (0);
                     740     ;     }
                     741     ;     if (pname == (char *)0) {                    /* Is 'pname' a NULL pointer?           
                                           */
                     742     ;         OS_EXIT_CRITICAL();                      /* Yes                                  
                                           */
                     743     ;         *err = OS_ERR_PNAME_NULL;
                     744     ;         return (0);
A51 MACRO ASSEMBLER  OS_CORE                                                              04/04/2007 13:38:31 PAGE    13

                     745     ;     }
                     746     ; #endif
                     747     ;     switch (pevent->OSEventType) {
                     748     ;         case OS_EVENT_TYPE_SEM:
                     749     ;         case OS_EVENT_TYPE_MUTEX:
                     750     ;         case OS_EVENT_TYPE_MBOX:
                     751     ;         case OS_EVENT_TYPE_Q:
                     752     ;              break;
                     753     ; 
                     754     ;         default:
                     755     ;              OS_EXIT_CRITICAL();
                     756     ;              *err = OS_ERR_EVENT_TYPE;
                     757     ;              return (0);
                     758     ;     }
                     759     ;     (void)strcpy(pname, pevent->OSEventName);    /* Yes, copy name from OS_EVENT         
                                           */
                     760     ;     len  = strlen(pname);
                     761     ;     OS_EXIT_CRITICAL();
                     762     ;     *err = OS_NO_ERR;
                     763     ;     return (len);
                     764     ; }
                     765     ; #endif
                     766     ; 
                     767     ; /*$PAGE*/
                     768     ; /*
                     769     ; *****************************************************************************************
                             ****************
                     770     ; *                         ASSIGN A NAME TO A SEMAPHORE, MUTEX, MAILBOX or QUEUE
                     771     ; *
                     772     ; * Description: This function assigns a name to a semaphore, mutex, mailbox or queue.
                     773     ; *
                     774     ; * Arguments  : pevent    is a pointer to the event group.  'pevent' can point either to a
                              semaphore,
                     775     ; *                        a mutex, a mailbox or a queue.  Where this function is concerned
                             , it doesn't
                     776     ; *                        matter the actual type.
                     777     ; *
                     778     ; *              pname     is a pointer to an ASCII string that will be used as the name of
                              the semaphore,
                     779     ; *                        mutex, mailbox or queue.  The string must be able to hold at lea
                             st 
                     780     ; *                        OS_EVENT_NAME_SIZE characters.
                     781     ; *
                     782     ; *              err       is a pointer to an error code that can contain one of the follow
                             ing values:
                     783     ; *
                     784     ; *                        OS_NO_ERR                  if the requested task is resumed
                     785     ; *                        OS_ERR_EVENT_TYPE          if 'pevent' is not pointing to the pr
                             oper event 
                     786     ; *                                                   control block type.
                     787     ; *                        OS_ERR_PNAME_NULL          You passed a NULL pointer for 'pname'
                     788     ; *                        OS_ERR_PEVENT_NULL         if you passed a NULL pointer for 'pev
                             ent'
                     789     ; *
                     790     ; * Returns    : None
                     791     ; *****************************************************************************************
                             ****************
                     792     ; */
                     793     ; 
                     794     ; #if OS_EVENT_NAME_SIZE > 0
                     795     ; void  OSEventNameSet (OS_EVENT *pevent, char *pname, INT8U *err)
                     796     ; {
                     797     ; #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status regis
                             ter           */
                     798     ;     OS_CPU_SR  cpu_sr;
                     799     ; #endif
A51 MACRO ASSEMBLER  OS_CORE                                                              04/04/2007 13:38:31 PAGE    14

                     800     ;     INT8U      len;
                     801     ; 
                     802     ; 

⌨️ 快捷键说明

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