diff options
| author | hathach <[email protected]> | 2018-12-05 14:02:48 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-12-05 14:02:48 +0700 |
| commit | cf60b206528fc955bbdd1bfec2c7016a985313ea (patch) | |
| tree | 50411de91abbd898b9f191932dc256dd30637bd6 /doxygen/porting.md | |
| parent | 861e7e6a7982c3e2b7e3c05b566eb06cd32b15c4 (diff) | |
| parent | 734b3ada8a57ca4c8c90a7502c5547a891886481 (diff) | |
Merge pull request #18 from hathach/devlocal
Devlocal
Diffstat (limited to 'doxygen/porting.md')
| -rw-r--r-- | doxygen/porting.md | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/doxygen/porting.md b/doxygen/porting.md index be917d6f7..5a464fa6b 100644 --- a/doxygen/porting.md +++ b/doxygen/porting.md @@ -59,19 +59,6 @@ The OPT_OS_NONE option is the only option which requires an MCU specific functio `tusb_hal_millis` is also provided in `hw/bsp/<board name>/board_<board name>.c` because it may vary with MCU use. -### Hardware Abstraction Layer (HAL) -The hardware abstraction layer is a minimal set of abstractions used in both Device and Host USB modes. - -The HAL implementations are located in `src/portable/<vendor>/<chip family>/hal_<chip family>.c`. - -#### tusb_hal_init - -The HAL init is responsible for configuring common settings of USB peripheral such as pad calibration. - -#### tusb_hal_int_enable / tusb_hal_int_disable - -Enables or disables the USB interrupt(s). May be used to prevent concurrency issues when mutating data structures shared between main code and the interrupt handler. - ### Device API After the USB device is setup, the USB device code works by processing events on the main thread (by calling `tusb_task`). These events are queued by the USB interrupt handler. So, there are three parts to the device low-level API: device setup, endpoint setup and interrupt processing. @@ -79,16 +66,22 @@ After the USB device is setup, the USB device code works by processing events on All of the code for the low-level device API is in `src/portable/<vendor>/<chip family>/dcd_<chip family>.c`. #### Device Setup -`dcd_connect`, `dcd_disconnect` and `dcd_set_config` are not currently used and can be left empty. ##### dcd_init Initializes the USB peripheral for device mode and enables it. +#### dcd_int_enable / dcd_int_disable + +Enables or disables the USB device interrupt(s). May be used to prevent concurrency issues when mutating data structures shared between main code and the interrupt handler. + ##### dcd_set_address Called when the device is given a new bus address. If your peripheral automatically changes address during enumeration (like the nrf52) you may leave this empty and also no queue an event for the corresponding SETUP packet. +##### dcd_set_config +Called when the device received SET_CONFIG request, you can leave this empty if your peripheral does not require any specific action. + #### Special events You must let TinyUSB know when certain events occur so that it can continue its work. There are a few methods you can call to queue events for TinyUSB to process. |
