C51 COMPILER V8.09 FX2HOOKS 12/28/2007 10:51:03 PAGE 1 C51 COMPILER V8.09, COMPILATION OF MODULE FX2HOOKS OBJECT MODULE PLACED IN .\Debug\FX2Hooks.obj COMPILER INVOKED BY: C:\Program Files\Keil\C51\BIN\C51.EXE FX2Hooks.c ROM(COMPACT) OPTIMIZE(6,SPEED) DEBUG OBJECTEXTEND -OBJECT(.\Debug\FX2Hooks.obj) line level source 1 //------------------------------------------------------------------------------ 2 // Cypress provided (C) 2005 framework for the FX2LP USB microcontroller. 3 // All rights reserved. 4 // Update from Piero Giubilato to fit the PARROT project. 5 //------------------------------------------------------------------------------ 6 7 //______________________________________________________________________________ 8 // {Trace} 9 // [File name] "FX2Hooks.c" 10 // [Author] "Cypress" 11 // [Modified by] "Piero Giubilato" 12 // [Last revision] "02 Nov 2007" 13 // [Language] "C Standard" 14 // [Compiler] "Keil uVision 3.53" 15 // [Member of] "FX2 Firmware" 16 // [Project] "PARROT" 17 // [Description] "This file contains the hooks called by the firmware framework 18 // upon different USB status condition. The only relevant one used by the PARROT 19 // system is the TD_Init, called once at startup, that is used to put the device 20 // into a so-called Slave FIFO Mode by setting the internal registers as defined 21 // inside SlaveFIFOMode.c" 22 // [Key documentation] "Cypress EZ-USB Technical Reference Manual" 23 // {Trace} 24 //______________________________________________________________________________ 25 26 //______________________________________________________________________________ 27 // {Description} 28 // 29 // 30 // 31 // 32 // 33 // 34 // {Description} 35 //______________________________________________________________________________ 36 37 38 39 #pragma NOIV // Do not generate interrupt vectors 40 #include "fx2.h" 41 #include "fx2regs.h" 42 #include "syncdly.h" // SYNCDELAY macro 43 44 extern BOOL GotSUD; // Received setup data flag 45 extern BOOL Sleep; 46 extern BOOL Rwuen; 47 extern BOOL Selfpwr; 48 49 BYTE Configuration; // Current configuration 50 BYTE AlternateSetting; // Alternate settings 51 52 // External functions 53 void SlaveFIFOMode (void); // Set up the Slave FIFO Mode 54 C51 COMPILER V8.09 FX2HOOKS 12/28/2007 10:51:03 PAGE 2 55 56 //------------------------------------------------------------------------------ 57 // Task Dispatcher hooks 58 // The following hooks are called by the task dispatcher. 59 //------------------------------------------------------------------------------ 60 61 // Called once at startup, this routine is used to initialize the system. 62 // Here there is a call to the sub that contains all the settings necessary 63 // to put the device in a SlaveFIFO mode (contained into SlaveFIFOMode.c). 64 void TD_Init(void) 65 { 66 1 // Put the device into a FIFO Slave Mode 67 1 SlaveFIFOMode(); 68 1 } 69 70 // Called repeatedly while the device is idle 71 void TD_Poll(void) {} 72 73 // Called before the device goes into suspend mode 74 BOOL TD_Suspend(void) {return(TRUE);} 75 76 // Called after the device resumes 77 BOOL TD_Resume(void) {return(TRUE);} 78 79 80 //------------------------------------------------------------------------------ 81 // Device Request hooks 82 // The following hooks are called by the end point 0 device request parser. 83 //------------------------------------------------------------------------------ 84 85 86 BOOL DR_GetDescriptor(void) {return(TRUE);} 87 88 // Called when a Set Configuration command is received 89 BOOL DR_SetConfiguration(void) 90 { 91 1 Configuration = SETUPDAT[2]; 92 1 return(TRUE); // Handled by user code 93 1 } 94 95 // Called when a Get Configuration command is received 96 BOOL DR_GetConfiguration(void) 97 { 98 1 EP0BUF[0] = Configuration; 99 1 EP0BCH = 0; 100 1 EP0BCL = 1; 101 1 return(TRUE); // Handled by user code 102 1 } 103 104 // Called when a Set Interface command is received 105 BOOL DR_SetInterface(void) 106 { 107 1 AlternateSetting = SETUPDAT[2]; 108 1 return(TRUE); // Handled by user code 109 1 } 110 111 // Called when a Set Interface command is received 112 BOOL DR_GetInterface(void) 113 { 114 1 EP0BUF[0] = AlternateSetting; 115 1 EP0BCH = 0; 116 1 EP0BCL = 1; C51 COMPILER V8.09 FX2HOOKS 12/28/2007 10:51:03 PAGE 3 117 1 return(TRUE); // Handled by user code 118 1 } 119 120 BOOL DR_GetStatus(void) {return(TRUE);} 121 122 BOOL DR_ClearFeature(void) {return(TRUE);} 123 124 BOOL DR_SetFeature(void) {return(TRUE);} 125 126 BOOL DR_VendorCmnd(void) {return(TRUE);} 127 128 129 //------------------------------------------------------------------------------ 130 // USB Interrupt Handlers 131 // The following functions are called by the USB interrupt jump table. 132 //------------------------------------------------------------------------------ 133 134 // Setup Data Available Interrupt Handler 135 void ISR_Sudav(void) interrupt 0 136 { 137 1 GotSUD = TRUE; // Set flag 138 1 EZUSB_IRQ_CLEAR(); 139 1 USBIRQ = bmSUDAV; // Clear SUDAV IRQ 140 1 } 141 142 // Setup Token Interrupt Handler 143 void ISR_Sutok(void) interrupt 0 144 { 145 1 EZUSB_IRQ_CLEAR(); 146 1 USBIRQ = bmSUTOK; // Clear SUTOK IRQ 147 1 } 148 149 void ISR_Sof(void) interrupt 0 150 { 151 1 EZUSB_IRQ_CLEAR(); 152 1 USBIRQ = bmSOF; // Clear SOF IRQ 153 1 } 154 155 void ISR_Ures(void) interrupt 0 156 { 157 1 // Whenever we get a USB reset, we should revert to full speed mode 158 1 pConfigDscr = pFullSpeedConfigDscr; 159 1 ((CONFIGDSCR xdata *) pConfigDscr)->type = CONFIG_DSCR; 160 1 pOtherConfigDscr = pHighSpeedConfigDscr; 161 1 ((CONFIGDSCR xdata *) pOtherConfigDscr)->type = OTHERSPEED_DSCR; 162 1 163 1 EZUSB_IRQ_CLEAR(); 164 1 USBIRQ = bmURES; // Clear URES IRQ 165 1 } 166 167 void ISR_Susp(void) interrupt 0 168 { 169 1 Sleep = TRUE; 170 1 EZUSB_IRQ_CLEAR(); 171 1 USBIRQ = bmSUSP; 172 1 } 173 174 void ISR_Highspeed(void) interrupt 0 175 { 176 1 if (EZUSB_HIGHSPEED()) 177 1 { 178 2 pConfigDscr = pHighSpeedConfigDscr; C51 COMPILER V8.09 FX2HOOKS 12/28/2007 10:51:03 PAGE 4 179 2 ((CONFIGDSCR xdata *) pConfigDscr)->type = CONFIG_DSCR; 180 2 pOtherConfigDscr = pFullSpeedConfigDscr; 181 2 ((CONFIGDSCR xdata *) pOtherConfigDscr)->type = OTHERSPEED_DSCR; 182 2 } 183 1 184 1 EZUSB_IRQ_CLEAR(); 185 1 USBIRQ = bmHSGRANT; 186 1 } 187 void ISR_Ep0ack(void) interrupt 0 {} 188 void ISR_Stub(void) interrupt 0 {} 189 void ISR_Ep0in(void) interrupt 0 {} 190 void ISR_Ep0out(void) interrupt 0 {} 191 void ISR_Ep1in(void) interrupt 0 {} 192 void ISR_Ep1out(void) interrupt 0 {} 193 void ISR_Ep2inout(void) interrupt 0 {} 194 void ISR_Ep4inout(void) interrupt 0 {} 195 void ISR_Ep6inout(void) interrupt 0 {} 196 void ISR_Ep8inout(void) interrupt 0 {} 197 void ISR_Ibn(void) interrupt 0 {} 198 void ISR_Ep0pingnak(void) interrupt 0 {} 199 void ISR_Ep1pingnak(void) interrupt 0 {} 200 void ISR_Ep2pingnak(void) interrupt 0 {} 201 void ISR_Ep4pingnak(void) interrupt 0 {} 202 void ISR_Ep6pingnak(void) interrupt 0 {} 203 void ISR_Ep8pingnak(void) interrupt 0 {} 204 void ISR_Errorlimit(void) interrupt 0 {} 205 void ISR_Ep2piderror(void) interrupt 0 {} 206 void ISR_Ep4piderror(void) interrupt 0 {} 207 void ISR_Ep6piderror(void) interrupt 0 {} 208 void ISR_Ep8piderror(void) interrupt 0 {} 209 void ISR_Ep2pflag(void) interrupt 0 {} 210 void ISR_Ep4pflag(void) interrupt 0 {} 211 void ISR_Ep6pflag(void) interrupt 0 {} 212 void ISR_Ep8pflag(void) interrupt 0 {} 213 void ISR_Ep2eflag(void) interrupt 0 {} 214 void ISR_Ep4eflag(void) interrupt 0 {} 215 void ISR_Ep6eflag(void) interrupt 0 {} 216 void ISR_Ep8eflag(void) interrupt 0 {} 217 void ISR_Ep2fflag(void) interrupt 0 {} 218 void ISR_Ep4fflag(void) interrupt 0 {} 219 void ISR_Ep6fflag(void) interrupt 0 {} 220 void ISR_Ep8fflag(void) interrupt 0 {} 221 void ISR_GpifComplete(void) interrupt 0 {} 222 void ISR_GpifWaveform(void) interrupt 0 {} MODULE INFORMATION: STATIC OVERLAYABLE CODE SIZE = 314 ---- CONSTANT SIZE = ---- ---- XDATA SIZE = ---- ---- PDATA SIZE = ---- ---- DATA SIZE = 2 ---- IDATA SIZE = ---- ---- BIT SIZE = ---- ---- END OF MODULE INFORMATION. C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)