aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2010-08-31 17:17:57 -0400
committerbnewbold <bnewbold@robocracy.org>2010-08-31 17:17:57 -0400
commite03d58f4dab4176514924baa3a1ff430bf5819b8 (patch)
treeb5c8269c34ab3bb4da0f7c52dea7049966753fb3 /libmaple
parent01c38f5567bf624413d901c2b287e63cdccd03a6 (diff)
downloadlibrambutan-e03d58f4dab4176514924baa3a1ff430bf5819b8.tar.gz
librambutan-e03d58f4dab4176514924baa3a1ff430bf5819b8.zip
Further wirish portability progress
Sort of ugly changes. Compiles but untested.
Diffstat (limited to 'libmaple')
-rw-r--r--libmaple/gpio.h14
-rw-r--r--libmaple/libmaple.h49
-rw-r--r--libmaple/rcc.c1
-rw-r--r--libmaple/rcc.h1
4 files changed, 55 insertions, 10 deletions
diff --git a/libmaple/gpio.h b/libmaple/gpio.h
index d1d0050..9099c9b 100644
--- a/libmaple/gpio.h
+++ b/libmaple/gpio.h
@@ -44,13 +44,13 @@
* - After reset, the alternate functions are not active and IO prts
* are set to Input Floating mode */
-#define GPIOA_BASE (GPIO_Port*)0x40010800
-#define GPIOB_BASE (GPIO_Port*)0x40010C00
-#define GPIOC_BASE (GPIO_Port*)0x40011000
-#define GPIOD_BASE (GPIO_Port*)0x40011400
-#define GPIOE_BASE (GPIO_Port*)0x40011800 // High-density devices only
-#define GPIOF_BASE (GPIO_Port*)0x40011C00 // High-density devices only
-#define GPIOG_BASE (GPIO_Port*)0x40012000 // High-density devices only
+#define GPIOA_BASE (GPIO_Port*)0x40010800
+#define GPIOB_BASE (GPIO_Port*)0x40010C00
+#define GPIOC_BASE (GPIO_Port*)0x40011000
+#define GPIOD_BASE (GPIO_Port*)0x40011400
+#define GPIOE_BASE (GPIO_Port*)0x40011800 // High-density devices only
+#define GPIOF_BASE (GPIO_Port*)0x40011C00 // High-density devices only
+#define GPIOG_BASE (GPIO_Port*)0x40012000 // High-density devices only
#define GPIO_SPEED_50MHZ (0x3)
diff --git a/libmaple/libmaple.h b/libmaple/libmaple.h
index 1fd0785..a481e63 100644
--- a/libmaple/libmaple.h
+++ b/libmaple/libmaple.h
@@ -48,9 +48,6 @@
// Number of timer devices ports, definately used
#define NR_TIMERS 4
- // Number of ADC pins. Not actually used?
- #define NR_ANALOG_PINS 29
-
// Has an FSMC bus?
//#define HAS_FSMC // Maple does not
@@ -86,6 +83,52 @@
#define BITBAND_PERI_BASE 0x42000000
#endif
+#ifdef MCU_STM32F103ZE // eg, LeafLabs Maple Native
+
+ // Number of GPIO ports (GPIOA, GPIOB, etc), definately used
+ #define NR_GPIO_PORTS 7
+
+ // Total number of GPIO pins
+ #define NR_GPIO_PINS 63
+
+ // Number of timer devices ports, definately used
+ #define NR_TIMERS 8
+
+ // Has an FSMC bus?
+ #define HAS_FSMC
+
+ // USB Identifier numbers
+ // Descriptor strings must be modified by hand in usb/descriptors.c for now
+ #define VCOM_ID_VENDOR 0x1EAF
+ #define VCOM_ID_PRODUCT 0x0004
+ #define USB_CONFIG_MAX_POWER (100 >> 1)
+ #define RESET_DELAY (100)
+
+ // Where to put usercode (based on space reserved for bootloader)
+ #define USER_ADDR_ROM 0x08005000
+ #define USER_ADDR_RAM 0x20000C00
+ #define STACK_TOP 0x20000800
+
+ // Debug port settings (from ASSERT)
+ #define ERROR_LED_PORT GPIOA_BASE
+ #define ERROR_LED_PIN 5
+ #define ERROR_USART_NUM 2
+ #define ERROR_USART_BAUD 9600
+ #define ERROR_TX_PIN 2
+ #define ERROR_TX_PORT GPIOA_BASE
+
+ // Just in case, most boards have at least some memory
+ #ifndef RAMSIZE
+ # define RAMSIZE (caddr_t)0x50000
+ #endif
+
+ // Bitbanded Memory sections
+ #define BITBAND_SRAM_REF 0x20000000
+ #define BITBAND_SRAM_BASE 0x22000000
+ #define BITBAND_PERI_REF 0x40000000
+ #define BITBAND_PERI_BASE 0x42000000
+#endif
+
// Make sure MCU-specific settings were defined
#ifndef NR_GPIO_PORTS
#error Error: No MCU type specified. Add something like -DMCU_STM32F103RB \
diff --git a/libmaple/rcc.c b/libmaple/rcc.c
index 4ac6629..848f59e 100644
--- a/libmaple/rcc.c
+++ b/libmaple/rcc.c
@@ -66,6 +66,7 @@ static const struct rcc_dev_info rcc_dev_table[] = {
[RCC_TIMER5] = { .clk_domain = APB1, .line_num = 3 }, // High-density devices only
[RCC_TIMER6] = { .clk_domain = APB1, .line_num = 4 }, // High-density devices only
[RCC_TIMER7] = { .clk_domain = APB1, .line_num = 5 }, // High-density devices only
+ [RCC_TIMER8] = { .clk_domain = APB2, .line_num = 13 }, // High-density devices only
[RCC_SPI1] = { .clk_domain = APB2, .line_num = 12 },
[RCC_SPI2] = { .clk_domain = APB1, .line_num = 14 },
};
diff --git a/libmaple/rcc.h b/libmaple/rcc.h
index b369f25..3f55b4f 100644
--- a/libmaple/rcc.h
+++ b/libmaple/rcc.h
@@ -163,6 +163,7 @@ enum {
RCC_TIMER5, // High-density devices only (Maple Native)
RCC_TIMER6, // High-density devices only (Maple Native)
RCC_TIMER7, // High-density devices only (Maple Native)
+ RCC_TIMER8, // High-density devices only (Maple Native)
RCC_SPI1,
RCC_SPI2,
};