APM:Libraries
Classes | Macros | Typedefs | Enumerations | Functions | Variables
boards.h File Reference

Board-specific pin information. More...

#include <hal.h>
#include <stm32f4xx_conf.h>
#include <hal_types.h>
#include <exti.h>
#include <gpio_hal.h>
#include <timer.h>
#include <adc.h>
#include <usart.h>
#include <pwm_in.h>
Include dependency graph for boards.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  stm32_pin_info
 Stores STM32-specific information related to a given Maple pin. More...
 

Macros

#define CLOCK_SPEED_MHZ   CYCLES_PER_MICROSECOND
 
#define CLOCK_SPEED_HZ   (CLOCK_SPEED_MHZ * 1000000UL)
 
#define BOOT_RTC_SIGNATURE   0xb007b007
 
#define DFU_RTC_SIGNATURE   0xDEADBEEF
 
#define FORCE_APP_RTC_SIGNATURE   0x4000AbbA
 
#define DSM_BIND_SIGNATURE   0xD82B14D0
 
#define DSM_BIND_SIGN_MASK   0xF
 
#define CONSOLE_PORT_SIGNATURE   0xC07501e0
 
#define CONSOLE_PORT_MASK   0xF
 
#define MASS_STORAGE_SIGNATURE   0x5106a8ed
 
#define OVERCLOCK_SIGNATURE   0xFACED1A0
 
#define OVERCLOCK_SIG_MASK   0xF
 
#define OV_GUARD_SIGNATURE   0xBABEFACE
 
#define OV_GUARD_FAIL_SIGNATURE   0xBABEFA17
 
#define RTC_SIGNATURE_REG   0
 
#define RTC_DSM_BIND_REG   1
 
#define RTC_MASS_STORAGE_REG   2
 
#define RTC_CONSOLE_REG   3
 
#define RTC_OVERCLOCK_REG   4
 
#define RTC_OV_GUARD_REG   5
 
#define digitalPinToPort(P)   ( PIN_MAP[P].gpio_device )
 
#define digitalPinToBitMask(P)   ( BIT(PIN_MAP[P].gpio_bit) )
 
#define portOutputRegister(port)   ( &(port->regs->ODR) )
 
#define portInputRegister(port)   ( &(port->regs->IDR) )
 
#define portSetRegister(pin)   ( &(PIN_MAP[pin].gpio_device->regs->BSRR) )
 
#define portClearRegister(pin)   ( &(PIN_MAP[pin].gpio_device->regs->BRR) )
 
#define portConfigRegister(pin)   ( &(PIN_MAP[pin].gpio_device->regs->CRL) )
 

Typedefs

typedef struct stm32_pin_info stm32_pin_info
 Stores STM32-specific information related to a given Maple pin. More...
 

Enumerations

enum  {
  D0 =0, D1, D2, D3,
  D4, D5, D6, D7,
  D8, D9, D10, D11,
  D12, D13, D14, D15,
  D16, D17, D18, D19,
  D20, D21, D22, D23,
  D24, D25, D26, D27,
  D28, D29, D30, D31,
  D32, D33, D34, D35,
  D36, D37, D38, D39,
  D40, D41, D42, D43,
  D44, D45, D46, D47,
  D48, D49, D50, D51,
  D52, D53, D54, D55,
  D56, D57, D58, D59,
  D60, D61, D62, D63,
  D64, D65, D66, D67,
  D68, D69, D70, D71,
  D72, D73, D74, D75,
  D76, D77, D78, D79,
  D80, D81, D82, D83,
  D84, D85, D86, D87,
  D88, D89, D90, D91,
  D92, D93, D94, D95,
  D96, D97, D98, D99,
  D100, D101, D102, D103,
  D104, D105, D106, D107,
  D108, D109, D110, D111
}
 
