Browse Source

Rename header file to USBHost_t36.h

main
PaulStoffregen 7 years ago
parent
commit
ea75a1c673
8 changed files with 37 additions and 16 deletions
  1. +30
    -9
      USBHost_t36.h
  2. +1
    -1
      ehci.cpp
  3. +1
    -1
      enumeration.cpp
  4. +1
    -1
      hub.cpp
  5. +1
    -1
      keyboard.cpp
  6. +1
    -1
      memory.cpp
  7. +1
    -1
      midi.cpp
  8. +1
    -1
      print.cpp

USBHost.h → USBHost_t36.h View File

#define USBHOST_PRINT_DEBUG #define USBHOST_PRINT_DEBUG


/************************************************/ /************************************************/
/* Data Structure Definitions */
/* Data Types */
/************************************************/ /************************************************/


These 6 types are the key to understanding how this USB Host
library really works.

// USBHost is a static class controlling the hardware.
// All common USB functionality is implemented here.
class USBHost; class USBHost;
class USBDriver;
class USBDriverTimer;

// These 3 structures represent the actual USB entities
// USBHost manipulates. One Device_t is created for
// each active USB device. One Pipe_t is create for
// each endpoint. Transfer_t structures are created
// when any data transfer is added to the EHCI work
// queues, and then returned to the free pool after the
// data transfer completes and the driver has processed
// the results.
typedef struct Device_struct Device_t; typedef struct Device_struct Device_t;
typedef struct Pipe_struct Pipe_t; typedef struct Pipe_struct Pipe_t;
typedef struct Transfer_struct Transfer_t; typedef struct Transfer_struct Transfer_t;
//typedef struct DriverTimer_struct DriverTimer_t;

// All USB device drivers inherit use these classes.
// Drivers build user-visible functionality on top
// of these classes, which receive USB events from
// USBHost.
class USBDriver;
class USBDriverTimer;


/************************************************/
/* Data Structure Definitions */
/************************************************/


// setup_t holds the 8 byte USB SETUP packet data. // setup_t holds the 8 byte USB SETUP packet data.
// These unions & structs allow convenient access to // These unions & structs allow convenient access to
Device_t *device; Device_t *device;
uint8_t type; // 0=control, 1=isochronous, 2=bulk, 3=interrupt uint8_t type; // 0=control, 1=isochronous, 2=bulk, 3=interrupt
uint8_t direction; // 0=out, 1=in (changes for control, others fixed) uint8_t direction; // 0=out, 1=in (changes for control, others fixed)
uint8_t start_mask; // TODO: is this redundant?
uint8_t complete_mask; // TODO: is this redundant?
uint8_t start_mask;
uint8_t complete_mask;
Pipe_t *next; Pipe_t *next;
void (*callback_function)(const Transfer_t *); void (*callback_function)(const Transfer_t *);
uint16_t periodic_interval; uint16_t periodic_interval;
uint16_t periodic_offset; // TODO: is this redundant?
uint16_t periodic_offset;
uint32_t unused1; uint32_t unused1;
uint32_t unused2; uint32_t unused2;
uint32_t unused3; uint32_t unused3;
static void println(const char *s, long n, uint8_t b) {} static void println(const char *s, long n, uint8_t b) {}
static void println(const char *s, unsigned long n, uint8_t b) {} static void println(const char *s, unsigned long n, uint8_t b) {}
#endif #endif

static void mk_setup(setup_t &s, uint32_t bmRequestType, uint32_t bRequest, static void mk_setup(setup_t &s, uint32_t bmRequestType, uint32_t bRequest,
uint32_t wValue, uint32_t wIndex, uint32_t wLength) { uint32_t wValue, uint32_t wIndex, uint32_t wLength) {
s.word1 = bmRequestType | (bRequest << 8) | (wValue << 16); s.word1 = bmRequestType | (bRequest << 8) | (wValue << 16);
void start_debounce_timer(uint32_t port); void start_debounce_timer(uint32_t port);
void stop_debounce_timer(uint32_t port); void stop_debounce_timer(uint32_t port);
static volatile bool reset_busy; static volatile bool reset_busy;

USBDriverTimer debouncetimer; USBDriverTimer debouncetimer;
USBDriverTimer resettimer; USBDriverTimer resettimer;
setup_t setup; setup_t setup;

+ 1
- 1
ehci.cpp View File

*/ */


#include <Arduino.h> #include <Arduino.h>
#include "USBHost.h"
#include "USBHost_t36.h" // Read this header first for key info


// Size of the periodic list, in milliseconds. This determines the // Size of the periodic list, in milliseconds. This determines the
// slowest rate we can poll interrupt endpoints. Each entry uses // slowest rate we can poll interrupt endpoints. Each entry uses

+ 1
- 1
enumeration.cpp View File

*/ */


#include <Arduino.h> #include <Arduino.h>
#include "USBHost.h"
#include "USBHost_t36.h" // Read this header first for key info




static USBDriver *available_drivers = NULL; static USBDriver *available_drivers = NULL;

+ 1
- 1
hub.cpp View File

*/ */


#include <Arduino.h> #include <Arduino.h>
#include "USBHost.h"
#include "USBHost_t36.h" // Read this header first for key info


// True when any hub port is in the reset or reset recovery phase. // True when any hub port is in the reset or reset recovery phase.
// Only one USB device may be reset at a time, because it will // Only one USB device may be reset at a time, because it will

+ 1
- 1
keyboard.cpp View File

*/ */


#include <Arduino.h> #include <Arduino.h>
#include "USBHost.h"
#include "USBHost_t36.h" // Read this header first for key info




KeyboardController::KeyboardController() KeyboardController::KeyboardController()

+ 1
- 1
memory.cpp View File

*/ */


#include <Arduino.h> #include <Arduino.h>
#include "USBHost.h"
#include "USBHost_t36.h" // Read this header first for key info




// Memory allocation // Memory allocation

+ 1
- 1
midi.cpp View File

*/ */


#include <Arduino.h> #include <Arduino.h>
#include "USBHost.h"
#include "USBHost_t36.h" // Read this header first for key info




MIDIDevice::MIDIDevice() MIDIDevice::MIDIDevice()

+ 1
- 1
print.cpp View File

*/ */


#include <Arduino.h> #include <Arduino.h>
#include "USBHost.h"
#include "USBHost_t36.h" // Read this header first for key info


#ifdef USBHOST_PRINT_DEBUG #ifdef USBHOST_PRINT_DEBUG



Loading…
Cancel
Save