USB host library, support isochronous,bulk,interrupt and control.

Dependents:   BaseUsbHost_example BaseJpegDecode_example SimpleJpegDecode_example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BaseUsbHostBlkEp.cpp Source File

BaseUsbHostBlkEp.cpp

00001 // BaseUsbHostBlkEp.cpp 2013/1/25
00002 #include "mbed.h"
00003 #include "rtos.h"
00004 #include "BaseUsbHost.h"
00005 //#define DEBUG
00006 #include "BaseUsbHostDebug.h"
00007 #define TEST
00008 #include "BaseUsbHostTest.h"
00009 
00010 BulkEp::BulkEp(int addr, uint8_t ep, uint16_t size): BaseEp(addr, ep, size)
00011 {
00012     HCTD* td = new HCTD(this);
00013     m_pED->TailTd = td;
00014     m_pED->HeadTd = td; 
00015     TEST_ASSERT(td);
00016     if (td == NULL) {
00017         return;
00018     }
00019     m_pED->Next = reinterpret_cast<HCED*>(LPC_USB->HcBulkHeadED);
00020     LPC_USB->HcBulkHeadED = reinterpret_cast<uint32_t>(m_pED);
00021   
00022     DBG_OHCI(LPC_USB->HcBulkHeadED);
00023     DBG_ED(m_pED);
00024 }
00025 
00026 void BulkEp::enable()
00027 {
00028     LPC_USB->HcCommandStatus |= OR_CMD_STATUS_BLF;
00029     LPC_USB->HcControl |= OR_CONTROL_BLE;
00030 }
00031 
00032 int BulkEp::bulkReceive(uint8_t* buf, int len, int millisec)
00033 {
00034     return send_receive(buf, len, millisec);
00035 }
00036 
00037 int BulkEp::bulkSend(const uint8_t* buf, int len, int millisec)
00038 {
00039     return send_receive(const_cast<uint8_t*>(buf), len, millisec);
00040 }