/* * FreeRTOS Kernel <DEVELOPMENT BRANCH> * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * https://www.FreeRTOS.org * https://github.com/FreeRTOS * *//* ... *//*-----------------------------------------------------------* Portable layer API. Each function must be defined for each port.*----------------------------------------------------------*//* ... */#ifndefPORTABLE_H#definePORTABLE_H/* Each FreeRTOS port has a unique portmacro.h header file. Originally a * pre-processor definition was used to ensure the pre-processor found the correct * portmacro.h file for the port being used. That scheme was deprecated in favour * of setting the compiler's include path such that it found the correct * portmacro.h file - removing the need for the constant and allowing the * portmacro.h file to be located anywhere in relation to the port being used. * Purely for reasons of backward compatibility the old method is still valid, but * to make it clear that new projects should not use it, support for the port * specific constants has been moved into the deprecated_definitions.h header * file. *//* ... */#include"deprecated_definitions.h"/* If portENTER_CRITICAL is not defined then including deprecated_definitions.h * did not result in a portmacro.h header file being included - and it should be * included here. In this case the path to the correct portmacro.h header file * must be set in the compiler's include path. *//* ... */#ifndefportENTER_CRITICAL#include"portmacro.h"#endif#ifportBYTE_ALIGNMENT==32#defineportBYTE_ALIGNMENT_MASK(0x001f)#elifportBYTE_ALIGNMENT==16#defineportBYTE_ALIGNMENT_MASK(0x000f)#elifportBYTE_ALIGNMENT==8#defineportBYTE_ALIGNMENT_MASK(0x0007)#elifportBYTE_ALIGNMENT==4#defineportBYTE_ALIGNMENT_MASK(0x0003)#elifportBYTE_ALIGNMENT==2#defineportBYTE_ALIGNMENT_MASK(0x0001)#elifportBYTE_ALIGNMENT==1#defineportBYTE_ALIGNMENT_MASK(0x0000)#else/* if portBYTE_ALIGNMENT == 32 */#error"Invalid portBYTE_ALIGNMENT definition"#endif/* if portBYTE_ALIGNMENT == 32 */#ifndefportUSING_MPU_WRAPPERS#defineportUSING_MPU_WRAPPERS0#endif#ifndefportNUM_CONFIGURABLE_REGIONS#defineportNUM_CONFIGURABLE_REGIONS1#endif#ifndefportHAS_STACK_OVERFLOW_CHECKING#defineportHAS_STACK_OVERFLOW_CHECKING0#endif#ifndefportARCH_NAME#defineportARCH_NAMENULL#endif#ifndefconfigSTACK_DEPTH_TYPE#defineconfigSTACK_DEPTH_TYPEStackType_t#endif#ifndefconfigSTACK_ALLOCATION_FROM_SEPARATE_HEAP/* Defaults to 0 for backward compatibility. */#defineconfigSTACK_ALLOCATION_FROM_SEPARATE_HEAP0/* ... */#endif#include"mpu_wrappers.h"/* *INDENT-OFF* */#ifdef__cplusplusextern"C"{#endif/* *INDENT-ON* *//* * Setup the stack of a new task so it is ready to be placed under the * scheduler control. The registers have to be placed on the stack in * the order that the port expects to find them. * *//* ... */#if(portUSING_MPU_WRAPPERS==1)#if(portHAS_STACK_OVERFLOW_CHECKING==1)StackType_t*pxPortInitialiseStack(StackType_t*pxTopOfStack,StackType_t*pxEndOfStack,TaskFunction_tpxCode,void*pvParameters,BaseType_txRunPrivileged,xMPU_SETTINGS*xMPUSettings)PRIVILEGED_FUNCTION;/* ... */#elseStackType_t*pxPortInitialiseStack(StackType_t*pxTopOfStack,TaskFunction_tpxCode,void*pvParameters,BaseType_txRunPrivileged,xMPU_SETTINGS*xMPUSettings)PRIVILEGED_FUNCTION;/* ... */#endif/* if ( portHAS_STACK_OVERFLOW_CHECKING == 1 ) *//* ... */#else/* if ( portUSING_MPU_WRAPPERS == 1 ) */#if(portHAS_STACK_OVERFLOW_CHECKING==1)StackType_t*pxPortInitialiseStack(StackType_t*pxTopOfStack,StackType_t*pxEndOfStack,TaskFunction_tpxCode,void*pvParameters)PRIVILEGED_FUNCTION;/* ... */#elseStackType_t*pxPortInitialiseStack(StackType_t*pxTopOfStack,TaskFunction_tpxCode,void*pvParameters)PRIVILEGED_FUNCTION;/* ... */#endif/* ... */#endif/* if ( portUSING_MPU_WRAPPERS == 1 ) *//* Used by heap_5.c to define the start address and size of each memory region * that together comprise the total FreeRTOS heap space. *//* ... */typedefstructHeapRegion{uint8_t*pucStartAddress;size_txSizeInBytes;...}HeapRegion_t;/* Used to pass information about the heap out of vPortGetHeapStats(). */typedefstructxHeapStats{size_txAvailableHeapSpaceInBytes;/* The total heap size currently available - this is the sum of all the free blocks, not the largest block that can be allocated. */size_txSizeOfLargestFreeBlockInBytes;/* The maximum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */size_txSizeOfSmallestFreeBlockInBytes;/* The minimum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */size_txNumberOfFreeBlocks;/* The number of free memory blocks within the heap at the time vPortGetHeapStats() is called. */size_txMinimumEverFreeBytesRemaining;/* The minimum amount of total free memory (sum of all free blocks) there has been in the heap since the system booted. */size_txNumberOfSuccessfulAllocations;/* The number of calls to pvPortMalloc() that have returned a valid memory block. */size_txNumberOfSuccessfulFrees;/* The number of calls to vPortFree() that has successfully freed a block of memory. */...}HeapStats_t;/* * Used to define multiple heap regions for use by heap_5.c. This function * must be called before any calls to pvPortMalloc() - not creating a task, * queue, semaphore, mutex, software timer, event group, etc. will result in * pvPortMalloc being called. * * pxHeapRegions passes in an array of HeapRegion_t structures - each of which * defines a region of memory that can be used as the heap. The array is * terminated by a HeapRegions_t structure that has a size of 0. The region * with the lowest start address must appear first in the array. *//* ... */voidvPortDefineHeapRegions(constHeapRegion_t*constpxHeapRegions)PRIVILEGED_FUNCTION;/* * Returns a HeapStats_t structure filled with information about the current * heap state. *//* ... */voidvPortGetHeapStats(HeapStats_t*pxHeapStats);/* * Map to the memory management routines required for the port. *//* ... */void*pvPortMalloc(size_txWantedSize)PRIVILEGED_FUNCTION;void*pvPortCalloc(size_txNum,size_txSize)PRIVILEGED_FUNCTION;voidvPortFree(void*pv)PRIVILEGED_FUNCTION;voidvPortInitialiseBlocks(void)PRIVILEGED_FUNCTION;size_txPortGetFreeHeapSize(void)PRIVILEGED_FUNCTION;size_txPortGetMinimumEverFreeHeapSize(void)PRIVILEGED_FUNCTION;#if(configSTACK_ALLOCATION_FROM_SEPARATE_HEAP==1)void*pvPortMallocStack(size_txSize)PRIVILEGED_FUNCTION;voidvPortFreeStack(void*pv)PRIVILEGED_FUNCTION;/* ... */#else#definepvPortMallocStackpvPortMalloc#definevPortFreeStackvPortFree/* ... */#endif/* * This function resets the internal state of the heap module. It must be called * by the application before restarting the scheduler. *//* ... */voidvPortHeapResetState(void)PRIVILEGED_FUNCTION;#if(configUSE_MALLOC_FAILED_HOOK==1)/** * task.h * @code{c} * void vApplicationMallocFailedHook( void ) * @endcode * * This hook function is called when allocation failed. *//* ... */voidvApplicationMallocFailedHook(void);/* ... */#endif/* * Setup the hardware ready for the scheduler to take control. This generally * sets up a tick interrupt and sets timers for the correct tick frequency. *//* ... */BaseType_txPortStartScheduler(void)PRIVILEGED_FUNCTION;/* * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so * the hardware is left in its original condition after the scheduler stops * executing. *//* ... */voidvPortEndScheduler(void)PRIVILEGED_FUNCTION;/* * The structures and methods of manipulating the MPU are contained within the * port layer. * * Fills the xMPUSettings structure with the memory region information * contained in xRegions. *//* ... */#if(portUSING_MPU_WRAPPERS==1)structxMEMORY_REGION;voidvPortStoreTaskMPUSettings(xMPU_SETTINGS*xMPUSettings,conststructxMEMORY_REGION*constxRegions,StackType_t*pxBottomOfStack,configSTACK_DEPTH_TYPEuxStackDepth)PRIVILEGED_FUNCTION;/* ... */#endif/** * @brief Checks if the calling task is authorized to access the given buffer. * * @param pvBuffer The buffer which the calling task wants to access. * @param ulBufferLength The length of the pvBuffer. * @param ulAccessRequested The permissions that the calling task wants. * * @return pdTRUE if the calling task is authorized to access the buffer, * pdFALSE otherwise. *//* ... */#if(portUSING_MPU_WRAPPERS==1)BaseType_txPortIsAuthorizedToAccessBuffer(constvoid*pvBuffer,uint32_tulBufferLength,uint32_tulAccessRequested)PRIVILEGED_FUNCTION;/* ... */#endif/** * @brief Checks if the calling task is authorized to access the given kernel object. * * @param lInternalIndexOfKernelObject The index of the kernel object in the kernel * object handle pool. * * @return pdTRUE if the calling task is authorized to access the kernel object, * pdFALSE otherwise. *//* ... */#if((portUSING_MPU_WRAPPERS==1)&&(configUSE_MPU_WRAPPERS_V1==0))BaseType_txPortIsAuthorizedToAccessKernelObject(int32_tlInternalIndexOfKernelObject)PRIVILEGED_FUNCTION;/* ... */#endif/* *INDENT-OFF* */#ifdef__cplusplus}extern "C" { ... }#endif/* *INDENT-ON* *//* ... */#endif/* PORTABLE_H */
Details
Show: from
Types: Columns:
All items filtered out
All items filtered out
This file uses the notable symbols shown below. Click anywhere in the file to view more details.