enum  {
  PB10 =0, PB2 =1, PB12 =2, PB13 =3,
  PB14 =4, PB15 =5, PC0 =6, PC1 =7,
  PC2 =8, PC3 =9, PC4 =10, PC5 =11,
  PC6 =12, PC7 =13, PC8 =14, PC9 =15,
  PC10 =16, PC11 =17, PC12 =18, PC13 =19,
  PC14 =20, PC15 =21, PA8 =22, PA9 =23,
  PA10 =24, PB9 =25, PD2 =26, PD3 =27,
  PD6 =28, PG11 =29, PG12 =30, PG13 =31,
  PG14 =32, PG8 =33, PG7 =34, PG6 =35,
  PB5 =36, PB6 =37, PB7 =38, PF6 =39,
  PF7 =40, PF8 =41, PF9 =42, PF10 =43,
  PF11 =44, PB1 =45, PB0 =46, PA0 =47,
  PA1 =48, PA2 =49, PA3 =50, PA4 =51,
  PA5 =52, PA6 =53, PA7 =54, PF0 =55,
  PD11 =56, PD14 =57, PF1 =58, PD12 =59,
  PD15 =60, PF2 =61, PD13 =62, PD0 =63,
  PF3 =64, PE3 =65, PD1 =66, PF4 =67,
  PE4 =68, PE7 =69, PF5 =70, PE5 =71,
  PE8 =72, PF12 =73, PE6 =74, PE9 =75,
  PF13 =76, PE10 =77, PF14 =78, PG9 =79,
  PE11 =80, PF15 =81, PG10 =82, PE12 =83,
  PG0 =84, PD5 =85, PE13 =86, PG1 =87,
  PD4 =88, PE14 =89, PG2 =90, PE1 =91,
  PE15 =92, PG3 =93, PE0 =94, PD8 =95,
  PG4 =96, PD9 =97, PG5 =98, PD10 =99,
  PB11 =100, PB8 =101, PE2 =102, PA15 =103,
  PB3 =104, PB4 =105, PA13 =106, PA14 =107,
  PA11 =108
}
 

Functions

void init (void)
 Generic board initialization function. More...
 
void boardInit (void)
 Board-specific initialization function. More...
 
void pre_init (void)
 
void board_set_rtc_register (uint32_t sig, uint16_t reg)
 
uint32_t board_get_rtc_register (uint16_t reg)
 
static void goDFU ()
 
static bool is_bare_metal ()
 
void NMI_Handler ()
 
void emerg_delay (uint32_t n)
 
void SetSysClock (uint8_t oc)
 Configures the System clock source, PLL Multiplier and Divider factors, AHB/APBx prescalers and Flash settings This function should be called only once the RCC clock configuration is reset to the default reset state (done in systemInit() function). More...
 
void clock_gettime (uint32_t mode, void *ptr)
 
void systemInit (uint8_t oc)
 Setup the microcontroller system Initialize the Embedded Flash Interface, the PLL and update the SystemFrequency variable. More...
 

Variables

const stm32_pin_info PIN_MAP []
 Maps each Maple pin to a corresponding stm32_pin_info. More...
 
unsigned __isr_vector_start
 
voidFuncPtr boardEmergencyHandler
 

Detailed Description

Board-specific pin information.

(c) 2017 night.nosp@m._gho.nosp@m.st@yk.nosp@m.octp.nosp@m.a.ru

based on:

Author
Bryan Newbold bnewb.nosp@m.old@.nosp@m.leafl.nosp@m.abs..nosp@m.com, Marti Bolivar mboli.nosp@m.var@.nosp@m.leafl.nosp@m.abs..nosp@m.com

To add a new board type, add a new pair of files to /wirish/boards/, update the section below with a new "BOARD" type, and update /wirish/rules.mk to include your boards/your_board.cpp file in the top-level Makefile build.

Definition in file boards.h.

Macro Definition Documentation

◆ BOOT_RTC_SIGNATURE

#define BOOT_RTC_SIGNATURE   0xb007b007

Definition at line 291 of file boards.h.

Referenced by F4Light::Scheduler::_reboot().

◆ CLOCK_SPEED_HZ

#define CLOCK_SPEED_HZ   (CLOCK_SPEED_MHZ * 1000000UL)

Definition at line 287 of file boards.h.

◆ CLOCK_SPEED_MHZ

#define CLOCK_SPEED_MHZ   CYCLES_PER_MICROSECOND

Definition at line 286 of file boards.h.

◆ CONSOLE_PORT_MASK

#define CONSOLE_PORT_MASK   0xF

Definition at line 300 of file boards.h.

Referenced by HAL_F4Light::HAL_F4Light(), and HAL_F4Light::lateInit().

◆ CONSOLE_PORT_SIGNATURE

#define CONSOLE_PORT_SIGNATURE   0xC07501e0

Definition at line 299 of file boards.h.

Referenced by HAL_F4Light::HAL_F4Light(), and HAL_F4Light::lateInit().

◆ DFU_RTC_SIGNATURE

#define DFU_RTC_SIGNATURE   0xDEADBEEF

Definition at line 292 of file boards.h.

Referenced by F4Light::Scheduler::_reboot(), init(), and VCP_DataRx().

◆ digitalPinToBitMask

#define digitalPinToBitMask (   P)    ( BIT(PIN_MAP[P].gpio_bit) )

Definition at line 323 of file boards.h.

◆ digitalPinToPort

#define digitalPinToPort (   P)    ( PIN_MAP[P].gpio_device )

Definition at line 322 of file boards.h.

◆ DSM_BIND_SIGN_MASK

#define DSM_BIND_SIGN_MASK   0xF

Definition at line 297 of file boards.h.

Referenced by F4Light::DSM_parser::init().

