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

📄 queue.s43

📁 MSP430 IAR project with FreeRTOS port.
💻 S43
📖 第 1 页 / 共 5 页
字号:
//////////////////////////////////////////////////////////////////////////////
//                                                                           /
// IAR MSP430 C/C++ Compiler V3.41A/W32                22/Apr/2006  00:25:16 /
// Copyright 1996-2006 IAR Systems. All rights reserved.                     /
//                                                                           /
//    __rt_version  =  2                                                     /
//    __double_size =  32                                                    /
//    __reg_r4      =  free                                                  /
//    __reg_r5      =  free                                                  /
//    __pic         =  no                                                    /
//    __core        =  64kb                                                  /
//    Source file   =  C:\MSP430F169_Eval_Port\FreeRTOSv401\Source\queue.c   /
//    Command line  =  C:\MSP430F169_Eval_Port\FreeRTOSv401\Source\queue.c   /
//                     -D ROWLEY_MSP430 -D IAR_MSP430 -lC                    /
//                     C:\MSP430F169_Eval_Port\FreeRTOSv401\Debug\List\ -lA  /
//                     C:\MSP430F169_Eval_Port\FreeRTOSv401\Debug\List\      /
//                     --remarks -o C:\MSP430F169_Eval_Port\FreeRTOSv401\Deb /
//                     ug\Obj\ -s2 --no_cse --no_unroll --no_inline          /
//                     --no_code_motion --no_tbaa --debug -e                 /
//                     --migration_preprocessor_extensions --double=32 -I    /
//                     C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\Common\Incl /
//                     ude\ -I C:\MSP430F169_Eval_Port\FreeRTOSv401\Source\I /
//                     nclude\ -I C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\ /
//                     MSP430_IAR\ -I C:\MSP430F169_Eval_Port\FreeRTOSv401\S /
//                     ource\portable\msp430f1611\ -I "C:\Program Files\IAR  /
//                     Systems\Embedded Workbench 4.0\430\INC\" -I           /
//                     "C:\Program Files\IAR Systems\Embedded Workbench      /
//                     4.0\430\INC\CLIB\"                                    /
//    List file     =  C:\MSP430F169_Eval_Port\FreeRTOSv401\Debug\List\queue /
//                     .s43                                                  /
//                                                                           /
//                                                                           /
//////////////////////////////////////////////////////////////////////////////

        NAME queue

        RTMODEL "__core", "64kb"
        RTMODEL "__double_size", "32"
        RTMODEL "__pic", "no"
        RTMODEL "__reg_r4", "free"
        RTMODEL "__reg_r5", "free"
        RTMODEL "__rt_version", "2"

        RSEG CSTACK:DATA:SORT:NOROOT(1)

        EXTERN ?Epilogue4
        EXTERN ?Epilogue3
        EXTERN ?Epilogue5
        EXTERN ?Mul16
        EXTERN ?longjmp_r4
        EXTERN ?longjmp_r5
        EXTERN ?setjmp_r4
        EXTERN ?setjmp_r5

        PUBWEAK ?setjmp_save_r4
        PUBWEAK ?setjmp_save_r5
        FUNCTION prvIsQueueEmpty,0203H
        LOCFRAME CSTACK, 2, STACK
        FUNCTION prvIsQueueFull,0203H
        LOCFRAME CSTACK, 2, STACK
        FUNCTION prvUnlockQueue,021203H
        LOCFRAME CSTACK, 6, STACK
        PUBLIC uxQueueMessagesWaiting
        FUNCTION uxQueueMessagesWaiting,0203H
        LOCFRAME CSTACK, 2, STACK
        PUBLIC vQueueDelete
        FUNCTION vQueueDelete,021203H
        LOCFRAME CSTACK, 4, STACK
        PUBLIC xQueueCreate
        FUNCTION xQueueCreate,021203H
        LOCFRAME CSTACK, 12, STACK
        PUBLIC xQueueReceive
        FUNCTION xQueueReceive,021203H
        LOCFRAME CSTACK, 12, STACK
        PUBLIC xQueueReceiveFromISR
        FUNCTION xQueueReceiveFromISR,021203H
        LOCFRAME CSTACK, 12, STACK
        PUBLIC xQueueSend
        FUNCTION xQueueSend,021203H
        LOCFRAME CSTACK, 12, STACK
        PUBLIC xQueueSendFromISR
        FUNCTION xQueueSendFromISR,021203H
        LOCFRAME CSTACK, 10, STACK
        
        CFI Names cfiNames0
        CFI StackFrame CFA SP DATA
        CFI Resource PC:16, SP:16, SR:16, R4:16, R5:16, R6:16, R7:16, R8:16
        CFI Resource R9:16, R10:16, R11:16, R12:16, R13:16, R14:16, R15:16
        CFI EndNames cfiNames0
        
        CFI Common cfiCommon0 Using cfiNames0
        CFI CodeAlign 2
        CFI DataAlign 2
        CFI ReturnAddress PC CODE
        CFI CFA SP+2
        CFI PC Frame(CFA, -2)
        CFI SR Undefined
        CFI R4 SameValue
        CFI R5 SameValue
        CFI R6 SameValue
        CFI R7 SameValue
        CFI R8 SameValue
        CFI R9 SameValue
        CFI R10 SameValue
        CFI R11 SameValue
        CFI R12 Undefined
        CFI R13 Undefined
        CFI R14 Undefined
        CFI R15 Undefined
        CFI EndCommon cfiCommon0
        
        EXTERN usCriticalNesting
        EXTERN xTaskRemoveFromEventList
        FUNCTION xTaskRemoveFromEventList,0202H
        EXTERN vPortFree
        FUNCTION vPortFree,0202H
        EXTERN memcpy
        FUNCTION memcpy,010202H
        EXTERN vTaskSuspendAll
        FUNCTION vTaskSuspendAll,0202H
        EXTERN vTaskPlaceOnEventList
        FUNCTION vTaskPlaceOnEventList,0202H
        EXTERN xTaskResumeAll
        FUNCTION xTaskResumeAll,0202H
        EXTERN vPortYield
        FUNCTION vPortYield,0202H
        EXTERN pvPortMalloc
        FUNCTION pvPortMalloc,0202H
        EXTERN vListInitialise
        FUNCTION vListInitialise,0202H

