Changeset 21
- Timestamp:
- Aug 29, 2009, 8:22:53 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FirmwareFX2/usbjtag.c
r4 r21 94 94 95 95 // Make Timer2 reload at 100 Hz to trigger Keepalive packets 96 96 97 tmp = 65536 - ( 48000000 / 12 / 100 ); 97 98 RCAP2H = tmp >> 8; … … 101 102 102 103 // Enable Autopointer 103 EXTACC = 1; // Enable 104 APTR1FZ = 1; // Don't freeze 105 APTR2FZ = 1; // Don't freeze 104 105 EXTACC = 1; // Enable 106 APTR1FZ = 1; // Don't freeze 107 APTR2FZ = 1; // Don't freeze 106 108 107 109 // define endpoint configuration … … 128 130 EP6CFG = 0xA2; SYNCDELAY; // Out endpoint, Bulk, Double buffering 129 131 EP6FIFOCFG = 0x00; SYNCDELAY; // Firmware has to see a rising edge on auto bit to enable auto arming 130 EP6FIFOCFG = bmAUTOOUT | bmWORDWIDE; SYNCDELAY; // Endpoint 6 used for user communicationn, auto commitment, 16bits data bus132 EP6FIFOCFG = bmAUTOOUT; SYNCDELAY; // Endpoint 6 used for user communicationn, auto commitment, 8 bits data bus 131 133 132 134 EP8CFG = 0xE0; SYNCDELAY; // In endpoint, Bulk 133 135 EP8FIFOCFG = 0x00; SYNCDELAY; // Firmware has to see a rising edge on auto bit to enable auto arming 134 EP8FIFOCFG = bmAUTOIN | bmWORDWIDE; SYNCDELAY; // Endpoint 8 used for user communication, auto commitment, 16bits data bus136 EP8FIFOCFG = bmAUTOIN; SYNCDELAY; // Endpoint 8 used for user communication, auto commitment, 8 bits data bus 135 137 136 138 EP8AUTOINLENH = 0x00; SYNCDELAY; // Size in bytes of the IN data automatically commited (64 bytes here, but changed dynamically depending on the connection) … … 143 145 EP2BCL = 0x80; SYNCDELAY; // Arm EP4OUT by writing byte count w/skip.= 144 146 EP4BCL = 0x80; SYNCDELAY; 145 146 // JTAG from FX2 enabled by default 147 IOC |= (1 << 7); 148 147 149 148 // Put the system in high speed by default (REM: USB-Blaster is in full speed) 150 149 // This can be changed by vendor commands … … 398 397 } 399 398 400 // change JTAG enable399 // change synchronous/asynchronous mode 401 400 if (bRequest == 0x92) 402 {403 if (wIndexL == 0) // FX2 is master of JTAG404 {405 IOC |= (1 << 7);406 }407 else // external connector is master of JTAG408 {409 IOC &= ~(1 << 7);410 }411 }412 // change synchronous/asynchronous mode413 if (bRequest == 0x93)414 401 { 415 402 if(IFCONFIG & bmASYNC) … … 422 409 } 423 410 } 424 425 if (bRequest == 0x9 4) // change to synchronous mode411 412 if (bRequest == 0x93) // change to synchronous mode 426 413 { 427 414 IFCONFIG &= ~bmASYNC; … … 445 432 EP0BCH = 0; 446 433 EP0BCL = wLengthL; 447 // EP0CS |= bmHSNAK; // Bram448 434 return 1; 449 435 } … … 460 446 } 461 447 462 if (bRequest == 0x95) // For debugging purposes463 {464 465 SPI &= ~bmSS; // enable slave select466 467 spi_write_byte_msb(wValueL); // address468 spi_write_byte_msb(wIndexL); // header469 EP0BUF[0] = spi_read_byte_msb(); // read back value from slave470 471 SPI |= bmSS; /* active low, disable slave */472 473 EP0BCH = 0;474 EP0BCL = 1; // Arm the EP475 return 1;476 477 /*static xdata unsigned char buf[2];478 buf[0] = 0xFF;479 buf[1] = 0x10;480 spi_read(0x00, wValueL, SPI_FMT_HDR_1, wValueH, buf, 0);481 //spi_write_byte_msb(wValueL);482 EP0BUF[0] = 0x51;483 EP0BUF[1] = wValueL;484 EP0BCH = 0;485 EP0BCL = wLengthL;486 return 1;*/487 }488 489 448 if(bRequest == 0x90) 490 449 { … … 502 461 EP0BCH = 0; 503 462 EP0BCL = (wLengthL<2) ? wLengthL : 2; // Arm endpoint with # bytes to transfer 504 //EP0CS |= bmHSNAK; // Bram505 463 506 464 return 1; … … 526 484 usb_jtag_init(); 527 485 eeprom_init(); 528 setup_autovectors 529 usb_install_handlers 486 setup_autovectors(); 487 usb_install_handlers(); 530 488 531 489
Note:
See TracChangeset
for help on using the changeset viewer.