25.12.2013 Aufrufe

Gecko3 - CCC Event Weblog

Gecko3 - CCC Event Weblog

Gecko3 - CCC Event Weblog

MEHR ANZEIGEN
WENIGER ANZEIGEN

Erfolgreiche ePaper selbst erstellen

Machen Sie aus Ihren PDF Publikationen ein blätterbares Flipbook mit unserer einzigartigen Google optimierten e-Paper Software.

E. Quellcode<br />

E.1. Firmware<br />

E.1.1. Cypress Firmware Framwork<br />

1 //−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

// F i l e : fw . c<br />

// Contents : Firmware frameworks t a s k d i s p a t c h e r and d e v i c e r e q u e s t p a r s e r<br />

// source .<br />

//<br />

6 // i n d e n t 3 . NO TABS!<br />

//<br />

// $Revision : 17 $<br />

// $Date : 11/15/01 5:45 p $<br />

//<br />

11 // Copyright ( c ) 2002 Cypress Semiconductor , Inc . A l l r i g h t s r e s e r v e d<br />

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

#include ” fx2 . h”<br />

#include ” f x 2 r e g s . h”<br />

16 //−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

// Constants<br />

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

#define DELAY COUNT 0 x9248 ∗8L // Delay f o r 8 sec at 24Mhz , 4 sec at 48<br />

#define IFREQ 48000 // IFCLK c o n s t a n t f o r S y n c h r o n i z a t i o n Delay<br />

21 #define CFREQ 48000 // CLKOUT c o n s t a n t f o r S y n c h r o n i z a t i o n Delay<br />

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

// Random Macros<br />

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

26 #define min ( a , b ) ( ( ( a ) (b ) ) ?( a ) : ( b ) )<br />

// R e g i s t e r s which r e q u i r e a s y n c h r o n i z a t i o n delay , see s e c t i o n 15.14<br />

// FIFORESET FIFOPINPOLAR<br />

31 // INPKTEND OUTPKTEND<br />

// EPxBCH: L REVCTL<br />

// GPIFTCB3 GPIFTCB2<br />

// GPIFTCB1 GPIFTCB0<br />

// EPxFIFOPFH: L EPxAUTOINLENH: L<br />

36 // EPxFIFOCFG EPxGPIFFLGSEL<br />

// PINFLAGSxx EPxFIFOIRQ<br />

// EPxFIFOIE GPIFIRQ<br />

// GPIFIE GPIFADRH: L<br />

// UDMACRCH: L EPxGPIFTRIG<br />

41 // GPIFTRIG<br />

// Note : The pre−REVE EPxGPIFTCH/L r e g i s t e r are a f f e c t e d , as w e l l . . .<br />

// . . . t h e s e have been r e p l a c e d by GPIFTC[ B3 : B0 ] r e g i s t e r s<br />

46 #include ” f x 2 s d l y . h” // Define IFREQ and CFREQ above t h i s #i n c l u d e<br />

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

// Global V a r i a b l e s<br />

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

51 v o l a t i l e BOOL GotSUD ;<br />

BOOL Rwuen ;<br />

BOOL S e l f p w r ;<br />

v o l a t i l e BOOL S l e e p ; // S l e e p mode e n a b l e f l a g<br />

56 WORD pDeviceDscr ; // Pointer to Device D e s c r i p t o r ; D e s c r i p t o r s may be moved<br />

WORD pDeviceQualDscr ;<br />

WORD pHighSpeedConfigDscr ;<br />

WORD pFullSpeedConfigDscr ;<br />

WORD pConfigDscr ;<br />

61 WORD pOtherConfigDscr ;<br />

58 Matthias Zurbrügg, Christoph Zimmermann

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!