/* * 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/*-----------------------------------------------------------*//* Architecture specifics. */#defineportSTACK_GROWTH(-1)#defineportTICK_PERIOD_MS((TickType_t)1000/configTICK_RATE_HZ)#defineportBYTE_ALIGNMENT8/*-----------------------------------------------------------*//* Scheduler utilities. */#defineportYIELD()\{\/* 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!=pdFALSE)portYIELD()#defineportYIELD_FROM_ISR(x)portEND_SWITCHING_ISR(x)8 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/*-----------------------------------------------------------*//* Tickless idle/low power functionality. */#ifndefportSUPPRESS_TICKS_AND_SLEEPexternvoidvPortSuppressTicksAndSleep(TickType_txExpectedIdleTime);#defineportSUPPRESS_TICKS_AND_SLEEP(xExpectedIdleTime)vPortSuppressTicksAndSleep(xExpectedIdleTime)/* ... */#endif/*-----------------------------------------------------------*//* 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))#endifportFORCE_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")#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.