25.12.2013 Aufrufe

Gecko3 - CCC Event Weblog

Gecko3 - CCC Event Weblog

Gecko3 - CCC Event Weblog

MEHR ANZEIGEN
WENIGER ANZEIGEN

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

E.1. Firmware<br />

191 // c l e a r t h e S l e e p f l a g .<br />

S l e e p = FALSE;<br />

// Task Dispatcher<br />

while (TRUE)<br />

// Main Loop<br />

196 {<br />

i f (GotSUD) // Wait f o r SUDAV<br />

{<br />

SetupCommand ( ) ; // Implement s e t u p command<br />

GotSUD = FALSE ; // Clear SUDAV f l a g<br />

201 }<br />

// P o l l User Device<br />

// NOTE: I d l e mode s t o p s t h e p r o c e s s o r c l o c k . There are only two<br />

// ways out o f i d l e mode , t h e WAKEUP pin , and d e t e c t i o n o f t h e USB<br />

206 // resume s t a t e on t h e USB bus . The timers w i l l s t o p and t h e<br />

// p r o c e s s o r w i l l not wake up on any o t h e r i n t e r r u p t s .<br />

i f ( S l e e p )<br />

{<br />

i f ( TD Suspend ( ) )<br />

211 {<br />

S l e e p = FALSE; // Clear t h e ”go to s l e e p ” f l a g . Do i t here<br />

to p r e v e n t any race c o n d i t i o n between wakeup and t h e next s l e e p .<br />

do<br />

{<br />

EZUSB Susp ( ) ; // Place p r o c e s s o r in i d l e mode .<br />

216 }<br />

while ( ! Rwuen && EZUSB EXTWAKEUP( ) ) ;<br />

// Must continue to go back i n t o suspend i f t h e h o s t has d i s a b l e d<br />

remote wakeup<br />

// ∗and∗ t h e wakeup was caused by t h e e x t e r n a l wakeup pin .<br />

221 // 8051 a c t i v i t y w i l l resume here due to USB bus or Wakeup# pin<br />

a c t i v i t y .<br />

EZUSB Resume ( ) ; // I f source i s t h e Wakeup# pin , s i g n a l t h e h o s t to<br />

Resume .<br />

TD Resume ( ) ;<br />

}<br />

}<br />

226 TD Poll ( ) ;<br />

}<br />

}<br />

// Device r e q u e s t p a r s e r<br />

231 void SetupCommand ( void )<br />

{<br />

void ∗ d s c r p t r ;<br />

switch (SETUPDAT[ 1 ] )<br />

236 {<br />

case SC GET DESCRIPTOR : // ∗∗∗ Get D e s c r i p t o r<br />

i f ( DR GetDescriptor ( ) )<br />

switch (SETUPDAT[ 3 ] )<br />

{<br />

241 case GD DEVICE: // Device<br />

SUDPTRH = MSB( pDeviceDscr ) ;<br />

SUDPTRL = LSB( pDeviceDscr ) ;<br />

break ;<br />

case GD DEVICE QUALIFIER : // Device Q u a l i f i e r<br />

246 SUDPTRH = MSB( pDeviceQualDscr ) ;<br />

SUDPTRL = LSB( pDeviceQualDscr ) ;<br />

break ;<br />

case GD CONFIGURATION: // C o n f i g u r a t i o n<br />

SUDPTRH = MSB( pConfigDscr ) ;<br />

251 SUDPTRL = LSB( pConfigDscr ) ;<br />

break ;<br />

Project Report 61

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

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!