Gecko3 - CCC Event Weblog
Gecko3 - CCC Event Weblog
Gecko3 - CCC Event Weblog
Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.
YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.
E. Quellcode<br />
∗ Author : Matthias Zurbrügg<br />
∗ Date o f c r e a t i o n : 22.11.2006<br />
∗ D e s c r i p t i o n :<br />
16 ∗ Source code o f Cypress EZ−USB FX2 Firmware<br />
∗<br />
∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ ∗/<br />
#include ” fx2 . h”<br />
21 #include ” f x 2 r e g s . h”<br />
#include ” f x 2 s d l y . h” // SYNCDELAY macro , see S e c t i o n 15.14 o f FX2 Tech .<br />
// Ref . Manual f o r usage d e t a i l s .<br />
#include ” g p i f r d w r f u n c . h”<br />
#include ” s p i f l a s h r d w r f u n c . h”<br />
26 #include ” f p g a c f g f u n c . h”<br />
#include ” eeprom rd wr func . h”<br />
// firmware v e r s i o n (max t h r e e d i g i t s )<br />
#define f w v e r d i g i t 0 ’ 1 ’<br />
31 #define f w v e r d i g i t 1 ’ . ’<br />
#define f w v e r d i g i t 2 ’ 0 ’<br />
#define f w v e r d i g i t 3 ’ 1 ’<br />
// Cypres b i t masks<br />
36 #define bmEP0BSY 0 x01<br />
#define bmEP1OUTBSY 0 x02<br />
#define bmEP1INBSY 0 x04<br />
// Defines f o r EEPROM communications<br />
41 #define w r i t e n o k 1<br />
#define w r i t e o k 0<br />
#define read nok 1<br />
#define read ok 0<br />
#define i n i t 0<br />
46 #define i d l e 3<br />
// Cypres v a r i a b l e s<br />
extern BOOL GotSUD ; // Received s e t u p data f l a g<br />
extern BOOL S l e e p ;<br />
51 extern BOOL Rwuen ;<br />
extern BOOL S e l f p w r ;<br />
BYTE C o n f i g u r a t i o n ; // Current c o n f i g u r a t i o n<br />
BYTE A l t e r n a t e S e t t i n g ; // A l t e r n a t e s e t t i n g s<br />
56<br />
// V a r i a b l e s f o r GPIF communications<br />
BOOL i n e n a b l e = FALSE ; // f l a g to e n a b l e IN t r a n s f e r s<br />
BOOL f i f o r d e n a b l e = FALSE; // f l a g to e n a b l e GPIF FIFO READ Transaction<br />
BOOL f i f o r d i n t = FALSE; // GPIF FIFO READ Transaction i n t e r r u p t f l a g<br />
61 BOOL enum high speed = FALSE; // f l a g to l e t firmware know FX2 enumerated at<br />
h i g h speed<br />
// V a r i a b l e s f o r EEPROM coummunications<br />
BOOL eeprom write mode = FALSE; // s e t eeprome write mode to f a l s e<br />
BOOL s t a r t t r a n s a c t i o n = 1 ;<br />
BOOL eeprom read mode = FALSE;<br />
66 BYTE e e p r o m r e a d s t a t e = i d l e ; // s e t eeprom read s t a t e on i d l e<br />
WORD eeprom adress = 0 ;<br />
WORD r e a d c o u n t = 0 ; // v a l u e o f number o f b y t e s to read<br />
// V a r i a b l e s f o r FPGA c o n f i g u r a t i o n<br />
BOOL fpga cfg m ode = FALSE; // FPGA c o n f i g u r a t i o n mode v a r i a b l e<br />
71 BOOL done ack = FALSE ; // v a r i a b l e to g i v e vendor r e q u e s t DONE<br />
acknoledgement<br />
// V a r i a b l e s f o r SPI Flash communications<br />
BOOL s p i f l a s h w r i t e m o d e = FALSE;<br />
BOOL s p i f l a s h r e a d m o d e = FALSE;<br />
BOOL f l a s h r d e n ;<br />
76 BOOL new cfg = 1 ;<br />
64 Matthias Zurbrügg, Christoph Zimmermann