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 />

141 //OEA |= 0x0C ; // i n i t i a l i z e PA3 and PA2 p o r t i /o p i n s as o u t p u t s<br />

//PORTECFG = 0x07 ;<br />

}<br />

void TD Poll ( void ) // c a l l e d r e p e a t e d l y w h i l e t h e d e v i c e i s i d l e<br />

146 {<br />

i f ( ! ( EP2468STAT & bmEP2EMPTY ) ) // i f t h e r e ’ s a p a c k e t in t h e p e r i p h e r a l<br />

domain f o r EP2<br />

{<br />

i f ( fpga cfg m ode == TRUE) // vendor command 0xC1 f o r FPGA c o n f i g u r a t i o n<br />

mode<br />

{<br />

151 f p g a c f g i n i t ( ) ; // i n i t a l i z e i /o l i n e s f o r FPGA c o n f i g u r a t i o n mode<br />

( f u n c t i o n in f p g a c f g f u n c . c )<br />

f p g a c f g ( ) ; // c a l l FPGA c o n f i g u r a t i o n prozedure ( f u n c t i o n in<br />

f p g a c f g f u n c . c )<br />

}<br />

i f ( eeprom write mode == TRUE) // vendor command 0xC2 l o ad firmware in EEPROM<br />

156 {<br />

eeprom wr ( ) ; // c a l l EEPROM w r i t e<br />

}<br />

i f ( s p i f l a s h w r i t e m o d e == TRUE) // vendor command 0xC4 l o ad FPGA<br />

c o n f i g u r a t i o n in SPI Flash , v a l u e in EP0 i s c o n f i g u r a t i o n p a r t (0 or 1)<br />

−−−−>> to do<br />

161 {<br />

s p i f l a s h w r ( ) ; // c a l l SPI Flash w r i t e<br />

}<br />

}<br />

166 i f ( eeprom read mode == TRUE) // vendor command 0xC3 read firmware from<br />

EEPROM, v a l u e in EP0 i s number o f b y t e s to read<br />

{<br />

eeprom rd ( r e a d c o u n t ) ; // c a l l EEPROM read<br />

}<br />

171 i f ( s p i f l a s h r e a d m o d e == TRUE) // vendor command 0xC5 read FPGA<br />

c o n f i g u r a t i o n from SPI Flash , v a l u e in EP0 i s number o f b y t e s to read<br />

{<br />

s p i f l a s h r d ( ) ; // c a l l SPI Flash read<br />

}<br />

176 i f ( ! ( EP2468STAT & bmEP6EMPTY ) ) // i f t h e r e ’ s a p a c k e t in t h e p e r i p h e r a l<br />

domain f o r EP6<br />

{<br />

gpif wr waveform ( ) ; // c a l l f u n c t i o n to s t a r t a GPIF FIFO WRITE<br />

Transaction ( f u n c t i o n in g p i f r d w r f u n c . c )<br />

i n e n a b l e = TRUE;<br />

}<br />

181 i f ( i n e n a b l e ) { // s t a r t communication<br />

g p i f r d w a v e f o r m ( ) ; // c a l l f u n c t i o n to s t a r t a GPIF FIFO READ<br />

Transaction ( f u n c t i o n in g p i f r d w r f u n c . c )<br />

}<br />

186 i f ( ! ( EP01STAT & bmEP1OUTBSY) )<br />

{<br />

// handle OUTs to EP1OUT<br />

}<br />

191 i f ( ! ( EP01STAT & bmEP1INBSY) )<br />

{<br />

// handle INs to EP1IN<br />

}<br />

}<br />

66 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!