aboutsummaryrefslogtreecommitdiff
path: root/example-cdc
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 /example-cdc
parent3eac2459815c0826d811ed808e5d7687c03638b8 (diff)
Update for STM32
Diffstat (limited to 'example-cdc')
-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
4 files changed, 7 insertions, 17 deletions
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;