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

Dependents:   BaseUsbHost_example BaseJpegDecode_example SimpleJpegDecode_example

Import programBaseUsbHost_example

BaseUsbHost example program

Committer:
va009039
Date:
Mon Feb 11 12:00:47 2013 +0000
Revision:
5:8a2d056e9b38
Parent:
4:d931d24c2f81
add GetStringDescriptor()

Who changed what in which revision?

UserRevisionLine numberNew contents of line
va009039 3:ae77d63a1eda 1 // BaseUsbHostIntEp.cpp 2012/12/24
va009039 0:b7d6879637a8 2 #include "mbed.h"
va009039 0:b7d6879637a8 3 #include "rtos.h"
va009039 0:b7d6879637a8 4 #include "BaseUsbHost.h"
va009039 0:b7d6879637a8 5 #define DEBUG
va009039 0:b7d6879637a8 6 #include "BaseUsbHostDebug.h"
va009039 0:b7d6879637a8 7 #define TEST
va009039 0:b7d6879637a8 8 #include "BaseUsbHostTest.h"
va009039 0:b7d6879637a8 9
va009039 0:b7d6879637a8 10 InterruptEp::InterruptEp(int addr, uint8_t ep, uint16_t size, int lowSpeed)
va009039 0:b7d6879637a8 11 :BaseEp(addr, ep, size, lowSpeed)
va009039 0:b7d6879637a8 12 {
va009039 4:d931d24c2f81 13 HCTD* td = new HCTD(this);
va009039 3:ae77d63a1eda 14 m_pED->HeadTd = td;
va009039 0:b7d6879637a8 15 m_pED->TailTd = td;
va009039 2:fe1e62051d88 16 TEST_ASSERT(td);
va009039 2:fe1e62051d88 17 if (td == NULL) {
va009039 2:fe1e62051d88 18 return;
va009039 2:fe1e62051d88 19 }
va009039 0:b7d6879637a8 20 HCCA* pHcca = reinterpret_cast<HCCA*>(LPC_USB->HcHCCA);
va009039 0:b7d6879637a8 21 TEST_ASSERT(pHcca);
va009039 2:fe1e62051d88 22 if (pHcca == NULL) {
va009039 2:fe1e62051d88 23 return;
va009039 2:fe1e62051d88 24 }
va009039 0:b7d6879637a8 25 int n = 0;
va009039 0:b7d6879637a8 26 m_pED->Next = pHcca->InterruptTable[n];
va009039 4:d931d24c2f81 27 pHcca->InterruptTable[n] = m_pED;
va009039 3:ae77d63a1eda 28
va009039 3:ae77d63a1eda 29 DBG_ED(m_pED);
va009039 3:ae77d63a1eda 30 }
va009039 3:ae77d63a1eda 31
va009039 3:ae77d63a1eda 32 void InterruptEp::enable()
va009039 3:ae77d63a1eda 33 {
va009039 0:b7d6879637a8 34 LPC_USB->HcControl |= OR_CONTROL_PLE;
va009039 0:b7d6879637a8 35 }
va009039 0:b7d6879637a8 36
va009039 1:3b7bc4f87a61 37 int InterruptEp::interruptReceive(uint8_t* buf, int len, int millisec)
va009039 0:b7d6879637a8 38 {
va009039 3:ae77d63a1eda 39 return send_receive(buf, len, millisec);
va009039 0:b7d6879637a8 40 }