Embedded Xinu Operating System
An ongoing research project and educational operating system.
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups Pages
Macros | Enumerations | Functions
usb_dwc_hcd.c File Reference
#include <interrupt.h>
#include <mailbox.h>
#include <string.h>
#include <thread.h>
#include <usb_core_driver.h>
#include <usb_dwc_regs.h>
#include <usb_hcdi.h>
#include <usb_hub_defs.h>
#include <usb_std_defs.h>
#include "bcm2837.h"
#include <core.h>

Macros

#define WORD_ALIGN(n)   (((n) + sizeof(ulong) - 1) & ~(sizeof(ulong) - 1))
 
#define IS_WORD_ALIGNED(ptr)   ((ulong)(ptr) % sizeof(ulong) == 0)
 
#define USB_MAX_PACKET_SIZE   1024
 
#define XFER_SCHEDULER_THREAD_STACK_SIZE   4096
 
#define XFER_SCHEDULER_THREAD_PRIORITY   60
 
#define XFER_SCHEDULER_THREAD_NAME   "USB scheduler"
 
#define DEFER_XFER_THREAD_STACK_SIZE   4096
 
#define DEFER_XFER_THREAD_PRIORITY   100
 
#define DEFER_XFER_THREAD_NAME   "USB defer xfer"
 
#define START_SPLIT_INTR_TRANSFERS_ON_SOF   1
 

Enumerations

enum  dwc_usb_pid { DWC_USB_PID_DATA0 = 0, DWC_USB_PID_DATA1 = 2, DWC_USB_PID_DATA2 = 1, DWC_USB_PID_SETUP = 3 }
 
enum  dwc_intr_status {
  XFER_COMPLETE = 0, XFER_FAILED = 1, XFER_NEEDS_DEFERRAL = 2, XFER_NEEDS_RESTART = 3,
  XFER_NEEDS_TRANS_RESTART = 4
}
 

Functions

usb_status_t hcd_start (void)
 
void hcd_stop (void)
 
usb_status_t hcd_submit_xfer_request (struct usb_xfer_request *req)
 

Detailed Description

This file contains a USB Host Controller Driver for the Synopsys DesignWare Hi-Speed USB 2.0 On-The-Go Controller.

Macro Definition Documentation

#define DEFER_XFER_THREAD_NAME   "USB defer xfer"

Name of USB defer transfer threads. Note: including the null-terminator this should be at most TNMLEN, otherwise it will be truncated.

#define DEFER_XFER_THREAD_PRIORITY   100

Priority of USB deferred transfer threads (should be very high since these threads are used for the necessary software polling of interrupt endpoints, which are supposed to have guaranteed bandwidth).

#define DEFER_XFER_THREAD_STACK_SIZE   4096

Stack size of USB deferred transfer threads (can be fairly small).

#define IS_WORD_ALIGNED (   ptr)    ((ulong)(ptr) % sizeof(ulong) == 0)

Determines whether a pointer is word-aligned or not.

#define START_SPLIT_INTR_TRANSFERS_ON_SOF   1

TODO: remove this if appropriate

#define USB_MAX_PACKET_SIZE   1024

Maximum packet size of any USB endpoint. 1024 is the maximum allowed by USB 2.0. Most endpoints will provide maximum packet sizes much smaller than this.

#define WORD_ALIGN (   n)    (((n) + sizeof(ulong) - 1) & ~(sizeof(ulong) - 1))

Round a number up to the next multiple of the word size.

#define XFER_SCHEDULER_THREAD_NAME   "USB scheduler"

Name of USB transfer request scheduler thread.

#define XFER_SCHEDULER_THREAD_PRIORITY   60

Priority of USB transfer request scheduler thread (should be fairly high so that USB transfers can be started as soon as possible).

#define XFER_SCHEDULER_THREAD_STACK_SIZE   4096

Stack size of USB transfer request scheduler thread (can be fairly small).

Enumeration Type Documentation

USB packet ID constants recognized by the DWC hardware.