
Cypress Semiconductor Corporation
SL811HS and SL811HST: Application Notes
©2001 Cypress Semiconductor Corporation. All rights reserved. The information
and specifications contained in this document are subject to change without
notice.
Date: 07/26/01
Revision: 1.21
Page: 28
Example for doing PID_IN or PID_OUT or PID_SETUP with payload = 8;
then the Software requirement is:
static short low_speed_via_hub = 0;static short low_speed_via_hub = 0;
// the low_speed_via_hub will be set high only when the HUB // the low_speed_via_hub will be set high only when the HUB detect lowdetect low
// speed device attach to the HUB.// speed device attach to the HUB.
short int_cnt=0; short int_cnt=0;
short pl, Cmd=DATA0_RD, loop=30000; short pl, Cmd=DATA0_RD, loop=30000;
if (low_speed_via_hub) if (low_speed_via_hub)
{ {
pl = payload + 16; // low speed pl = payload + 16; // low speed
Cmd |= 0x80; // Cmd |= 0x80; //
} }
else pl = (payload>>3) + 3; else pl = (payload>>3) + 3;
SL11Write SL11Write(EP0Status, (BYTE)( (PID_IN << 4) + 0 ) );(EP0Status, (BYTE)( (PID_IN << 4) + 0 ) );
SL11Write(EP0Counter, 0); SL11Write(EP0Counter, 0);
SL11Write(EP0XferLen, payload); // setup 3 SL11Write(EP0XferLen, payload); // setup 3--byte header + payloadbyte header + payload
SL11Write(EP0Address, 0x10); // DATA0 SL11Write(EP0Address, 0x10); // DATA0
while( loop while( loop---- ) )
{ {
int_cnt++; int_cnt++;
SL11Write(IntStatus SL11Write(IntStatus,0xff);,0xff);
if (SL11Read(0xf) > (BYTE)pl) if (SL11Read(0xf) > (BYTE)pl)
SL11Write(EP0Control,Cmd); // Enable ARM SL11Write(EP0Control,Cmd); // Enable ARM
else else
SL11Write(EP0Control,Cmd|0x20); // Enable ARM and Wait after SOF SL11Write(EP0Control,Cmd|0x20); // Enable ARM and Wait after SOF
// just for example only. If CPU uses the Interrupt // just for example only. If CPU uses the Interrupt
Delay1ms(2,0); Delay1ms(2,0);
// should check the interrupt variable "int_cnt" // should check the interrupt variable "int_cnt"
if ((SL11Read(IntStatus)&1)==0) if ((SL11Read(IntStatus)&1)==0)
printf("Missing Interrupt printf("Missing Interrupt\\n");n");
else int_cnt else int_cnt----;;
} }
if (int_cnt) if (int_cnt)
printf("Missing interrupt printf("Missing interrupt\\n");n");
4.1.13 SOF or EOP Generation
The USB Specification v1.1 requires a host controller to generate an End of Packet (EOP) at
regular timed intervals - nominally every 1 millisecond - to keep low speed devices alive. An
EOP is defined as two single-ended zeros (SE0) followed by a J State. See figure below for
EOP pulse width.
Figure 5: EOP Pulse Width
Kommentare zu diesen Handbüchern