parent
a44eb5f16a
commit
3784a46951
@ -0,0 +1,19 @@ |
||||
USB support is implemented using the STM32 USB Device library. |
||||
|
||||
The library is copied into the core project to make customizations easier to maintain |
||||
across different ports. The USBD library supports all versions of the HAL and LL. |
||||
|
||||
GEX uses USB classes CDC/ACM and MSC/SCSI. |
||||
The two classes are combined into a composite class with association descriptors. |
||||
|
||||
USB interrupts are processed by the USBD library and endpoint callbacks in the composite |
||||
class are fired. To avoid race conditions (and because DAPlink did it the same way), the |
||||
events are notified to the USB thread (TaskMain) which calls endpoint handlers in the |
||||
corresponding class drivers. |
||||
|
||||
VFS is handled synchronously on the main thread. CDC messages (TinyFrame data) are queued |
||||
and processed by the message queue thread. This makes it possible to query hardware |
||||
(e.g. slow USART or NeoPixel) without stalling the USB communication. This arrangement |
||||
also makes it possible to wait on a binary semaphore when sending data back to host. The |
||||
semaphore is set from the CDC TxComplete callback and taken by the TinyFrame write |
||||
function, serving as a form of flow control. |
@ -1,14 +1,59 @@ |
||||
//
|
||||
// Created by MightyPork on 2017/11/26.
|
||||
//
|
||||
// Those are low memory footprint implementations of some stdlib functions
|
||||
// taken from the AVR libc. They are used instead of newlib versions.
|
||||
//
|
||||
|
||||
#ifndef GEX_AVRLIBC_H_H |
||||
#define GEX_AVRLIBC_H_H |
||||
|
||||
/**
|
||||
* atoi() - parse decimal int from ASCII |
||||
* |
||||
* @param p - string |
||||
* @return int, 0 on failure |
||||
*/ |
||||
int avr_atoi(const char *p); |
||||
long avr_strtol(const char *nptr, char **endptr, register int base); |
||||
|
||||
/**
|
||||
* atol() - parse decimal long int from ASCII |
||||
* |
||||
* @param p - string |
||||
* @return int, 0 on failure |
||||
*/ |
||||
long avr_atol(const char *p); |
||||
|
||||
/**
|
||||
* strtol() - parse integer number form string. |
||||
* this is internally called by atol and atoi |
||||
* |
||||
* 0x is allowed for bases 0 and 16 |
||||
* |
||||
* @param nptr - string to parse |
||||
* @param endptr - NULL or pointer to string where the end will be stored (first bad char) |
||||
* @param base - base 2, 10, 16.... 0 for auto |
||||
* @return the number |
||||
*/ |
||||
long avr_strtol(const char *nptr, char **endptr, register int base); |
||||
|
||||
/**
|
||||
* Parse double from ASCII |
||||
* |
||||
* @param nptr - string to parse |
||||
* @param endptr - NULL or pointer to string where the end will be stored (first bad char) |
||||
* @return the number |
||||
*/ |
||||
double avr_strtod (const char * nptr, char ** endptr); |
||||
|
||||
/**
|
||||
* like strtol(), but unsigned (and hence higher max value) |
||||
* |
||||
* @param nptr - string to parse |
||||
* @param endptr - NULL or pointer to string where the end will be stored (first bad char) |
||||
* @param base - base 2, 10, 16.... 0 for auto |
||||
* @return the number |
||||
*/ |
||||
unsigned long avr_strtoul(const char *nptr, char **endptr, register int base); |
||||
|
||||
#endif //GEX_AVRLIBC_H_H
|
||||
|
Loading…
Reference in new issue