diff options
author | AJM <poslathian@poslathian.(none)> | 2010-04-20 14:35:58 -0400 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2010-05-20 22:09:15 -0400 |
commit | bfb86b6c2ac84c691c150e20adcc1b77d57efd10 (patch) | |
tree | feb5286f411417d6832a417e02e07fe1c775f4e7 /core/usb/usb.h | |
parent | 0db5696149d8f01275955c94ec55c9c43d7ca390 (diff) | |
download | librambutan-bfb86b6c2ac84c691c150e20adcc1b77d57efd10.tar.gz librambutan-bfb86b6c2ac84c691c150e20adcc1b77d57efd10.zip |
finished the entire low level usb app for virtual com minus the precise handling of get/send data callbacks and toggle line state. completely undebugged for now.
Diffstat (limited to 'core/usb/usb.h')
-rw-r--r-- | core/usb/usb.h | 57 |
1 files changed, 42 insertions, 15 deletions
diff --git a/core/usb/usb.h b/core/usb/usb.h index fa40123..b2bf23c 100644 --- a/core/usb/usb.h +++ b/core/usb/usb.h @@ -1,24 +1,51 @@ -#ifndef _USB_H_ -#define _USB_H_ +/* insert license */ -#define USB_ISR_ADDR (0x08000090) -#define USB_SERIAL_ENDP_TXADDR ((uint32) 0xC0) -#define USB_SERIAL_ENDP_RXADDR ((uint32) 0x110) -#define USB_SERIAL_ENDP_TX ((uint16) 0x1) -#define USB_SERIAL_ENDP_RX ((uint16) 0x3) -#define USB_SERIAL_BUF_SIZE (0x40) +#ifndef __USB_H_ +#define __USB_H_ + +#include "usb_config.h" +#include "usb_callbacks.h" +#include "usb_lib.h" #ifdef __cplusplus extern "C" { #endif -void usb_lpIRQHandler(void); -void usb_userToPMABufferCopy(uint8 *pbUsrBuf,uint16 wPMABufAddr,uint16 wNBytes); -void usb_PMAToUserBufferCopy(uint8 *pbUsrBuf,uint16 wPMABufAddr,uint16 wNBytes); -void usb_serialWriteStr(const char *outStr); -void usb_serialWriteChar(unsigned char ch); -uint8_t usb_serialGetRecvLen(); -void usb_copyRecvBuffer(unsigned char* dest, uint8 len); +typedef enum + { + RESUME_EXTERNAL, + RESUME_INTERNAL, + RESUME_LATER, + RESUME_WAIT, + RESUME_START, + RESUME_ON, + RESUME_OFF, + RESUME_ESOF + } RESUME_STATE; + +typedef enum + { + UNCONNECTED, + ATTACHED, + POWERED, + SUSPENDED, + ADDRESSED, + CONFIGURED + } DEVICE_STATE; + + void setupUSB(void); + void usbSuspend(void); + void usbResumeInit(void); + void usbResume(RESUME_STATE); + + RESULT usbPowerOn(void); + RESULT usbPowerOff(void); + + void usbDsbISR(void); + void usbEnbISR(void); + + /* overloaded ISR routine, this is the main usb ISR */ + void usb_lpIRQHandler(void); #ifdef __cplusplus } // extern "C" |