
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: 22
for (i = EP0Buf; i < cMemEnd; i++) // verify data for (i = EP0Buf; i < cMemEnd; i++) // verify data
{ {
if ((BYTE)i != SL11Read((BYTE)i) if ((BYTE)i != SL11Read((BYTE)i)) )
errors++; errors++;
SL11Write ((BYTE)i, (BYTE)~i); SL11Write ((BYTE)i, (BYTE)~i);
if ((BYTE)~i != SL11Read((BYTE)i)) if ((BYTE)~i != SL11Read((BYTE)i))
errors++; errors++;
} }
// auto increment: addr = data // auto increment: addr = data
for (i = EP0Buf, outportb(SL11_ADDR,EP0Buf); i < cMemEnd; i++) for (i = EP0Buf, outportb(SL11_ADDR,EP0Buf); i < cMemEnd; i++)
outportb(SL11_ADDR+1, i outportb(SL11_ADDR+1, i););
// auto: addr = data // auto: addr = data
for (i = EP0Buf, outportb(SL11_ADDR, EP0Buf); i < cMemEnd; i++) for (i = EP0Buf, outportb(SL11_ADDR, EP0Buf); i < cMemEnd; i++)
{ {
if ((BYTE)i != (BYTE)inportb(SL11_ADDR + 1)) if ((BYTE)i != (BYTE)inportb(SL11_ADDR + 1))
errors++; errors++;
} }
// clear all SL811H/SL11H Memory // clear all SL811H/SL11H Memory
for (i = EP0Buf, outportb(SL11_ADDR, EP0 for (i = EP0Buf, outportb(SL11_ADDR, EP0Buf); i<cMemEnd; i++)Buf); i<cMemEnd; i++)
outportb(SL11_ADDR + 1, 0); outportb(SL11_ADDR + 1, 0);
printf("Memory test done %x printf("Memory test done %x\\n",errors);n",errors);
return errors; // Return number of error return errors; // Return number of error
}}
4.1.4 USB Reset
Before accessing a USB device, the SL811HS must generate a USB_RESET, which forces the
slave device to its default address of zero. The minimum time required to hold the USB bus in
Reset is ≥ 10 milliseconds. Every USB device after detecting Reset responds to USB address
zero. After Reset, configuration software can read every device’s descriptor at the same
default address, one device at a time.
Program Sample 6: USB Reset Function
////----------------------------------------------------------------------------------------------------------------------------------------------------
// UsbReset:// UsbReset:
////----------------------------------------------------------------------------------------------------------------------------------------------------
void USBReset()void USBReset()
{{
BYTE tmp; BYTE tmp;
tmp = SL11Read(CtrlReg); // Read Control Status tmp = SL11Read(CtrlReg); // Read Control Status
SL11Write(CtrlReg,tmp | 8); // Setup USB Reset SL11Write(CtrlReg,tmp | 8); // Setup USB Reset
Delayms(250,0); Delayms(250,0);
SL11Write(CtrlReg,tmp | 0x18); // su SL11Write(CtrlReg,tmp | 0x18); // suspend/resume, resetspend/resume, reset
Delayms(150,0); Delayms(150,0);
SL11Write(CtrlReg,tmp | 8); // Setup USB Reset SL11Write(CtrlReg,tmp | 8); // Setup USB Reset
Delayms(10,0); // Delay 10 ms Delayms(10,0); // Delay 10 ms
SL11Write(CtrlReg,tmp); // enable USB SL11Write(CtrlReg,tmp); // enable USB
}}
Comentarios a estos manuales