summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmir Hammad <amir.hammad@hotmail.com>2015-04-08 07:50:31 +0200
committerAmir Hammad <amir.hammad@hotmail.com>2015-04-08 08:08:09 +0200
commit7503fd901abe55078209d9bc822ff9e7a6c56215 (patch)
tree28e61280037740089d0078f705cf0ec8785330bd
parent5622fb0fdae5d1039108848ab98d5060fe3244d4 (diff)
downloadsecure-hid-7503fd901abe55078209d9bc822ff9e7a6c56215.tar.gz
secure-hid-7503fd901abe55078209d9bc822ff9e7a6c56215.tar.bz2
secure-hid-7503fd901abe55078209d9bc822ff9e7a6c56215.zip
lld: stm32f4: Move driver definitions to the end of file
This way, we don't need forward declarations Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
-rw-r--r--src/usbh_lld_stm32f4.c85
1 files changed, 38 insertions, 47 deletions
diff --git a/src/usbh_lld_stm32f4.c b/src/usbh_lld_stm32f4.c
index 4ee9d77..fc59dd1 100644
--- a/src/usbh_lld_stm32f4.c
+++ b/src/usbh_lld_stm32f4.c
@@ -38,9 +38,6 @@
/* Transmit periodic FIFO size in 32-bit words. */
#define TX_P_FIFO_SIZE (64)
-
-
-
enum CHANNEL_STATE {
CHANNEL_STATE_FREE = 0,
CHANNEL_STATE_WORK = 1
@@ -103,55 +100,12 @@ typedef struct _usbh_lld_stm32f4_driver_data usbh_lld_stm32f4_driver_data_t;
#define REBASE_CH(reg, x) MMIO32(USB_OTG_HS_BASE + reg(x))
#endif
-
-static void stm32f4_usbh_init(void *drvdata);
-static enum USBH_POLL_STATUS stm32f4_usbh_poll(void *drvdata, uint32_t time_curr_us);
-static void stm32f4_usbh_read(void *drvdata, usbh_packet_t *packet);
-static void stm32f4_usbh_write(void *drvdata, const usbh_packet_t *packet);
-uint8_t stm32f4_root_speed(void *drvdata);
-
static int8_t get_free_channel(void *drvdata);
static void channels_init(void *drvdata);
static void rxflvl_handle(void *drvdata);
static void free_channel(void *drvdata, uint8_t channel);
-// USB Full Speed - OTG_FS
-#if defined(USE_STM32F4_USBH_DRIVER_FS)
-#define NUM_CHANNELS_FS (8)
-static channel_t channels_fs[NUM_CHANNELS_FS];
-static usbh_lld_stm32f4_driver_data_t driver_data_fs = {
- .base = USB_OTG_FS_BASE,
- .channels = channels_fs,
- .num_channels = NUM_CHANNELS_FS
-};
-const usbh_driver_t stm32f4_usbh_driver_fs = {
- .init = stm32f4_usbh_init,
- .poll = stm32f4_usbh_poll,
- .read = stm32f4_usbh_read,
- .write = stm32f4_usbh_write,
- .root_speed = stm32f4_root_speed,
- .driver_data = &driver_data_fs
-};
-#endif
-// USB High Speed - OTG_HS
-#if defined(USE_STM32F4_USBH_DRIVER_HS)
-#define NUM_CHANNELS_HS (12)
-static channel_t channels_hs[NUM_CHANNELS_HS];
-static usbh_lld_stm32f4_driver_data_t driver_data_hs = {
- .base = USB_OTG_HS_BASE,
- .channels = channels_hs,
- .num_channels = NUM_CHANNELS_HS
-};
-const usbh_driver_t stm32f4_usbh_driver_hs = {
- .init = stm32f4_usbh_init,
- .poll = stm32f4_usbh_poll,
- .read = stm32f4_usbh_read,
- .write = stm32f4_usbh_write,
- .root_speed = stm32f4_root_speed,
- .driver_data = &driver_data_hs
-};
-#endif
@@ -1000,7 +954,7 @@ static void channels_init(void *drvdata)
* Get speed of connected device
*
*/
-uint8_t stm32f4_root_speed(void *drvdata)
+static uint8_t stm32f4_root_speed(void *drvdata)
{
usbh_lld_stm32f4_driver_data_t *dev = drvdata;
(void)dev;
@@ -1036,6 +990,43 @@ void print_channels(const void *lld)
}
#endif
+// USB Full Speed - OTG_FS
+#if defined(USE_STM32F4_USBH_DRIVER_FS)
+#define NUM_CHANNELS_FS (8)
+static channel_t channels_fs[NUM_CHANNELS_FS];
+static usbh_lld_stm32f4_driver_data_t driver_data_fs = {
+ .base = USB_OTG_FS_BASE,
+ .channels = channels_fs,
+ .num_channels = NUM_CHANNELS_FS
+};
+const usbh_driver_t stm32f4_usbh_driver_fs = {
+ .init = stm32f4_usbh_init,
+ .poll = stm32f4_usbh_poll,
+ .read = stm32f4_usbh_read,
+ .write = stm32f4_usbh_write,
+ .root_speed = stm32f4_root_speed,
+ .driver_data = &driver_data_fs
+};
+#endif
+
+// USB High Speed - OTG_HS
+#if defined(USE_STM32F4_USBH_DRIVER_HS)
+#define NUM_CHANNELS_HS (12)
+static channel_t channels_hs[NUM_CHANNELS_HS];
+static usbh_lld_stm32f4_driver_data_t driver_data_hs = {
+ .base = USB_OTG_HS_BASE,
+ .channels = channels_hs,
+ .num_channels = NUM_CHANNELS_HS
+};
+const usbh_driver_t stm32f4_usbh_driver_hs = {
+ .init = stm32f4_usbh_init,
+ .poll = stm32f4_usbh_poll,
+ .read = stm32f4_usbh_read,
+ .write = stm32f4_usbh_write,
+ .root_speed = stm32f4_root_speed,
+ .driver_data = &driver_data_hs
+};
+#endif
const void *usbh_lld_stm32f4_drivers[] = {
#if defined(USE_STM32F4_USBH_DRIVER_FS)