aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2016-04-20 17:30:41 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2016-04-20 17:30:41 +0900
commit437b2dc43ca2e9b39b7be40f41b233bbaa8f8362 (patch)
treea5f79be7bc5e7374244befe23955c700ea9407e7
parent3eac2459815c0826d811ed808e5d7687c03638b8 (diff)
Update for STM32
-rw-r--r--ChangeLog14
-rw-r--r--example-cdc/sys.c2
-rw-r--r--example-cdc/usb-cdc.c8
-rw-r--r--example-cdc/usb_lld.h3
-rw-r--r--example-cdc/usb_stm32f103.c11
-rw-r--r--example-led/sys.c2
-rw-r--r--example-primer2/sys.c2
7 files changed, 22 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index d7c038f..260ac78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,16 @@
-2016-04-19 gniibe <gniibe@fsij.org>
+2016-04-20 Niibe Yutaka <gniibe@fsij.org>
+
+ * example-cdc/usb_stm32f103.c (usb_lld_reset): Supply FEATURE
+ argument. Call usb_lld_set_configuration internally and set
+ FEATURE.
+ (usb_lld_set_feature): Remove.
+ * example-cdc/usb-cdc.c (usb_cb_device_reset): Update with new
+ API.
+
+ * example-cdc/sys.c: Include clk_gpio_init-stm32.c.
+ * example-led/sys.c, example-primer2/sys.c: Ditto.
+
+2016-04-19 Niibe Yutaka <gniibe@fsij.org>
* example-fs-bb48/sample.c (main): Change the example to display
CRC32 value from input line.
diff --git a/example-cdc/sys.c b/example-cdc/sys.c
index 586a79f..2cb9894 100644
--- a/example-cdc/sys.c
+++ b/example-cdc/sys.c
@@ -17,7 +17,7 @@
#include <stdlib.h>
#include "board.h"
-#include "clk_gpio_init.c"
+#include "clk_gpio_init-stm32.c"
#define CORTEX_PRIORITY_BITS 4
#define CORTEX_PRIORITY_MASK(n) ((n) << (8 - CORTEX_PRIORITY_BITS))
diff --git a/example-cdc/usb-cdc.c b/example-cdc/usb-cdc.c
index d2c4961..6af47a8 100644
--- a/example-cdc/usb-cdc.c
+++ b/example-cdc/usb-cdc.c
@@ -163,13 +163,7 @@ uint32_t bDeviceState = UNCONNECTED; /* USB device status */
void
usb_cb_device_reset (void)
{
- /* Set DEVICE as not configured */
- usb_lld_set_configuration (0);
-
- /* Current Feature initialization */
- usb_lld_set_feature (vcom_config_desc[7]);
-
- usb_lld_reset ();
+ usb_lld_reset (vcom_config_desc[7]);
/* Initialize Endpoint 0 */
usb_lld_setup_endpoint (ENDP0, EP_CONTROL, 0, ENDP0_RXADDR, ENDP0_TXADDR, 64);
diff --git a/example-cdc/usb_lld.h b/example-cdc/usb_lld.h
index 86de9bc..3710f20 100644
--- a/example-cdc/usb_lld.h
+++ b/example-cdc/usb_lld.h
@@ -104,13 +104,12 @@ int usb_lld_reply_request (const void *buf, size_t buflen,
void usb_lld_rx_enable (int ep_num);
int usb_lld_rx_data_len (int ep_num);
void usb_lld_rxcpy (uint8_t *dst, int ep_num, int offset, size_t len);
-void usb_lld_reset (void);
+void usb_lld_reset (uint8_t feature);
void usb_lld_setup_endpoint (int ep_num, int ep_type, int ep_kind,
int ep_rx_addr, int ep_tx_addr,
int ep_rx_memory_size);
void usb_lld_set_configuration (uint8_t config);
uint8_t usb_lld_current_configuration (void);
-void usb_lld_set_feature (uint8_t feature);
void usb_lld_set_data_to_recv (void *p, size_t len);
void usb_lld_prepare_shutdown (void);
diff --git a/example-cdc/usb_stm32f103.c b/example-cdc/usb_stm32f103.c
index 2dac791..80fbcc7 100644
--- a/example-cdc/usb_stm32f103.c
+++ b/example-cdc/usb_stm32f103.c
@@ -355,7 +355,7 @@ void usb_lld_init (uint8_t feature)
dev_p->state = IN_DATA;
usb_lld_set_configuration (0);
- usb_lld_set_feature (feature);
+ dev_p->current_feature = feature;
/* Reset USB */
st103_set_cntr (CNTR_FRES);
@@ -891,8 +891,10 @@ usb_handle_transfer (uint16_t istr_value)
}
}
-void usb_lld_reset (void)
+void usb_lld_reset (uint8_t feature)
{
+ usb_lld_set_configuration (0);
+ dev_p->current_feature = feature;
st103_set_btable ();
st103_set_daddr (0);
}
@@ -999,11 +1001,6 @@ uint8_t usb_lld_current_configuration (void)
return dev_p->current_configuration;
}
-void usb_lld_set_feature (uint8_t feature)
-{
- dev_p->current_feature = feature;
-}
-
void usb_lld_set_data_to_recv (void *p, size_t len)
{
data_p->addr = p;
diff --git a/example-led/sys.c b/example-led/sys.c
index a37c393..d488b20 100644
--- a/example-led/sys.c
+++ b/example-led/sys.c
@@ -17,7 +17,7 @@
#include <stdlib.h>
#include "board.h"
-#include "clk_gpio_init.c"
+#include "clk_gpio_init-stm32.c"
#define CORTEX_PRIORITY_BITS 4
#define CORTEX_PRIORITY_MASK(n) ((n) << (8 - CORTEX_PRIORITY_BITS))
diff --git a/example-primer2/sys.c b/example-primer2/sys.c
index 6481703..a399b7f 100644
--- a/example-primer2/sys.c
+++ b/example-primer2/sys.c
@@ -27,7 +27,7 @@
(RCC_APB2RSTR_IOPARST | RCC_APB2RSTR_IOPDRST | RCC_APB2RSTR_IOPERST \
| RCC_APB2RSTR_IOPCRST | RCC_APB2RSTR_IOPBRST)
-#include "clk_gpio_init.c"
+#include "clk_gpio_init-stm32.c"
static struct GPIO *const GPIO_OTHER1 = ((struct GPIO *const) GPIOC_BASE);
static struct GPIO *const GPIO_OTHER2 = ((struct GPIO *const) GPIOB_BASE);