◆ DSM_BIND_SIGNATURE

#define DSM_BIND_SIGNATURE   0xD82B14D0

Definition at line 296 of file boards.h.

Referenced by F4Light::DSM_parser::init().

◆ FORCE_APP_RTC_SIGNATURE

#define FORCE_APP_RTC_SIGNATURE   0x4000AbbA

◆ MASS_STORAGE_SIGNATURE

#define MASS_STORAGE_SIGNATURE   0x5106a8ed

Definition at line 303 of file boards.h.

Referenced by HAL_F4Light::lateInit(), and HAL_F4Light::run().

◆ OV_GUARD_FAIL_SIGNATURE

#define OV_GUARD_FAIL_SIGNATURE   0xBABEFA17

Definition at line 309 of file boards.h.

Referenced by init(), and HAL_F4Light::lateInit().

◆ OV_GUARD_SIGNATURE

#define OV_GUARD_SIGNATURE   0xBABEFACE

Definition at line 308 of file boards.h.

Referenced by init().

◆ OVERCLOCK_SIG_MASK

#define OVERCLOCK_SIG_MASK   0xF

Definition at line 307 of file boards.h.

Referenced by init(), and HAL_F4Light::lateInit().

◆ OVERCLOCK_SIGNATURE

#define OVERCLOCK_SIGNATURE   0xFACED1A0

Definition at line 306 of file boards.h.

Referenced by init(), and HAL_F4Light::lateInit().

◆ portClearRegister

#define portClearRegister (   pin)    ( &(PIN_MAP[pin].gpio_device->regs->BRR) )

Definition at line 328 of file boards.h.

◆ portConfigRegister

#define portConfigRegister (   pin)    ( &(PIN_MAP[pin].gpio_device->regs->CRL) )

Definition at line 330 of file boards.h.

◆ portInputRegister

#define portInputRegister (   port)    ( &(port->regs->IDR) )

Definition at line 325 of file boards.h.

◆ portOutputRegister

#define portOutputRegister (   port)    ( &(port->regs->ODR) )

Definition at line 324 of file boards.h.

◆ portSetRegister

#define portSetRegister (   pin)    ( &(PIN_MAP[pin].gpio_device->regs->BSRR) )

Definition at line 327 of file boards.h.

◆ RTC_CONSOLE_REG

#define RTC_CONSOLE_REG   3

Definition at line 315 of file boards.h.

Referenced by HAL_F4Light::HAL_F4Light(), and HAL_F4Light::lateInit().

◆ RTC_DSM_BIND_REG

#define RTC_DSM_BIND_REG   1

Definition at line 313 of file boards.h.

Referenced by F4Light::DSM_parser::init().

◆ RTC_MASS_STORAGE_REG

#define RTC_MASS_STORAGE_REG   2

Definition at line 314 of file boards.h.

Referenced by HAL_F4Light::lateInit(), and HAL_F4Light::run().

◆ RTC_OV_GUARD_REG

#define RTC_OV_GUARD_REG   5

Definition at line 317 of file boards.h.

Referenced by init(), and HAL_F4Light::lateInit().

◆ RTC_OVERCLOCK_REG

#define RTC_OVERCLOCK_REG   4

Definition at line 316 of file boards.h.

Referenced by init(), and HAL_F4Light::lateInit().

◆ RTC_SIGNATURE_REG

#define RTC_SIGNATURE_REG   0

Typedef Documentation

◆ stm32_pin_info

Stores STM32-specific information related to a given Maple pin.

See also
PIN_MAP

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
D0 
D1 
D2 
D3 
D4 
D5 
D6 
D7 
D8 
D9 
D10 
D11 
D12 
D13 
D14 
D15 
D16 
D17 
D18 
D19 
D20 
D21 
D22 
D23 
D24 
D25 
D26 
D27 
D28 
D29 
D30 
D31 
D32 
D33 
D34 
D35 
D36 
D37 
D38 
D39 
D40 
D41 
D42 
D43 
D44 
D45 
D46 
D47 
D48 
D49 
D50 
D51 
D52 
D53 
D54 
D55 
D56 
D57 
D58 
D59 
D60 
D61 
D62 
D63 
D64 
D65 
D66 
D67 
D68 
D69 
D70 
D71 
D72 
D73 
D74 
D75 
D76 
D77 
D78 
D79 
D80 
D81 
D82 
D83 
D84 
D85 
D86 
D87 
D88 
D89 
D90 
D91 
D92 
D93 
D94 
D95 
D96 
D97 
D98 
D99 
D100 
D101 
D102 
D103 
D104 
D105 
D106 
D107 
D108 
D109 
D110 
D111 

Definition at line 68 of file boards.h.

◆ anonymous enum

