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

📄 test.lst

📁 ucos在mage128上的应用
💻 LST
📖 第 1 页 / 共 5 页
字号:
__start:
__text_start:
      CF EFCF      LDI	R28,0xFF
      D0 E1D0      LDI	R29,0x10
      D1 BFCD      OUT	0x3D,R28
      D2 BFDE      OUT	0x3E,R29
      D3 51C0      SUBI	R28,0x10
      D4 40D0      SBCI	R29,0
      D5 EA0A      LDI	R16,0xAA
      D6 8308      STD	Y+0,R16
      D7 2400      CLR	R0
      D8 E0E0      LDI	R30,0
      D9 E0F1      LDI	R31,1
      DA E01E      LDI	R17,0xE
      DB 39EC      CPI	R30,0x9C
      DC 07F1      CPC	R31,R17
      DD F011      BEQ	0x00E0
      DE 9201      ST	R0,Z+
      DF CFFB      RJMP	0x00DB
      E0 8300      STD	Z+0,R16
      E1 E9EE      LDI	R30,0x9E
      E2 E0F1      LDI	R31,1
      E3 E0A0      LDI	R26,0
      E4 E0B1      LDI	R27,1
      E5 E011      LDI	R17,1
      E6 E000      LDI	R16,0
      E7 BF0B      OUT	0x3B,R16
      E8 39EE      CPI	R30,0x9E
      E9 07F1      CPC	R31,R17
      EA F021      BEQ	0x00EF
      EB 95C8      LPM
      EC 9631      ADIW	R30,1
      ED 920D      ST	R0,X+
      EE CFF9      RJMP	0x00E8
      EF 940E 0DEF CALL	_main
_exit:
      F1 CFFF      RJMP	_exit
