portable.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  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. #endif
  156. #ifdef IAR_ARM_CM3
  157. #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
  158. #endif
  159. #ifdef IAR_ARMCM3_LM
  160. #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
  161. #endif
  162. #ifdef HCS12_CODE_WARRIOR
  163. #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"
  164. #endif
  165. #ifdef MICROBLAZE_GCC
  166. #include "../../Source/portable/GCC/MicroBlaze/portmacro.h"
  167. #endif
  168. #ifdef TERN_EE
  169. #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"
  170. #endif
  171. #ifdef GCC_HCS12
  172. #include "../../Source/portable/GCC/HCS12/portmacro.h"
  173. #endif
  174. #ifdef GCC_MCF5235
  175. #include "../../Source/portable/GCC/MCF5235/portmacro.h"
  176. #endif
  177. #ifdef COLDFIRE_V2_GCC
  178. #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"
  179. #endif
  180. #ifdef COLDFIRE_V2_CODEWARRIOR
  181. #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"
  182. #endif
  183. #ifdef GCC_PPC405
  184. #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"
  185. #endif
  186. #ifdef GCC_PPC440
  187. #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"
  188. #endif
  189. #ifdef _16FX_SOFTUNE
  190. #include "..\..\Source\portable\Softune\MB96340\portmacro.h"
  191. #endif
  192. #ifdef BCC_INDUSTRIAL_PC_PORT
  193. /* A short file name has to be used in place of the normal
  194. FreeRTOSConfig.h when using the Borland compiler. */
  195. #include "frconfig.h"
  196. #include "..\portable\BCC\16BitDOS\PC\prtmacro.h"
  197. typedef void ( __interrupt __far *pxISR )();
  198. #endif
  199. #ifdef BCC_FLASH_LITE_186_PORT
  200. /* A short file name has to be used in place of the normal
  201. FreeRTOSConfig.h when using the Borland compiler. */
  202. #include "frconfig.h"
  203. #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"
  204. typedef void ( __interrupt __far *pxISR )();
  205. #endif
  206. #ifdef __GNUC__
  207. #ifdef __AVR32_AVR32A__
  208. #include "portmacro.h"
  209. #endif
  210. #endif
  211. #ifdef __ICCAVR32__
  212. #ifdef __CORE__
  213. #if __CORE__ == __AVR32A__
  214. #include "portmacro.h"
  215. #endif
  216. #endif
  217. #endif
  218. #ifdef __91467D
  219. #include "portmacro.h"
  220. #endif
  221. #ifdef __96340
  222. #include "portmacro.h"
  223. #endif
  224. #ifdef __IAR_V850ES_Fx3__
  225. #include "../../Source/portable/IAR/V850ES/portmacro.h"
  226. #endif
  227. #ifdef __IAR_V850ES_Jx3__
  228. #include "../../Source/portable/IAR/V850ES/portmacro.h"
  229. #endif
  230. #ifdef __IAR_V850ES_Jx3_L__
  231. #include "../../Source/portable/IAR/V850ES/portmacro.h"
  232. #endif
  233. #ifdef __IAR_V850ES_Jx2__
  234. #include "../../Source/portable/IAR/V850ES/portmacro.h"
  235. #endif
  236. #ifdef __IAR_V850ES_Hx2__
  237. #include "../../Source/portable/IAR/V850ES/portmacro.h"
  238. #endif
  239. #ifdef __IAR_78K0R_Kx3__
  240. #include "../../Source/portable/IAR/78K0R/portmacro.h"
  241. #endif
  242. #ifdef __IAR_78K0R_Kx3L__
  243. #include "../../Source/portable/IAR/78K0R/portmacro.h"
  244. #endif
  245. /* Catch all to ensure portmacro.h is included in the build. Newer demos
  246. have the path as part of the project options, rather than as relative from
  247. the project location. If portENTER_CRITICAL() has not been defined then
  248. portmacro.h has not yet been included - as every portmacro.h provides a
  249. portENTER_CRITICAL() definition. Check the demo application for your demo
  250. to find the path to the correct portmacro.h file. */
  251. #ifndef portENTER_CRITICAL
  252. #include "portmacro.h"
  253. #endif
  254. #if portBYTE_ALIGNMENT == 8
  255. #define portBYTE_ALIGNMENT_MASK ( 0x0007 )
  256. #endif
  257. #if portBYTE_ALIGNMENT == 4
  258. #define portBYTE_ALIGNMENT_MASK ( 0x0003 )
  259. #endif
  260. #if portBYTE_ALIGNMENT == 2
  261. #define portBYTE_ALIGNMENT_MASK ( 0x0001 )
  262. #endif
  263. #if portBYTE_ALIGNMENT == 1
  264. #define portBYTE_ALIGNMENT_MASK ( 0x0000 )
  265. #endif
  266. #ifndef portBYTE_ALIGNMENT_MASK
  267. #error "Invalid portBYTE_ALIGNMENT definition"
  268. #endif
  269. #ifndef portNUM_CONFIGURABLE_REGIONS
  270. #define portNUM_CONFIGURABLE_REGIONS 1
  271. #endif
  272. #ifdef __cplusplus
  273. extern "C" {
  274. #endif
  275. #include "mpu_wrappers.h"
  276. /*
  277. * Setup the stack of a new task so it is ready to be placed under the
  278. * scheduler control. The registers have to be placed on the stack in
  279. * the order that the port expects to find them.
  280. *
  281. */
  282. #if( portUSING_MPU_WRAPPERS == 1 )
  283. portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, portBASE_TYPE xRunPrivileged ) PRIVILEGED_FUNCTION;
  284. #else
  285. portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters );
  286. #endif
  287. /*
  288. * Map to the memory management routines required for the port.
  289. */
  290. void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
  291. void vPortFree( void *pv ) PRIVILEGED_FUNCTION;
  292. void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
  293. size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
  294. /*
  295. * Setup the hardware ready for the scheduler to take control. This generally
  296. * sets up a tick interrupt and sets timers for the correct tick frequency.
  297. */
  298. portBASE_TYPE xPortStartScheduler( void ) PRIVILEGED_FUNCTION;
  299. /*
  300. * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
  301. * the hardware is left in its original condition after the scheduler stops
  302. * executing.
  303. */
  304. void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
  305. /*
  306. * The structures and methods of manipulating the MPU are contained within the
  307. * port layer.
  308. *
  309. * Fills the xMPUSettings structure with the memory region information
  310. * contained in xRegions.
  311. */
  312. #if( portUSING_MPU_WRAPPERS == 1 )
  313. struct xMEMORY_REGION;
  314. void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, portSTACK_TYPE *pxBottomOfStack, unsigned short usStackDepth ) PRIVILEGED_FUNCTION;
  315. #endif
  316. #ifdef __cplusplus
  317. }
  318. #endif
  319. #endif /* PORTABLE_H */