aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple
diff options
context:
space:
mode:
Diffstat (limited to 'libmaple')
-rw-r--r--libmaple/libmaple.h33
-rw-r--r--libmaple/nvic.c7
-rw-r--r--libmaple/nvic.h1
-rw-r--r--libmaple/usb/usb_config.h3
-rw-r--r--libmaple/util.c6
5 files changed, 23 insertions, 27 deletions
diff --git a/libmaple/libmaple.h b/libmaple/libmaple.h
index 8e072c3..437566f 100644
--- a/libmaple/libmaple.h
+++ b/libmaple/libmaple.h
@@ -34,7 +34,7 @@
#include "libmaple_types.h"
// General configuration
-#define MAPLE_DEBUG 0
+#define MAPLE_DEBUG 1
// MCU-specific configuration
#ifdef MCU_STM32F103RB // eg, LeafLabs Maple
@@ -48,16 +48,21 @@
// Number of timer devices ports, definately used
#define NR_TIMERS 4
+ // Number of USART ports
+ #define NR_USART 3
+
// Has an FSMC bus?
- #define NR_FSMC 1
+ #define NR_FSMC 0
// Has an FSMC bus?
- #define NR_DAC_PINS 2
+ #define NR_DAC_PINS 0
// 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_DISC_BANK GPIOC_BASE
+ #define USB_DISC_PIN 12
#define USB_CONFIG_MAX_POWER (100 >> 1)
#define RESET_DELAY (100)
@@ -86,36 +91,26 @@
#define BITBAND_PERI_BASE 0x42000000
#endif
-#ifdef MCU_STM32F103ZE // eg, LeafLabs Maple Native
-
- // Number of GPIO ports (GPIOA, GPIOB, etc), definately used
+#ifdef MCU_STM32F103ZE
+ // eg, LeafLabs Maple Native
#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 NR_USART 3
#define NR_FSMC 1
-
- // Has an FSMC bus?
#define NR_DAC_PINS 2
- // 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_DISC_BANK GPIOB_BASE
+ #define USB_DISC_PIN 8
#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 GPIOC_BASE
#define ERROR_LED_PIN 15
#define ERROR_USART_NUM 1
@@ -123,12 +118,10 @@
#define ERROR_TX_PIN 10
#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
diff --git a/libmaple/nvic.c b/libmaple/nvic.c
index 7aef26d..60e7eac 100644
--- a/libmaple/nvic.c
+++ b/libmaple/nvic.c
@@ -65,7 +65,12 @@ void nvic_irq_disable(uint32 n) {
}
}
-
+void nvic_irq_disable_all(void) {
+ short n;
+ for(n=0; n<65; n++) {
+ nvic_irq_disable(n);
+ }
+}
/**
* @brief Initialice the NVIC at address addr
diff --git a/libmaple/nvic.h b/libmaple/nvic.h
index a24086a..4e425c5 100644
--- a/libmaple/nvic.h
+++ b/libmaple/nvic.h
@@ -78,6 +78,7 @@ enum {
void nvic_init(void);
void nvic_irq_enable(uint32 device);
void nvic_irq_disable(uint32 device);
+void nvic_irq_disable_all(void);
#ifdef __cplusplus
}
diff --git a/libmaple/usb/usb_config.h b/libmaple/usb/usb_config.h
index 27294dc..ba05d42 100644
--- a/libmaple/usb/usb_config.h
+++ b/libmaple/usb/usb_config.h
@@ -40,9 +40,6 @@
CNTR_ESOFM | \
CNTR_RESETM )
-#define USB_DISC_BANK GPIOB_BASE
-#define USB_DISC_PIN 8
-
#define F_SUSPEND_ENABLED 1
#endif
diff --git a/libmaple/util.c b/libmaple/util.c
index 61beab8..a747948 100644
--- a/libmaple/util.c
+++ b/libmaple/util.c
@@ -44,7 +44,7 @@ void _fail(const char* file, int line, const char* exp) {
uint32 i = 0;
/* Turn off interrupts */
- nvic_disable_interrupts();
+ nvic_irq_disable_all();
/* Turn off timers */
timer_disable_all();
@@ -73,8 +73,8 @@ void _fail(const char* file, int line, const char* exp) {
gpio_set_mode(ERROR_LED_PORT, ERROR_LED_PIN, GPIO_MODE_OUTPUT_PP);
/* Turn the USB interrupt back on so the bootloader keeps on functioning */
- nvic_enable_interrupt(NVIC_INT_USBHP);
- nvic_enable_interrupt(NVIC_INT_USBLP);
+ nvic_irq_enable(NVIC_INT_USBHP);
+ nvic_irq_enable(NVIC_INT_USBLP);
/* Error fade */
while (1) {