FILE: D:\MICRIUM\Source\os_core.c
(0001) /*
(0002) *********************************************************************************************************
(0003) *                                                uC/OS-II
(0004) *                                          The Real-Time Kernel
(0005) *                                             CORE FUNCTIONS
(0006) *
(0007) *                          (c) Copyright 1992-2003, Jean J. Labrosse, Weston, FL
(0008) *                                           All Rights Reserved
(0009) *
(0010) * File : OS_CORE.C
(0011) * By   : Jean J. Labrosse
(0012) *********************************************************************************************************
(0013) */
(0014) 
(0015) #ifndef  OS_MASTER_FILE
(0016) #define  OS_GLOBALS
(0017) #include <ucos_ii.h>
(0018) #endif
(0019) 
(0020) /*
(0021) *********************************************************************************************************
(0022) *                              MAPPING TABLE TO MAP BIT POSITION TO BIT MASK
(0023) *
(0024) * Note: Index into table is desired bit position, 0..7
(0025) *       Indexed value corresponds to bit mask
(0026) *********************************************************************************************************
(0027) */
(0028) 
(0029) INT8U  const  OSMapTbl[8]   = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
(0030) 
(0031) /*
(0032) *********************************************************************************************************
(0033) *                                       PRIORITY RESOLUTION TABLE
(0034) *
(0035) * Note: Index into table is bit pattern to resolve highest priority
(0036) *       Indexed value corresponds to highest priority bit position (i.e. 0..7)
(0037) *********************************************************************************************************
(0038) */
(0039) 
(0040) INT8U  const  OSUnMapTbl[256] = {
(0041)     0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x00 to 0x0F                             */
(0042)     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x10 to 0x1F                             */
(0043)     5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x20 to 0x2F                             */
(0044)     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x30 to 0x3F                             */
(0045)     6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x40 to 0x4F                             */
(0046)     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x50 to 0x5F                             */
(0047)     5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x60 to 0x6F                             */
(0048)     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x70 to 0x7F                             */
(0049)     7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x80 to 0x8F                             */
(0050)     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0x90 to 0x9F                             */
(0051)     5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0xA0 to 0xAF                             */
(0052)     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0xB0 to 0xBF                             */
(0053)     6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0xC0 to 0xCF                             */
(0054)     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0xD0 to 0xDF                             */
(0055)     5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,       /* 0xE0 to 0xEF                             */
(0056)     4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0        /* 0xF0 to 0xFF                             */
(0057) };
(0058) 
(0059) /*$PAGE*/
(0060) /*
(0061) *********************************************************************************************************
(0062) *                                       FUNCTION PROTOTYPES
(0063) *********************************************************************************************************
(0064) */
(0065) static  void  OS_InitEventList(void);
(0066) static  void  OS_InitMisc(void);
(0067) static  void  OS_InitRdyList(void);
(0068) static  void  OS_InitTaskIdle(void);
(0069) #if OS_TASK_STAT_EN > 0
(0070) static  void  OS_InitTaskStat(void);
(0071) #endif
(0072) static  void  OS_InitTCBList(void);
(0073) 
(0074) /*$PAGE*/
(0075) /*
(0076) *********************************************************************************************************
(0077) *                         GET THE NAME OF A SEMAPHORE, MUTEX, MAILBOX or QUEUE
(0078) *
(0079) * Description: This function is used to obtain the name assigned to a semaphore, mutex, mailbox or queue.
(0080) *
(0081) * Arguments  : pevent    is a pointer to the event group.  'pevent' can point either to a semaphore,
(0082) *                        a mutex, a mailbox or a queue.  Where this function is concerned, the actual
(0083) *                        type is irrelevant.
(0084) *
(0085) *              pname     is a pointer to an ASCII string that will receive the name of the semaphore,
(0086) *                        mutex, mailbox or queue.  The string must be able to hold at least 
(0087) *                        OS_EVENT_NAME_SIZE characters.
(0088) *
(0089) *              err       is a pointer to an error code that can contain one of the following values:
(0090) *
(0091) *                        OS_NO_ERR                  if the name was copied to 'pname'
(0092) *                        OS_ERR_EVENT_TYPE          if 'pevent' is not pointing to the proper event 
(0093) *                                                   control block type.
(0094) *                        OS_ERR_PNAME_NULL          You passed a NULL pointer for 'pname'
(0095) *                        OS_ERR_PEVENT_NULL         if you passed a NULL pointer for 'pevent'
(0096) *
(0097) * Returns    : The length of the string or 0 if the 'pevent' is a NULL pointer.
(0098) *********************************************************************************************************
(0099) */
(0100) 
(0101) #if OS_EVENT_NAME_SIZE > 1
(0102) INT8U  OSEventNameGet (OS_EVENT *pevent, char *pname, INT8U *err)
(0103) {
(0104) #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
(0105)     OS_CPU_SR  cpu_sr;
(0106) #endif
(0107)     INT8U      len;
(0108) 
(0109) 
(0110)     OS_ENTER_CRITICAL();
(0111) #if OS_ARG_CHK_EN > 0
(0112)     if (pevent == (OS_EVENT *)0) {               /* Is 'pevent' a NULL pointer?                        */
(0113)         OS_EXIT_CRITICAL();                      /* Yes                                                */
(0114)         *err = OS_ERR_PEVENT_NULL;
(0115)         return (0);
(0116)     }
(0117)     if (pname == (char *)0) {                    /* Is 'pname' a NULL pointer?                         */
(0118)         OS_EXIT_CRITICAL();                      /* Yes                                                */
(0119)         *err = OS_ERR_PNAME_NULL;
(0120)         return (0);
(0121)     }
(0122) #endif
(0123)     switch (pevent->OSEventType) {
(0124)         case OS_EVENT_TYPE_SEM:
(0125)         case OS_EVENT_TYPE_MUTEX:
(0126)         case OS_EVENT_TYPE_MBOX:
(0127)         case OS_EVENT_TYPE_Q:
(0128)              break;
(0129) 
(0130)         default:
(0131)              OS_EXIT_CRITICAL();
(0132)              *err = OS_ERR_EVENT_TYPE;
(0133)              return (0);
(0134)     }
(0135)     len  = OS_StrCopy(pname, pevent->OSEventName);    /* Copy name from OS_EVENT                       */
(0136)     OS_EXIT_CRITICAL();
(0137)     *err = OS_NO_ERR;
(0138)     return (len);
(0139) }
(0140) #endif
(0141) 
(0142) /*$PAGE*/
(0143) /*
(0144) *********************************************************************************************************
(0145) *                         ASSIGN A NAME TO A SEMAPHORE, MUTEX, MAILBOX or QUEUE
(0146) *
(0147) * Description: This function assigns a name to a semaphore, mutex, mailbox or queue.
(0148) *
(0149) * Arguments  : pevent    is a pointer to the event group.  'pevent' can point either to a semaphore,
(0150) *                        a mutex, a mailbox or a queue.  Where this function is concerned, it doesn't
(0151) *                        matter the actual type.
(0152) *
(0153) *              pname     is a pointer to an ASCII string that will be used as the name of the semaphore,
(0154) *                        mutex, mailbox or queue.  The string must be able to hold at least 
(0155) *                        OS_EVENT_NAME_SIZE characters.
(0156) *
(0157) *              err       is a pointer to an error code that can contain one of the following values:
(0158) *
(0159) *                        OS_NO_ERR                  if the requested task is resumed
(0160) *                        OS_ERR_EVENT_TYPE          if 'pevent' is not pointing to the proper event 
(0161) *                                                   control block type.
(0162) *                        OS_ERR_PNAME_NULL          You passed a NULL pointer for 'pname'
(0163) *                        OS_ERR_PEVENT_NULL         if you passed a NULL pointer for 'pevent'
(0164) *
(0165) * Returns    : None
(0166) *********************************************************************************************************
(0167) */
(0168) 
(0169) #if OS_EVENT_NAME_SIZE > 1
(0170) void  OSEventNameSet (OS_EVENT *pevent, char *pname, INT8U *err)
(0171) {
(0172) #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
(0173)     OS_CPU_SR  cpu_sr;
(0174) #endif
(0175)     INT8U      len;
(0176) 
(0177) 
(0178)     OS_ENTER_CRITICAL();
(0179) #if OS_ARG_CHK_EN > 0
(0180)     if (pevent == (OS_EVENT *)0) {               /* Is 'pevent' a NULL pointer?                        */
(0181)         OS_EXIT_CRITICAL();                      /* Yes                                                */
(0182)         *err = OS_ERR_PEVENT_NULL;
(0183)         return;
(0184)     }
(0185)     if (pname == (char *)0) {                    /* Is 'pname' a NULL pointer?                         */
(0186)         OS_EXIT_CRITICAL();                      /* Yes                                                */
(0187)         *err = OS_ERR_PNAME_NULL;
(0188)         return;
(0189)     }
(0190) #endif
(0191)     switch (pevent->OSEventType) {
(0192)         case OS_EVENT_TYPE_SEM:
(0193)         case OS_EVENT_TYPE_MUTEX:
(0194)         case OS_EVENT_TYPE_MBOX:
(0195)         case OS_EVENT_TYPE_Q:
(0196)              break;
(0197) 
(0198)         default:
(0199)              OS_EXIT_CRITICAL();
(0200)              *err = OS_ERR_EVENT_TYPE;
(0201)              return;
(0202)     }
(0203)     len = OS_StrLen(pname);                           /* Can we fit the string in the storage area?    */
(0204)     if (len > (OS_EVENT_NAME_SIZE - 1)) {             /* No                                            */
(0205)         OS_EXIT_CRITICAL();
(0206)         *err = OS_ERR_EVENT_NAME_TOO_LONG;
(0207)         return;
(0208)     } 
(0209)     (void)OS_StrCopy(pevent->OSEventName, pname);     /* Yes, copy name to the event control block     */
(0210)     OS_EXIT_CRITICAL();
(0211)     *err = OS_NO_ERR;
(0212) }
(0213) #endif
(0214) 
(0215) /*$PAGE*/
(0216) /*
(0217) *********************************************************************************************************
(0218) *                                             INITIALIZATION
(0219) *
(0220) * Description: This function is used to initialize the internals of uC/OS-II and MUST be called prior to
(0221) *              creating any uC/OS-II object and, prior to calling OSStart().
(0222) *
(0223) * Arguments  : none
(0224) *
(0225) * Returns    : none
(0226) *********************************************************************************************************
(0227) */
(0228) 
(0229) void  OSInit (void)
(0230) {
(0231) #if OS_VERSION >= 204
(0232)     OSInitHookBegin();                                           /* Call port specific initialization code   */
_OSInit:
      F2 940E 0CE9 CALL	_OSInitHookBegin
(0233) #endif
(0234) 
(0235)     OS_InitMisc();                                               /* Initialize miscellaneous variables       */
      F4 D2B5      RCALL	os_core.c:OS_InitMisc
(0236) 
(0237)     OS_InitRdyList();                                            /* Initialize the Ready List                */
      F5 D2D6      RCALL	os_core.c:OS_InitRdyList
(0238) 
(0239)     OS_InitTCBList();                                            /* Initialize the free list of OS_TCBs      */
      F6 D304      RCALL	os_core.c:OS_InitTCBList
(0240) 
(0241)     OS_InitEventList();                                          /* Initialize the free list of OS_EVENTs    */
      F7 D285      RCALL	os_core.c:OS_InitEventList
(0242) 
(0243) #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
(0244)     OS_FlagInit();                                               /* Initialize the event flag structures     */
(0245) #endif
(0246) 
(0247) #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
(0248)     OS_MemInit();                                                /* Initialize the memory manager            */
      F8 D663      RCALL	_OS_MemInit
(0249) #endif
(0250) 
(0251) #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
(0252)     OS_QInit();                                                  /* Initialize the message queue structures  */
(0253) #endif
(0254) 
(0255)     OS_InitTaskIdle();                                           /* Create the Idle Task                     */
      F9 D2F3      RCALL	_OS_InitTaskIdle
(0256) #if OS_TASK_STAT_EN > 0
(0257)     OS_InitTaskStat();                                           /* Create the Statistic Task                */
(0258) #endif
(0259) 
(0260) #if OS_VERSION >= 204
(0261)     OSInitHookEnd();                                             /* Call port specific init. code            */
      FA 940E 0CEA CALL	_OSInitHookEnd
      FC 9508      RET
(0262) #endif
(0263) 
(0264) #if OS_VERSION >= 270 && OS_DEBUG_EN > 0
(0265)     OSDebugInit();

⌨️ 快捷键说明

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