amiro-os / modules / STM32F407G-DISC1 / module.h @ 891fd122
History | View | Annotate | Download (6.707 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 STM32F4Discovery module.
|
22 |
*
|
23 |
* @addtogroup STM32F4Discovery_module
|
24 |
* @{
|
25 |
*/
|
26 |
|
27 |
#ifndef AMIROOS_MODULE_H
|
28 |
#define AMIROOS_MODULE_H
|
29 |
|
30 |
#include <amiroos.h> |
31 |
|
32 |
/*===========================================================================*/
|
33 |
/**
|
34 |
* @name Module specific functions
|
35 |
* @{
|
36 |
*/
|
37 |
/*===========================================================================*/
|
38 |
|
39 |
/*
|
40 |
* @brief Makro to store data in the core coupled memory (ccm).
|
41 |
* Example:
|
42 |
* int compute_buffer[128] CCM_RAM;
|
43 |
*
|
44 |
* @note The ccm is not connected to any bus system.
|
45 |
*/
|
46 |
#define CCM_RAM __attribute__((section(".ram4"), aligned(4))) |
47 |
|
48 |
/*
|
49 |
* @brief Makro to store data in the ethernet memory (eth).
|
50 |
* Example:
|
51 |
* int dma_buffer[128] ETH_RAM;
|
52 |
*
|
53 |
* @note The eth is a dedicated memory block with its own DMA controller.
|
54 |
*/
|
55 |
#define ETH_RAM __attribute__((section(".ram2"), aligned(4))) |
56 |
|
57 |
/*
|
58 |
* @brief Makro to store data in the backup memory (bckp).
|
59 |
* Example:
|
60 |
* int backup_buffer[128] BCKP_RAM;
|
61 |
*
|
62 |
* @note The eth is a dedicated memory block with its own DMA controller.
|
63 |
*/
|
64 |
#define BCKP_RAM __attribute__((section(".ram5"), aligned(4))) |
65 |
|
66 |
/** @} */
|
67 |
|
68 |
/*===========================================================================*/
|
69 |
/**
|
70 |
* @name ChibiOS/HAL configuration
|
71 |
* @{
|
72 |
*/
|
73 |
/*===========================================================================*/
|
74 |
|
75 |
/**
|
76 |
* @brief Serial driver of the programmer interface.
|
77 |
*/
|
78 |
#define MODULE_HAL_PROGIF SD2
|
79 |
|
80 |
/**
|
81 |
* @brief Configuration for the programmer serial interface driver.
|
82 |
*/
|
83 |
extern SerialConfig moduleHalProgIfConfig;
|
84 |
|
85 |
|
86 |
/**
|
87 |
* @brief Real-Time Clock driver.
|
88 |
*/
|
89 |
#define MODULE_HAL_RTC RTCD1
|
90 |
|
91 |
/** @} */
|
92 |
|
93 |
/*===========================================================================*/
|
94 |
/**
|
95 |
* @name GPIO definitions
|
96 |
* @{
|
97 |
*/
|
98 |
/*===========================================================================*/
|
99 |
|
100 |
/**
|
101 |
* @brief Red LED output signal.
|
102 |
*/
|
103 |
extern ROMCONST apalControlGpio_t moduleGpioLedRed;
|
104 |
|
105 |
/**
|
106 |
* @brief Green LED output signal.
|
107 |
*/
|
108 |
extern ROMCONST apalControlGpio_t moduleGpioLedGreen;
|
109 |
|
110 |
/**
|
111 |
* @brief Blue LED output signal.
|
112 |
*/
|
113 |
extern ROMCONST apalControlGpio_t moduleGpioLedBlue;
|
114 |
|
115 |
/**
|
116 |
* @brief Orange LED output signal.
|
117 |
*/
|
118 |
extern ROMCONST apalControlGpio_t moduleGpioLedOrange;
|
119 |
|
120 |
/**
|
121 |
* @brief User button input signal.
|
122 |
*/
|
123 |
extern ROMCONST apalControlGpio_t moduleGpioUserButton;
|
124 |
|
125 |
/** @} */
|
126 |
|
127 |
/*===========================================================================*/
|
128 |
/**
|
129 |
* @name AMiRo-OS core configurations
|
130 |
* @{
|
131 |
*/
|
132 |
/*===========================================================================*/
|
133 |
|
134 |
/**
|
135 |
* @brief Event flag to be set on a USER_BUTTON interrupt.
|
136 |
*/
|
137 |
#define MODULE_OS_IOEVENTFLAGS_USERBUTTON AOS_IOEVENT_FLAG(GPIOA_BUTTON)
|
138 |
|
139 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
140 |
/**
|
141 |
* @brief Shell prompt text.
|
142 |
*/
|
143 |
extern ROMCONST char* moduleShellPrompt; |
144 |
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */ |
145 |
|
146 |
/**
|
147 |
* @brief Interrupt initialization macro.
|
148 |
* @note SSSP related interrupt signals are already initialized in 'aos_system.c'.
|
149 |
*/
|
150 |
#define MODULE_INIT_INTERRUPTS() { \
|
151 |
/* user button */ \
|
152 |
palSetPadCallback(moduleGpioUserButton.gpio->port, moduleGpioUserButton.gpio->pad, _intCallback, &moduleGpioUserButton.gpio->pad); \ |
153 |
palEnablePadEvent(moduleGpioUserButton.gpio->port, moduleGpioUserButton.gpio->pad, APAL2CH_EDGE(moduleGpioUserButton.meta.edge)); \ |
154 |
} |
155 |
|
156 |
/**
|
157 |
* @brief Unit test initialization hook.
|
158 |
*/
|
159 |
#define MODULE_INIT_TESTS() { \
|
160 |
/* add unit-test shell commands */ \
|
161 |
} |
162 |
|
163 |
/**
|
164 |
* @brief Periphery communication interfaces initialization hook.
|
165 |
*/
|
166 |
#define MODULE_INIT_PERIPHERY_COMM() { \
|
167 |
/* serial driver */ \
|
168 |
sdStart(&MODULE_HAL_PROGIF, &moduleHalProgIfConfig); \ |
169 |
} |
170 |
|
171 |
/**
|
172 |
* @brief Periphery communication interface deinitialization hook.
|
173 |
*/
|
174 |
#define MODULE_SHUTDOWN_PERIPHERY_COMM() { \
|
175 |
} |
176 |
|
177 |
/**
|
178 |
* @brief HOOK to toggle the LEDs when the user button is pressed.
|
179 |
*/
|
180 |
#define MODULE_MAIN_LOOP_IO_EVENT(eventflags) { \
|
181 |
if (eventflags & MODULE_OS_IOEVENTFLAGS_USERBUTTON) { \
|
182 |
apalControlGpioState_t buttonstate; \ |
183 |
apalControlGpioGet(&moduleGpioUserButton, &buttonstate); \ |
184 |
apalControlGpioSet(&moduleGpioLedRed, buttonstate); \ |
185 |
apalControlGpioSet(&moduleGpioLedGreen, buttonstate); \ |
186 |
apalControlGpioSet(&moduleGpioLedBlue, buttonstate); \ |
187 |
apalControlGpioSet(&moduleGpioLedOrange, buttonstate); \ |
188 |
} \ |
189 |
} |
190 |
|
191 |
/** @} */
|
192 |
|
193 |
/*===========================================================================*/
|
194 |
/**
|
195 |
* @name Startup Shutdown Synchronization Protocol (SSSP)
|
196 |
* @{
|
197 |
*/
|
198 |
/*===========================================================================*/
|
199 |
|
200 |
/** @} */
|
201 |
|
202 |
/*===========================================================================*/
|
203 |
/**
|
204 |
* @name Low-level drivers
|
205 |
* @{
|
206 |
*/
|
207 |
/*===========================================================================*/
|
208 |
|
209 |
/** @} */
|
210 |
|
211 |
/*===========================================================================*/
|
212 |
/**
|
213 |
* @name Unit tests (UT)
|
214 |
* @{
|
215 |
*/
|
216 |
/*===========================================================================*/
|
217 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
218 |
|
219 |
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
220 |
|
221 |
/** @} */
|
222 |
|
223 |
#endif /* AMIROOS_MODULE_H */ |
224 |
|
225 |
/** @} */
|