portable.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. /*
  2. FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.
  3. FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
  4. http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
  5. ***************************************************************************
  6. * *
  7. * FreeRTOS tutorial books are available in pdf and paperback. *
  8. * Complete, revised, and edited pdf reference manuals are also *
  9. * available. *
  10. * *
  11. * Purchasing FreeRTOS documentation will not only help you, by *
  12. * ensuring you get running as quickly as possible and with an *
  13. * in-depth knowledge of how to use FreeRTOS, it will also help *
  14. * the FreeRTOS project to continue with its mission of providing *
  15. * professional grade, cross platform, de facto standard solutions *
  16. * for microcontrollers - completely free of charge! *
  17. * *
  18. * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
  19. * *
  20. * Thank you for using FreeRTOS, and thank you for your support! *
  21. * *
  22. ***************************************************************************
  23. This file is part of the FreeRTOS distribution.
  24. FreeRTOS is free software; you can redistribute it and/or modify it under
  25. the terms of the GNU General Public License (version 2) as published by the
  26. Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
  27. >>>NOTE<<< The modification to the GPL is included to allow you to
  28. distribute a combined work that includes FreeRTOS without being obliged to
  29. provide the source code for proprietary components outside of the FreeRTOS
  30. kernel. FreeRTOS is distributed in the hope that it will be useful, but
  31. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  32. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  33. more details. You should have received a copy of the GNU General Public
  34. License and the FreeRTOS license exception along with FreeRTOS; if not it
  35. can be viewed here: http://www.freertos.org/a00114.html and also obtained
  36. by writing to Richard Barry, contact details for whom are available on the
  37. FreeRTOS WEB site.
  38. 1 tab == 4 spaces!
  39. ***************************************************************************
  40. * *
  41. * Having a problem? Start by reading the FAQ "My application does *
  42. * not run, what could be wrong?" *
  43. * *
  44. * http://www.FreeRTOS.org/FAQHelp.html *
  45. * *
  46. ***************************************************************************
  47. http://www.FreeRTOS.org - Documentation, training, latest versions, license
  48. and contact details.
  49. http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
  50. including FreeRTOS+Trace - an indispensable productivity tool.
  51. Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
  52. the code with commercial support, indemnification, and middleware, under
  53. the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
  54. provide a safety engineered and independently SIL3 certified version under
  55. the SafeRTOS brand: http://www.SafeRTOS.com.
  56. */
  57. /*-----------------------------------------------------------
  58. * Portable layer API. Each function must be defined for each port.
  59. *----------------------------------------------------------*/
  60. #ifndef PORTABLE_H
  61. #define PORTABLE_H
  62. #define GCC_ARMCM3
  63. /* Include the macro file relevant to the port being used. */
  64. #ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT
  65. #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"
  66. typedef void ( __interrupt __far *pxISR )();
  67. #endif
  68. #ifdef OPEN_WATCOM_FLASH_LITE_186_PORT
  69. #include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h"
  70. typedef void ( __interrupt __far *pxISR )();
  71. #endif
  72. #ifdef GCC_MEGA_AVR
  73. #include "../portable/GCC/ATMega323/portmacro.h"
  74. #endif
  75. #ifdef IAR_MEGA_AVR
  76. #include "../portable/IAR/ATMega323/portmacro.h"
  77. #endif
  78. #ifdef MPLAB_PIC24_PORT
  79. #include "..\..\Source\portable\MPLAB\PIC24_dsPIC\portmacro.h"
  80. #endif
  81. #ifdef MPLAB_DSPIC_PORT
  82. #include "..\..\Source\portable\MPLAB\PIC24_dsPIC\portmacro.h"
  83. #endif
  84. #ifdef MPLAB_PIC18F_PORT
  85. #include "..\..\Source\portable\MPLAB\PIC18F\portmacro.h"
  86. #endif
  87. #ifdef MPLAB_PIC32MX_PORT
  88. #include "..\..\Source\portable\MPLAB\PIC32MX\portmacro.h"
  89. #endif
  90. #ifdef _FEDPICC
  91. #include "libFreeRTOS/Include/portmacro.h"
  92. #endif
  93. #ifdef SDCC_CYGNAL
  94. #include "../../Source/portable/SDCC/Cygnal/portmacro.h"
  95. #endif
  96. #ifdef GCC_ARM7
  97. #include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h"
  98. #endif
  99. #ifdef GCC_ARM7_ECLIPSE
  100. #include "portmacro.h"
  101. #endif
  102. #ifdef ROWLEY_LPC23xx
  103. #include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h"
  104. #endif
  105. #ifdef IAR_MSP430
  106. #include "..\..\Source\portable\IAR\MSP430\portmacro.h"
  107. #endif
  108. #ifdef GCC_MSP430
  109. #include "../../Source/portable/GCC/MSP430F449/portmacro.h"
  110. #endif
  111. #ifdef ROWLEY_MSP430
  112. #include "../../Source/portable/Rowley/MSP430F449/portmacro.h"
  113. #endif
  114. #ifdef ARM7_LPC21xx_KEIL_RVDS
  115. #include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h"
  116. #endif
  117. #ifdef SAM7_GCC
  118. #include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h"
  119. #endif
  120. #ifdef SAM7_IAR
  121. #include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h"
  122. #endif
  123. #ifdef SAM9XE_IAR
  124. #include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h"
  125. #endif
  126. #ifdef LPC2000_IAR
  127. #include "..\..\Source\portable\IAR\LPC2000\portmacro.h"
  128. #endif
  129. #ifdef STR71X_IAR
  130. #include "..\..\Source\portable\IAR\STR71x\portmacro.h"
  131. #endif
  132. #ifdef STR75X_IAR
  133. #include "..\..\Source\portable\IAR\STR75x\portmacro.h"
  134. #endif
  135. #ifdef STR75X_GCC
  136. #include "..\..\Source\portable\GCC\STR75x\portmacro.h"
  137. #endif
  138. #ifdef STR91X_IAR
  139. #include "..\..\Source\portable\IAR\STR91x\portmacro.h"
  140. #endif
  141. #ifdef GCC_H8S
  142. #include "../../Source/portable/GCC/H8S2329/portmacro.h"
  143. #endif
  144. #ifdef GCC_AT91FR40008
  145. #include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h"
  146. #endif
  147. #ifdef RVDS_ARMCM3_LM3S102
  148. #include "../../Source/portable/RVDS/ARM_CM3/portmacro.h"
  149. #endif
  150. #ifdef GCC_ARMCM3_LM3S102
  151. #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
  152. #endif
  153. #ifdef GCC_ARMCM3
  154. // #include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
  155. #include "portmacro.h"
  156. #endif
  157. #ifdef IAR_ARM_CM3
  158. #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
  159. #endif
  160. #ifdef IAR_ARMCM3_LM
  161. #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
  162. #endif
  163. #ifdef HCS12_CODE_WARRIOR
  164. #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"
  165. #endif
  166. #ifdef MICROBLAZE_GCC
  167. #include "../../Source/portable/GCC/MicroBlaze/portmacro.h"
  168. #endif
  169. #ifdef TERN_EE
  170. #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"
  171. #endif
  172. #ifdef GCC_HCS12
  173. #include "../../Source/portable/GCC/HCS12/portmacro.h"
  174. #endif
  175. #ifdef GCC_MCF5235
  176. #include "../../Source/portable/GCC/MCF5235/portmacro.h"
  177. #endif
  178. #ifdef COLDFIRE_V2_GCC
  179. #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"
  180. #endif
  181. #ifdef COLDFIRE_V2_CODEWARRIOR
  182. #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"
  183. #endif
  184. #ifdef GCC_PPC405
  185. #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"
  186. #endif
  187. #ifdef GCC_PPC440
  188. #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"
  189. #endif
  190. #ifdef _16FX_SOFTUNE
  191. #include "..\..\Source\portable\Softune\MB96340\portmacro.h"
  192. #endif
  193. #ifdef BCC_INDUSTRIAL_PC_PORT
  194. /* A short file name has to be used in place of the normal
  195. FreeRTOSConfig.h when using the Borland compiler. */
  196. #include "frconfig.h"
  197. #include "..\portable\BCC\16BitDOS\PC\prtmacro.h"
  198. typedef void ( __interrupt __far *pxISR )();
  199. #endif
  200. #ifdef BCC_FLASH_LITE_186_PORT
  201. /* A short file name has to be used in place of the normal
  202. FreeRTOSConfig.h when using the Borland compiler. */
  203. #include "frconfig.h"
  204. #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"
  205. typedef void ( __interrupt __far *pxISR )();
  206. #endif
  207. #ifdef __GNUC__
  208. #ifdef __AVR32_AVR32A__
  209. #include "portmacro.h"
  210. #endif
  211. #endif
  212. #ifdef __ICCAVR32__
  213. #ifdef __CORE__
  214. #if __CORE__ == __AVR32A__
  215. #include "portmacro.h"
  216. #endif
  217. #endif
  218. #endif
  219. #ifdef __91467D
  220. #include "portmacro.h"
  221. #endif
  222. #ifdef __96340
  223. #include "portmacro.h"
  224. #endif
  225. #ifdef __IAR_V850ES_Fx3__
  226. #include "../../Source/portable/IAR/V850ES/portmacro.h"
  227. #endif
  228. #ifdef __IAR_V850ES_Jx3__
  229. #include "../../Source/portable/IAR/V850ES/portmacro.h"
  230. #endif
  231. #ifdef __IAR_V850ES_Jx3_L__
  232. #include "../../Source/portable/IAR/V850ES/portmacro.h"
  233. #endif
  234. #ifdef __IAR_V850ES_Jx2__
  235. #include "../../Source/portable/IAR/V850ES/portmacro.h"
  236. #endif
  237. #ifdef __IAR_V850ES_Hx2__
  238. #include "../../Source/portable/IAR/V850ES/portmacro.h"
  239. #endif
  240. #ifdef __IAR_78K0R_Kx3__
  241. #include "../../Source/portable/IAR/78K0R/portmacro.h"
  242. #endif
  243. #ifdef __IAR_78K0R_Kx3L__
  244. #include "../../Source/portable/IAR/78K0R/portmacro.h"
  245. #endif
  246. /* Catch all to ensure portmacro.h is included in the build. Newer demos
  247. have the path as part of the project options, rather than as relative from
  248. the project location. If portENTER_CRITICAL() has not been defined then
  249. portmacro.h has not yet been included - as every portmacro.h provides a
  250. portENTER_CRITICAL() definition. Check the demo application for your demo
  251. to find the path to the correct portmacro.h file. */
  252. #ifndef portENTER_CRITICAL
  253. #include "portmacro.h"
  254. #endif
  255. #if portBYTE_ALIGNMENT == 8
  256. #define portBYTE_ALIGNMENT_MASK ( 0x0007 )
  257. #endif
  258. #if portBYTE_ALIGNMENT == 4
  259. #define portBYTE_ALIGNMENT_MASK ( 0x0003 )
  260. #endif
  261. #if portBYTE_ALIGNMENT == 2
  262. #define portBYTE_ALIGNMENT_MASK ( 0x0001 )
  263. #endif
  264. #if portBYTE_ALIGNMENT == 1
  265. #define portBYTE_ALIGNMENT_MASK ( 0x0000 )
  266. #endif
  267. #ifndef portBYTE_ALIGNMENT_MASK
  268. #error "Invalid portBYTE_ALIGNMENT definition"
  269. #endif
  270. #ifndef portNUM_CONFIGURABLE_REGIONS
  271. #define portNUM_CONFIGURABLE_REGIONS 1
  272. #endif
  273. #ifdef __cplusplus
  274. extern "C" {
  275. #endif
  276. #include "mpu_wrappers.h"
  277. /*
  278. * Setup the stack of a new task so it is ready to be placed under the
  279. * scheduler control. The registers have to be placed on the stack in
  280. * the order that the port expects to find them.
  281. *
  282. */
  283. #if( portUSING_MPU_WRAPPERS == 1 )
  284. portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, portBASE_TYPE xRunPrivileged ) PRIVILEGED_FUNCTION;
  285. #else
  286. portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters );
  287. #endif
  288. /*
  289. * Map to the memory management routines required for the port.
  290. */
  291. void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
  292. void vPortFree( void *pv ) PRIVILEGED_FUNCTION;
  293. void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
  294. size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
  295. /*
  296. * Setup the hardware ready for the scheduler to take control. This generally
  297. * sets up a tick interrupt and sets timers for the correct tick frequency.
  298. */
  299. portBASE_TYPE xPortStartScheduler( void ) PRIVILEGED_FUNCTION;
  300. /*
  301. * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
  302. * the hardware is left in its original condition after the scheduler stops
  303. * executing.
  304. */
  305. void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
  306. /*
  307. * The structures and methods of manipulating the MPU are contained within the
  308. * port layer.
  309. *
  310. * Fills the xMPUSettings structure with the memory region information
  311. * contained in xRegions.
  312. */
  313. #if( portUSING_MPU_WRAPPERS == 1 )
  314. struct xMEMORY_REGION;
  315. void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, portSTACK_TYPE *pxBottomOfStack, unsigned short usStackDepth ) PRIVILEGED_FUNCTION;
  316. #endif
  317. #ifdef __cplusplus
  318. }
  319. #endif
  320. #endif /* PORTABLE_H */