anonymous enum
Enumerator
PB10 
PB2 
PB12 
PB13 
PB14 
PB15 
PC0 
PC1 
PC2 
PC3 
PC4 
PC5 
PC6 
PC7 
PC8 
PC9 
PC10 
PC11 
PC12 
PC13 
PC14 
PC15 
PA8 
PA9 
PA10 
PB9 
PD2 
PD3 
PD6 
PG11 
PG12 
PG13 
PG14 
PG8 
PG7 
PG6 
PB5 
PB6 
PB7 
PF6 
PF7 
PF8 
PF9 
PF10 
PF11 
PB1 
PB0 
PA0 
PA1 
PA2 
PA3 
PA4 
PA5 
PA6 
PA7 
PF0 
PD11 
PD14 
PF1 
PD12 
PD15 
PF2 
PD13 
PD0 
PF3 
PE3 
PD1 
PF4 
PE4 
PE7 
PF5 
PE5 
PE8 
PF12 
PE6 
PE9 
PF13 
PE10 
PF14 
PG9 
PE11 
PF15 
PG10 
PE12 
PG0 
PD5 
PE13 
PG1 
PD4 
PE14 
PG2 
PE1 
PE15 
PG3 
PE0 
PD8 
PG4 
PD9 
PG5 
PD10 
PB11 
PB8 
PE2 
PA15 
PB3 
PB4 
PA13 
PA14 
PA11 

Definition at line 172 of file boards.h.

Function Documentation

◆ board_get_rtc_register()

uint32_t board_get_rtc_register ( uint16_t  reg)

Definition at line 151 of file boards.cpp.

Referenced by HAL_F4Light::HAL_F4Light(), F4Light::DSM_parser::init(), init(), HAL_F4Light::lateInit(), and HAL_F4Light::run().

Here is the caller graph for this function:

◆ board_set_rtc_register()

void board_set_rtc_register ( uint32_t  sig,
uint16_t  reg 
)

Definition at line 141 of file boards.cpp.

Referenced by F4Light::Scheduler::_reboot(), F4Light::Scheduler::_try_kill_task_or_reboot(), F4Light::DSM_parser::init(), init(), HAL_F4Light::lateInit(), HAL_F4Light::run(), F4Light::Scheduler::system_initialized(), and VCP_DataRx().

Here is the caller graph for this function:

◆ boardInit()

void boardInit ( void  )

Board-specific initialization function.

This function is called from init() after all generic board initialization has been performed. Each board is required to define its own.

See also
init()

Board-specific initialization function.

Todo:
Add your board-specific code, if any.

Definition at line 118 of file board.c.

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clock_gettime()

void clock_gettime ( uint32_t  mode,
void *  ptr 
)

Definition at line 201 of file syscalls.c.

Referenced by is_bare_metal().

Here is the caller graph for this function:

◆ emerg_delay()

void emerg_delay ( uint32_t  n)

Definition at line 257 of file boards.cpp.

Referenced by is_bare_metal(), and NMI_Handler().

Here is the caller graph for this function:

◆ goDFU()

static void goDFU ( )
inlinestatic

Definition at line 137 of file boards.h.

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

void init ( void  )
inline

Generic board initialization function.

This function is called before main(). It ensures that the clocks and peripherals are configured properly for use with wirish, then calls boardInit().

See also
boardInit()

Definition at line 136 of file system.cpp.

Referenced by HALSITL::AnalogIn::AnalogIn(), PX4::PX4_I2C::do_transfer(), VRBRAIN::VRBRAIN_I2C::do_transfer(), Linux::GPIO_Sysfs::from(), Linux::RCOutput_Bebop::from(), F4Light::I2CDevice::get_device(), Linux::CANManager::getNumIfaces(), AP_HAL::GPIO::GPIO(), AP_HAL::HAL::HAL(), pre_init(), PX4::PX4CAN::PX4CAN(), HAL_Linux::run(), and VRBRAIN::VRBRAINCAN::VRBRAINCAN().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_bare_metal()

static bool is_bare_metal ( )
inlinestatic

Definition at line 149 of file boards.h.

Referenced by F4Light::Scheduler::_reboot(), goDFU(), and VCP_DataRx().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NMI_Handler()

void NMI_Handler ( )

Definition at line 45 of file system.cpp.

Referenced by __cxa_pure_virtual(), and is_bare_metal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pre_init()

void pre_init ( void  )

Definition at line 250 of file boards.cpp.

Here is the call graph for this function:

Variable Documentation

◆ __isr_vector_start

unsigned __isr_vector_start

Referenced by goDFU(), and systemInit().

◆ boardEmergencyHandler

voidFuncPtr boardEmergencyHandler

Referenced by is_bare_metal().

◆ PIN_MAP

const stm32_pin_info PIN_MAP[]

Maps each Maple pin to a corresponding stm32_pin_info.

See also
stm32_pin_info