diff options
author | Joel Bodenmann <joel@unormal.org> | 2013-11-10 22:09:09 +0100 |
---|---|---|
committer | Joel Bodenmann <joel@unormal.org> | 2013-11-10 22:09:09 +0100 |
commit | 75a6dd8404fe693f6002a56efa8b649b013226cc (patch) | |
tree | 4dc2de86da1a9d4e51532c5df73e0777c649da01 /boards/base/FireBull-STM32F103-FB/chibios_board | |
parent | 9df8b52d165ccb57bf80a82cae0f6b67983e8ef3 (diff) | |
download | uGFX-75a6dd8404fe693f6002a56efa8b649b013226cc.tar.gz uGFX-75a6dd8404fe693f6002a56efa8b649b013226cc.tar.bz2 uGFX-75a6dd8404fe693f6002a56efa8b649b013226cc.zip |
added FireBull-STM32F103-FB board
Diffstat (limited to 'boards/base/FireBull-STM32F103-FB/chibios_board')
3 files changed, 155 insertions, 0 deletions
diff --git a/boards/base/FireBull-STM32F103-FB/chibios_board/board.c b/boards/base/FireBull-STM32F103-FB/chibios_board/board.c new file mode 100755 index 00000000..b5dc0354 --- /dev/null +++ b/boards/base/FireBull-STM32F103-FB/chibios_board/board.c @@ -0,0 +1,49 @@ +#include "ch.h" +#include "hal.h" + +/** +* @brief PAL setup. +* @details Digital I/O ports static configuration as defined in @p board.h. +* This variable is used by the HAL when initializing the PAL driver. +*/ +#if HAL_USE_PAL || defined(__DOXYGEN__) +const PALConfig pal_default_config = { + {VAL_GPIOAODR, VAL_GPIOACRL, VAL_GPIOACRH}, + {VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH}, + {VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH}, + {VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH}, + {VAL_GPIOEODR, VAL_GPIOECRL, VAL_GPIOECRH}, +}; +#endif + +#if HAL_USE_MMC_SPI +/* Board-related functions related to the MMC_SPI driver.*/ +bool_t mmc_lld_is_card_inserted(MMCDriver *mmcp) { + (void)mmcp; + + return !palReadPad(GPIOA, GPIOA_MMCCP); +} + +bool_t mmc_lld_is_write_protected(MMCDriver *mmcp) { + (void)mmcp; + + return 0; +} +#endif + +/* + * Early initialization code. + * This initialization must be performed just after stack setup and before + * any other initialization. + */ +void __early_init(void) { + stm32_clock_init(); +} + +void boardInit(void) { + palClearPad(GPIOD, GPIOD_LED1); + palClearPad(GPIOD, GPIOD_LED2); + palClearPad(GPIOD, GPIOD_LED3); + palClearPad(GPIOD, GPIOD_LED4); +} + diff --git a/boards/base/FireBull-STM32F103-FB/chibios_board/board.h b/boards/base/FireBull-STM32F103-FB/chibios_board/board.h new file mode 100755 index 00000000..0cfe134a --- /dev/null +++ b/boards/base/FireBull-STM32F103-FB/chibios_board/board.h @@ -0,0 +1,100 @@ +#ifndef _BOARD_H_ +#define _BOARD_H_ + +// Board identifier. +#define BOARD_FIREBULL_STM32_F103 +#define BOARD_NAME "FireBull STM32F103-FB" + +// Board frequencies. +#define STM32_LSECLK 32768 +#define STM32_HSECLK 8000000 + +// MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h. +#define STM32F10X_HD + +// IO pins assignments. +#define GPIOA_BUTTON 8 + +#define GPIOD_LED1 8 +#define GPIOD_LED2 9 +#define GPIOD_LED3 10 +#define GPIOD_LED4 11 + +#define GPIOA_SPI1NSS 4 +#define GPIOB_SPI2NSS 12 +#define GPIOA_SPI3NSS 15 +#define GPIOA_MMCCP 4 +#define GPIOC_SDPWR 8 +#define GPIOC_USB_EN 9 + +#define TP_CS_PORT GPIOC +#define TP_IRQ_PORT GPIOC +#define TP_IRQ 4 +#define TP_CS 6 + +#define GDISP_DATA_PORT GPIOE +#define GDISP_CMD_PORT GPIOD +#define GDISP_CS 12 +#define GDISP_RS 13 +#define GDISP_WR 14 +#define GDISP_RD 15 + + /* + * I/O ports initial setup, this configuration is established soon after reset + * in the initialization code. + * + * The digits have the following meaning: + * 0 - Analog input. + * 1 - Push Pull output 10MHz. + * 2 - Push Pull output 2MHz. + * 3 - Push Pull output 50MHz. + * 4 - Digital input. + * 5 - Open Drain output 10MHz. + * 6 - Open Drain output 2MHz. + * 7 - Open Drain output 50MHz. + * 8 - Digital input with PullUp or PullDown resistor depending on ODR. + * 9 - Alternate Push Pull output 10MHz. + * A - Alternate Push Pull output 2MHz. + * B - Alternate Push Pull output 50MHz. + * C - Reserved. + * D - Alternate Open Drain output 10MHz. + * E - Alternate Open Drain output 2MHz. + * F - Alternate Open Drain output 50MHz. + * Please refer to the STM32 Reference Manual for details. + */ + +#define VAL_GPIOACRL 0xB4B44B34 /* PA7...PA0 */ +#define VAL_GPIOACRH 0x444334B4 /* PA15...PA8 */ +#define VAL_GPIOAODR 0xFFFFFFFF + +#define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */ +#define VAL_GPIOBCRH 0xB4B88888 /* PB15...PB8 */ +#define VAL_GPIOBODR 0xFFFFFFFF + +#define VAL_GPIOCCRL 0x33048888 /* PC7...PC0 */ +#define VAL_GPIOCCRH 0x88833383 /* PC15...PC8 */ +#define VAL_GPIOCODR 0xFFFFFFFF + +#define VAL_GPIODCRL 0x33388888 /* PD7...PD0 */ +#define VAL_GPIODCRH 0x33333333 /* PD15...PD8 */ +#define VAL_GPIODODR 0xFFFFFFFF + +#define VAL_GPIOECRL 0x33333333 /* PE7...PE0 */ +#define VAL_GPIOECRH 0x33333333 /* PE15...PE8 */ +#define VAL_GPIOEODR 0xFFFFFFFF + +#define usb_lld_connect_bus(usbp) palClearPad(GPIOC, GPIOC_USB_EN) +#define usb_lld_disconnect_bus(usbp) palSetPad(GPIOC, GPIOC_USB_EN) + +#if !defined(_FROM_ASM_) +#ifdef __cplusplus +extern "C" { + #endif + void boardInit(void); + #ifdef __cplusplus +} +#endif +#endif /* _FROM_ASM_ */ + +#endif /* _BOARD_H_ */ + diff --git a/boards/base/FireBull-STM32F103-FB/chibios_board/board.mk b/boards/base/FireBull-STM32F103-FB/chibios_board/board.mk new file mode 100755 index 00000000..0258db77 --- /dev/null +++ b/boards/base/FireBull-STM32F103-FB/chibios_board/board.mk @@ -0,0 +1,6 @@ +# List of all the board related files.
+BOARDSRC = ${CHIBIOS}/boards/FIREBULL_STM32_F103/board.c
+
+# Required include directories
+BOARDINC = ${CHIBIOS}/boards/FIREBULL_STM32_F103
+
|