/* * FreeRTOS Kernel V10.3.1 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * 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. * * http://www.FreeRTOS.org * http://aws.amazon.com/freertos * * 1 tab == 4 spaces! *//* ... */#ifndefPORTMACRO_H#definePORTMACRO_H#ifdef__cplusplusextern"C"{#endif/*----------------------------------------------------------- * Port specific definitions. * * The settings in this file configure FreeRTOS correctly for the * given hardware and compiler. * * These settings should not be altered. *----------------------------------------------------------- *//* ... *//* Type definitions. */#defineportCHARchar#defineportFLOATfloat#defineportDOUBLEdouble#defineportLONGlong#defineportSHORTshort#defineportSTACK_TYPEuint32_t#defineportBASE_TYPElong7 definestypedefportSTACK_TYPEStackType_t;typedeflongBaseType_t;typedefunsignedlongUBaseType_t;#if(configUSE_16_BIT_TICKS==1)typedefuint16_tTickType_t;#defineportMAX_DELAY(TickType_t)0xffff/* ... */#elsetypedefuint32_tTickType_t;#defineportMAX_DELAY(TickType_t)0xffffffffUL/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do not need to be guarded with a critical section. *//* ... */#defineportTICK_TYPE_IS_ATOMIC1/* ... */#endif/*-----------------------------------------------------------*//* MPU specific constants. */#defineportUSING_MPU_WRAPPERS1#defineportPRIVILEGE_BIT(0x80000000UL)#defineportMPU_REGION_READ_WRITE(0x03UL<<24UL)#defineportMPU_REGION_PRIVILEGED_READ_ONLY(0x05UL<<24UL)#defineportMPU_REGION_READ_ONLY(0x06UL<<24UL)#defineportMPU_REGION_PRIVILEGED_READ_WRITE(0x01UL<<24UL)#defineportMPU_REGION_PRIVILEGED_READ_WRITE_UNPRIV_READ_ONLY(0x02UL<<24UL)#defineportMPU_REGION_CACHEABLE_BUFFERABLE(0x03UL<<16UL)#defineportMPU_REGION_EXECUTE_NEVER(0x01UL<<28UL)#defineportUNPRIVILEGED_FLASH_REGION(0UL)#defineportPRIVILEGED_FLASH_REGION(1UL)#defineportPRIVILEGED_RAM_REGION(2UL)#defineportGENERAL_PERIPHERALS_REGION(3UL)#defineportSTACK_REGION(4UL)#defineportFIRST_CONFIGURABLE_REGION(5UL)#defineportLAST_CONFIGURABLE_REGION(7UL)#defineportNUM_CONFIGURABLE_REGIONS((portLAST_CONFIGURABLE_REGION-portFIRST_CONFIGURABLE_REGION)+1)#defineportTOTAL_NUM_REGIONS(portNUM_CONFIGURABLE_REGIONS+1)/* Plus one to make space for the stack region. */#defineportSWITCH_TO_USER_MODE()__asmvolatile(" mrs r0, control \n orr r0, #1 \n msr control, r0 ":::"r0","memory")19 definestypedefstructMPU_REGION_REGISTERS{uint32_tulRegionBaseAddress;uint32_tulRegionAttribute;...}xMPU_REGION_REGISTERS;/* Plus 1 to create space for the stack region. */typedefstructMPU_SETTINGS{xMPU_REGION_REGISTERSxRegion[portTOTAL_NUM_REGIONS];...}xMPU_SETTINGS;/* Architecture specifics. */#defineportSTACK_GROWTH(-1)#defineportTICK_PERIOD_MS((TickType_t)1000/configTICK_RATE_HZ)#defineportBYTE_ALIGNMENT8/*-----------------------------------------------------------*//* SVC numbers for various services. */#defineportSVC_START_SCHEDULER0#defineportSVC_YIELD1#defineportSVC_RAISE_PRIVILEGE2/* Scheduler utilities. */#defineportYIELD()__asmvolatile(" SVC %0 \n"::"i"(portSVC_YIELD):"memory")#defineportYIELD_WITHIN_API()\{\/* Set a PendSV to request a context switch. */\portNVIC_INT_CTRL_REG=portNVIC_PENDSVSET_BIT;\\/* Barriers are normally not required but do ensure the code is completely \ within the specified behaviour for the architecture. *//* ... */\__asmvolatile("dsb":::"memory");\__asmvolatile("isb");\...}...#defineportNVIC_INT_CTRL_REG(*((volatileuint32_t*)0xe000ed04))#defineportNVIC_PENDSVSET_BIT(1UL<<28UL)#defineportEND_SWITCHING_ISR(xSwitchRequired)if(xSwitchRequired)portNVIC_INT_CTRL_REG=portNVIC_PENDSVSET_BIT#defineportYIELD_FROM_ISR(x)portEND_SWITCHING_ISR(x)12 defines/*-----------------------------------------------------------*//* Critical section management. */externvoidvPortEnterCritical(void);externvoidvPortExitCritical(void);#defineportSET_INTERRUPT_MASK_FROM_ISR()ulPortRaiseBASEPRI()#defineportCLEAR_INTERRUPT_MASK_FROM_ISR(x)vPortSetBASEPRI(x)#defineportDISABLE_INTERRUPTS()vPortRaiseBASEPRI()#defineportENABLE_INTERRUPTS()vPortSetBASEPRI(0)#defineportENTER_CRITICAL()vPortEnterCritical()#defineportEXIT_CRITICAL()vPortExitCritical()/*-----------------------------------------------------------*//* Task function macros as described on the FreeRTOS.org WEB site. These arenot necessary for to use this port. They are defined so the common demo files(which build with all the ports) will build. *//* ... */#defineportTASK_FUNCTION_PROTO(vFunction,pvParameters)voidvFunction(void*pvParameters)#defineportTASK_FUNCTION(vFunction,pvParameters)voidvFunction(void*pvParameters)8 defines/*-----------------------------------------------------------*//* Architecture specific optimisations. */#ifndefconfigUSE_PORT_OPTIMISED_TASK_SELECTION#defineconfigUSE_PORT_OPTIMISED_TASK_SELECTION1#endif#ifconfigUSE_PORT_OPTIMISED_TASK_SELECTION==1/* Generic helper function. */__attribute__((always_inline))staticinlineuint8_tucPortCountLeadingZeros(uint32_tulBitmap){uint8_tucReturn;__asmvolatile("clz %0, %1":"=r"(ucReturn):"r"(ulBitmap):"memory");returnucReturn;}{ ... }/* Check the configuration. */#if(configMAX_PRIORITIES>32)#errorconfigUSE_PORT_OPTIMISED_TASK_SELECTIONcanonlybesetto1whenconfigMAX_PRIORITIESislessthanorequalto32.Itisveryrarethatasystemrequiresmorethan10to15differenceprioritiesastasksthatshareaprioritywilltimeslice.#endif/* Store/clear the ready priorities in a bit map. */#defineportRECORD_READY_PRIORITY(uxPriority,uxReadyPriorities)(uxReadyPriorities)|=(1UL<<(uxPriority))#defineportRESET_READY_PRIORITY(uxPriority,uxReadyPriorities)(uxReadyPriorities)&=~(1UL<<(uxPriority))/*-----------------------------------------------------------*/#defineportGET_HIGHEST_PRIORITY(uxTopPriority,uxReadyPriorities)uxTopPriority=(31UL-(uint32_t)ucPortCountLeadingZeros((uxReadyPriorities)))/* ... */#endif/* configUSE_PORT_OPTIMISED_TASK_SELECTION *//*-----------------------------------------------------------*/#ifdefconfigASSERTvoidvPortValidateInterruptPriority(void);#defineportASSERT_IF_INTERRUPT_PRIORITY_INVALID()vPortValidateInterruptPriority()/* ... */#endif/* portNOP() is not required by this port. */#defineportNOP()#defineportINLINE__inline#ifndefportFORCE_INLINE#defineportFORCE_INLINEinline__attribute__((always_inline))#endif/*-----------------------------------------------------------*/externBaseType_txIsPrivileged(void);externvoidvResetPrivilege(void);/** * @brief Checks whether or not the processor is privileged. * * @return 1 if the processor is already privileged, 0 otherwise. *//* ... */#defineportIS_PRIVILEGED()xIsPrivileged()/** * @brief Raise an SVC request to raise privilege.*//* ... */#defineportRAISE_PRIVILEGE()__asmvolatile("svc %0 \n"::"i"(portSVC_RAISE_PRIVILEGE):"memory");/** * @brief Lowers the privilege level by setting the bit 0 of the CONTROL * register. *//* ... */#defineportRESET_PRIVILEGE()vResetPrivilege()/*-----------------------------------------------------------*/portFORCE_INLINEstaticBaseType_txPortIsInsideInterrupt(void){uint32_tulCurrentInterrupt;BaseType_txReturn;/* Obtain the number of the currently executing interrupt. */__asmvolatile("mrs %0, ipsr":"=r"(ulCurrentInterrupt)::"memory");if(ulCurrentInterrupt==0){xReturn=pdFALSE;}if (ulCurrentInterrupt == 0) { ... }else{xReturn=pdTRUE;}else { ... }returnxReturn;}{ ... }/*-----------------------------------------------------------*/portFORCE_INLINEstaticvoidvPortRaiseBASEPRI(void){uint32_tulNewBASEPRI;__asmvolatile(" mov %0, %1 \n"\" msr basepri, %0 \n"\" isb \n"\" dsb \n"\:"=r"(ulNewBASEPRI):"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY):"memory");}{ ... }/*-----------------------------------------------------------*/portFORCE_INLINEstaticuint32_tulPortRaiseBASEPRI(void){uint32_tulOriginalBASEPRI,ulNewBASEPRI;__asmvolatile(" mrs %0, basepri \n"\" mov %1, %2 \n"\" msr basepri, %1 \n"\" isb \n"\" dsb \n"\:"=r"(ulOriginalBASEPRI),"=r"(ulNewBASEPRI):"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY):"memory");/* This return will not be reached but is necessary to prevent compiler warnings. *//* ... */returnulOriginalBASEPRI;}{ ... }/*-----------------------------------------------------------*/portFORCE_INLINEstaticvoidvPortSetBASEPRI(uint32_tulNewMaskValue){__asmvolatile(" msr basepri, %0 "::"r"(ulNewMaskValue):"memory");}{ ... }/*-----------------------------------------------------------*/#defineportMEMORY_BARRIER()__asmvolatile("":::"memory")#ifndefconfigENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY#warning"configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY is not defined. We recommend defining it to 1 in FreeRTOSConfig.h for better security. https://www.freertos.org/FreeRTOS-V10.3.x.html"#defineconfigENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY0/* ... */#endif/*-----------------------------------------------------------*/#ifdef__cplusplus}extern "C" { ... }#endif/* ... */#endif/* PORTMACRO_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.