amiro-os / modules / STM32F4Discovery / module.h @ 83ca1b95
History | View | Annotate | Download (6.64 KB)
1 |
/*
|
---|---|
2 |
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
|
3 |
Copyright (C) 2016..2019 Thomas Schöpping et al.
|
4 |
|
5 |
This program is free software: you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License as published by
|
7 |
the Free Software Foundation, either version 3 of the License, or
|
8 |
(at your option) any later version.
|
9 |
|
10 |
This program is distributed in the hope that it will be useful,
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
GNU General Public License for more details.
|
14 |
|
15 |
You should have received a copy of the GNU General Public License
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
*/
|
18 |
|
19 |
/**
|
20 |
* @file
|
21 |
* @brief Structures and constant for the PowerManagement module.
|
22 |
*
|
23 |
* @addtogroup powermanagement_module
|
24 |
* @{
|
25 |
*/
|
26 |
|
27 |
#ifndef _AMIROOS_MODULE_H_
|
28 |
#define _AMIROOS_MODULE_H_
|
29 |
|
30 |
/*===========================================================================*/
|
31 |
/**
|
32 |
* @name Module specific functions
|
33 |
* @{
|
34 |
*/
|
35 |
/*===========================================================================*/
|
36 |
|
37 |
/*
|
38 |
* @brief Makro to store data in the core coupled memory (ccm).
|
39 |
* Example:
|
40 |
* int compute_buffer[128] CCM_RAM;
|
41 |
*
|
42 |
* @note The ccm is not connected to any bus system.
|
43 |
*/
|
44 |
#define CCM_RAM __attribute__((section(".ram4"), aligned(4))) |
45 |
|
46 |
/*
|
47 |
* @brief Makro to store data in the ethernet memory (eth).
|
48 |
* Example:
|
49 |
* int dma_buffer[128] ETH_RAM;
|
50 |
*
|
51 |
* @note The eth is a dedicated memory block with its own DMA controller.
|
52 |
*/
|
53 |
#define ETH_RAM __attribute__((section(".ram2"), aligned(4))) |
54 |
|
55 |
/*
|
56 |
* @brief Makro to store data in the backup memory (bckp).
|
57 |
* Example:
|
58 |
* int backup_buffer[128] BCKP_RAM;
|
59 |
*
|
60 |
* @note The eth is a dedicated memory block with its own DMA controller.
|
61 |
*/
|
62 |
#define BCKP_RAM __attribute__((section(".ram5"), aligned(4))) |
63 |
|
64 |
/** @} */
|
65 |
|
66 |
/*===========================================================================*/
|
67 |
/**
|
68 |
* @name ChibiOS/HAL configuration
|
69 |
* @{
|
70 |
*/
|
71 |
/*===========================================================================*/
|
72 |
#include <hal.h> |
73 |
|
74 |
/**
|
75 |
* @brief CAN driver to use.
|
76 |
*/
|
77 |
#define MODULE_HAL_CAN CAND1
|
78 |
|
79 |
/**
|
80 |
* @brief Configuration for the CAN driver.
|
81 |
*/
|
82 |
extern CANConfig moduleHalCanConfig;
|
83 |
|
84 |
/**
|
85 |
* @brief Serial driver of the programmer interface.
|
86 |
*/
|
87 |
#define MODULE_HAL_PROGIF SD2
|
88 |
|
89 |
/**
|
90 |
* @brief Configuration for the programmer serial interface driver.
|
91 |
*/
|
92 |
extern SerialConfig moduleHalProgIfConfig;
|
93 |
|
94 |
/**
|
95 |
* @brief Real-Time Clock driver.
|
96 |
*/
|
97 |
#define MODULE_HAL_RTC RTCD1
|
98 |
|
99 |
/** @} */
|
100 |
|
101 |
/*===========================================================================*/
|
102 |
/**
|
103 |
* @name GPIO definitions
|
104 |
* @{
|
105 |
*/
|
106 |
/*===========================================================================*/
|
107 |
#include <amiro-lld.h> |
108 |
|
109 |
/**
|
110 |
* @brief Red LED output signal.
|
111 |
*/
|
112 |
extern ROMCONST apalControlGpio_t moduleGpioLedRed;
|
113 |
|
114 |
/**
|
115 |
* @brief Green LED output signal.
|
116 |
*/
|
117 |
extern ROMCONST apalControlGpio_t moduleGpioLedGreen;
|
118 |
|
119 |
/**
|
120 |
* @brief Blue LED output signal.
|
121 |
*/
|
122 |
extern ROMCONST apalControlGpio_t moduleGpioLedBlue;
|
123 |
|
124 |
/**
|
125 |
* @brief Orange LED output signal.
|
126 |
*/
|
127 |
extern ROMCONST apalControlGpio_t moduleGpioLedOrange;
|
128 |
|
129 |
/**
|
130 |
* @brief User button input signal.
|
131 |
*/
|
132 |
extern ROMCONST apalControlGpio_t moduleGpioUserButton;
|
133 |
|
134 |
/** @} */
|
135 |
|
136 |
/*===========================================================================*/
|
137 |
/**
|
138 |
* @name AMiRo-OS core configurations
|
139 |
* @{
|
140 |
*/
|
141 |
/*===========================================================================*/
|
142 |
|
143 |
/**
|
144 |
* @brief Event flag to be set on a USER_BUTTON interrupt.
|
145 |
*/
|
146 |
#define MODULE_OS_IOEVENTFLAGS_USERBUTTON ((eventflags_t)1 << GPIOA_BUTTON) |
147 |
|
148 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
149 |
/**
|
150 |
* @brief Shell prompt text.
|
151 |
*/
|
152 |
extern ROMCONST char* moduleShellPrompt; |
153 |
#endif
|
154 |
|
155 |
/**
|
156 |
* @brief Interrupt initialization macro.
|
157 |
* @note SSSP related interrupt signals are already initialized in 'aos_system.c'.
|
158 |
*/
|
159 |
#define MODULE_INIT_INTERRUPTS() { \
|
160 |
/* user button */ \
|
161 |
palSetPadCallback(moduleGpioUserButton.gpio->port, moduleGpioUserButton.gpio->pad, _intCallback, &moduleGpioUserButton.gpio->pad); \ |
162 |
palEnablePadEvent(moduleGpioUserButton.gpio->port, moduleGpioUserButton.gpio->pad, APAL2CH_EDGE(moduleGpioUserButton.meta.edge)); \ |
163 |
} |
164 |
|
165 |
/**
|
166 |
* @brief Unit test initialization hook.
|
167 |
*/
|
168 |
#define MODULE_INIT_TESTS() { \
|
169 |
/* add unit-test shell commands */ \
|
170 |
} |
171 |
|
172 |
/**
|
173 |
* @brief Periphery communication interfaces initialization hook.
|
174 |
*/
|
175 |
#define MODULE_INIT_PERIPHERY_COMM() { \
|
176 |
/* serial driver */ \
|
177 |
sdStart(&MODULE_HAL_PROGIF, &moduleHalProgIfConfig); \ |
178 |
} |
179 |
|
180 |
/**
|
181 |
* @brief Periphery communication interface deinitialization hook.
|
182 |
*/
|
183 |
#define MODULE_SHUTDOWN_PERIPHERY_COMM() { \
|
184 |
} |
185 |
|
186 |
/**
|
187 |
* @brief HOOK to toggle the LEDs when the user button is pressed.
|
188 |
*/
|
189 |
#define MODULE_MAIN_LOOP_IO_EVENT(eventmask, eventflags) { \
|
190 |
if (eventflags & MODULE_OS_IOEVENTFLAGS_USERBUTTON) { \
|
191 |
apalGpioToggle(moduleGpioLedRed.gpio); \ |
192 |
apalGpioToggle(moduleGpioLedGreen.gpio); \ |
193 |
apalGpioToggle(moduleGpioLedBlue.gpio); \ |
194 |
apalGpioToggle(moduleGpioLedOrange.gpio); \ |
195 |
} \ |
196 |
} |
197 |
|
198 |
/** @} */
|
199 |
|
200 |
/*===========================================================================*/
|
201 |
/**
|
202 |
* @name Startup Shutdown Synchronization Protocol (SSSP)
|
203 |
* @{
|
204 |
*/
|
205 |
/*===========================================================================*/
|
206 |
|
207 |
/** @} */
|
208 |
|
209 |
/*===========================================================================*/
|
210 |
/**
|
211 |
* @name Low-level drivers
|
212 |
* @{
|
213 |
*/
|
214 |
/*===========================================================================*/
|
215 |
|
216 |
/** @} */
|
217 |
|
218 |
/*===========================================================================*/
|
219 |
/**
|
220 |
* @name Unit tests (UT)
|
221 |
* @{
|
222 |
*/
|
223 |
/*===========================================================================*/
|
224 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
225 |
|
226 |
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */ |
227 |
|
228 |
/** @} */
|
229 |
|
230 |
#endif /* _AMIROOS_MODULE_H_ */ |
231 |
|
232 |
/** @} */
|