-
-
- #ifndef USB_HOST_TEENSY36_
- #define USB_HOST_TEENSY36_
-
- #include <stdint.h>
-
- typedef struct Device_struct Device_t;
- typedef struct Pipe_struct Pipe_t;
- typedef struct Transfer_struct Transfer_t;
-
-
- typedef union {
- struct {
- union {
- struct {
- uint8_t bmRequestType;
- uint8_t bRequest;
- };
- uint16_t wRequestAndType;
- };
- uint16_t wValue;
- uint16_t wIndex;
- uint16_t wLength;
- };
- struct {
- uint32_t word1;
- uint32_t word2;
- };
- } setup_t;
-
-
- struct Device_struct {
- Pipe_t *control_pipe;
- Device_t *next;
- setup_t setup;
- uint8_t speed;
- uint8_t address;
- uint8_t hub_address;
- uint8_t hub_port;
- uint8_t enum_state;
- };
-
- struct Pipe_struct {
-
- struct {
- volatile uint32_t horizontal_link;
- volatile uint32_t capabilities[2];
- volatile uint32_t current;
- volatile uint32_t next;
- volatile uint32_t alt_next;
- volatile uint32_t token;
- volatile uint32_t buffer[5];
- } qh;
- Device_t *device;
- uint8_t type;
- uint8_t direction;
- uint8_t unusedbyte[2];
- void *callback_object;
- void (*callback_function)(const Transfer_t *);
- };
-
-
- struct Transfer_struct {
-
- struct {
- volatile uint32_t next;
- volatile uint32_t alt_next;
- volatile uint32_t token;
- volatile uint32_t buffer[5];
- } qtd;
-
- Transfer_t *next_followup;
- Transfer_t *prev_followup;
-
- Pipe_t *pipe;
- void *buffer;
- uint32_t length;
- uint32_t unused[3];
- };
-
- void init_Device_Pipe_Transfer_memory(void);
- Device_t * allocate_Device(void);
- void free_Device(Device_t *q);
- Pipe_t * allocate_Pipe(void);
- void free_Pipe(Pipe_t *q);
- Transfer_t * allocate_Transfer(void);
- void free_Transfer(Transfer_t *q);
-
- #endif
|