]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - os/7.4.2/include/os/portable.h
Merge branch 'tms570_emac' of git@rtime.felk.cvut.cz:pes-rpp/rpp-lib into personal...
[pes-rpp/rpp-lib.git] / os / 7.4.2 / include / os / portable.h
1 /*
2     FreeRTOS V7.4.2 - Copyright (C) 2013 Real Time Engineers Ltd.
3
4     FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT
5     http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
6
7     ***************************************************************************
8      *                                                                       *
9      *    FreeRTOS tutorial books are available in pdf and paperback.        *
10      *    Complete, revised, and edited pdf reference manuals are also       *
11      *    available.                                                         *
12      *                                                                       *
13      *    Purchasing FreeRTOS documentation will not only help you, by       *
14      *    ensuring you get running as quickly as possible and with an        *
15      *    in-depth knowledge of how to use FreeRTOS, it will also help       *
16      *    the FreeRTOS project to continue with its mission of providing     *
17      *    professional grade, cross platform, de facto standard solutions    *
18      *    for microcontrollers - completely free of charge!                  *
19      *                                                                       *
20      *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *
21      *                                                                       *
22      *    Thank you for using FreeRTOS, and thank you for your support!      *
23      *                                                                       *
24     ***************************************************************************
25
26
27     This file is part of the FreeRTOS distribution.
28
29     FreeRTOS is free software; you can redistribute it and/or modify it under
30     the terms of the GNU General Public License (version 2) as published by the
31     Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
32
33     >>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
34     distribute a combined work that includes FreeRTOS without being obliged to
35     provide the source code for proprietary components outside of the FreeRTOS
36     kernel.
37
38     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
39     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
40     FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
41     details. You should have received a copy of the GNU General Public License
42     and the FreeRTOS license exception along with FreeRTOS; if not it can be
43     viewed here: http://www.freertos.org/a00114.html and also obtained by
44     writing to Real Time Engineers Ltd., contact details for whom are available
45     on the FreeRTOS WEB site.
46
47     1 tab == 4 spaces!
48
49     ***************************************************************************
50      *                                                                       *
51      *    Having a problem?  Start by reading the FAQ "My application does   *
52      *    not run, what could be wrong?"                                     *
53      *                                                                       *
54      *    http://www.FreeRTOS.org/FAQHelp.html                               *
55      *                                                                       *
56     ***************************************************************************
57
58
59     http://www.FreeRTOS.org - Documentation, books, training, latest versions,
60     license and Real Time Engineers Ltd. contact details.
61
62     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
63     including FreeRTOS+Trace - an indispensable productivity tool, and our new
64     fully thread aware and reentrant UDP/IP stack.
65
66     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
67     Integrity Systems, who sell the code with commercial support,
68     indemnification and middleware, under the OpenRTOS brand.
69
70     http://www.SafeRTOS.com - High Integrity Systems also provide a safety
71     engineered and independently SIL3 certified version for use in safety and
72     mission critical applications that require provable dependability.
73 */
74
75 /*-----------------------------------------------------------
76  * Portable layer API.  Each function must be defined for each port.
77  *----------------------------------------------------------*/
78
79 #ifndef PORTABLE_H
80 #define PORTABLE_H
81
82 /* Include the macro file relevant to the port being used. */
83 #include "os/portmacro.h"
84
85 #if portBYTE_ALIGNMENT == 8
86     #define portBYTE_ALIGNMENT_MASK ( 0x0007 )
87 #endif
88
89 #if portBYTE_ALIGNMENT == 4
90     #define portBYTE_ALIGNMENT_MASK ( 0x0003 )
91 #endif
92
93 #if portBYTE_ALIGNMENT == 2
94     #define portBYTE_ALIGNMENT_MASK ( 0x0001 )
95 #endif
96
97 #if portBYTE_ALIGNMENT == 1
98     #define portBYTE_ALIGNMENT_MASK ( 0x0000 )
99 #endif
100
101 #ifndef portBYTE_ALIGNMENT_MASK
102     #error "Invalid portBYTE_ALIGNMENT definition"
103 #endif
104
105 #ifndef portNUM_CONFIGURABLE_REGIONS
106     #define portNUM_CONFIGURABLE_REGIONS 1
107 #endif
108
109 #ifdef __cplusplus
110 extern "C" {
111 #endif
112
113 #include "os/mpu_wrappers.h"
114
115 /*
116  * Setup the stack of a new task so it is ready to be placed under the
117  * scheduler control.  The registers have to be placed on the stack in
118  * the order that the port expects to find them.
119  *
120  */
121 #if( portUSING_MPU_WRAPPERS == 1 )
122     portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, portBASE_TYPE xRunPrivileged ) PRIVILEGED_FUNCTION;
123 #else
124     portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters );
125 #endif
126
127 /*
128  * Map to the memory management routines required for the port.
129  */
130 void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
131 void vPortFree( void *pv ) PRIVILEGED_FUNCTION;
132 void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
133 size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
134
135 /*
136  * Setup the hardware ready for the scheduler to take control.  This generally
137  * sets up a tick interrupt and sets timers for the correct tick frequency.
138  */
139 portBASE_TYPE xPortStartScheduler( void ) PRIVILEGED_FUNCTION;
140
141 /*
142  * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
143  * the hardware is left in its original condition after the scheduler stops
144  * executing.
145  */
146 void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
147
148 /*
149  * The structures and methods of manipulating the MPU are contained within the
150  * port layer.
151  *
152  * Fills the xMPUSettings structure with the memory region information
153  * contained in xRegions.
154  */
155 #if( portUSING_MPU_WRAPPERS == 1 )
156     struct xMEMORY_REGION;
157     void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, portSTACK_TYPE *pxBottomOfStack, unsigned short usStackDepth ) PRIVILEGED_FUNCTION;
158 #endif
159
160 #ifdef __cplusplus
161 }
162 #endif
163
164 #endif /* PORTABLE_H */
165