Line 1... |
Line 1... |
/*!
|
/*!
|
ZTEX Firmware Kit for EZ-USB Microcontrollers
|
ZTEX Firmware Kit for EZ-USB Microcontrollers
|
Copyright (C) 2008-2009 ZTEX e.K.
|
Copyright (C) 2009-2010 ZTEX e.K.
|
http://www.ztex.de
|
http://www.ztex.de
|
|
|
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
it under the terms of the GNU General Public License version 3 as
|
it under the terms of the GNU General Public License version 3 as
|
published by the Free Software Foundation.
|
published by the Free Software Foundation.
|
Line 61... |
Line 61... |
}
|
}
|
|
|
/* *********************************************************************
|
/* *********************************************************************
|
***** getStringDescriptor *******************************************
|
***** getStringDescriptor *******************************************
|
********************************************************************* */
|
********************************************************************* */
|
#define[SEND_STRING_DESCRIPTOR(][,$1);][sendStringDescriptor(LSB($1), MSB($1), sizeof($1) );]
|
#define[SEND_STRING_DESCRIPTOR(][);][sendStringDescriptor(LSB($0), MSB($0), sizeof($0) );]
|
|
|
static void sendStringDescriptor (BYTE loAddr, BYTE hiAddr, BYTE size)
|
static void sendStringDescriptor (BYTE loAddr, BYTE hiAddr, BYTE size)
|
{
|
{
|
BYTE i;
|
BYTE i;
|
if ( size > 31)
|
if ( size > 31)
|
size = 31;
|
size = 31;
|
|
AUTOPTRSETUP = 7;
|
AUTOPTRL1 = loAddr;
|
AUTOPTRL1 = loAddr;
|
AUTOPTRH1 = hiAddr;
|
AUTOPTRH1 = hiAddr;
|
AUTOPTRL2 = (BYTE)(((unsigned short)(&EP0BUF))+1);
|
AUTOPTRL2 = (BYTE)(((unsigned short)(&EP0BUF))+1);
|
AUTOPTRH2 = (BYTE)((((unsigned short)(&EP0BUF))+1) >> 8);
|
AUTOPTRH2 = (BYTE)((((unsigned short)(&EP0BUF))+1) >> 8);
|
XAUTODAT2 = 3;
|
XAUTODAT2 = 3;
|
AUTOPTRSETUP = 7;
|
|
for (i=0; i<size; i++) {
|
for (i=0; i<size; i++) {
|
XAUTODAT2 = XAUTODAT1;
|
XAUTODAT2 = XAUTODAT1;
|
XAUTODAT2 = 0;
|
XAUTODAT2 = 0;
|
}
|
}
|
i = (size+1) << 1;
|
i = (size+1) << 1;
|
Line 212... |
Line 212... |
}
|
}
|
break;
|
break;
|
case 0x03: // strings
|
case 0x03: // strings
|
switch (SETUPDAT[2]) {
|
switch (SETUPDAT[2]) {
|
case 1:
|
case 1:
|
SEND_STRING_DESCRIPTOR(1,manufacturerString);
|
SEND_STRING_DESCRIPTOR(manufacturerString);
|
break;
|
break;
|
case 2:
|
case 2:
|
SEND_STRING_DESCRIPTOR(2,productString);
|
SEND_STRING_DESCRIPTOR(productString);
|
break;
|
break;
|
case 3:
|
case 3:
|
SEND_STRING_DESCRIPTOR(3,SN_STRING);
|
SEND_STRING_DESCRIPTOR(SN_STRING);
|
break;
|
break;
|
case 4:
|
case 4:
|
SEND_STRING_DESCRIPTOR(4,configurationString);
|
SEND_STRING_DESCRIPTOR(configurationString);
|
break;
|
break;
|
default:
|
default:
|
SUDPTRH = MSB(&EmptyStringDescriptor);
|
SUDPTRH = MSB(&EmptyStringDescriptor);
|
SUDPTRL = LSB(&EmptyStringDescriptor);
|
SUDPTRL = LSB(&EmptyStringDescriptor);
|
break;
|
break;
|