Merge remote-tracking branch 'rogerclarkmelbourne/master'

This commit is contained in:
Vassilis Serasidis 2015-08-30 19:45:41 +03:00
commit 1c089da510
8 changed files with 1553 additions and 95 deletions

View File

@ -39,14 +39,14 @@
* Devices * Devices
*/ */
static adc_dev adc1 = { adc_dev adc1 = {
.regs = ADC1_BASE, .regs = ADC1_BASE,
.clk_id = RCC_ADC1, .clk_id = RCC_ADC1,
}; };
/** ADC1 device. */ /** ADC1 device. */
const adc_dev *ADC1 = &adc1; const adc_dev *ADC1 = &adc1;
static adc_dev adc2 = { adc_dev adc2 = {
.regs = ADC2_BASE, .regs = ADC2_BASE,
.clk_id = RCC_ADC2, .clk_id = RCC_ADC2,
}; };
@ -54,7 +54,7 @@ static adc_dev adc2 = {
const adc_dev *ADC2 = &adc2; const adc_dev *ADC2 = &adc2;
#if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY) #if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
static adc_dev adc3 = { adc_dev adc3 = {
.regs = ADC3_BASE, .regs = ADC3_BASE,
.clk_id = RCC_ADC3, .clk_id = RCC_ADC3,
}; };

View File

@ -48,74 +48,74 @@ static inline void enable_irq(timer_dev *dev, timer_interrupt_id iid);
*/ */
#if STM32_HAVE_TIMER(1) #if STM32_HAVE_TIMER(1)
static timer_dev timer1 = ADVANCED_TIMER(1); timer_dev timer1 = ADVANCED_TIMER(1);
/** Timer 1 device (advanced) */ /** Timer 1 device (advanced) */
timer_dev *TIMER1 = &timer1; timer_dev *const TIMER1 = &timer1;
#endif #endif
#if STM32_HAVE_TIMER(2) #if STM32_HAVE_TIMER(2)
static timer_dev timer2 = GENERAL_TIMER(2); timer_dev timer2 = GENERAL_TIMER(2);
/** Timer 2 device (general-purpose) */ /** Timer 2 device (general-purpose) */
timer_dev *TIMER2 = &timer2; timer_dev *const TIMER2 = &timer2;
#endif #endif
#if STM32_HAVE_TIMER(3) #if STM32_HAVE_TIMER(3)
static timer_dev timer3 = GENERAL_TIMER(3); timer_dev timer3 = GENERAL_TIMER(3);
/** Timer 3 device (general-purpose) */ /** Timer 3 device (general-purpose) */
timer_dev *TIMER3 = &timer3; timer_dev *const TIMER3 = &timer3;
#endif #endif
#if STM32_HAVE_TIMER(4) #if STM32_HAVE_TIMER(4)
static timer_dev timer4 = GENERAL_TIMER(4); timer_dev timer4 = GENERAL_TIMER(4);
/** Timer 4 device (general-purpose) */ /** Timer 4 device (general-purpose) */
timer_dev *TIMER4 = &timer4; timer_dev *const TIMER4 = &timer4;
#endif #endif
#if STM32_HAVE_TIMER(5) #if STM32_HAVE_TIMER(5)
static timer_dev timer5 = GENERAL_TIMER(5); timer_dev timer5 = GENERAL_TIMER(5);
/** Timer 5 device (general-purpose) */ /** Timer 5 device (general-purpose) */
timer_dev *TIMER5 = &timer5; timer_dev *const TIMER5 = &timer5;
#endif #endif
#if STM32_HAVE_TIMER(6) #if STM32_HAVE_TIMER(6)
static timer_dev timer6 = BASIC_TIMER(6); timer_dev timer6 = BASIC_TIMER(6);
/** Timer 6 device (basic) */ /** Timer 6 device (basic) */
timer_dev *TIMER6 = &timer6; timer_dev *const TIMER6 = &timer6;
#endif #endif
#if STM32_HAVE_TIMER(7) #if STM32_HAVE_TIMER(7)
static timer_dev timer7 = BASIC_TIMER(7); timer_dev timer7 = BASIC_TIMER(7);
/** Timer 7 device (basic) */ /** Timer 7 device (basic) */
timer_dev *TIMER7 = &timer7; timer_dev *const TIMER7 = &timer7;
#endif #endif
#if STM32_HAVE_TIMER(8) #if STM32_HAVE_TIMER(8)
static timer_dev timer8 = ADVANCED_TIMER(8); timer_dev timer8 = ADVANCED_TIMER(8);
/** Timer 8 device (advanced) */ /** Timer 8 device (advanced) */
timer_dev *TIMER8 = &timer8; timer_dev *const TIMER8 = &timer8;
#endif #endif
#if STM32_HAVE_TIMER(9) #if STM32_HAVE_TIMER(9)
static timer_dev timer9 = RESTRICTED_GENERAL_TIMER(9, TIMER_DIER_TIE_BIT); timer_dev timer9 = RESTRICTED_GENERAL_TIMER(9, TIMER_DIER_TIE_BIT);
/** Timer 9 device (general-purpose) */ /** Timer 9 device (general-purpose) */
timer_dev *TIMER9 = &timer9; timer_dev *const TIMER9 = &timer9;
#endif #endif
#if STM32_HAVE_TIMER(10) #if STM32_HAVE_TIMER(10)
static timer_dev timer10 = RESTRICTED_GENERAL_TIMER(10, TIMER_DIER_CC1IE_BIT); timer_dev timer10 = RESTRICTED_GENERAL_TIMER(10, TIMER_DIER_CC1IE_BIT);
/** Timer 10 device (general-purpose) */ /** Timer 10 device (general-purpose) */
timer_dev *TIMER10 = &timer10; timer_dev *const TIMER10 = &timer10;
#endif #endif
#if STM32_HAVE_TIMER(11) #if STM32_HAVE_TIMER(11)
static timer_dev timer11 = RESTRICTED_GENERAL_TIMER(11, TIMER_DIER_CC1IE_BIT); timer_dev timer11 = RESTRICTED_GENERAL_TIMER(11, TIMER_DIER_CC1IE_BIT);
/** Timer 11 device (general-purpose) */ /** Timer 11 device (general-purpose) */
timer_dev *TIMER11 = &timer11; timer_dev *const TIMER11 = &timer11;
#endif #endif
#if STM32_HAVE_TIMER(12) #if STM32_HAVE_TIMER(12)
static timer_dev timer12 = RESTRICTED_GENERAL_TIMER(12, TIMER_DIER_TIE_BIT); timer_dev timer12 = RESTRICTED_GENERAL_TIMER(12, TIMER_DIER_TIE_BIT);
/** Timer 12 device (general-purpose) */ /** Timer 12 device (general-purpose) */
timer_dev *TIMER12 = &timer12; timer_dev *const TIMER12 = &timer12;
#endif #endif
#if STM32_HAVE_TIMER(13) #if STM32_HAVE_TIMER(13)
static timer_dev timer13 = RESTRICTED_GENERAL_TIMER(13, TIMER_DIER_CC1IE_BIT); timer_dev timer13 = RESTRICTED_GENERAL_TIMER(13, TIMER_DIER_CC1IE_BIT);
/** Timer 13 device (general-purpose) */ /** Timer 13 device (general-purpose) */
timer_dev *TIMER13 = &timer13; timer_dev *const TIMER13 = &timer13;
#endif #endif
#if STM32_HAVE_TIMER(14) #if STM32_HAVE_TIMER(14)
static timer_dev timer14 = RESTRICTED_GENERAL_TIMER(14, TIMER_DIER_CC1IE_BIT); timer_dev timer14 = RESTRICTED_GENERAL_TIMER(14, TIMER_DIER_CC1IE_BIT);
/** Timer 14 device (general-purpose) */ /** Timer 14 device (general-purpose) */
timer_dev *TIMER14 = &timer14; timer_dev *const TIMER14 = &timer14;
#endif #endif
/* /*

View File

@ -30,7 +30,7 @@ extern void init(void);
// Force init to be called *first*, i.e. before static object allocation. // Force init to be called *first*, i.e. before static object allocation.
// Otherwise, statically allocated objects that need libmaple may fail. // Otherwise, statically allocated objects that need libmaple may fail.
__attribute__(( constructor )) void premain() { __attribute__(( constructor (101))) void premain() {
init(); init();
} }

View File

@ -134,46 +134,60 @@ typedef struct timer_dev {
} timer_dev; } timer_dev;
#if STM32_HAVE_TIMER(1) #if STM32_HAVE_TIMER(1)
extern timer_dev *TIMER1; extern timer_dev *const TIMER1;
extern timer_dev timer1;
#endif #endif
#if STM32_HAVE_TIMER(2) #if STM32_HAVE_TIMER(2)
extern timer_dev *TIMER2; extern timer_dev *const TIMER2;
extern timer_dev timer2;
#endif #endif
#if STM32_HAVE_TIMER(3) #if STM32_HAVE_TIMER(3)
extern timer_dev *TIMER3; extern timer_dev *const TIMER3;
extern timer_dev timer3;
#endif #endif
#if STM32_HAVE_TIMER(4) #if STM32_HAVE_TIMER(4)
extern timer_dev *TIMER4; extern timer_dev *const TIMER4;
extern timer_dev timer4;
#endif #endif
#if STM32_HAVE_TIMER(5) #if STM32_HAVE_TIMER(5)
extern timer_dev *TIMER5; extern timer_dev *const TIMER5;
extern timer_dev timer5;
#endif #endif
#if STM32_HAVE_TIMER(6) #if STM32_HAVE_TIMER(6)
extern timer_dev *TIMER6; extern timer_dev *const TIMER6;
extern timer_dev timer6;
#endif #endif
#if STM32_HAVE_TIMER(7) #if STM32_HAVE_TIMER(7)
extern timer_dev *TIMER7; extern timer_dev *const TIMER7;
extern timer_dev timer7;
#endif #endif
#if STM32_HAVE_TIMER(8) #if STM32_HAVE_TIMER(8)
extern timer_dev *TIMER8; extern timer_dev *const TIMER8;
extern timer_dev timer8;
#endif #endif
#if STM32_HAVE_TIMER(9) #if STM32_HAVE_TIMER(9)
extern timer_dev *TIMER9; extern timer_dev *const TIMER9;
extern timer_dev timer9;
#endif #endif
#if STM32_HAVE_TIMER(10) #if STM32_HAVE_TIMER(10)
extern timer_dev *TIMER10; extern timer_dev *const TIMER10;
extern timer_dev timer10;
#endif #endif
#if STM32_HAVE_TIMER(11) #if STM32_HAVE_TIMER(11)
extern timer_dev *TIMER11; extern timer_dev *const TIMER11;
extern timer_dev timer11;
#endif #endif
#if STM32_HAVE_TIMER(12) #if STM32_HAVE_TIMER(12)
extern timer_dev *TIMER12; extern timer_dev *const TIMER12;
extern timer_dev timer12;
#endif #endif
#if STM32_HAVE_TIMER(13) #if STM32_HAVE_TIMER(13)
extern timer_dev *TIMER13; extern timer_dev *const TIMER13;
extern timer_dev timer13;
#endif #endif
#if STM32_HAVE_TIMER(14) #if STM32_HAVE_TIMER(14)
extern timer_dev *TIMER14; extern timer_dev *const TIMER14;
extern timer_dev timer14;
#endif #endif
/* /*

View File

@ -42,10 +42,12 @@
/* /*
* Devices * Devices
*/ */
extern adc_dev adc1;
extern const struct adc_dev *ADC1; extern const struct adc_dev *ADC1;
extern adc_dev adc2;
extern const struct adc_dev *ADC2; extern const struct adc_dev *ADC2;
#if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY) #if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
extern adc_dev adc3;
extern const struct adc_dev *ADC3; extern const struct adc_dev *ADC3;
#endif #endif

View File

@ -106,23 +106,23 @@ struct timer_bas_reg_map;
struct timer_dev; struct timer_dev;
extern struct timer_dev *TIMER1; extern struct timer_dev *const TIMER1;
extern struct timer_dev *TIMER2; extern struct timer_dev *const TIMER2;
extern struct timer_dev *TIMER3; extern struct timer_dev *const TIMER3;
extern struct timer_dev *TIMER4; extern struct timer_dev *const TIMER4;
#if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY) #if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
extern struct timer_dev *TIMER5; extern struct timer_dev *const TIMER5;
extern struct timer_dev *TIMER6; extern struct timer_dev *const TIMER6;
extern struct timer_dev *TIMER7; extern struct timer_dev *const TIMER7;
extern struct timer_dev *TIMER8; extern struct timer_dev *const TIMER8;
#endif #endif
#ifdef STM32_XL_DENSITY #ifdef STM32_XL_DENSITY
extern struct timer_dev *TIMER9; extern struct timer_dev *const TIMER9;
extern struct timer_dev *TIMER10; extern struct timer_dev *const TIMER10;
extern struct timer_dev *TIMER11; extern struct timer_dev *const TIMER11;
extern struct timer_dev *TIMER12; extern struct timer_dev *const TIMER12;
extern struct timer_dev *TIMER13; extern struct timer_dev *const TIMER13;
extern struct timer_dev *TIMER14; extern struct timer_dev *const TIMER14;
#endif #endif
#endif #endif

View File

@ -54,43 +54,43 @@ extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS] = {
/* Top header */ /* Top header */
{GPIOB, NULL, NULL, 11, 0, ADCx}, /* D0/PB11 */ {&gpiob, NULL, NULL, 11, 0, ADCx}, /* D0/PB11 */
{GPIOB, NULL, NULL, 10, 0, ADCx}, /* D1/PB10 */ {&gpiob, NULL, NULL, 10, 0, ADCx}, /* D1/PB10 */
{GPIOB, NULL, NULL, 2, 0, ADCx}, /* D2/PB2 */ {&gpiob, NULL, NULL, 2, 0, ADCx}, /* D2/PB2 */
{GPIOB, TIMER3, ADC1, 0, 3, 8}, /* D3/PB0 */ {&gpiob, &timer3, &adc1, 0, 3, 8}, /* D3/PB0 */
{GPIOA, TIMER3, ADC1, 7, 2, 7}, /* D4/PA7 */ {&gpioa, &timer3, &adc1, 7, 2, 7}, /* D4/PA7 */
{GPIOA, TIMER3, ADC1, 6, 1, 6}, /* D5/PA6 */ {&gpioa, &timer3, &adc1, 6, 1, 6}, /* D5/PA6 */
{GPIOA, NULL, ADC1, 5, 0, 5}, /* D6/PA5 */ {&gpioa, NULL, &adc1, 5, 0, 5}, /* D6/PA5 */
{GPIOA, NULL, ADC1, 4, 0, 4}, /* D7/PA4 */ {&gpioa, NULL, &adc1, 4, 0, 4}, /* D7/PA4 */
{GPIOA, TIMER2, ADC1, 3, 4, 3}, /* D8/PA3 */ {&gpioa, &timer2, &adc1, 3, 4, 3}, /* D8/PA3 */
{GPIOA, TIMER2, ADC1, 2, 3, 2}, /* D9/PA2 */ {&gpioa, &timer2, &adc1, 2, 3, 2}, /* D9/PA2 */
{GPIOA, TIMER2, ADC1, 1, 2, 1}, /* D10/PA1 */ {&gpioa, &timer2, &adc1, 1, 2, 1}, /* D10/PA1 */
{GPIOA, TIMER2, ADC1, 0, 1, 0}, /* D11/PA0 */ {&gpioa, &timer2, &adc1, 0, 1, 0}, /* D11/PA0 */
{GPIOC, NULL, NULL, 15, 0, ADCx}, /* D12/PC15 */ {&gpioc, NULL, NULL, 15, 0, ADCx}, /* D12/PC15 */
{GPIOC, NULL, NULL, 14, 0, ADCx}, /* D13/PC14 */ {&gpioc, NULL, NULL, 14, 0, ADCx}, /* D13/PC14 */
{GPIOC, NULL, NULL, 13, 0, ADCx}, /* D14/PC13 */ {&gpioc, NULL, NULL, 13, 0, ADCx}, /* D14/PC13 */
/* Bottom header */ /* Bottom header */
{GPIOB, TIMER4, NULL, 7, 2, ADCx}, /* D15/PB7 */ {&gpiob, &timer4, NULL, 7, 2, ADCx}, /* D15/PB7 */
{GPIOB, TIMER4, NULL, 6, 1, ADCx}, /* D16/PB6 */ {&gpiob, &timer4, NULL, 6, 1, ADCx}, /* D16/PB6 */
{GPIOB, NULL, NULL, 5, 0, ADCx}, /* D17/PB5 */ {&gpiob, NULL, NULL, 5, 0, ADCx}, /* D17/PB5 */
{GPIOB, NULL, NULL, 4, 0, ADCx}, /* D18/PB4 */ {&gpiob, NULL, NULL, 4, 0, ADCx}, /* D18/PB4 */
{GPIOB, NULL, NULL, 3, 0, ADCx}, /* D19/PB3 */ {&gpiob, NULL, NULL, 3, 0, ADCx}, /* D19/PB3 */
{GPIOA, NULL, NULL, 15, 0, ADCx}, /* D20/PA15 */ {&gpioa, NULL, NULL, 15, 0, ADCx}, /* D20/PA15 */
{GPIOA, NULL, NULL, 14, 0, ADCx}, /* D21/PA14 */ {&gpioa, NULL, NULL, 14, 0, ADCx}, /* D21/PA14 */
{GPIOA, NULL, NULL, 13, 0, ADCx}, /* D22/PA13 */ {&gpioa, NULL, NULL, 13, 0, ADCx}, /* D22/PA13 */
{GPIOA, NULL, NULL, 12, 0, ADCx}, /* D23/PA12 */ {&gpioa, NULL, NULL, 12, 0, ADCx}, /* D23/PA12 */
{GPIOA, TIMER1, NULL, 11, 4, ADCx}, /* D24/PA11 */ {&gpioa, &timer1, NULL, 11, 4, ADCx}, /* D24/PA11 */
{GPIOA, TIMER1, NULL, 10, 3, ADCx}, /* D25/PA10 */ {&gpioa, &timer1, NULL, 10, 3, ADCx}, /* D25/PA10 */
{GPIOA, TIMER1, NULL, 9, 2, ADCx}, /* D26/PA9 */ {&gpioa, &timer1, NULL, 9, 2, ADCx}, /* D26/PA9 */
{GPIOA, TIMER1, NULL, 8, 1, ADCx}, /* D27/PA8 */ {&gpioa, &timer1, NULL, 8, 1, ADCx}, /* D27/PA8 */
{GPIOB, NULL, NULL, 15, 0, ADCx}, /* D28/PB15 */ {&gpiob, NULL, NULL, 15, 0, ADCx}, /* D28/PB15 */
{GPIOB, NULL, NULL, 14, 0, ADCx}, /* D29/PB14 */ {&gpiob, NULL, NULL, 14, 0, ADCx}, /* D29/PB14 */
{GPIOB, NULL, NULL, 13, 0, ADCx}, /* D30/PB13 */ {&gpiob, NULL, NULL, 13, 0, ADCx}, /* D30/PB13 */
{GPIOB, NULL, NULL, 12, 0, ADCx}, /* D31/PB12 */ {&gpiob, NULL, NULL, 12, 0, ADCx}, /* D31/PB12 */
{GPIOB, TIMER4, NULL, 8, 3, ADCx}, /* D32/PB8 */ {&gpiob, &timer4, NULL, 8, 3, ADCx}, /* D32/PB8 */
{GPIOB, TIMER3, ADC1, 1, 4, 9}, /* D33/PB1 */ {&gpiob, &timer3, &adc1, 1, 4, 9}, /* D33/PB1 */
}; };
extern const uint8 boardPWMPins[BOARD_NR_PWM_PINS] __FLASH__ = { extern const uint8 boardPWMPins[BOARD_NR_PWM_PINS] __FLASH__ = {