Defines | Functions | Variables

usb.h File Reference

For more information on this file please refer to Programmer’s Guide: MSP430 USB API Stack for CDC/HID http://focus.ti.com/docs/prod/folders/print/msp430f5529.html#toolssoftware. More...

Go to the source code of this file.

Defines

#define USB_RETURN_DATA_LENGTH   8
#define SIZEOF_DEVICE_REQUEST   0x08
#define USB_REQ_TYPE_OUTPUT   0x00
#define USB_REQ_TYPE_INPUT   0x80
#define USB_REQ_TYPE_MASK   0x60
#define USB_REQ_TYPE_STANDARD   0x00
#define USB_REQ_TYPE_CLASS   0x20
#define USB_REQ_TYPE_VENDOR   0x40
#define USB_REQ_TYPE_RECIP_MASK   0x1F
#define USB_REQ_TYPE_DEVICE   0x00
#define USB_REQ_TYPE_INTERFACE   0x01
#define USB_REQ_TYPE_ENDPOINT   0x02
#define USB_REQ_TYPE_OTHER   0x03
#define USB_REQ_GET_STATUS   0
#define USB_REQ_CLEAR_FEATURE   1
#define USB_REQ_SET_FEATURE   3
#define USB_REQ_SET_ADDRESS   5
#define USB_REQ_GET_DESCRIPTOR   6
#define USB_REQ_SET_DESCRIPTOR   7
#define USB_REQ_GET_CONFIGURATION   8
#define USB_REQ_SET_CONFIGURATION   9
#define USB_REQ_GET_INTERFACE   10
#define USB_REQ_SET_INTERFACE   11
#define USB_REQ_SYNCH_FRAME   12
#define USB_CDC_GET_LINE_CODING   0x21
#define USB_CDC_SET_LINE_CODING   0x20
#define USB_CDC_SET_CONTROL_LINE_STATE   0x22
#define USB_HID_REQ   0x81
#define USB_REQ_GET_REPORT   0x01
#define USB_REQ_GET_IDLE   0x02
#define USB_REQ_SET_REPORT   0x09
#define USB_REQ_SET_IDLE   0x0A
#define USB_REQ_SET_PROTOCOL   0x0B
#define USB_REQ_GET_PROTOCOL   0x03
#define USB_REQ_HID_INPUT   0x01
#define USB_REQ_HID_OUTPUT   0x02
#define USB_REQ_HID_FEATURE   0x03
#define DESC_TYPE_DEVICE   1
#define DESC_TYPE_CONFIG   2
#define DESC_TYPE_STRING   3
#define DESC_TYPE_INTERFACE   4
#define DESC_TYPE_ENDPOINT   5
#define DESC_TYPE_DEVICE_QUALIFIER   6
#define DESC_TYPE_HUB   0x29
#define DESC_TYPE_HID   0x21
#define DESC_TYPE_REPORT   0x22
#define DESC_TYPE_PHYSICAL   0x23
#define FEATURE_REMOTE_WAKEUP   1
#define FEATURE_ENDPOINT_STALL   0
#define DEVICE_STATUS_REMOTE_WAKEUP   0x02
#define DEVICE_STATUS_SELF_POWER   0x01
#define MAX_DESC_SIZE   256
#define SIZEOF_DEVICE_DESCRIPTOR   0x12
#define OFFSET_DEVICE_DESCRIPTOR_VID_L   0x08
#define OFFSET_DEVICE_DESCRIPTOR_VID_H   0x09
#define OFFSET_DEVICE_DESCRIPTOR_PID_L   0x0A
#define OFFSET_DEVICE_DESCRIPTOR_PID_H   0x0B
#define OFFSET_CONFIG_DESCRIPTOR_POWER   0x07
#define OFFSET_CONFIG_DESCRIPTOR_CURT   0x08
#define SIZEOF_CONFIG_DESCRIPTOR   0x09
#define CFG_DESC_ATTR_SELF_POWERED   0x40
#define CFG_DESC_ATTR_BUS_POWERED   0x80
#define CFG_DESC_ATTR_REMOTE_WAKE   0x20
#define SIZEOF_INTERFACE_DESCRIPTOR   0x09
#define SIZEOF_ENDPOINT_DESCRIPTOR   0x07
#define EP_DESC_ADDR_EP_NUM   0x0F
#define EP_DESC_ADDR_DIR_IN   0x80
#define EP_DESC_ATTR_TYPE_MASK   0x03
#define EP_DESC_ATTR_TYPE_CONT   0x00
#define EP_DESC_ATTR_TYPE_ISOC   0x01
#define EP_DESC_ATTR_TYPE_BULK   0x02
#define EP_DESC_ATTR_TYPE_INT   0x03
#define kUSB_succeed   0x00
#define kUSB_generalError   0x01
#define kUSB_notEnabled   0x02
#define kUSB_vbusPresent   0x01
#define kUSB_busActive   0x02
#define kUSB_ConnectNoVBUS   0x04
#define kUSB_suspended   0x08
#define kUSB_NotSuspended   0x10
#define kUSB_Enumerated   0x20
#define kUSB_purHigh   0x40
#define kUSB_clockFaultEvent   0x0001
#define kUSB_VbusOnEvent   0x0002
#define kUSB_VbusOffEvent   0x0004
#define kUSB_UsbResetEvent   0x0008
#define kUSB_UsbSuspendEvent   0x0010
#define kUSB_UsbResumeEvent   0x0020
#define kUSB_dataReceivedEvent   0x0040
#define kUSB_sendCompletedEvent   0x0080
#define kUSB_receiveCompletedEvent   0x0100
#define ST_USB_DISCONNECTED   0x80
#define ST_USB_CONNECTED_NO_ENUM   0x81
#define ST_ENUM_IN_PROGRESS   0x82
#define ST_ENUM_ACTIVE   0x83
#define ST_ENUM_SUSPENDED   0x84
#define ST_ERROR   0x86
#define ST_NOENUM_SUSPENDED   0x87
#define ENUMERATION_COMPLETE   0x01

