lol....Ok.
Also ich hab in der Datei "usbdrv/usbdrv.c" erstmal ein paar globale Variablen definiert:
Code: Alles auswählen
int test1=0;
int test2=0;
int test3=0;
int test4=0;
int test5=0;
int test6=0;
Und die Funktion "usbProcessRx" sieht am Anfang so aus:
Code: Alles auswählen
static void usbProcessRx(uchar *data, uchar len)
{
usbRequest_t *rq = (void *)data;
uchar replyLen = 0, flags = USB_FLG_USE_DEFAULT_RW;
/* We use if() cascades because the compare is done byte-wise while switch()
* is int-based. The if() cascades are therefore more efficient.
*/
/* usbRxToken can be:
* 0x2d 00101101 (USBPID_SETUP for endpoint 0)
* 0xe1 11100001 (USBPID_OUT for endpoint 0)
* 0xff 11111111 (USBPID_OUT for endpoint 1)
*/
DBG2(0x10 + ((usbRxToken >> 1) & 3), data, len); /* SETUP0=12; OUT0=10; OUT1=13 */
#if USB_CFG_IMPLEMENT_FN_WRITEOUT
if(usbRxToken == 0xff){
switch(*data)
{
case 0x72:
if((test1 == 0) && (test2 == 0) && (test3 == 0) && (test4 == 0) && (test5 == 0) && (test6 == 0))
test1 = 1;
break;
case 0x65:
if((test1 == 1) && (test2 == 0) && (test3 == 0) && (test4 == 0) && (test5 == 0) && (test6 == 0))
test2 = 1;
break;
case 0x6c:
if((test1 == 1) && (test2 == 1) && (test3 == 0) && (test4 == 0) && (test5 == 0) && (test6 == 0))
test3 = 1;
break;
case 0x61:
if((test1 == 1) && (test2 == 1) && (test3 == 1) && (test4 == 0) && (test5 == 0) && (test6 == 0))
test4 = 1;
break;
case 0x69:
if((test1 == 1) && (test2 == 1) && (test3 == 1) && (test4 == 1) && (test5 == 0) && (test6 == 0))
test5 = 1;
break;
case 0x73:
if((test1 == 1) && (test2 == 1) && (test3 == 1) && (test4 == 1) && (test5 == 1) && (test6 == 0))
test6 = 1;
break;
default:
if((test1 == 1) && (test2 == 1) && (test3 == 1) && (test4 == 1) && (test5 == 1) && (test6 == 1))
usbFunctionWriteOut(data, len);
test1 = 0;
test2 = 0;
test3 = 0;
test4 = 0;
test5 = 0;
test6 = 0;
break;
}
return; /* no reply expected, hence no usbMsgPtr, usbMsgFlags, usbMsgLen set */
}
#endif
if(usbRxToken == (uchar)USBPID_SETUP){
usbTxLen = USBPID_NAK; /* abort pending transmit */
if(len == 8){ /* Setup size must be always 8 bytes. Ignore otherwise. */
uchar type = rq->bmRequestType & USBRQ_TYPE_MASK;
if(type == USBRQ_TYPE_STANDARD){
#define SET_REPLY_LEN(len) replyLen = (len); usbMsgPtr = replyData
Und das fertige Programm hab ich angehängt, falls es jemanden interessiert.
Gruß
Lucky
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.