ZestCode
 
Loading...
Searching...
No Matches
portable.h
1/*
2 * FreeRTOS Kernel V10.0.1
3 * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 * this software and associated documentation files (the "Software"), to deal in
7 * the Software without restriction, including without limitation the rights to
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 * the Software, and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * http://www.FreeRTOS.org
23 * http://aws.amazon.com/freertos
24 *
25 * 1 tab == 4 spaces!
26 */
27
28/*-----------------------------------------------------------
29 * Portable layer API. Each function must be defined for each port.
30 *----------------------------------------------------------*/
31
32#ifndef PORTABLE_H
33#define PORTABLE_H
34
35/* If portENTER_CRITICAL is not defined then including deprecated_definitions.h
36did not result in a portmacro.h header file being included - and it should be
37included here. In this case the path to the correct portmacro.h header file
38must be set in the compiler's include path. */
39#ifndef portENTER_CRITICAL
40 #include "portmacro.h"
41#endif
42
43#if portBYTE_ALIGNMENT == 32
44 #define portBYTE_ALIGNMENT_MASK ( 0x001f )
45#endif
46
47#if portBYTE_ALIGNMENT == 16
48 #define portBYTE_ALIGNMENT_MASK ( 0x000f )
49#endif
50
51#if portBYTE_ALIGNMENT == 8
52 #define portBYTE_ALIGNMENT_MASK ( 0x0007 )
53#endif
54
55#if portBYTE_ALIGNMENT == 4
56 #define portBYTE_ALIGNMENT_MASK ( 0x0003 )
57#endif
58
59#if portBYTE_ALIGNMENT == 2
60 #define portBYTE_ALIGNMENT_MASK ( 0x0001 )
61#endif
62
63#if portBYTE_ALIGNMENT == 1
64 #define portBYTE_ALIGNMENT_MASK ( 0x0000 )
65#endif
66
67#ifndef portBYTE_ALIGNMENT_MASK
68 #error "Invalid portBYTE_ALIGNMENT definition"
69#endif
70
71#ifndef portNUM_CONFIGURABLE_REGIONS
72 #define portNUM_CONFIGURABLE_REGIONS 1
73#endif
74
75#ifdef __cplusplus
76extern "C" {
77#endif
78
79/*
80 * Setup the stack of a new task so it is ready to be placed under the
81 * scheduler control. The registers have to be placed on the stack in
82 * the order that the port expects to find them.
83 *
84 */
85task_stack_t *pxPortInitialiseStack( task_stack_t *pxTopOfStack, task_fn_t pxCode, void *pvParameters ) ;
86
87/* Used by heap_5.c. */
88typedef struct HeapRegion
89{
90 uint8_t *pucStartAddress;
91 size_t xSizeInBytes;
92} HeapRegion_t;
93
94/*
95 * Used to define multiple heap regions for use by heap_5.c. This function
96 * must be called before any calls to kmalloc() - not creating a task,
97 * queue, semaphore, mutex, software timer, event group, etc. will result in
98 * kmalloc being called.
99 *
100 * pxHeapRegions passes in an array of HeapRegion_t structures - each of which
101 * defines a region of memory that can be used as the heap. The array is
102 * terminated by a HeapRegions_t structure that has a size of 0. The region
103 * with the lowest start address must appear first in the array.
104 */
105void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) ;
106
107
108/*
109 * Map to the memory management routines required for the port.
110 */
111void *kmalloc( size_t xSize ) ;
112void kfree( void *pv ) ;
113void vPortInitialiseBlocks( void ) ;
114size_t xPortGetFreeHeapSize( void ) ;
115size_t xPortGetMinimumEverFreeHeapSize( void ) ;
116
117/*
118 * Setup the hardware ready for the scheduler to take control. This generally
119 * sets up a tick interrupt and sets timers for the correct tick frequency.
120 */
121int32_t xPortStartScheduler( void ) ;
122
123/*
124 * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
125 * the hardware is left in its original condition after the scheduler stops
126 * executing.
127 */
128void vPortEndScheduler( void ) ;
129
130#ifdef __cplusplus
131}
132#endif
133
134#endif /* PORTABLE_H */
void(* task_fn_t)(void *)
Definition rtos.h:108
Definition portable.h:89