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

📄 os_q.ls1

📁 uCOS-II_2.52在51上的移植程序
💻 LS1
📖 第 1 页 / 共 5 页
字号:
                             ct, the
                     598     ; *              interrupt disable time is proportional to the number of tasks waiting on t
                             he queue.
                     599     ; *****************************************************************************************
                             ****************
                     600     ; */
                     601     ; 
                     602     ; #if OS_Q_POST_OPT_EN > 0
                     603     ; INT8U  OSQPostOpt (OS_EVENT *pevent, void *msg, INT8U opt)
                     604     ; {
                     605     ; 
                     606     ;     OS_Q      *pq;
                     607     ; 
                     608     ; 
                     609     ; #if OS_ARG_CHK_EN > 0
                     610     ;     if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'               
                                           */
                     611     ;         return (OS_ERR_PEVENT_NULL);
                     612     ;     }
                     613     ;     if (msg == (void *)0) {                           /* Make sure we are not posting a N
                             ULL pointer   */
                     614     ;         return (OS_ERR_POST_NULL_PTR);
                     615     ;     }
                     616     ;     if (pevent->OSEventType != OS_EVENT_TYPE_Q) {     /* Validate event block type       
                                           */
                     617     ;         return (OS_ERR_EVENT_TYPE);
                     618     ;     }