// C:\MSP430F169_Eval_Port\FreeRTOSv401\Source\queue.c
//    1 /*
//    2 	FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.
//    3 
//    4 	This file is part of the FreeRTOS distribution.
//    5 
//    6 	FreeRTOS is free software; you can redistribute it and/or modify
//    7 	it under the terms of the GNU General Public License as published by
//    8 	the Free Software Foundation; either version 2 of the License, or
//    9 	(at your option) any later version.
//   10 
//   11 	FreeRTOS is distributed in the hope that it will be useful,
//   12 	but WITHOUT ANY WARRANTY; without even the implied warranty of
//   13 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   14 	GNU General Public License for more details.
//   15 
//   16 	You should have received a copy of the GNU General Public License
//   17 	along with FreeRTOS; if not, write to the Free Software
//   18 	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//   19 
//   20 	A special exception to the GPL can be applied should you wish to distribute
//   21 	a combined work that includes FreeRTOS, without being obliged to provide
//   22 	the source code for any proprietary components.  See the licensing section
//   23 	of http://www.FreeRTOS.org for full details of how and when the exception
//   24 	can be applied.
//   25 
//   26 	***************************************************************************
//   27 	See http://www.FreeRTOS.org for documentation, latest information, license
//   28 	and contact details.  Please ensure to read the configuration and relevant
//   29 	port sections of the online documentation.
//   30 	***************************************************************************
//   31 */
//   32 
//   33 /*
//   34 Changes from V1.01
//   35 
//   36 	+ More use of 8bit data types.
//   37 	+ Function name prefixes changed where the data type returned has changed.
//   38 
//   39 Changed from V2.0.0
//   40 
//   41 	+ Added the queue locking mechanism and make more use of the scheduler
//   42 	  suspension feature to minimise the time interrupts have to be disabled
//   43 	  when accessing a queue.
//   44 
//   45 Changed from V2.2.0
//   46 
//   47 	+ Explicit use of 'signed' qualifier on portCHAR types added.
//   48 
//   49 Changes from V3.0.0
//   50 
//   51 	+ API changes as described on the FreeRTOS.org WEB site.
//   52 
//   53 Changes from V3.2.3
//   54 
//   55 	+ Added the queue functions that can be used from co-routines.
//   56 
//   57 */
//   58 
//   59 #include <stdlib.h>
//   60 #include <string.h>
//   61 #include "FreeRTOS.h"
//   62 #include "task.h"
//   63 #include "croutine.h"
//   64 
//   65 /*-----------------------------------------------------------
//   66  * PUBLIC LIST API documented in list.h
//   67  *----------------------------------------------------------*/
//   68 
//   69 /* Constants used with the cRxLock and cTxLock structure members. */
//   70 #define queueUNLOCKED	( ( signed portBASE_TYPE ) -1 )
//   71 
//   72 /*
//   73  * Definition of the queue used by the scheduler.
//   74  * Items are queued by copy, not reference.
//   75  */
//   76 typedef struct QueueDefinition
//   77 {
//   78 	signed portCHAR *pcHead;				/*< Points to the beginning of the queue storage area. */
//   79 	signed portCHAR *pcTail;				/*< Points to the byte at the end of the queue storage area.  Once more byte is allocated than necessary to store the queue items, this is used as a marker. */
//   80 
//   81 	signed portCHAR *pcWriteTo;				/*< Points to the free next place in the storage area. */
//   82 	signed portCHAR *pcReadFrom;			/*< Points to the last place that a queued item was read from. */
//   83 
//   84 	xList xTasksWaitingToSend;				/*< List of tasks that are blocked waiting to post onto this queue.  Stored in priority order. */
//   85 	xList xTasksWaitingToReceive;			/*< List of tasks that are blocked waiting to read from this queue.  Stored in priority order. */
//   86 
//   87 	unsigned portBASE_TYPE uxMessagesWaiting;/*< The number of items currently in the queue. */
//   88 	unsigned portBASE_TYPE uxLength;		/*< The length of the queue defined as the number of items it will hold, not the number of bytes. */
//   89 	unsigned portBASE_TYPE uxItemSize;		/*< The size of each items that the queue will hold. */
//   90 
//   91 	signed portBASE_TYPE xRxLock;				/*< Stores the number of items received from the queue (removed from the queue) while the queue was locked.  Set to queueUNLOCKED when the queue is not locked. */
//   92 	signed portBASE_TYPE xTxLock;				/*< Stores the number of items transmitted to the queue (added to the queue) while the queue was locked.  Set to queueUNLOCKED when the queue is not locked. */
//   93 } xQUEUE;
//   94 /*-----------------------------------------------------------*/
//   95 
//   96 /*
//   97  * Inside this file xQueueHandle is a pointer to a xQUEUE structure.
//   98  * To keep the definition private the API header file defines it as a
//   99  * pointer to void.
//  100  */
//  101 typedef xQUEUE * xQueueHandle;
//  102 
//  103 /*
//  104  * Prototypes for public functions are included here so we don't have to
//  105  * include the API header file (as it defines xQueueHandle differently).  These
//  106  * functions are documented in the API header file.
//  107  */
//  108 xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize );
//  109 signed portBASE_TYPE xQueueSend( xQueueHandle xQueue, const void * pvItemToQueue, portTickType xTicksToWait );
//  110 unsigned portBASE_TYPE uxQueueMessagesWaiting( xQueueHandle pxQueue );
//  111 void vQueueDelete( xQueueHandle xQueue );
//  112 signed portBASE_TYPE xQueueSendFromISR( xQueueHandle pxQueue, const void *pvItemToQueue, signed portBASE_TYPE xTaskPreviouslyWoken );
//  113 signed portBASE_TYPE xQueueReceive( xQueueHandle pxQueue, void *pvBuffer, portTickType xTicksToWait );
//  114 signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle pxQueue, void *pvBuffer, signed portBASE_TYPE *pxTaskWoken );
//  115 
//  116 #if configUSE_CO_ROUTINES == 1
//  117 	signed portBASE_TYPE xQueueCRSendFromISR( xQueueHandle pxQueue, const void *pvItemToQueue, signed portBASE_TYPE xCoRoutinePreviouslyWoken );
//  118 	signed portBASE_TYPE xQueueCRReceiveFromISR( xQueueHandle pxQueue, void *pvBuffer, signed portBASE_TYPE *pxTaskWoken );
//  119 	signed portBASE_TYPE xQueueCRSend( xQueueHandle pxQueue, const void *pvItemToQueue, portTickType xTicksToWait );
//  120 	signed portBASE_TYPE xQueueCRReceive( xQueueHandle pxQueue, void *pvBuffer, portTickType xTicksToWait );
//  121 #endif
//  122 
//  123 /*
//  124  * Unlocks a queue locked by a call to prvLockQueue.  Locking a queue does not
//  125  * prevent an ISR from adding or removing items to the queue, but does prevent
//  126  * an ISR from removing tasks from the queue event lists.  If an ISR finds a
//  127  * queue is locked it will instead increment the appropriate queue lock count
//  128  * to indicate that a task may require unblocking.  When the queue in unlocked
//  129  * these lock counts are inspected, and the appropriate action taken.
//  130  */
//  131 static signed portBASE_TYPE prvUnlockQueue( xQueueHandle pxQueue );
//  132 
//  133 /*
//  134  * Uses a critical section to determine if there is any data in a queue.
//  135  *
//  136  * @return pdTRUE if the queue contains no items, otherwise pdFALSE.
//  137  */
//  138 static signed portBASE_TYPE prvIsQueueEmpty( const xQueueHandle pxQueue );
//  139 
//  140 /*
//  141  * Uses a critical section to determine if there is any space in a queue.
//  142  *
//  143  * @return pdTRUE if there is no space, otherwise pdFALSE;
//  144  */
//  145 static signed portBASE_TYPE prvIsQueueFull( const xQueueHandle pxQueue );
//  146 
//  147 /*
//  148  * Macro that copies an item into the queue.  This is done by copying the item
//  149  * byte for byte, not by reference.  Updates the queue state to ensure it's
//  150  * integrity after the copy.
//  151  */
//  152 #define prvCopyQueueData( pxQueue, pvItemToQueue )												\ 
//  153 {																								\ 
//  154 	memcpy( ( void * ) pxQueue->pcWriteTo, pvItemToQueue, ( unsigned ) pxQueue->uxItemSize );	\ 
//  155 	++( pxQueue->uxMessagesWaiting );															\ 
//  156 	pxQueue->pcWriteTo += pxQueue->uxItemSize;													\ 
//  157 	if( pxQueue->pcWriteTo >= pxQueue->pcTail )													\ 
//  158 	{																							\ 
//  159 		pxQueue->pcWriteTo = pxQueue->pcHead;													\ 
//  160 	}																							\ 
//  161 }
//  162 /*-----------------------------------------------------------*/
//  163 
//  164 /*
//  165  * Macro to mark a queue as locked.  Locking a queue prevents an ISR from
//  166  * accessing the queue event lists.
//  167  */
//  168 #define prvLockQueue( pxQueue )			\ 
//  169 {										\ 
//  170 	taskENTER_CRITICAL();				\ 
//  171 		++( pxQueue->xRxLock );			\ 
//  172 		++( pxQueue->xTxLock );			\ 
//  173 	taskEXIT_CRITICAL();				\ 
//  174 }
//  175 /*-----------------------------------------------------------*/
//  176 
//  177 
//  178 /*-----------------------------------------------------------
//  179  * PUBLIC QUEUE MANAGEMENT API documented in queue.h
//  180  *----------------------------------------------------------*/
//  181 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//  182 xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize )
xQueueCreate:
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function xQueueCreate
//  183 {
        FUNCALL xQueueCreate, pvPortMalloc
        LOCFRAME CSTACK, 12, STACK
        FUNCALL xQueueCreate, pvPortMalloc
        LOCFRAME CSTACK, 12, STACK
        FUNCALL xQueueCreate, vListInitialise
        LOCFRAME CSTACK, 12, STACK
        FUNCALL xQueueCreate, vListInitialise
        LOCFRAME CSTACK, 12, STACK
        FUNCALL xQueueCreate, vPortFree
        LOCFRAME CSTACK, 12, STACK
        PUSH.W  R10
        CFI R10 Frame(CFA, -4)
        CFI CFA SP+4
        PUSH.W  R11
        CFI R11 Frame(CFA, -6)
        CFI CFA SP+6
        PUSH.W  R8
        CFI R8 Frame(CFA, -8)
        CFI CFA SP+8
        PUSH.W  R9

⌨️ 快捷键说明

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