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 BaseUsbHostIntEp.cpp Source File

BaseUsbHostIntEp.cpp

00001 // BaseUsbHostIntEp.cpp 2012/12/24
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 InterruptEp::InterruptEp(int addr, uint8_t ep, uint16_t size, int lowSpeed)
00011     :BaseEp(addr, ep, size, lowSpeed)
00012 {
00013     HCTD* td = new HCTD(this);
00014     m_pED->HeadTd = td; 
00015     m_pED->TailTd = td;
00016     TEST_ASSERT(td);
00017     if (td == NULL) {
00018         return;
00019     }
00020     HCCA* pHcca = reinterpret_cast<HCCA*>(LPC_USB->HcHCCA);
00021     TEST_ASSERT(pHcca);
00022     if (pHcca == NULL) {
00023         return;
00024     }
00025     int n = 0;
00026     m_pED->Next = pHcca->InterruptTable[n];
00027     pHcca->InterruptTable[n] = m_pED;
00028 
00029     DBG_ED(m_pED);
00030 }
00031 
00032 void InterruptEp::enable()
00033 {
00034     LPC_USB->HcControl |= OR_CONTROL_PLE;
00035 }
00036     
00037 int InterruptEp::interruptReceive(uint8_t* buf, int len, int millisec)
00038 {
00039     return send_receive(buf, len, millisec);
00040 }