A51 MACRO ASSEMBLER  OS_Q                                                                 08/08/2005 11:36:51 PAGE    13

                     619     ; #endif
                     620     ;     OS_ENTER_CRITICAL();
                     621     ;     if (pevent->OSEventGrp != 0x00) {                 /* See if any task pending on queue
                                           */
                     622     ;         if ((opt & OS_POST_OPT_BROADCAST) != 0x00) {  /* Do we need to post msg to ALL wa
                             iting tasks ? */
                     623     ;             while (pevent->OSEventGrp != 0x00) {      /* Yes, Post to ALL tasks waiting o
                             n queue       */
                     624     ;                 OS_EventTaskRdy(pevent, msg, OS_STAT_Q);
                     625     ;             }
                     626     ;         } else {
                     627     ;             OS_EventTaskRdy(pevent, msg, OS_STAT_Q);  /* No,  Post to HPT waiting on queu
                             e             */
                     628     ;         }
                     629     ;         OS_EXIT_CRITICAL();
                     630     ;         OS_Sched();                                   /* Find highest priority task ready
                              to run       */
                     631     ;         return (OS_NO_ERR);
                     632     ;     }
                     633     ;     pq = (OS_Q *)pevent->OSEventPtr;                  /* Point to queue control block    
                                           */
                     634     ;     if (pq->OSQEntries >= pq->OSQSize) {              /* Make sure queue is not full     
                                           */
                     635     ;         OS_EXIT_CRITICAL();
                     636     ;         return (OS_Q_FULL);
                     637     ;     }
                     638     ;     if ((opt & OS_POST_OPT_FRONT) != 0x00) {          /* Do we post to the FRONT of the q
                             ueue?         */
                     639     ;         if (pq->OSQOut == pq->OSQStart) {             /* Yes, Post as LIFO, Wrap OUT poin
                             ter if we ... */
                     640     ;             pq->OSQOut = pq->OSQEnd;                  /*      ... are at the 1st queue en
                             try           */
                     641     ;         }
                     642     ;         pq->OSQOut--;
                     643     ;         *pq->OSQOut = msg;                            /*      Insert message into queue  
                                           */
                     644     ;     } else {                                          /* No,  Post as FIFO               
                                           */
                     645     ;         *pq->OSQIn++ = msg;                           /*      Insert message into queue  
                                           */
                     646     ;         if (pq->OSQIn == pq->OSQEnd) {                /*      Wrap IN ptr if we are at en
                             d of queue    */
                     647     ;             pq->OSQIn = pq->OSQStart;
                     648     ;         }
                     649     ;     }
                     650     ;     pq->OSQEntries++;                                 /* Update the nbr of entries in the
                              queue        */
                     651     ;     OS_EXIT_CRITICAL();
                     652     ;     return (OS_NO_ERR);
                     653     ; }
                     654     ; #endif
                     655     ; /*$PAGE*/
                     656     ; /*
                     657     ; *****************************************************************************************
                             ****************
                     658     ; *                                        QUERY A MESSAGE QUEUE
                     659     ; *
                     660     ; * Description: This function obtains information about a message queue.
                     661     ; *
                     662     ; * Arguments  : pevent        is a pointer to the event control block associated with the 
                             desired queue
                     663     ; *
                     664     ; *              pdata         is a pointer to a structure that will contain information ab
                             out the message
                     665     ; *                            queue.
                     666     ; *
A51 MACRO ASSEMBLER  OS_Q                                                                 08/08/2005 11:36:51 PAGE    14

                     667     ; * Returns    : OS_NO_ERR           The call was successful and the message was sent
                     668     ; *              OS_ERR_EVENT_TYPE   If you are attempting to obtain data from a non queue.
                     669     ; *              OS_ERR_PEVENT_NULL  If 'pevent' is a NULL pointer
                     670     ; *****************************************************************************************
                             ****************
                     671     ; */
                     672     ; 
                     673     ; #if OS_Q_QUERY_EN > 0
                     674     ; INT8U  OSQQuery (OS_EVENT *pevent, OS_Q_DATA *ppdata)
                     675     ; {
                     676     ; 
                     677     ;     OS_Q      *pq;
                     678     ;     INT8U     *psrc;
                     679     ;     INT8U     *pdest;
                     680     ; 
                     681     ; 
                     682     ; #if OS_ARG_CHK_EN > 0
                     683     ;     if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'          
                                           */
                     684     ;         return (OS_ERR_PEVENT_NULL);
                     685     ;     }
                     686     ;     if (pevent->OSEventType != OS_EVENT_TYPE_Q) {          /* Validate event block type  
                                           */
                     687     ;         return (OS_ERR_EVENT_TYPE);
                     688     ;     }
                     689     ; #endif
                     690     ;     OS_ENTER_CRITICAL();
                     691     ;     ppdata->OSEventGrp = pevent->OSEventGrp;                /* Copy message queue wait li
                             st           */
                     692     ;     psrc              = &pevent->OSEventTbl[0];
                     693     ;     pdest             = &ppdata->OSEventTbl[0];
                     694     ; #if OS_EVENT_TBL_SIZE > 0
                     695     ;     *pdest++          = *psrc++;
                     696     ; #endif
                     697     ; 
                     698     ; #if OS_EVENT_TBL_SIZE > 1
                     699     ;     *pdest++          = *psrc++;
                     700     ; #endif
                     701     ; 
                     702     ; #if OS_EVENT_TBL_SIZE > 2
                     703     ;     *pdest++          = *psrc++;
                     704     ; #endif
                     705     ; 
                     706     ; #if OS_EVENT_TBL_SIZE > 3
                     707     ;     *pdest++          = *psrc++;
                     708     ; #endif
                     709     ; 
                     710     ; #if OS_EVENT_TBL_SIZE > 4
                     711     ;     *pdest++          = *psrc++;
                     712     ; #endif
                     713     ; 
                     714     ; #if OS_EVENT_TBL_SIZE > 5
                     715     ;     *pdest++          = *psrc++;
                     716     ; #endif
                     717     ; 
                     718     ; #if OS_EVENT_TBL_SIZE > 6
                     719     ;     *pdest++          = *psrc++;
                     720     ; #endif
                     721     ; 
                     722     ; #if OS_EVENT_TBL_SIZE > 7
                     723     ;     *pdest            = *psrc;
                     724     ; #endif
                     725     ;     pq = (OS_Q *)pevent->OSEventPtr;
                     726     ;     if (pq->OSQEntries > 0) {
                     727     ;         ppdata->OSMsg = *pq->OSQOut;                        /* Get next message to return
                              if available  */
A51 MACRO ASSEMBLER  OS_Q                                                                 08/08/2005 11:36:51 PAGE    15

                     728     ;     } else {
                     729     ;         ppdata->OSMsg = (void *)0;
                     730     ;     }
                     731     ;     ppdata->OSNMsgs = pq->OSQEntries;
                     732     ;     ppdata->OSQSize = pq->OSQSize;
                     733     ;     OS_EXIT_CRITICAL();
                     734     ;     return (OS_NO_ERR);
                     735     ; }
                     736     ; #endif                                                     /* OS_Q_QUERY_EN              
                                           */
                     737     ; 
                     738     ; /*$PAGE*/
                     739     ; /*
                     740     ; *****************************************************************************************
                             ****************
                     741     ; *                                      QUEUE MODULE INITIALIZATION
                     742     ; *
                     743     ; * Description : This function is called by uC/OS-II to initialize the message queue modul
                             e.  Your
                     744     ; *               application MUST NOT call this function.
                     745     ; *
                     746     ; * Arguments   :  none
                     747     ; *
                     748     ; * Returns     : none
                     749     ; *
                     750     ; * Note(s)    : This function is INTERNAL to uC/OS-II and your application should not call
                              it.
                     751     ; *****************************************************************************************
                             ****************
                     752     ; */
                     753  

⌨️ 快捷键说明

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