AM261x MCU+ SDK  11.00.00
os_defs.h File Reference

Introduction

This file contains OS-specific includes and definitions.

Go to the source code of this file.

#define DWC_DMA_ADDR_INVALID   (~(dwc_dma_t)0)
 
typedef unsigned long dwc_dma_t
 

Data Structures

struct  task_struct
 
struct  tasklet_struct
 
struct  dwc_usb3_core_params_t
 
struct  usb_ep_t
 
struct  usb_request_t
 
struct  usb_dfu_functional_descriptor_t
 
struct  fs_msc_config_desc_t
 
struct  hs_msc_config_desc_t
 
struct  dfu_config_desc_t
 
struct  ss_config_desc_t
 

Macros

#define NEAR
 
#define TRUE   1
 
#define FALSE   0
 
#define UPACKED
 
#define UALIGNED16   __attribute__((__aligned__(16)))
 
#define __iomem   /* */
 
#define KERN_DEBUG   "debug" /* debug messages */
 
#define KERN_INFO   "info" /* informational messages */
 
#define KERN_WARNING   "war" /* warning messages */
 
#define KERN_ERR   "err" /* error messages */
 
#define EIO   5 /* I/O error */
 
#define EAGAIN   11 /* Try again */
 
#define ENOMEM   12 /* Out of memory */
 
#define EBUSY   16 /* Device or resource busy */
 
#define ENODEV   19 /* No such device */
 
#define EINVAL   22 /* Invalid argument */
 
#define ENOSPC   28 /* No space left on device */
 
#define EPIPE   32 /* Broken pipe */
 
#define EDOM   33 /* Math argument out of domain of func */
 
#define ENODATA   61 /* No data available */
 
#define ENOSR   63 /* Out of streams resources */
 
#define ECOMM   70 /* Communication error on send */
 
#define EPROTO   71 /* Protocol error */
 
#define EOVERFLOW   75 /* Value too large for defined data type */
 
#define ERESTART   85 /* Interrupted system call should be restarted */
 
#define EOPNOTSUPP   95 /* Operation not supported on transport endpoint */
 
#define ECONNABORTED   103 /* Software caused connection abort */
 
#define ECONNRESET   104 /* Connection reset by peer */
 
#define ESHUTDOWN   108 /* Cannot send after transport endpoint shutdown */
 
#define ETIMEDOUT   110 /* Connection timed out */
 
#define EINPROGRESS   115 /* Operation now in progress */
 
#define wmb()   do {} while ((bool)(0))
 
#define interrupt_disable()   0
 
#define interrupt_enable()   do {} while ((bool)(0))
 
#define dwc_init_spinlock(d, p)   do {} while ((bool)(0))
 
#define dwc_acquire_spinlock(d, p)   do {} while ((bool)(0))
 
#define dwc_release_spinlock(d, p)   do {} while ((bool)(0))
 
#define dwc_acquire_spinlock_irq(d, p, f)   do { (f) = interrupt_disable(); } while ((bool)(0))
 
#define dwc_release_spinlock_irq(d, p, f)   do { if (f > 0U) { interrupt_enable(); } } while ((bool)(0))
 
#define DWC_NUM_BULK_TRBS   1
 
#define DWC_NUM_INTR_TRBS   1
 
#define DWC_NUM_ISOC_TRBS   32
 
Error Codes
#define DWC_E_INVALID   EINVAL
 
#define DWC_E_NO_MEMORY   ENOMEM
 
#define DWC_E_NO_DEVICE   ENODEV
 
#define DWC_E_NOT_SUPPORTED   EOPNOTSUPP
 
#define DWC_E_TIMEOUT   ETIMEDOUT
 
#define DWC_E_BUSY   EBUSY
 
#define DWC_E_AGAIN   EAGAIN
 
#define DWC_E_RESTART   ERESTART
 
#define DWC_E_ABORT   ECONNABORTED
 
