diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2017-11-14 00:26:16 +0100 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-07-09 14:09:10 +0000 |
commit | 278a76b3a6dbf658bd0d3ad67ad7f15d8b8fa32a (patch) | |
tree | c8f8e47974dca803517dc5c86db7ec8399dc5ee7 | |
parent | b64a286a81fcb2706eada010ffe4b561b473889e (diff) | |
download | rockbox-278a76b3a6dbf658bd0d3ad67ad7f15d8b8fa32a.tar.gz rockbox-278a76b3a6dbf658bd0d3ad67ad7f15d8b8fa32a.zip |
add some documentation in usb.h and usb_drv.h
Change-Id: Icd39ee5c017fc219144b33ef96b0df85c5d430da
-rw-r--r-- | firmware/export/usb.h | 3 | ||||
-rw-r--r-- | firmware/export/usb_drv.h | 36 |
2 files changed, 39 insertions, 0 deletions
diff --git a/firmware/export/usb.h b/firmware/export/usb.h index ff85cb99ce..0c74efc9e2 100644 --- a/firmware/export/usb.h +++ b/firmware/export/usb.h | |||
@@ -178,6 +178,9 @@ struct usb_transfer_completion_event_data | |||
178 | void usb_init(void) INIT_ATTR; | 178 | void usb_init(void) INIT_ATTR; |
179 | /* target must implement this to enable/disable the usb transceiver/core */ | 179 | /* target must implement this to enable/disable the usb transceiver/core */ |
180 | void usb_enable(bool on); | 180 | void usb_enable(bool on); |
181 | /* when one or more driver requires exclusive mode, this is called after all threads have acknowledged | ||
182 | * exclusive mode and disk have been umounted; otherwise it is called immediately after host has | ||
183 | * been detected */ | ||
181 | void usb_attach(void); | 184 | void usb_attach(void); |
182 | /* enable usb detection monitoring; before this function is called, all usb | 185 | /* enable usb detection monitoring; before this function is called, all usb |
183 | * detection changes are ignored */ | 186 | * detection changes are ignored */ |
diff --git a/firmware/export/usb_drv.h b/firmware/export/usb_drv.h index 6ec9ac07e5..b5b5a7f065 100644 --- a/firmware/export/usb_drv.h +++ b/firmware/export/usb_drv.h | |||
@@ -23,9 +23,45 @@ | |||
23 | #include "usb_ch9.h" | 23 | #include "usb_ch9.h" |
24 | #include "kernel.h" | 24 | #include "kernel.h" |
25 | 25 | ||
26 | /** USB initialisation flow: | ||
27 | * usb_init() | ||
28 | * -> usb_init_device() | ||
29 | * -> [soc specific one-time init] | ||
30 | * -> usb_drv_startup() | ||
31 | * ..... | ||
32 | * [USB is plugged] | ||
33 | * usb_enable(true) | ||
34 | * -> soc specific controller/clock init | ||
35 | * -> usb_core_init() | ||
36 | * -> usb_drv_init() | ||
37 | * -> usb_drv_int_enable(true) [only if controller needs soc specific code for interrupt] | ||
38 | * -> for each usb driver, driver.init() | ||
39 | * #ifdef USB_DETECT_BY_REQUEST | ||
40 | * [rockbox waits until first control request before proceeding] | ||
41 | * #endif | ||
42 | * [rockbox decides which usb drivers to enable, based on user preference and buttons] | ||
43 | * -> if not exclusive mode, usb_attach() | ||
44 | * -> if exclusive mode, usb_attach() call be called at any point starting from now | ||
45 | * (but after threads have acked usb mode and disk have been unmounted) | ||
46 | * for each enabled driver | ||
47 | * -> driver.request_endpoints() | ||
48 | * -> driver.set_first_interface() | ||
49 | * [usb controller/core start answering requests] | ||
50 | * ..... | ||
51 | * [USB is unplugged] | ||
52 | * usb_enable(false) | ||
53 | * -> usb_core_exit() | ||
54 | * -> for each enabled usb driver, driver.disconnect() | ||
55 | * -> usb_drv_exit() | ||
56 | * -> usb_drv_int_enable(false) [ditto] | ||
57 | * -> soc specific controller/clock deinit */ | ||
58 | |||
59 | /* one-time initialisation of the USB driver */ | ||
26 | void usb_drv_startup(void); | 60 | void usb_drv_startup(void); |
27 | void usb_drv_int_enable(bool enable); /* Target implemented */ | 61 | void usb_drv_int_enable(bool enable); /* Target implemented */ |
62 | /* enable and initialise the USB controller */ | ||
28 | void usb_drv_init(void); | 63 | void usb_drv_init(void); |
64 | /* stop and disable and the USB controller */ | ||
29 | void usb_drv_exit(void); | 65 | void usb_drv_exit(void); |
30 | void usb_drv_int(void); /* Call from target INT handler */ | 66 | void usb_drv_int(void); /* Call from target INT handler */ |
31 | void usb_drv_stall(int endpoint, bool stall,bool in); | 67 | void usb_drv_stall(int endpoint, bool stall,bool in); |