amiro-os / modules / STM32F407G-DISC1 / module.h @ 7de0cc90
History | View | Annotate | Download (6.71 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 |
* @brief Real-Time Clock driver.
|
87 |
*/
|
88 |
#define MODULE_HAL_RTC RTCD1
|
89 |
|
90 |
/** @} */
|
91 |
|
92 |
/*===========================================================================*/
|
93 |
/**
|
94 |
* @name GPIO definitions
|
95 |
* @{
|
96 |
*/
|
97 |
/*===========================================================================*/
|
98 |
|
99 |
/**
|
100 |
* @brief Red LED output signal.
|
101 |
*/
|
102 |
extern ROMCONST apalControlGpio_t moduleGpioLedRed;
|
103 |
|
104 |
/**
|
105 |
* @brief Green LED output signal.
|
106 |
*/
|
107 |
extern ROMCONST apalControlGpio_t moduleGpioLedGreen;
|
108 |
|
109 |
/**
|
110 |
* @brief Blue LED output signal.
|
111 |
*/
|
112 |
extern ROMCONST apalControlGpio_t moduleGpioLedBlue;
|
113 |
|
114 |
/**
|
115 |
* @brief Orange LED output signal.
|
116 |
*/
|
117 |
extern ROMCONST apalControlGpio_t moduleGpioLedOrange;
|
118 |
|
119 |
/**
|
120 |
* @brief User button input signal.
|
121 |
*/
|
122 |
extern ROMCONST apalControlGpio_t moduleGpioUserButton;
|
123 |
|
124 |
/** @} */
|
125 |
|
126 |
/*===========================================================================*/
|
127 |
/**
|
128 |
* @name AMiRo-OS core configurations
|
129 |
* @{
|
130 |
*/
|
131 |
/*===========================================================================*/
|
132 |
|
133 |
/**
|
134 |
* @brief Event flag to be set on a USER_BUTTON interrupt.
|
135 |
*/
|
136 |
#define MODULE_OS_IOEVENTFLAGS_USERBUTTON AOS_IOEVENT_FLAG(GPIOA_BUTTON)
|
137 |
|
138 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
139 |
/**
|
140 |
* @brief Shell prompt text.
|
141 |
*/
|
142 |
extern ROMCONST char* moduleShellPrompt; |
143 |
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */ |
144 |
|
145 |
/**
|
146 |
* @brief Interrupt initialization macro.
|
147 |
* @note SSSP related interrupt signals are already initialized in 'aos_system.c'.
|
148 |
*/
|
149 |
#define MODULE_INIT_INTERRUPTS() { \
|
150 |
/* user button */ \
|
151 |
palSetPadCallback(moduleGpioUserButton.gpio->port, moduleGpioUserButton.gpio->pad, _intCallback, &moduleGpioUserButton.gpio->pad); \ |
152 |
palEnablePadEvent(moduleGpioUserButton.gpio->port, moduleGpioUserButton.gpio->pad, APAL2CH_EDGE(moduleGpioUserButton.meta.edge)); \ |
153 |
} |
154 |
|
155 |
/**
|
156 |
* @brief Unit test initialization hook.
|
157 |
*/
|
158 |
#define MODULE_INIT_TESTS() { \
|
159 |
/* add unit-test shell commands */ \
|
160 |
} |
161 |
|
162 |
/**
|
163 |
* @brief Periphery communication interfaces initialization hook.
|
164 |
*/
|
165 |
#define MODULE_INIT_PERIPHERY_COMM() { \
|
166 |
/* serial driver */ \
|
167 |
sdStart(&MODULE_HAL_PROGIF, &moduleHalProgIfConfig); \ |
168 |
} |
169 |
|
170 |
/**
|
171 |
* @brief Periphery communication interface deinitialization hook.
|
172 |
*/
|
173 |
#define MODULE_SHUTDOWN_PERIPHERY_COMM() { \
|
174 |
} |
175 |
|
176 |
/**
|
177 |
* @brief HOOK to toggle the LEDs when the user button is pressed.
|
178 |
*/
|
179 |
#define MODULE_MAIN_LOOP_IO_EVENT(eventflags) { \
|
180 |
if (eventflags & MODULE_OS_IOEVENTFLAGS_USERBUTTON) { \
|
181 |
apalControlGpioState_t buttonstate; \ |
182 |
apalControlGpioGet(&moduleGpioUserButton, &buttonstate); \ |
183 |
apalControlGpioSet(&moduleGpioLedRed, buttonstate); \ |
184 |
apalControlGpioSet(&moduleGpioLedGreen, buttonstate); \ |
185 |
apalControlGpioSet(&moduleGpioLedBlue, buttonstate); \ |
186 |
apalControlGpioSet(&moduleGpioLedOrange, buttonstate); \ |
187 |
} \ |
188 |
} |
189 |
|
190 |
/** @} */
|
191 |
|
192 |
/*===========================================================================*/
|
193 |
/**
|
194 |
* @name Startup Shutdown Synchronization Protocol (SSSP)
|
195 |
* @{
|
196 |
*/
|
197 |
/*===========================================================================*/
|
198 |
|
199 |
/** @} */
|
200 |
|
201 |
/*===========================================================================*/
|
202 |
/**
|
203 |
* @name Low-level drivers
|
204 |
* @{
|
205 |
*/
|
206 |
/*===========================================================================*/
|
207 |
|
208 |
/** @} */
|
209 |
|
210 |
/*===========================================================================*/
|
211 |
/**
|
212 |
* @name Unit tests (UT)
|
213 |
* @{
|
214 |
*/
|
215 |
/*===========================================================================*/
|
216 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
217 |
|
218 |
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
219 |
|
220 |
/** @} */
|
221 |
|
222 |
#endif /* AMIROOS_MODULE_H */ |
223 |
|
224 |
/** @} */
|