#define DWC_E_SHUTDOWN   ESHUTDOWN
 
#define DWC_E_NO_DATA   ENODATA
 
#define DWC_E_DISCONNECT   ECONNRESET
 
#define DWC_E_UNKNOWN   EINVAL
 
#define DWC_E_NO_STREAM_RES   ENOSR
 
#define DWC_E_COMMUNICATION   ECOMM
 
#define DWC_E_OVERFLOW   EOVERFLOW
 
#define DWC_E_PROTOCOL   EPROTO
 
#define DWC_E_IN_PROGRESS   EINPROGRESS
 
#define DWC_E_PIPE   EPIPE
 
#define DWC_E_IO   EIO
 
#define DWC_E_NO_SPACE   ENOSPC
 
#define DWC_E_DOMAIN   EDOM
 

Typedefs

typedef unsigned long long u64
 
typedef unsigned int u32
 
typedef unsigned short u16
 
typedef unsigned char u8
 
typedef unsigned char UINT8
 
typedef long long s64
 
typedef int s32
 
typedef short s16
 
typedef char s8
 
typedef unsigned long u_long
 
typedef unsigned int u_int
 
typedef unsigned short u_short
 
typedef unsigned char u_char
 

Functions

static void dwc_usb3_task_schedule (volatile struct tasklet_struct *tasklet)
 
struct dwc_usb3_device * dwc_usb3_driver_init (u32 base_addr_dwc)
 
void dwc_usb3_driver_remove (void)
 
void dwc_usb3_common_irq (int irq, void *dev)
 
volatile usb_ep_tdwc_usb3_ep_enable (struct dwc_usb3_device *usb3_dev, const void *epdesc, const void *epcomp)
 
int dwc_usb3_ep_disable (volatile struct dwc_usb3_device *usb3_dev, volatile usb_ep_t *usb_ep)
 
int dwc_usb3_close_all_ep (volatile struct dwc_usb3_device *usb3_dev)
 
usb_request_tdwc_usb3_alloc_request (struct dwc_usb3_device *usb3_dev, volatile usb_ep_t *usb_ep)
 
void dwc_usb3_free_request (struct dwc_usb3_device *usb3_dev, volatile usb_ep_t *usb_ep, volatile usb_request_t *usb_req)
 
int dwc_usb3_ep_queue (struct dwc_usb3_device *usb3_dev, volatile usb_ep_t *usb_ep, usb_request_t *usb_req)
 
int dwc_usb3_ep_dequeue (struct dwc_usb3_device *usb3_dev, usb_ep_t *usb_ep, usb_request_t *usb_req)
 
int dwc_usb3_wait_pme (volatile struct dwc_usb3_device *usb3_dev)
 
int dwc_usb3_handle_pme_intr (volatile struct dwc_usb3_device *usb3_dev)
 
int dwc_usb3_function_init (struct dwc_usb3_device *usb3_dev)
 
void dwc_usb3_function_remove (struct dwc_usb3_device *usb3_dev)
 
int dwc_usb3_function_connect (struct dwc_usb3_device *usb3_dev, int speed)
 
int dwc_usb3_function_disconnect (struct dwc_usb3_device *usb3_dev)
 

Variables

fs_msc_config_desc_t fs_msc_config_desc
 
hs_msc_config_desc_t hs_msc_config_desc
 
ss_config_desc_t ss_config_desc
 
const dwc_usb3_core_params_t usb3ss_module_params
 

Macro Definition Documentation

◆ NEAR

#define NEAR

◆ TRUE

#define TRUE   1

◆ FALSE

#define FALSE   0

◆ DWC_DMA_ADDR_INVALID

#define DWC_DMA_ADDR_INVALID   (~(dwc_dma_t)0)

◆ UPACKED

#define UPACKED

Compiler 'packed' attribute

◆ UALIGNED16

#define UALIGNED16   __attribute__((__aligned__(16)))

