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

📄 os_q.lst

📁 IAR project for MSP430 and uC/OS. All configured to start filling with tasks.
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \   031C  0A24              JEQ     (?0137) 
    481                  OS_EventTaskRdy(pevent, msg, OS_STAT_Q);      /* Ready highest priority task waiting on event  */
   \   031E  70120400          PUSH.B  #4      
   \   0322  B0120000          CALL    #OS_EventTaskRdy        
   \   0326  2153              ADD     #2,SP   
    482                  OS_EXIT_CRITICAL();
   \   0328  32D2              EINT            
    483                  OS_Sched();                                   /* Find highest priority task ready to run       */
   \   032A  B0120000          CALL    #OS_Sched       
    484                  return (OS_NO_ERR);
   \   032E  4C43              MOV.B   #0,R12  
    485              }
   \   0330  3041              RET             
   \   0332            ?0137:
    486              pq = (OS_Q *)pevent->OSEventPtr;                  /* Point to queue control block                  */
   \   0332  1D4C0400          MOV     4(R12),R13      
    487              if (pq->OSQEntries >= pq->OSQSize) {              /* Make sure queue is not full                   */
   \   0336  9D9D0A00          CMP     10(R13),12(R13) 
   \   033A  0C00
   \   033C  0428              JNC     (?0139) 
    488                  OS_EXIT_CRITICAL();
   \   033E  32D2              EINT            
    489                  return (OS_Q_FULL);
   \   0340  7C401E00          MOV.B   #30,R12 
    490              }
   \   0344  3041              RET             
   \   0346            ?0139:
    491              if (pq->OSQOut == pq->OSQStart) {                 /* Wrap OUT ptr if we are at the 1st queue entry */
   \   0346  9D9D0800          CMP     8(R13),2(R13)   
   \   034A  0200
   \   034C  0320              JNE     (?0141) 
    492                  pq->OSQOut = pq->OSQEnd;
   \   034E  9D4D0400          MOV     4(R13),8(R13)   
   \   0352  0800
   \   0354            ?0141:
    493              }
    494              pq->OSQOut--;
   \   0354  BD50FEFF          ADD     #-2,8(R13)      
   \   0358  0800
    495              *pq->OSQOut = msg;                                /* Insert message into queue                     */
   \   035A  1C4D0800          MOV     8(R13),R12      
   \   035E  8C4E0000          MOV     R14,0(R12)      
    496              pq->OSQEntries++;                                 /* Update the nbr of entries in the queue        */
   \   0362  9D530C00          ADD     #1,12(R13)      
    497              OS_EXIT_CRITICAL();
   \   0366  32D2              EINT            
    498              return (OS_NO_ERR);
   \   0368  4C43              MOV.B   #0,R12  
    499          }
   \   036A  3041              RET             
   \   036C            OSQPostOpt:
    500          #endif
    501          /*$PAGE*/
    502          /*
    503          *********************************************************************************************************
    504          *                                        POST MESSAGE TO A QUEUE
    505          *
    506          * Description: This function sends a message to a queue.  This call has been added to reduce code size
    507          *              since it can replace both OSQPost() and OSQPostFront().  Also, this function adds the
    508          *              capability to broadcast a message to ALL tasks waiting on the message queue.
    509          *
    510          * Arguments  : pevent        is a pointer to the event control block associated with the desired queue
    511          *
    512          *              msg           is a pointer to the message to send.  You MUST NOT send a NULL pointer.
    513          *
    514          *              opt           determines the type of POST performed:
    515          *                            OS_POST_OPT_NONE         POST to a single waiting task
    516          *                                                     (Identical to OSQPost())
    517          *                            OS_POST_OPT_BROADCAST    POST to ALL tasks that are waiting on the queue
    518          *                            OS_POST_OPT_FRONT        POST as LIFO (Simulates OSQPostFront())
    519          *
    520          *                            Below is a list of ALL the possible combination of these flags:
    521          *
    522          *                                 1) OS_POST_OPT_NONE
    523          *                                    identical to OSQPost()
    524          *
    525          *                                 2) OS_POST_OPT_FRONT
    526          *                                    identical to OSQPostFront()
    527          *
    528          *                                 3) OS_POST_OPT_BROADCAST
    529          *                                    identical to OSQPost() but will broadcast 'msg' to ALL waiting tasks
    530          *
    531          *                                 4) OS_POST_OPT_FRONT + OS_POST_OPT_BROADCAST  is identical to
    532          *                                    OSQPostFront() except that will broadcast 'msg' to ALL waiting tasks
    533          *
    534          * Returns    : OS_NO_ERR             The call was successful and the message was sent
    535          *              OS_Q_FULL             If the queue cannot accept any more messages because it is full.
    536          *              OS_ERR_EVENT_TYPE     If you didn't pass a pointer to a queue.
    537          *              OS_ERR_PEVENT_NULL    If 'pevent' is a NULL pointer
    538          *              OS_ERR_POST_NULL_PTR  If you are attempting to post a NULL pointer
    539          *
    540          * Warning    : Interrupts can be disabled for a long time if you do a 'broadcast'.  In fact, the
    541          *              interrupt disable time is proportional to the number of tasks waiting on the queue.
    542          *********************************************************************************************************
    543          */
    544          
    545          #if OS_Q_POST_OPT_EN > 0
    546          INT8U  OSQPostOpt (OS_EVENT *pevent, void *msg, INT8U opt)
    547          {
   \   036C  0A12              PUSH    R10     
   \   036E  0B12              PUSH    R11     
   \   0370  0B4C              MOV     R12,R11 
   \   0372  0A4E              MOV     R14,R10 
   \   0374  5D410600          MOV.B   6(SP),R13       
    548          #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    549              OS_CPU_SR  cpu_sr;
    550          #endif
    551              OS_Q      *pq;
    552          
    553          
    554          #if OS_ARG_CHK_EN > 0
    555              if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                             */
   \   0378  0B93              CMP     #0,R11  
   \   037A  0220              JNE     (?0144) 
    556                  return (OS_ERR_PEVENT_NULL);
   \   037C  6C42              MOV.B   #4,R12  
    557              }
   \   037E  533C              JMP     (?0166) 
   \   0380            ?0144:
    558              if (msg == (void *)0) {                           /* Make sure we are not posting a NULL pointer   */
   \   0380  0A93              CMP     #0,R10  
   \   0382  0320              JNE     (?0146) 
    559                  return (OS_ERR_POST_NULL_PTR);
   \   0384  7C400300          MOV.B   #3,R12  
    560              }
   \   0388  4E3C              JMP     (?0166) 
   \   038A            ?0146:
    561              if (pevent->OSEventType != OS_EVENT_TYPE_Q) {     /* Validate event block type                     */
   \   038A  6C43              MOV.B   #2,R12  
   \   038C  6C9B              CMP.B   @R11,R12        
   \   038E  0224              JEQ     (?0148) 
    562                  return (OS_ERR_EVENT_TYPE);
   \   0390  5C43              MOV.B   #1,R12  
    563              }
   \   0392  493C              JMP     (?0166) 
   \   0394            ?0148:
    564          #endif
    565              OS_ENTER_CRITICAL();
   \   0394  32C2              DINT            
    566              if (pevent->OSEventGrp != 0x00) {                 /* See if any task pending on queue              */
   \   0396  CB930100          CMP.B   #0,1(R11)       
   \   039A  1924              JEQ     (?0150) 
    567                  if ((opt & OS_POST_OPT_BROADCAST) != 0x00) {  /* Do we need to post msg to ALL waiting tasks ? */
   \   039C  5DB3              BIT.B   #1,R13  
   \   039E  0B24              JEQ     (?0152) 
   \   03A0            ?0151:
    568                      while (pevent->OSEventGrp != 0x00) {      /* Yes, Post to ALL tasks waiting on queue       */
   \   03A0  CB930100          CMP.B   #0,1(R11)       
   \   03A4  0F24              JEQ     (?0156) 
    569                          OS_EventTaskRdy(pevent, msg, OS_STAT_Q);
   \   03A6  70120400          PUSH.B  #4      
   \   03AA  0E4A              MOV     R10,R14 
   \   03AC  0C4B              MOV     R11,R12 
   \   03AE  B0120000          CALL    #OS_EventTaskRdy        
   \   03B2  2153              ADD     #2,SP   
    570                      }
    571                  } else {
   \   03B4  F53F              JMP     (?0151) 
   \   03B6            ?0152:
    572                      OS_EventTaskRdy(pevent, msg, OS_STAT_Q);  /* No,  Post to HPT waiting on queue             */
   \   03B6  70120400          PUSH.B  #4      
   \   03BA  0E4A              MOV     R10,R14 
   \   03BC  0C4B              MOV     R11,R12 
   \   03BE  B0120000          CALL    #OS_EventTaskRdy        
   \   03C2  2153              ADD     #2,SP   
   \   03C4            ?0156:
    573                  }
    574                  OS_EXIT_CRITICAL();
   \   03C4  32D2              EINT            
    575                  OS_Sched();                                   /* Find highest priority task ready to run       */
   \   03C6  B0120000          CALL    #OS_Sched       
    576                  return (OS_NO_ERR);
   \   03CA  4C43              MOV.B   #0,R12  
    577              }
   \   03CC  2C3C              JMP     (?0166) 
   \   03CE            ?0150:
    578              pq = (OS_Q *)pevent->OSEventPtr;                  /* Point to queue control block                  */
   \   03CE  1C4B0400          MOV     4(R11),R12      
    579              if (pq->OSQEntries >= pq->OSQSize) {              /* Make sure queue is not full                   */
   \   03D2  9C9C0A00          CMP     10(R12),12(R12) 
   \   03D6  0C00
   \   03D8  0428              JNC     (?0158) 
    580                  OS_EXIT_CRITICAL();
   \   03DA  32D2              EINT            
    581                  return (OS_Q_FULL);
   \   03DC  7C401E00          MOV.B   #30,R12 
    582              }
   \   03E0  223C              JMP     (?0166) 
   \   03E2            ?0158:
    583              if ((opt & OS_POST_OPT_FRONT) != 0x00) {          /* Do we post to the FRONT of the queue?         */
   \   03E2  6DB3              BIT.B   #2,R13  
   \   03E4  0F24              JEQ     (?0160) 
    584                  if (pq->OSQOut == pq->OSQStart) {             /* Yes, Post as LIFO, Wrap OUT pointer if we ... */
   \   03E6  9C9C0800          CMP     8(R12),2(R12)   
   \   03EA  0200
   \   03EC  0320              JNE     (?0162) 
    585                      pq->OSQOut = pq->OSQEnd;                  /*      ... are at the 1st queue entry           */
   \   03EE  9C4C0400          MOV     4(R12),8(R12)   
   \   03F2  0800
   \   03F4            ?0162:
    586                  }
    587                  pq->OSQOut--;
   \   03F4  BC50FEFF          ADD     #-2,8(R12)      
   \   03F8  0800
    588                  *pq->OSQOut = msg;                            /*      Insert message into queue                */
   \   03FA  1D4C0800          MOV     8(R12),R13      
   \   03FE  8D4A0000          MOV     R10,0(R13)      
    589              } else {                                          /* No,  Post as FIFO                             */
   \   0402  0D3C              JMP     (?0165) 
   \   0404            ?0160:
    590                  *pq->OSQIn++ = msg;                           /*      Insert message into queue                */
   \   0404  1D4C0600          MOV     6(R12),R13      
   \   0408  AC530600          ADD     #2,6(R12)       
   \   040C  8D4A0000          MOV     R10,0(R13)      
    591                  if (pq->OSQIn == pq->OSQEnd) {                /*      Wrap IN ptr if we are at end of queue    */
   \   0410  9C9C0600          CMP     6(R12),4(R12)   
   \   0414  0400
   \   0416  0320              JNE     (?0165) 
    592                      pq->OSQIn = pq->OSQStart;
   \   0418  9C4C02

⌨️ 快捷键说明

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