Update for STM32
This commit is contained in:
14
ChangeLog
14
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
|
* example-fs-bb48/sample.c (main): Change the example to display
|
||||||
CRC32 value from input line.
|
CRC32 value from input line.
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
||||||
#include "clk_gpio_init.c"
|
#include "clk_gpio_init-stm32.c"
|
||||||
|
|
||||||
#define CORTEX_PRIORITY_BITS 4
|
#define CORTEX_PRIORITY_BITS 4
|
||||||
#define CORTEX_PRIORITY_MASK(n) ((n) << (8 - CORTEX_PRIORITY_BITS))
|
#define CORTEX_PRIORITY_MASK(n) ((n) << (8 - CORTEX_PRIORITY_BITS))
|
||||||
|
|||||||
@@ -163,13 +163,7 @@ uint32_t bDeviceState = UNCONNECTED; /* USB device status */
|
|||||||
void
|
void
|
||||||
usb_cb_device_reset (void)
|
usb_cb_device_reset (void)
|
||||||
{
|
{
|
||||||
/* Set DEVICE as not configured */
|
usb_lld_reset (vcom_config_desc[7]);
|
||||||
usb_lld_set_configuration (0);
|
|
||||||
|
|
||||||
/* Current Feature initialization */
|
|
||||||
usb_lld_set_feature (vcom_config_desc[7]);
|
|
||||||
|
|
||||||
usb_lld_reset ();
|
|
||||||
|
|
||||||
/* Initialize Endpoint 0 */
|
/* Initialize Endpoint 0 */
|
||||||
usb_lld_setup_endpoint (ENDP0, EP_CONTROL, 0, ENDP0_RXADDR, ENDP0_TXADDR, 64);
|
usb_lld_setup_endpoint (ENDP0, EP_CONTROL, 0, ENDP0_RXADDR, ENDP0_TXADDR, 64);
|
||||||
|
|||||||
@@ -104,13 +104,12 @@ int usb_lld_reply_request (const void *buf, size_t buflen,
|
|||||||
void usb_lld_rx_enable (int ep_num);
|
void usb_lld_rx_enable (int ep_num);
|
||||||
int usb_lld_rx_data_len (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_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,
|
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_addr, int ep_tx_addr,
|
||||||
int ep_rx_memory_size);
|
int ep_rx_memory_size);
|
||||||
void usb_lld_set_configuration (uint8_t config);
|
void usb_lld_set_configuration (uint8_t config);
|
||||||
uint8_t usb_lld_current_configuration (void);
|
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_set_data_to_recv (void *p, size_t len);
|
||||||
|
|
||||||
void usb_lld_prepare_shutdown (void);
|
void usb_lld_prepare_shutdown (void);
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ void usb_lld_init (uint8_t feature)
|
|||||||
dev_p->state = IN_DATA;
|
dev_p->state = IN_DATA;
|
||||||
|
|
||||||
usb_lld_set_configuration (0);
|
usb_lld_set_configuration (0);
|
||||||
usb_lld_set_feature (feature);
|
dev_p->current_feature = feature;
|
||||||
|
|
||||||
/* Reset USB */
|
/* Reset USB */
|
||||||
st103_set_cntr (CNTR_FRES);
|
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_btable ();
|
||||||
st103_set_daddr (0);
|
st103_set_daddr (0);
|
||||||
}
|
}
|
||||||
@@ -999,11 +1001,6 @@ uint8_t usb_lld_current_configuration (void)
|
|||||||
return dev_p->current_configuration;
|
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)
|
void usb_lld_set_data_to_recv (void *p, size_t len)
|
||||||
{
|
{
|
||||||
data_p->addr = p;
|
data_p->addr = p;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
||||||
#include "clk_gpio_init.c"
|
#include "clk_gpio_init-stm32.c"
|
||||||
|
|
||||||
#define CORTEX_PRIORITY_BITS 4
|
#define CORTEX_PRIORITY_BITS 4
|
||||||
#define CORTEX_PRIORITY_MASK(n) ((n) << (8 - CORTEX_PRIORITY_BITS))
|
#define CORTEX_PRIORITY_MASK(n) ((n) << (8 - CORTEX_PRIORITY_BITS))
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
(RCC_APB2RSTR_IOPARST | RCC_APB2RSTR_IOPDRST | RCC_APB2RSTR_IOPERST \
|
(RCC_APB2RSTR_IOPARST | RCC_APB2RSTR_IOPDRST | RCC_APB2RSTR_IOPERST \
|
||||||
| RCC_APB2RSTR_IOPCRST | RCC_APB2RSTR_IOPBRST)
|
| 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_OTHER1 = ((struct GPIO *const) GPIOC_BASE);
|
||||||
static struct GPIO *const GPIO_OTHER2 = ((struct GPIO *const) GPIOB_BASE);
|
static struct GPIO *const GPIO_OTHER2 = ((struct GPIO *const) GPIOB_BASE);
|
||||||
|
|||||||
Reference in New Issue
Block a user