| ISF 2.1 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
MQX1.c
Go to the documentation of this file.
1 /** ###################################################################
2 ** THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
3 ** Filename : MQX1.c
4 ** Project : ISF_K64F_CW_PROJ
5 ** Processor : MK64FN1M0VLL12
6 ** Version : Component 01.110, Driver 01.00, CPU db: 3.00.000
7 ** Compiler : GNU C Compiler
8 ** Date/Time : 2015-03-03, 11:16, # CodeGen: 3
9 ** Abstract :
10 ** MQX Lite RTOS Adapter component.
11 ** Settings :
12 **
13 ** Copyright : 1997 - 2014 Freescale Semiconductor, Inc.
14 ** All Rights Reserved.
15 **
16 ** Redistribution and use in source and binary forms, with or without modification,
17 ** are permitted provided that the following conditions are met:
18 **
19 ** o Redistributions of source code must retain the above copyright notice, this list
20 ** of conditions and the following disclaimer.
21 **
22 ** o Redistributions in binary form must reproduce the above copyright notice, this
23 ** list of conditions and the following disclaimer in the documentation and/or
24 ** other materials provided with the distribution.
25 **
26 ** o Neither the name of Freescale Semiconductor, Inc. nor the names of its
27 ** contributors may be used to endorse or promote products derived from this
28 ** software without specific prior written permission.
29 **
30 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
31 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33 ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
34 ** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35 ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
37 ** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 **
41 ** http: www.freescale.com
42 ** mail: support@freescale.com
43 ** ###################################################################*/
44 /*!
45 ** @file MQX1.c
46 ** @version 01.00
47 ** @brief
48 ** MQX Lite RTOS Adapter component.
49 */
50 /*!
51 ** @addtogroup MQX1_module MQX1 module documentation
52 ** @{
53 */
54
55 /* MODULE MQX1. */
56
57 #include "MQX1.h"
58 #include "mqx_tasks.h"
59
60
61
62 /* Task stacks definition */
63 uint8_t Task1_task_stack[TASK1_TASK_STACK_SIZE];
64 uint8_t CI_task_stack[CI_TASK_STACK_SIZE];
65 uint8_t PM_task_stack[PM_TASK_STACK_SIZE];
66 uint8_t TaskBusManager_task_stack[TASKBUSMANAGER_TASK_STACK_SIZE];
67 uint8_t Fusion_Task_task_stack[FUSION_TASK_TASK_STACK_SIZE];
68 uint8_t MagCal_Task_task_stack[MAGCAL_TASK_TASK_STACK_SIZE];
69 uint8_t TaskRLI1_task_stack[TASKRLI1_TASK_STACK_SIZE];
70 uint8_t TaskApp1_task_stack[TASKAPP1_TASK_STACK_SIZE];
71
72 /* Task stacks array of pointers */
73 const uint8_t * mqx_task_stack_pointers[] = {
74 /* "Task1" task */ Task1_task_stack,
75 /* "CI" task */ CI_task_stack,
76 /* "PM" task */ PM_task_stack,
77 /* "TaskBusManager" task */ TaskBusManager_task_stack,
78 /* "Fusion_Task" task */ Fusion_Task_task_stack,
79 /* "MagCal_Task" task */ MagCal_Task_task_stack,
80 /* "TaskRLI1" task */ TaskRLI1_task_stack,
81 /* "TaskApp1" task */ TaskApp1_task_stack,
82 /* Stack array end */ NULL
83 };
84
85 /* Kernel Data Structure */
86 volatile KERNEL_DATA_STRUCT _mqx_kernel_data_struct;
87 #define __KERNEL_DATA_START (pointer)(&_mqx_kernel_data_struct)
88 #define __KERNEL_DATA_END (pointer)((uchar_ptr)&_mqx_kernel_data_struct + sizeof(_mqx_kernel_data_struct))
89
90 /* Task ready queue */
91 READY_Q_STRUCT mqx_static_ready_queue[MQX_READY_QUEUE_ITEMS];
92
93 /* Table of 'C' handlers for interrupts. */
94 INTERRUPT_TABLE_STRUCT mqx_static_isr_table[MQX_INTERRUPT_TABLE_ITEMS];
95
96
97 /* Interrupt stack */
98 uint8_t mqx_interrupt_stack[MQX_INTERRUPT_STACK_SIZE + PSP_STACK_ALIGNMENT + 1];
99 /* Idle task stack */
100 uint8_t mqx_idle_task_stack[sizeof(TD_STRUCT) + PSP_IDLE_STACK_SIZE + PSP_STACK_ALIGNMENT + 1];
101
102 /* MQX Lite initialization structure */
103 const MQXLITE_INITIALIZATION_STRUCT MQX_init_struct =
104 {
105 /* PROCESSOR NUMBER */ 1,
106 /* START OF KERNEL MEMORY */ __KERNEL_DATA_START,
107 /* END OF KERNEL MEMORY */ __KERNEL_DATA_END,
108 /* MQX_HARDWARE_INTERRUPT_LEVEL_MAX */ 2,
109 /* INTERRUPT STACK SIZE */ sizeof(mqx_interrupt_stack),
110 /* INTERRUPT STACK LOCATION */ mqx_interrupt_stack,
111 /* IDLE_TASK STACK SIZE */ sizeof(mqx_idle_task_stack),
112 /* IDLE_TASK STACK_LOCATION */ mqx_idle_task_stack,
113 /* TASK TEMPLATE LIST */ (TASK_TEMPLATE_STRUCT_PTR)&MQX_template_list[0]
114 };
115
116 /*
117 ** ===================================================================
118 ** Method : MQX1_OnCounterRestart (component MQXLite)
119 **
120 ** Description :
121 ** This method is internal. It is used by Processor Expert only.
122 ** ===================================================================
123 */
124 void SystemTimer1_OnCounterRestart(LDD_TUserData *UserDataPtr)
125 {
126 _time_notify_kernel();
127 }
128
129
130 /* Function returns number of ticks per second for system timer */
131 uint32_t SystemTimer1_GetTicsPerSecond(LDD_TDeviceData *DeviceDataPtr)
132 {
133 uint32_t period_ticks;
134
135 SystemTimer1_GetPeriodTicks(DeviceDataPtr, &period_ticks);
136 return SystemTimer1_GetInputFrequency(DeviceDataPtr) / period_ticks;
137 }
138
139
140 static LDD_TDeviceDataPtr SystemTimerDeviceDataPtr;
141
142 uint32_t system_timer_init(const void * timer_data_ptr)
143 {
144 uint32_t hw_ticks_per_tick;
145 KERNEL_DATA_STRUCT_PTR kernel_data = _mqx_kernel_data;
146
147 /* Parameter is not used, suppress unused argument warning */
148 (void)timer_data_ptr;
149
150 SystemTimerDeviceDataPtr = SystemTimer1_Init(NULL);
151
152 /* Set number of system ticks per second */
153 kernel_data->TICKS_PER_SECOND = SystemTimer1_GetTicsPerSecond(SystemTimerDeviceDataPtr);
154
155 _time_set_hwtick_function((MQX_GET_HWTICKS_FPTR)&SystemTimer1_GetCounterValue, (pointer)SystemTimerDeviceDataPtr);
156
157 /* Set number of hardware ticks per system tick */
158 SystemTimer1_GetPeriodTicks(SystemTimerDeviceDataPtr, &hw_ticks_per_tick);
159 _time_set_hwticks_per_tick(hw_ticks_per_tick);
160
161 return MQX_OK;
162 }
163
164 uint32_t system_timer_start(const void * timer_data_ptr)
165 {
166 /* Parameter is not used, suppress unused argument warning */
167 (void)timer_data_ptr;
168
169 SystemTimer1_Enable(SystemTimerDeviceDataPtr);
170
171 return MQX_OK;
172 }
173
174 /* Heap settings */
175
176 void mqx_initialize_heap(void)
177 {
178 /** Definiton of heap for GCC ARM compiler
179 * Extern symbols defined in linker command file
180 */
181 extern char __heap_addr[];
182 extern char __heap_size[];
183
184 LWMEM_POOL_STRUCT * pool_ptr;
185 void * start_addr;
186
187 pool_ptr = (LWMEM_POOL_STRUCT *) __heap_addr;
188
189 /* Set default lwmem pool */
190 (void)_lwmem_set_default_pool(pool_ptr);
191
192 start_addr = (void *)((char *) __heap_addr + sizeof(LWMEM_POOL_STRUCT));
193
194 _lwmem_create_pool(pool_ptr, start_addr, (_mem_size)__heap_size);
195 }
196
197 /*
198 ** ===================================================================
199 ** Method : MQX1_PEX_RTOS_InstallInterrupt (component MQXLite)
200 **
201 ** Description :
202 ** Installs the interrupt service routine through the RTOS.
203 ** This method is internal. It is used by Processor Expert only.
204 ** ===================================================================
205 */
206 void PEX_RTOS_InstallInterrupt(IRQInterruptIndex IntVector, void (*IsrFunction)(void *), void *IsrParam)
207 {
208 if (IntVector >= 15) {
209 /* Interrupts are install through the MQX standard ISR installation mechanism */
210 (void)_int_install_isr(IntVector, (INT_ISR_FPTR)IsrFunction, IsrParam);
211 } else {
212 /* Interrupts are install through the MQX kernel ISR installation mechanism */
213 (void)_int_install_kernel_isr(IntVector, (INT_KERNEL_ISR_FPTR)IsrFunction);
214 }
215 }
216
217
218 /*
219 ** ===================================================================
220 ** Method : MQX1_SetOperationMode (component MQXLite)
221 **
222 ** Description :
223 ** This method is internal. It is used by Processor Expert only.
224 ** ===================================================================
225 */
226 void MQX1_SetOperationMode(LDD_TDriverOperationMode OperationMode)
227 {
228
229 }
230
231 /* END MQX1. */
232
233 /*!
234 ** @}
235 */
236 /*
237 ** ###################################################################
238 **
239 ** This file was created by Processor Expert 10.3 [05.09]
240 ** for the Freescale Kinetis series of microcontrollers.
241 **
242 ** ###################################################################
243 */
TaskRLI1_task_stack
uint8_t TaskRLI1_task_stack[TASKRLI1_TASK_STACK_SIZE]
Definition: MQX1.c:69
TaskApp1_task_stack
uint8_t TaskApp1_task_stack[TASKAPP1_TASK_STACK_SIZE]
Definition: MQX1.c:70
mqx_static_ready_queue
READY_Q_STRUCT mqx_static_ready_queue[MQX_READY_QUEUE_ITEMS]
Definition: MQX1.c:91
mqx_static_isr_table
INTERRUPT_TABLE_STRUCT mqx_static_isr_table[MQX_INTERRUPT_TABLE_ITEMS]
Definition: MQX1.c:94
MagCal_Task_task_stack
uint8_t MagCal_Task_task_stack[MAGCAL_TASK_TASK_STACK_SIZE]
Definition: MQX1.c:68
MQX_INTERRUPT_TABLE_ITEMS
#define MQX_INTERRUPT_TABLE_ITEMS
Definition: MQX1.h:131
CI_task_stack
uint8_t CI_task_stack[CI_TASK_STACK_SIZE]
Definition: MQX1.c:64
MQX_init_struct
const MQXLITE_INITIALIZATION_STRUCT MQX_init_struct
This data structure/variable holds the complete state of the rli magnetometer sensor embedded applica...
Definition: MQX1.c:103
system_timer_init
uint32_t system_timer_init(const void *timer_data_ptr)
Definition: MQX1.c:142
SystemTimer1_OnCounterRestart
void SystemTimer1_OnCounterRestart(LDD_TUserData *UserDataPtr)
Definition: MQX1.c:124
mqx_idle_task_stack
uint8_t mqx_idle_task_stack[sizeof(TD_STRUCT)+PSP_IDLE_STACK_SIZE+PSP_STACK_ALIGNMENT+1]
Definition: MQX1.c:100
Fusion_Task_task_stack
uint8_t Fusion_Task_task_stack[FUSION_TASK_TASK_STACK_SIZE]
Definition: MQX1.c:67
MQX_READY_QUEUE_ITEMS
#define MQX_READY_QUEUE_ITEMS
Definition: MQX1.h:138
__KERNEL_DATA_START
#define __KERNEL_DATA_START
Definition: MQX1.c:87
TaskBusManager_task_stack
uint8_t TaskBusManager_task_stack[TASKBUSMANAGER_TASK_STACK_SIZE]
Definition: MQX1.c:66
mqx_interrupt_stack
uint8_t mqx_interrupt_stack[MQX_INTERRUPT_STACK_SIZE+PSP_STACK_ALIGNMENT+1]
Definition: MQX1.c:98
PM_task_stack
uint8_t PM_task_stack[PM_TASK_STACK_SIZE]
Definition: MQX1.c:65
Task1_task_stack
uint8_t Task1_task_stack[TASK1_TASK_STACK_SIZE]
Definition: MQX1.c:63
PEX_RTOS_InstallInterrupt
void PEX_RTOS_InstallInterrupt(IRQInterruptIndex IntVector, void(*IsrFunction)(void *), void *IsrParam)
Definition: MQX1.c:206
__KERNEL_DATA_END
#define __KERNEL_DATA_END
Definition: MQX1.c:88
mqx_task_stack_pointers
const uint8_t * mqx_task_stack_pointers[]
Definition: MQX1.c:73
mqx_initialize_heap
void mqx_initialize_heap(void)
Definition: MQX1.c:176
MQX1_SetOperationMode
void MQX1_SetOperationMode(LDD_TDriverOperationMode OperationMode)
Definition: MQX1.c:226
_mqx_kernel_data_struct
volatile KERNEL_DATA_STRUCT _mqx_kernel_data_struct
Definition: MQX1.c:86
SystemTimer1_GetTicsPerSecond
uint32_t SystemTimer1_GetTicsPerSecond(LDD_TDeviceData *DeviceDataPtr)
Definition: MQX1.c:131
MQX1.h
MQX Lite RTOS Adapter component.
system_timer_start
uint32_t system_timer_start(const void *timer_data_ptr)
Definition: MQX1.c:164
MQX_template_list
const TASK_TEMPLATE_STRUCT MQX_template_list[]
- © Freescale Semiconductor, Inc. 2015. All Rights Reserved.