阅读:2357回复:1
请大家帮我看看68013的固件程序
void TD_Init(void) // Called once at startup
{ //set high speed mode //USBCS = 0x80; // set the CPU clock to 48MHz CPUCS = ((CPUCS & ~bmCLKSPD) | bmCLKSPD1) ; // set the slave FIFO interface to 48MHz IFCONFIG = 0x43;//ʹÓÃÍⲿʱÖÓ5~48MHz // Registers which require a synchronization delay, see section 15.14 // FIFORESET FIFOPINPOLAR // INPKTEND OUTPKTEND // EPxBCH:L REVCTL // GPIFTCB3 GPIFTCB2 // GPIFTCB1 GPIFTCB0 // EPxFIFOPFH:L EPxAUTOINLENH:L // EPxFIFOCFG EPxGPIFFLGSEL // PINFLAGSxx EPxFIFOIRQ // EPxFIFOIE GPIFIRQ // GPIFIE GPIFADRH:L // UDMACRCH:L EPxGPIFTRIG // GPIFTRIG // Note: The pre-REVE EPxGPIFTCH/L register are affected, as well... // ...these have been replaced by GPIFTC[B3:B0] registers // default: all endpoints have their VALID bit set // default: TYPE1 = 1 and TYPE0 = 0 --> BULK // default: EP2 and EP4 DIR bits are 0 (OUT direction) // default: EP6 and EP8 DIR bits are 1 (IN direction) // default: EP2, EP4, EP6, and EP8 are double buffered // we are just using the default values, yes this is not necessary... REVCTL=0x03; SYNCDELAY; //¸´Î»ËĸöFIFO FIFORESET=0x80; SYNCDELAY; FIFORESET=0x02; SYNCDELAY; FIFORESET=0x04; SYNCDELAY; FIFORESET=0x06; SYNCDELAY; FIFORESET=0x08; SYNCDELAY; FIFORESET=0x00; SYNCDELAY; //EP2ÉèΪBULK£¬OUT£¬4buffer£¬EP6ÉèΪBULK£¬IN£¬4buffer EP1OUTCFG = 0xA0; SYNCDELAY; EP1INCFG = 0xA0; SYNCDELAY; EP4CFG = 0x20; SYNCDELAY; EP8CFG = 0x60; SYNCDELAY; // see TRM section 15.14 EP2CFG = 0xA0; SYNCDELAY; EP6CFG = 0xE0; SYNCDELAY; EP2BCL = 0x80; // arm EP2OUT by writing byte count w/skip. SYNCDELAY; EP2BCL = 0x80; SYNCDELAY; EP2BCL = 0x80; SYNCDELAY; EP2BCL = 0x80; SYNCDELAY; //EP2Ϊautoout,ʹÄÜ0³¤¶È°ü£¬16bit£¬EP6Ϊautoin£¬Ê¹ÄÜ0³¤¶È°ü£¬16bit EP2FIFOCFG = 0x15; SYNCDELAY; EP6FIFOCFG = 0x0D; SYNCDELAY; //FlagΪĬÈÏ PINFLAGSAB=0x00; // SlaveFIFO?FLAGA/FLAGB?? SYNCDELAY; PINFLAGSCD=0x00; // SlaveFIFO?FLAGC/FLAGD?? SYNCDELAY; FIFOPINPOLAR=0x00; // FIFO½Ó¿ÚµÍµçƽÓÐЧ SYNCDELAY; //AUTOINµÄ³¤¶ÈΪ512×Ö½Ú EP6AUTOINLENH=0x02; SYNCDELAY; EP6AUTOINLENL=0x00; SYNCDELAY; //ÏȽ«×Ô¶¨Òå±ê־λ´óСÉèΪ256×Ö½Ú // EP2FIFOPFH=0x08; //SYNCDELAY; //EP2FIFOPFL=0x00; //SYNCDELAY; //EP6FIFOPFH=0x08; //SYNCDELAY; //EP6FIFOPFL=0x00; //SYNCDELAY; // out endpoints do not come up armed // since the defaults are double buffered we must write dummy byte counts twice // enable dual autopointer feature AUTOPTRSETUP |= 0x01; } void TD_Poll(void) // Called repeatedly while the device is idle { } 直接通过CYpress的bulkloop程序改的,改动的地方只是TD_Init和TD_poll。其余的都没改不知道行不行? 以下是TD_Init和TD_poll。想实现的是EP2 bulk模式,512*4,autoout,16bit,外部时钟驱动。 EP6 bulk模式,512*4,autoin,16bit,外部时钟驱动。autoinlen为512B 大家帮我看看有没有问题? 多谢 |
|
沙发#
发布于:2008-09-25 17:00
看怎么行,又不是考试,跑一跑就知道了
|
|