Functions

BYTE USB_init (VOID)
BYTE USB_enable ()
BYTE USB_disable (VOID)
BYTE USB_setEnabledEvents (WORD events)
WORD USB_getEnabledEvents ()
BYTE USB_connect ()
BYTE USB_disconnect ()
BYTE USB_reset ()
BYTE USB_suspend (VOID)
BYTE USB_resume (VOID)
BYTE USB_forceRemoteWakeup ()
BYTE USB_connectionInfo ()
BYTE USB_connectionState ()
BYTE USB_handleClockEvent ()
BYTE USB_handleVbusOnEvent ()
BYTE USB_handleVbusOffEvent ()
BYTE USB_handleResetEvent ()
BYTE USB_handleSuspendEvent ()
BYTE USB_handleResumeEvent ()
BYTE USB_handleEnumCompleteEvent ()
VOID usbStallEndpoint0 (VOID)
VOID usbClearOEP0ByteCount (VOID)
VOID usbStallOEP0 (VOID)
VOID usbSendNextPacketOnIEP0 (VOID)
VOID usbSendDataPacketOnEP0 (PBYTE pbBuffer)
VOID usbReceiveNextPacketOnOEP0 (VOID)
VOID usbReceiveDataPacketOnEP0 (PBYTE pbBuffer)
VOID usbSendZeroLengthPacketOnIEP0 (VOID)
BYTE usbDecodeAndProcessUsbRequest (VOID)

Variables

__no_init tDEVICE_REQUEST __data16 tSetupPacket
__no_init BYTE __data16 abIEP0Buffer []
__no_init BYTE __data16 abOEP0Buffer []
__no_init BYTE __data16 pbXBufferAddressEp1 []
__no_init BYTE __data16 pbYBufferAddressEp1 []
__no_init BYTE __data16 pbXBufferAddressEp81 []
__no_init BYTE __data16 pbYBufferAddressEp81 []
__no_init BYTE __data16 pbXBufferAddressEp2 []
__no_init BYTE __data16 pbYBufferAddressEp2 []
__no_init BYTE __data16 pbXBufferAddressEp82 []
__no_init BYTE __data16 pbYBufferAddressEp82 []
WORD wBytesRemainingOnIEP0
WORD wBytesRemainingOnOEP0
BYTE abUsbRequestReturnData []
BYTE abUsbRequestIncomingData []
BYTE bEnumerationStatus
BYTE bFunctionSuspended

Detailed Description

For more information on this file please refer to Programmer’s Guide: MSP430 USB API Stack for CDC/HID http://focus.ti.com/docs/prod/folders/print/msp430f5529.html#toolssoftware.

Author:
Texas Instruments, Inc
Date:
2009/06/11
Version:
1.18 Initial Release
Note:
Built with IAR Embedded Workbench for MSP430 Version: 5.10.1

Definition in file usb.h.


Function Documentation

BYTE USB_disable ( VOID   ) 

Disables the USB module and PLL.

Definition at line 365 of file usb.c.

BYTE USB_enable (  ) 

Init and start the USB PLL.

Definition at line 314 of file usb.c.

BYTE USB_init ( VOID   ) 

Init the USB HW interface.

Definition at line 238 of file usb.c.

BYTE USB_reset (  ) 

Reset USB-SIE and global variables.

Definition at line 396 of file usb.c.

BYTE USB_resume ( VOID   ) 

Resume USB.

Definition at line 674 of file usb.c.

BYTE USB_suspend ( VOID   ) 

Suspend USB.

Definition at line 645 of file usb.c.

VOID usbClearOEP0ByteCount ( VOID   ) 

Clear byte counter for endpoint0 (control pipe)

Definition at line 695 of file usb.c.

BYTE usbDecodeAndProcessUsbRequest ( VOID   ) 

Decode incoming usb setup packet and call corresponding function usbDecodeAndProcessUsbRequest is called from IRQ. Do not call from user application returns TRUE to keep CPU awake

Definition at line 1266 of file usb.c.

VOID usbReceiveDataPacketOnEP0 ( PBYTE  pbBuffer  ) 

Receive data from control pipe. Number of bytes to receive should be set with global varible "wBytesRemainingOnOEP0" before function is called.

Definition at line 810 of file usb.c.

VOID usbReceiveNextPacketOnOEP0 ( VOID   ) 

Receive further data from control pipe if needed. Function is called from control-out IRQ. Do not call from user application

Definition at line 774 of file usb.c.

VOID usbSendDataPacketOnEP0 ( PBYTE  pbBuffer  ) 

Send data over control pipe to host. Number of bytes to transmit should be set with global varible "wBytesRemainingOnIEP0" before function is called.

Definition at line 756 of file usb.c.

VOID usbSendNextPacketOnIEP0 ( VOID   ) 

Send further data over control pipe if needed. Function is called from control-in IRQ. Do not call from user application

Definition at line 712 of file usb.c.

VOID usbSendZeroLengthPacketOnIEP0 ( VOID   ) 

Send zero length packet on control pipe.

Definition at line 823 of file usb.c.

VOID usbStallEndpoint0 ( VOID   ) 

Send stall handshake for in- and out-endpoint0 (control pipe)

Definition at line 687 of file usb.c.

VOID usbStallOEP0 ( VOID   ) 

Send stall handshake for out-endpoint0 (control pipe)

Definition at line 702 of file usb.c.