Changeset 135 for trunk


Ignore:
Timestamp:
Mar 14, 2011, 8:37:34 PM (14 years ago)
Author:
demin
Message:

remove unused vendor commands and set auto commit length to 512

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FirmwareFX2/usbjtag.c

    r40 r135  
    3434#include "hardware.h"
    3535
    36 #include "spi.h"
    37 
    3836//-----------------------------------------------------------------------------
    3937// Define USE_MOD256_OUTBUFFER:
     
    136134   EP8FIFOCFG = bmAUTOIN; SYNCDELAY;                    // Endpoint 8 used for user communication, auto commitment, 8 bits data bus
    137135
    138    EP8AUTOINLENH = 0x00; SYNCDELAY;                     // Size in bytes of the IN data automatically commited (64 bytes here, but changed dynamically depending on the connection)
    139    EP8AUTOINLENL = 0x40; SYNCDELAY;                     // Can use signal PKTEND if you want to commit a shorter packet
     136   EP8AUTOINLENH = 0x02; SYNCDELAY;                     // Size in bytes of the IN data automatically commited (512 bytes here, but changed dynamically depending on the connection)
     137   EP8AUTOINLENL = 0x00; SYNCDELAY;                     // Can use signal PKTEND if you want to commit a shorter packet
    140138
    141139   // Out endpoints do not come up armed
    142140   // Since the defaults are double buffered we must write dummy byte counts twice
    143    EP2BCL = 0x80; SYNCDELAY;                            // Arm EP2OUT by writing byte count w/skip.=
     141   EP2BCL = 0x80; SYNCDELAY;                            // Arm EP2OUT by writing byte count w/skip.
    144142   EP4BCL = 0x80; SYNCDELAY;
    145    EP2BCL = 0x80; SYNCDELAY;                            // Arm EP4OUT by writing byte count w/skip.=
     143   EP2BCL = 0x80; SYNCDELAY;                            // Arm EP4OUT by writing byte count w/skip.
    146144   EP4BCL = 0x80; SYNCDELAY;
    147145
    148146   PINFLAGSAB = 0xFA; SYNCDELAY;                        // 1111_1010 => FLAGA = EMPTY flag for EP6; FLAGB = FULL flag for EP8
    149 
    150147
    151148   // LED turned off by default
     
    370367    }
    371368
    372     if (bRequest == VEN_SPI_WR) // 0x99
    373     {
    374       // get EP0 data
    375       EP0BCL = 0;               // arm EP0 for OUT xfer.  This sets the busy bit
    376 
    377       while (EP0CS & bmEPBUSY)  // wait for busy to clear
    378         ;
    379 
    380       //                 head_hi, head_l , format , address, *buf  , len
    381       return !spi_write (wValueH, wValueL, wIndexH, wIndexL, EP0BUF, EP0BCL);
    382     }
    383 
    384 
    385369    return 1;
    386370  }
     
    388372  // IN requests.
    389373
    390   // change USB speed
    391   if (bRequest == 0x91)
    392   {
    393     if (wIndexL == 0)                // high speed
    394     {
    395       CT1 &= ~0x02;
    396       fx2_renumerate();              // renumerate
    397     }
    398     else                             // full speed
    399     {
    400       CT1 |= 0x02;
    401       fx2_renumerate();              // renumerate
    402     }   
    403   }
    404  
    405   // change synchronous/asynchronous mode
    406   if (bRequest == 0x92)
    407   {
    408     if(IFCONFIG & bmASYNC)
    409     {
    410       IFCONFIG &= ~bmASYNC;
    411     }
    412     else
    413     {
    414       IFCONFIG |= bmASYNC;
    415     }
    416   }
    417 
    418   if (bRequest == 0x93) // change to synchronous mode
    419   {
    420     IFCONFIG &= ~bmASYNC;
    421   }
    422  
    423   if (bRequest == VEN_SPI_EN) // 0x96
    424   {
    425     SPI_OE |= bmSPI_OE; // PA.0,1,3,7 output enable
    426     init_spi();
    427     EP0BUF[0] = 0;
    428     EP0BUF[1] = 0;
    429   }
    430  
    431   if (bRequest == VEN_SPI_DIS) // 0x97
    432   {
    433     SPI_OE &= ~bmSPI_OE; // PA.0,1,3,7 output disable
    434     EP0BUF[0] = 0x42;
    435     EP0BUF[1] = 0x43;
    436     EP0BUF[2] = 0x42;
    437     EP0BUF[3] = 0x43;
    438     EP0BCH = 0;
    439     EP0BCL = wLengthL;
    440     return 1;
    441   }
    442  
    443   if (bRequest == VEN_SPI_RD) // 0x98
    444   {
    445     //            header_H,header_L, format, address, *buf  , len
    446     if (spi_read (wValueH, wValueL, wIndexH, wIndexL, EP0BUF, wLengthL))
    447       return 0;
    448  
    449     EP0BCH = 0;
    450     EP0BCL = wLengthL;
    451     return 1;
    452   }
    453  
    454374  if(bRequest == 0x90)
    455375  {
Note: See TracChangeset for help on using the changeset viewer.