Compiler 'aligned(16)' attribute — doesn't work with cl470. Use pragma DATA_ALIGN instead

◆ __iomem

#define __iomem   /* */

I/O memory attribute for pointers. Needed for Linux "sparse" tool.

◆ KERN_DEBUG

#define KERN_DEBUG   "debug" /* debug messages */

◆ KERN_INFO

#define KERN_INFO   "info" /* informational messages */

◆ KERN_WARNING

#define KERN_WARNING   "war" /* warning messages */

◆ KERN_ERR

#define KERN_ERR   "err" /* error messages */

◆ EIO

#define EIO   5 /* I/O error */

◆ EAGAIN

#define EAGAIN   11 /* Try again */

◆ ENOMEM

#define ENOMEM   12 /* Out of memory */

◆ EBUSY

#define EBUSY   16 /* Device or resource busy */

◆ ENODEV

#define ENODEV   19 /* No such device */

◆ EINVAL

#define EINVAL   22 /* Invalid argument */

◆ ENOSPC

#define ENOSPC   28 /* No space left on device */

◆ EPIPE

#define EPIPE   32 /* Broken pipe */

◆ EDOM

#define EDOM   33 /* Math argument out of domain of func */

◆ ENODATA

#define ENODATA   61 /* No data available */

◆ ENOSR

#define ENOSR   63 /* Out of streams resources */

◆ ECOMM

#define ECOMM   70 /* Communication error on send */

◆ EPROTO

#define EPROTO   71 /* Protocol error */

◆ EOVERFLOW

#define EOVERFLOW   75 /* Value too large for defined data type */

◆ ERESTART

#define ERESTART   85 /* Interrupted system call should be restarted */

◆ EOPNOTSUPP

#define EOPNOTSUPP   95 /* Operation not supported on transport endpoint */

◆ ECONNABORTED

#define ECONNABORTED   103 /* Software caused connection abort */

◆ ECONNRESET

#define ECONNRESET   104 /* Connection reset by peer */

◆ ESHUTDOWN

#define ESHUTDOWN   108 /* Cannot send after transport endpoint shutdown */

◆ ETIMEDOUT

#define ETIMEDOUT   110 /* Connection timed out */

◆ EINPROGRESS

#define EINPROGRESS   115 /* Operation now in progress */

◆ wmb

#define wmb ( )    do {} while ((bool)(0))

Write memory barrier macro

◆ interrupt_disable

#define interrupt_disable ( )    0

◆ interrupt_enable

#define interrupt_enable ( )    do {} while ((bool)(0))

◆ dwc_init_spinlock

#define dwc_init_spinlock (   d,
 
)    do {} while ((bool)(0))

◆ dwc_acquire_spinlock

#define dwc_acquire_spinlock (   d,
 
)    do {} while ((bool)(0))

◆ dwc_release_spinlock

#define dwc_release_spinlock (   d,
 
)    do {} while ((bool)(0))

◆ dwc_acquire_spinlock_irq

#define dwc_acquire_spinlock_irq (   d,
  p,
 
)    do { (f) = interrupt_disable(); } while ((bool)(0))

◆ dwc_release_spinlock_irq

#define dwc_release_spinlock_irq (   d,
  p,
 
)    do { if (f > 0U) { interrupt_enable(); } } while ((bool)(0))

◆ DWC_E_INVALID

#define DWC_E_INVALID   EINVAL

◆ DWC_E_NO_MEMORY

#define DWC_E_NO_MEMORY   ENOMEM

◆ DWC_E_NO_DEVICE

#define DWC_E_NO_DEVICE   ENODEV

◆ DWC_E_NOT_SUPPORTED

#define DWC_E_NOT_SUPPORTED   EOPNOTSUPP

◆ DWC_E_TIMEOUT

#define DWC_E_TIMEOUT   ETIMEDOUT

◆ DWC_E_BUSY

#define DWC_E_BUSY   EBUSY

◆ DWC_E_AGAIN

