From 72dcfa88663999e2484463eaaa97ab861f2c7a19 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 8 Apr 2008 15:34:54 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@256 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARMCM3-STM32F103-GCC/board.c | 20 +++++++++++ demos/ARMCM3-STM32F103-GCC/board.h | 39 ++++++++++++++++++++++ .../ARMCM3-STM32F103-GCC/stm32lib/stm32f10x_conf.h | 20 +++++------ 3 files changed, 69 insertions(+), 10 deletions(-) (limited to 'demos/ARMCM3-STM32F103-GCC') diff --git a/demos/ARMCM3-STM32F103-GCC/board.c b/demos/ARMCM3-STM32F103-GCC/board.c index ec5ac2fb4..1d689bee8 100644 --- a/demos/ARMCM3-STM32F103-GCC/board.c +++ b/demos/ARMCM3-STM32F103-GCC/board.c @@ -19,10 +19,30 @@ #include +#include "board.h" + /* * Hardware initialization goes here. * NOTE: Interrupts are still disabled. */ void hwinit(void) { + /* + * I/O ports initialization as specified in board.h. + */ + GPIOA->CRL = VAL_GPIOACRL; + GPIOA->CRH = VAL_GPIOACRH; + GPIOA->ODR = VAL_GPIOAODR; + + GPIOB->CRL = VAL_GPIOBCRL; + GPIOB->CRH = VAL_GPIOBCRH; + GPIOB->ODR = VAL_GPIOBODR; + + GPIOC->CRL = VAL_GPIOCCRL; + GPIOC->CRH = VAL_GPIOCCRH; + GPIOC->ODR = VAL_GPIOCODR; + + GPIOD->CRL = VAL_GPIODCRL; + GPIOD->CRH = VAL_GPIODCRH; + GPIOD->ODR = VAL_GPIODODR; } diff --git a/demos/ARMCM3-STM32F103-GCC/board.h b/demos/ARMCM3-STM32F103-GCC/board.h index 88459c3e7..cdb9d2588 100644 --- a/demos/ARMCM3-STM32F103-GCC/board.h +++ b/demos/ARMCM3-STM32F103-GCC/board.h @@ -20,6 +20,45 @@ #ifndef _BOARD_H_ #define _BOARD_H_ +#undef FALSE +#undef TRUE +#ifndef __STM32F10x_MAP_H +#include "stm32lib/stm32f10x_map.h" +#endif + #define BOARD_OLIMEX_STM32_P103 +#define LSECLK 32768 +#define HSECLK 8000000 +#define PLLDIV 1 +#define PLLMUL 9 +#define PLLCLK ((HSECLK / PLLDIV) * PLLMUL) + +#define GPIOA_BUTTON (1 << 0) + +#define GPIOC_MMCWP (1 << 6) +#define GPIOC_MMCCP (1 << 7) +#define GPIOC_CANCNTL (1 << 10) +#define GPIOC_DISC (1 << 11) +#define GPIOC_LED (1 << 12) + +/* + * All inputs with pullups unless otherwise specified. + */ +#define VAL_GPIOACRL 0x88888884 // PA0:FI +#define VAL_GPIOACRH 0x88888888 +#define VAL_GPIOAODR 0xFFFFFFFF + +#define VAL_GPIOBCRL 0x88883888 // PB3:PP +#define VAL_GPIOBCRH 0x88888888 +#define VAL_GPIOBODR 0xFFFFFFFF + +#define VAL_GPIOCCRL 0x44888888 // PC6,PC7:FI +#define VAL_GPIOCCRH 0x88833888 // PC11,PC12:PP +#define VAL_GPIOCODR 0xFFFFFFFF + +#define VAL_GPIODCRL 0x88888844 // PD0,PD1:FI +#define VAL_GPIODCRH 0x88888888 +#define VAL_GPIODODR 0xFFFFFFFF + #endif /* _BOARD_H_ */ diff --git a/demos/ARMCM3-STM32F103-GCC/stm32lib/stm32f10x_conf.h b/demos/ARMCM3-STM32F103-GCC/stm32lib/stm32f10x_conf.h index 59ae65d01..8e51a48fd 100644 --- a/demos/ARMCM3-STM32F103-GCC/stm32lib/stm32f10x_conf.h +++ b/demos/ARMCM3-STM32F103-GCC/stm32lib/stm32f10x_conf.h @@ -34,7 +34,7 @@ //#define _ADC2 /************************************* BKP ************************************/ -//#define _BKP +//#define _BKP /************************************* CAN ************************************/ //#define _CAN @@ -60,11 +60,11 @@ /* #define _FLASH_PROG */ /************************************* GPIO ***********************************/ -//#define _GPIO -//#define _GPIOA -//#define _GPIOB -//#define _GPIOC -//#define _GPIOD +#define _GPIO +#define _GPIOA +#define _GPIOB +#define _GPIOC +#define _GPIOD //#define _GPIOE //#define _AFIO @@ -94,7 +94,7 @@ //#define _SPI2 /************************************* SysTick ********************************/ -//#define _SysTick +#define _SysTick /************************************* TIM1 ***********************************/ //#define _TIM1 @@ -123,13 +123,13 @@ /******************************************************************************* * Macro Name : assert_param * Description : The assert_param macro is used for function's parameters check. -* It is used only if the library is compiled in DEBUG mode. +* It is used only if the library is compiled in DEBUG mode. * Input : - expr: If expr is false, it calls assert_failed function * which reports the name of the source file and the source -* line number of the call that failed. +* line number of the call that failed. * If expr is true, it returns no value. * Return : None -*******************************************************************************/ +*******************************************************************************/ #define assert_param(expr) ((expr) ? (void)0 : assert_failed((u8 *)__FILE__, __LINE__)) /* Exported functions ------------------------------------------------------- */ void assert_failed(u8* file, u32 line); -- cgit v1.2.3