
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: 24
SL811HS provides two EP0Status=0x03 and EP0Counter =0x04 registers for setting USB
device PID, Endpoint, and Address. SL811HS host mode allows the user to setup any of the
16 endpoints and any of the 127 addresses.
ep = (crc>>7) & 0xf; ep = (crc>>7) & 0xf;
data0 = 0x10; // Memory start data0 = 0x10; // Memory start
SL11Write(EP0Address, (BYTE)data0); // DATA0
... ...
// Setup PID, Endpoint, and device Address // Setup PID, Endpoint, and device Address
SL11Write(EP0Status, (BYTE)( (pid << 4) + ep ) ); SL11Write(EP0Status, (BYTE)( (pid << 4) + ep ) );
SL11Write(EP0Counter, (BYTE)(crc & 0x7f)); SL11Write(EP0Counter, (BYTE)(crc & 0x7f));
// setup 3 // setup 3--byte header + payloadbyte header + payload
SL11Write(EP0XferLen,(BYTE)(payload));
... ...
// setup next ping // setup next ping--pong bufferpong buffer
data1 = data0 + payload; // next buffer data1 = data0 + payload; // next buffer
... ...
4.1.8 Single IN Packet
Example of a single IN Packet transaction: The IN Packet includes transmission of IN PID with
device address and endpoint. The device responds with either DATA0 or DATA1 token and
data payload. The program sample shows PID IN packet followed by a Data0 packet. For
continuous IN packets, the device is required to toggle Data tokens i.e., Data0, Data1, and so
on.
Program Sample 8: Single IN Packet
short addr = 3; // address 3 short addr = 3; // address 3
... ...
SL11Write(EP0Address, (BYTE)cMemStart); // DATA0 SL11Write(EP0Address, (BYTE)cMemStart); // DATA0
// PID_IN and endpoint 1 // PID_IN and endpoint 1
SL11Write(EP0Status, ((PID_IN & 0xff SL11Write(EP0Status, ((PID_IN & 0xff)<<4) | 1); // PID + ep)<<4) | 1); // PID + ep
SL11Write(EP0Counter, addr); SL11Write(EP0Counter, addr);
SL11Write(EP0XferLen,payload); // payload SL11Write(EP0XferLen,payload); // payload
SL11Write(EP0Control,DATA0_RD); SL11Write(EP0Control,DATA0_RD);
USB Trace 2: IN Packet
Comentários a estes Manuais