#define DWC_E_AGAIN   EAGAIN

◆ DWC_E_RESTART

#define DWC_E_RESTART   ERESTART

◆ DWC_E_ABORT

#define DWC_E_ABORT   ECONNABORTED

◆ DWC_E_SHUTDOWN

#define DWC_E_SHUTDOWN   ESHUTDOWN

◆ DWC_E_NO_DATA

#define DWC_E_NO_DATA   ENODATA

◆ DWC_E_DISCONNECT

#define DWC_E_DISCONNECT   ECONNRESET

◆ DWC_E_UNKNOWN

#define DWC_E_UNKNOWN   EINVAL

◆ DWC_E_NO_STREAM_RES

#define DWC_E_NO_STREAM_RES   ENOSR

◆ DWC_E_COMMUNICATION

#define DWC_E_COMMUNICATION   ECOMM

◆ DWC_E_OVERFLOW

#define DWC_E_OVERFLOW   EOVERFLOW

◆ DWC_E_PROTOCOL

#define DWC_E_PROTOCOL   EPROTO

◆ DWC_E_IN_PROGRESS

#define DWC_E_IN_PROGRESS   EINPROGRESS

◆ DWC_E_PIPE

#define DWC_E_PIPE   EPIPE

◆ DWC_E_IO

#define DWC_E_IO   EIO

◆ DWC_E_NO_SPACE

#define DWC_E_NO_SPACE   ENOSPC

◆ DWC_E_DOMAIN

#define DWC_E_DOMAIN   EDOM

◆ DWC_NUM_BULK_TRBS

#define DWC_NUM_BULK_TRBS   1

The number of DMA Descriptors (TRBs) to allocate for each endpoint type. NOTE: The driver currently supports more than 1 TRB for Isoc EPs only. So the values for Bulk and Intr must be 1.

◆ DWC_NUM_INTR_TRBS

#define DWC_NUM_INTR_TRBS   1

◆ DWC_NUM_ISOC_TRBS

#define DWC_NUM_ISOC_TRBS   32

Typedef Documentation

◆ u64

typedef unsigned long long u64

Data types needed by the PCD

◆ u32

typedef unsigned int u32

◆ u16

typedef unsigned short u16

◆ u8

typedef unsigned char u8

◆ UINT8

typedef unsigned char UINT8

◆ s64

typedef long long s64

◆ s32

typedef int s32

◆ s16

typedef short s16

◆ s8

typedef char s8

◆ u_long

typedef unsigned long u_long

◆ u_int

typedef unsigned int u_int

◆ u_short

typedef unsigned short u_short

◆ u_char

typedef unsigned char u_char

◆ dwc_dma_t

typedef unsigned long dwc_dma_t

Data type for DMA addresses

Function Documentation

◆ dwc_usb3_task_schedule()

static void dwc_usb3_task_schedule ( volatile struct tasklet_struct tasklet)
inlinestatic

◆ dwc_usb3_driver_init()

struct dwc_usb3_device* dwc_usb3_driver_init ( u32  base_addr_dwc)

◆ dwc_usb3_driver_remove()

void dwc_usb3_driver_remove ( void  )

◆ dwc_usb3_common_irq()

void dwc_usb3_common_irq ( int  irq,
void *  dev 
)

◆ dwc_usb3_ep_enable()

volatile usb_ep_t* dwc_usb3_ep_enable ( struct dwc_usb3_device *  usb3_dev,
const void *  epdesc,
const void *  epcomp 
)

This routine enables a USB endpoint

Parameters
usb3_devProgramming view of DWC_usb3 device.
epdescUSB endpoint descriptor for the EP.
epcompUSB SS endpoint companion descriptor for the EP.
Returns
Pointer to USB EP context, or NULL on failure.

◆ dwc_usb3_ep_disable()

int dwc_usb3_ep_disable ( volatile struct dwc_usb3_device *  usb3_dev,
volatile usb_ep_t usb_ep 
)

