Webcam Server.

Dependencies:   uvchost FatFileSystem mbed HTTPServer NetServicesMin

Committer:
va009039
Date:
Wed Jun 06 11:47:06 2012 +0000
Revision:
0:2b4ea8a138e5

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
va009039 0:2b4ea8a138e5 1 #include "UsbBaseClass.h"
va009039 0:2b4ea8a138e5 2 //#define __DEBUG
va009039 0:2b4ea8a138e5 3 #include "mydbg.h"
va009039 0:2b4ea8a138e5 4
va009039 0:2b4ea8a138e5 5 UsbBaseClass::UsbBaseClass()
va009039 0:2b4ea8a138e5 6 {
va009039 0:2b4ea8a138e5 7 if (m_pHost == NULL) {
va009039 0:2b4ea8a138e5 8 m_pHost = new UsbHostMgr;
va009039 0:2b4ea8a138e5 9 DBG_ASSERT(m_pHost);
va009039 0:2b4ea8a138e5 10 m_pHost->init();
va009039 0:2b4ea8a138e5 11 }
va009039 0:2b4ea8a138e5 12 DBG("m_pHost=%p\n", m_pHost);
va009039 0:2b4ea8a138e5 13 }
va009039 0:2b4ea8a138e5 14
va009039 0:2b4ea8a138e5 15 UsbErr UsbBaseClass::Usb_poll(int timeout, int timeout2)
va009039 0:2b4ea8a138e5 16 {
va009039 0:2b4ea8a138e5 17 DBG("%p %d %d\n", this, timeout, timeout2);
va009039 0:2b4ea8a138e5 18 Timer t;
va009039 0:2b4ea8a138e5 19 t.reset();
va009039 0:2b4ea8a138e5 20 t.start();
va009039 0:2b4ea8a138e5 21 Timer t2;
va009039 0:2b4ea8a138e5 22 t2.reset();
va009039 0:2b4ea8a138e5 23 t2.start();
va009039 0:2b4ea8a138e5 24 while(t.read_ms() < timeout) {
va009039 0:2b4ea8a138e5 25 UsbErr rc = m_pHost->poll();
va009039 0:2b4ea8a138e5 26 if (rc == USBERR_PROCESSING) {
va009039 0:2b4ea8a138e5 27 t2.reset();
va009039 0:2b4ea8a138e5 28 }
va009039 0:2b4ea8a138e5 29 if (t2.read_ms() > timeout2) {
va009039 0:2b4ea8a138e5 30 DBG("%p t=%d\n", this, t.read_ms());
va009039 0:2b4ea8a138e5 31 return USBERR_OK;
va009039 0:2b4ea8a138e5 32 }
va009039 0:2b4ea8a138e5 33 wait_ms(50);
va009039 0:2b4ea8a138e5 34 }
va009039 0:2b4ea8a138e5 35 return USBERR_PROCESSING;
va009039 0:2b4ea8a138e5 36 }
va009039 0:2b4ea8a138e5 37
va009039 0:2b4ea8a138e5 38 UsbHostMgr* UsbBaseClass::m_pHost = NULL;