#include "portmacro.h"
#include "mpu_wrappers.h"
Go to the source code of this file.
Defines | |
#define | portNUM_CONFIGURABLE_REGIONS 1 |
Functions | |
void * | pvPortMalloc (size_t xSize) PRIVILEGED_FUNCTION |
portSTACK_TYPE * | pxPortInitialiseStack (portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters) |
void | vPortEndScheduler (void) PRIVILEGED_FUNCTION |
void | vPortFree (void *pv) PRIVILEGED_FUNCTION |
void | vPortInitialiseBlocks (void) PRIVILEGED_FUNCTION |
size_t | xPortGetFreeHeapSize (void) PRIVILEGED_FUNCTION |
portBASE_TYPE | xPortStartScheduler (void) PRIVILEGED_FUNCTION |
#define portNUM_CONFIGURABLE_REGIONS 1 |
Definition at line 331 of file portable.h.
void* pvPortMalloc | ( | size_t | xSize | ) |
Definition at line 89 of file heap_1.c.
References configTOTAL_HEAP_SIZE, heapMINIMUM_BLOCK_SIZE, heapSTRUCT_SIZE, pdFALSE, pdTRUE, portBASE_TYPE, portBYTE_ALIGNMENT, prvHeapInit, prvInsertBlockIntoFreeList, A_BLOCK_LINK::pxNextFreeBlock, xRTOS_HEAP::ucHeap, vTaskSuspendAll(), A_BLOCK_LINK::xBlockSize, xHeap, xNextFreeByte, and xTaskResumeAll().
Referenced by portTASK_FUNCTION(), prvAllocateTCBAndStack(), vCreateSuicidalTasks(), vMemCheckTask(), vStartAltBlockingQueueTasks(), vStartBlockingQueueTasks(), vStartSemaphoreTasks(), and xCoRoutineCreate().
00090 { 00091 void *pvReturn = NULL; 00092 00093 /* Ensure that blocks are always aligned to the required number of bytes. */ 00094 #if portBYTE_ALIGNMENT != 1 00095 if( xWantedSize & portBYTE_ALIGNMENT_MASK ) 00096 { 00097 /* Byte alignment required. */ 00098 xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ); 00099 } 00100 #endif 00101 00102 vTaskSuspendAll(); 00103 { 00104 /* Check there is enough room left for the allocation. */ 00105 if( ( ( xNextFreeByte + xWantedSize ) < configTOTAL_HEAP_SIZE ) && 00106 ( ( xNextFreeByte + xWantedSize ) > xNextFreeByte ) )/* Check for overflow. */ 00107 { 00108 /* Return the next free byte then increment the index past this 00109 block. */ 00110 pvReturn = &( xHeap.ucHeap[ xNextFreeByte ] ); 00111 xNextFreeByte += xWantedSize; 00112 } 00113 } 00114 xTaskResumeAll(); 00115 00116 #if( configUSE_MALLOC_FAILED_HOOK == 1 ) 00117 { 00118 if( pvReturn == NULL ) 00119 { 00120 extern void vApplicationMallocFailedHook( void ); 00121 vApplicationMallocFailedHook(); 00122 } 00123 } 00124 #endif 00125 00126 return pvReturn; 00127 }
portSTACK_TYPE* pxPortInitialiseStack | ( | portSTACK_TYPE * | pxTopOfStack, | |
pdTASK_CODE | pxCode, | |||
void * | pvParameters | |||
) |
Definition at line 294 of file GCC/AVR32_UC3/port.c.
References portINITIAL_SR, portINSTRUCTION_SIZE, portNO_CRITICAL_NESTING, and portSTACK_TYPE.
Referenced by prvInitialiseTaskLists().
00295 { 00296 /* Setup the initial stack of the task. The stack is set exactly as 00297 expected by the portRESTORE_CONTEXT() macro. */ 00298 00299 /* When the task starts, it will expect to find the function parameter in R12. */ 00300 pxTopOfStack--; 00301 *pxTopOfStack-- = ( portSTACK_TYPE ) 0x08080808; /* R8 */ 00302 *pxTopOfStack-- = ( portSTACK_TYPE ) 0x09090909; /* R9 */ 00303 *pxTopOfStack-- = ( portSTACK_TYPE ) 0x0A0A0A0A; /* R10 */ 00304 *pxTopOfStack-- = ( portSTACK_TYPE ) 0x0B0B0B0B; /* R11 */ 00305 *pxTopOfStack-- = ( portSTACK_TYPE ) pvParameters; /* R12 */ 00306 *pxTopOfStack-- = ( portSTACK_TYPE ) 0xDEADBEEF; /* R14/LR */ 00307 *pxTopOfStack-- = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; /* R15/PC */ 00308 *pxTopOfStack-- = ( portSTACK_TYPE ) portINITIAL_SR; /* SR */ 00309 *pxTopOfStack-- = ( portSTACK_TYPE ) 0xFF0000FF; /* R0 */ 00310 *pxTopOfStack-- = ( portSTACK_TYPE ) 0x01010101; /* R1 */ 00311 *pxTopOfStack-- = ( portSTACK_TYPE ) 0x02020202; /* R2 */ 00312 *pxTopOfStack-- = ( portSTACK_TYPE ) 0x03030303; /* R3 */ 00313 *pxTopOfStack-- = ( portSTACK_TYPE ) 0x04040404; /* R4 */ 00314 *pxTopOfStack-- = ( portSTACK_TYPE ) 0x05050505; /* R5 */ 00315 *pxTopOfStack-- = ( portSTACK_TYPE ) 0x06060606; /* R6 */ 00316 *pxTopOfStack-- = ( portSTACK_TYPE ) 0x07070707; /* R7 */ 00317 *pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_NESTING; /* ulCriticalNesting */ 00318 00319 return pxTopOfStack; 00320 }
void vPortEndScheduler | ( | void | ) |
Definition at line 337 of file GCC/AVR32_UC3/port.c.
Referenced by vTaskEndScheduler().
00338 { 00339 /* It is unlikely that the AVR32 port will require this function as there 00340 is nothing to return to. */ 00341 }
void vPortFree | ( | void * | pv | ) |
Definition at line 130 of file heap_1.c.
References heapSTRUCT_SIZE, prvInsertBlockIntoFreeList, vTaskSuspendAll(), A_BLOCK_LINK::xBlockSize, and xTaskResumeAll().
Referenced by portTASK_FUNCTION(), prvAllocateTCBAndStack(), vMemCheckTask(), and vQueueDelete().
00131 { 00132 /* Memory cannot be freed using this scheme. See heap_2.c and heap_3.c 00133 for alternative implementations, and the memory management pages of 00134 http://www.FreeRTOS.org for more information. */ 00135 ( void ) pv; 00136 }
void vPortInitialiseBlocks | ( | void | ) |
Definition at line 139 of file heap_1.c.
References xNextFreeByte.
00140 { 00141 /* Only required when static memory is not cleared. */ 00142 xNextFreeByte = ( size_t ) 0; 00143 }
size_t xPortGetFreeHeapSize | ( | void | ) |
Definition at line 146 of file heap_1.c.
References configTOTAL_HEAP_SIZE, and xNextFreeByte.
00147 { 00148 return ( configTOTAL_HEAP_SIZE - xNextFreeByte ); 00149 }
portBASE_TYPE xPortStartScheduler | ( | void | ) |
Definition at line 323 of file GCC/AVR32_UC3/port.c.
References portRESTORE_CONTEXT, and prvSetupTimerInterrupt().
Referenced by vTaskStartScheduler().
00324 { 00325 /* Start the timer that generates the tick ISR. Interrupts are disabled 00326 here already. */ 00327 prvSetupTimerInterrupt(); 00328 00329 /* Start the first task. */ 00330 portRESTORE_CONTEXT(); 00331 00332 /* Should not get here! */ 00333 return 0; 00334 }