This routine disables a USB endpoint

Parameters
usb3_devProgramming view of DWC_usb3 device.
usb_epUSB EP to disable.
Returns
0 for success, else negative error code.

◆ dwc_usb3_close_all_ep()

int dwc_usb3_close_all_ep ( volatile struct dwc_usb3_device *  usb3_dev)

This routine disables a all active non EP-0 USB endpoint

Parameters
usb3_devProgramming view of DWC_usb3 device.
Returns
0 for success, else negative error code.

◆ dwc_usb3_alloc_request()

usb_request_t* dwc_usb3_alloc_request ( struct dwc_usb3_device *  usb3_dev,
volatile usb_ep_t usb_ep 
)

This routine allocates a USB request object to use with the specified USB endpoint. The contents of a USB request are defined by the Function Driver, and are opaque to the PCD. The USB request is embedded inside of an enclosing PCD request object (see the definition of struct dwc_usb3_pcd_req in pcd.h). One request object is needed for each transfer that is submitted to the PCD.

Parameters
usb3_devProgramming view of DWC_usb3 device.
usb_epUSB EP for the request.

◆ dwc_usb3_free_request()

void dwc_usb3_free_request ( struct dwc_usb3_device *  usb3_dev,
volatile usb_ep_t usb_ep,
volatile usb_request_t usb_req 
)

This routine frees a USB request object

Parameters
usb3_devProgramming view of DWC_usb3 device.
usb_epUSB EP for the request.
usb_reqUSB request to be freed.

◆ dwc_usb3_ep_queue()

int dwc_usb3_ep_queue ( struct dwc_usb3_device *  usb3_dev,
volatile usb_ep_t usb_ep,
usb_request_t usb_req 
)

This routine submits a transfer request for a USB endpoint. The example code maintains a queue of requests for each endpoint, so that the application can start another transfer on the same endpoint without having to wait for the first transfer to complete.

Parameters
usb3_devProgramming view of DWC_usb3 device.
usb_epUSB EP for the transfer.
usb_reqUSB request for the transfer.
Returns
0 for success, else negative error code.

◆ dwc_usb3_ep_dequeue()

int dwc_usb3_ep_dequeue ( struct dwc_usb3_device *  usb3_dev,
usb_ep_t usb_ep,
usb_request_t usb_req 
)

This routine cancels a transfer request for a USB endpoint. This is only needed in exceptional cases, a normal transfer completion does not require this.

Parameters
usb3_devProgramming view of DWC_usb3 device.
usb_epUSB EP for the transfer.
usb_reqUSB request for the transfer.
Returns
0 for success, else negative error code.

◆ dwc_usb3_wait_pme()

int dwc_usb3_wait_pme ( volatile struct dwc_usb3_device *  usb3_dev)

◆ dwc_usb3_handle_pme_intr()

int dwc_usb3_handle_pme_intr ( volatile struct dwc_usb3_device *  usb3_dev)

◆ dwc_usb3_function_init()

int dwc_usb3_function_init ( struct dwc_usb3_device *  usb3_dev)

◆ dwc_usb3_function_remove()

void dwc_usb3_function_remove ( struct dwc_usb3_device *  usb3_dev)

◆ dwc_usb3_function_connect()

int dwc_usb3_function_connect ( struct dwc_usb3_device *  usb3_dev,
int  speed 
)

◆ dwc_usb3_function_disconnect()

int dwc_usb3_function_disconnect ( struct dwc_usb3_device *  usb3_dev)

Variable Documentation

◆ fs_msc_config_desc

fs_msc_config_desc_t fs_msc_config_desc
extern

◆ hs_msc_config_desc

hs_msc_config_desc_t hs_msc_config_desc
extern

◆ ss_config_desc

ss_config_desc_t ss_config_desc
extern

◆ usb3ss_module_params

const dwc_usb3_core_params_t usb3ss_module_params
extern