amiro-os / modules / STM32F407G-DISC1 / module.h @ 2745c37f
History | View | Annotate | Download (6.745 KB)
| 1 | 07ff44a7 | Thomas Schöpping | /*
|
|---|---|---|---|
| 2 | AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
|
||
| 3 | 96621a83 | Thomas Schöpping | Copyright (C) 2016..2020 Thomas Schöpping et al.
|
| 4 | 07ff44a7 | Thomas Schöpping | |
| 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 | a0301104 | Thomas Schöpping | * @brief Structures and constant for the STM32F4Discovery module.
|
| 22 | 07ff44a7 | Thomas Schöpping | *
|
| 23 | a0301104 | Thomas Schöpping | * @addtogroup STM32F4Discovery_module
|
| 24 | 07ff44a7 | Thomas Schöpping | * @{
|
| 25 | */
|
||
| 26 | |||
| 27 | 6ff06bbf | Thomas Schöpping | #ifndef AMIROOS_MODULE_H
|
| 28 | #define AMIROOS_MODULE_H
|
||
| 29 | 07ff44a7 | Thomas Schöpping | |
| 30 | e2d7143f | Thomas Schöpping | #include <amiroos.h> |
| 31 | |||
| 32 | 07ff44a7 | Thomas Schöpping | /*===========================================================================*/
|
| 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 | cda14729 | Thomas Schöpping | #define MODULE_OS_GPIOEVENTFLAG_USERBUTTON AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_BUTTON))
|
| 137 | 07ff44a7 | Thomas Schöpping | |
| 138 | cda14729 | Thomas Schöpping | #if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
| 139 | 07ff44a7 | Thomas Schöpping | /**
|
| 140 | * @brief Shell prompt text.
|
||
| 141 | */
|
||
| 142 | extern ROMCONST char* moduleShellPrompt; |
||
| 143 | cda14729 | Thomas Schöpping | #endif /* (AMIROOS_CFG_SHELL_ENABLE == true) */ |
| 144 | 07ff44a7 | Thomas Schöpping | |
| 145 | /**
|
||
| 146 | * @brief Interrupt initialization macro.
|
||
| 147 | */
|
||
| 148 | #define MODULE_INIT_INTERRUPTS() { \
|
||
| 149 | /* user button */ \
|
||
| 150 | cda14729 | Thomas Schöpping | palSetLineCallback(moduleGpioUserButton.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioUserButton.gpio->line); \ |
| 151 | 56dc4779 | Thomas Schöpping | palEnableLineEvent(moduleGpioUserButton.gpio->line, APAL2CH_EDGE(moduleGpioUserButton.meta.edge)); \ |
| 152 | 07ff44a7 | Thomas Schöpping | } |
| 153 | |||
| 154 | /**
|
||
| 155 | cda14729 | Thomas Schöpping | * @brief Test initialization hook.
|
| 156 | 07ff44a7 | Thomas Schöpping | */
|
| 157 | #define MODULE_INIT_TESTS() { \
|
||
| 158 | cda14729 | Thomas Schöpping | /* add test commands to shell */ \
|
| 159 | 07ff44a7 | Thomas Schöpping | } |
| 160 | |||
| 161 | /**
|
||
| 162 | * @brief Periphery communication interfaces initialization hook.
|
||
| 163 | */
|
||
| 164 | 4c72a54c | Thomas Schöpping | #define MODULE_INIT_PERIPHERY_IF() { \
|
| 165 | 07ff44a7 | Thomas Schöpping | /* serial driver */ \
|
| 166 | sdStart(&MODULE_HAL_PROGIF, &moduleHalProgIfConfig); \ |
||
| 167 | } |
||
| 168 | |||
| 169 | /**
|
||
| 170 | * @brief Periphery communication interface deinitialization hook.
|
||
| 171 | */
|
||
| 172 | 4c72a54c | Thomas Schöpping | #define MODULE_SHUTDOWN_PERIPHERY_IF() { \
|
| 173 | cda14729 | Thomas Schöpping | /* don't stop the serial driver so messages can still be printed */ \
|
| 174 | 07ff44a7 | Thomas Schöpping | } |
| 175 | |||
| 176 | /**
|
||
| 177 | * @brief HOOK to toggle the LEDs when the user button is pressed.
|
||
| 178 | */
|
||
| 179 | cda14729 | Thomas Schöpping | #define MODULE_MAIN_LOOP_GPIOEVENT(eventflags) { \
|
| 180 | if (eventflags & MODULE_OS_GPIOEVENTFLAG_USERBUTTON) { \
|
||
| 181 | c9cecdb6 | Thomas Schöpping | apalControlGpioState_t buttonstate; \ |
| 182 | apalControlGpioGet(&moduleGpioUserButton, &buttonstate); \ |
||
| 183 | apalControlGpioSet(&moduleGpioLedRed, buttonstate); \ |
||
| 184 | apalControlGpioSet(&moduleGpioLedGreen, buttonstate); \ |
||
| 185 | apalControlGpioSet(&moduleGpioLedBlue, buttonstate); \ |
||
| 186 | apalControlGpioSet(&moduleGpioLedOrange, buttonstate); \ |
||
| 187 | 07ff44a7 | Thomas Schöpping | } \ |
| 188 | } |
||
| 189 | |||
| 190 | /** @} */
|
||
| 191 | |||
| 192 | /*===========================================================================*/
|
||
| 193 | /**
|
||
| 194 | * @name Startup Shutdown Synchronization Protocol (SSSP)
|
||
| 195 | * @{
|
||
| 196 | */
|
||
| 197 | /*===========================================================================*/
|
||
| 198 | |||
| 199 | cda14729 | Thomas Schöpping | #if (AMIROOS_CFG_SSSP_ENABLE == true) || defined(__DOXYGEN__) |
| 200 | c53ef0b1 | Thomas Schöpping | #error "SSSP is not supported on this module." |
| 201 | cda14729 | Thomas Schöpping | #endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */ |
| 202 | |||
| 203 | 07ff44a7 | Thomas Schöpping | /** @} */
|
| 204 | |||
| 205 | /*===========================================================================*/
|
||
| 206 | /**
|
||
| 207 | * @name Low-level drivers
|
||
| 208 | * @{
|
||
| 209 | */
|
||
| 210 | /*===========================================================================*/
|
||
| 211 | |||
| 212 | /** @} */
|
||
| 213 | |||
| 214 | /*===========================================================================*/
|
||
| 215 | /**
|
||
| 216 | 4c72a54c | Thomas Schöpping | * @name Tests
|
| 217 | 07ff44a7 | Thomas Schöpping | * @{
|
| 218 | */
|
||
| 219 | /*===========================================================================*/
|
||
| 220 | #if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
||
| 221 | |||
| 222 | 7de0cc90 | Thomas Schöpping | #endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
| 223 | 07ff44a7 | Thomas Schöpping | |
| 224 | /** @} */
|
||
| 225 | |||
| 226 | 6ff06bbf | Thomas Schöpping | #endif /* AMIROOS_MODULE_H */ |
| 227 | 07ff44a7 | Thomas Schöpping | |
| 228 | /** @} */ |