Cypress Semiconductor SL811HS Manual do Utilizador Página 34

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 43
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 33
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: 34
//// 0x02 Device Error Bit 0x02 Device Error Bit
// 0x04 Device Time out// 0x04 Device Time out
// 0x08 Toggle bit// 0x08 Toggle bit
// 0x10 SET_UP packet bit (Not used in SL11H)// 0x10 SET_UP packet bit (Not used in SL11H)
// 0x20 Overflow bit// 0x20 Overflow bit
// 0x40 Device return NAKs, forever// 0x40 Device return NAKs, forever
// 0x80 Device return STALL// 0x80 Device return STALL
// need to keep track DATA0 // need to keep track DATA0 and DATA1 for write endpointand DATA1 for write endpoint
////----------------------------------------------------------------------------------------------------------------------------------------------------
int usbXfer(WORD crc, BYTE pid, BYTE iso, WORD payload, int len, BYTE *buf)int usbXfer(WORD crc, BYTE pid, BYTE iso, WORD payload, int len, BYTE *buf)
{ {
short result, bLen, rLen, time_out, data0, data1, D0, ep; short result, bLen, rLen, time_out, data0, data1, D0, ep;
WORD WORD retry; retry;
BYTE Cmd=DATA0_RD, addr, rem, pl; BYTE Cmd=DATA0_RD, addr, rem, pl;
extern short dbug; extern short dbug;
if (dbug) pl = payload + 24; // low speed debug if (dbug) pl = payload + 24; // low speed debug
else pl = (payload>>3) + 3; else pl = (payload>>3) + 3;
ep = (crc>>7) & 0xf; ep = (crc>>7) & 0xf;
data0 = cMemStart; data0 = cMemStart;
#ifdef SL811H#ifdef SL811H
SL11Write(EP0Status, (BYTE)( (pid SL11Write(EP0Status, (BYTE)( (pid << 4) + ep ) ); << 4) + ep ) );
SL11Write(EP0Counter, (BYTE)(crc & 0x7f)); SL11Write(EP0Counter, (BYTE)(crc & 0x7f));
#ifdef REV13#ifdef REV13
if (dbug && pid==PID_IN) // handle low speed via Hub if (dbug && pid==PID_IN) // handle low speed via Hub
{ {
SL11Write(EP1Status, 0xc0); SL11Write(EP1Status, 0xc0);
SL11Write(EP1XferLen, 0); SL11Write(EP1XferLen, 0);
} }
#endif#endif
#else#else
SL11Write(data0,p SL11Write(data0,pid); // PID id); // PID
SL11BufWrite((short)(data0+1),(BYTE*)&crc, 2); // 2 bytes CRC SL11BufWrite((short)(data0+1),(BYTE*)&crc, 2); // 2 bytes CRC
#endif#endif
if (len>=(int)payload) if (len>=(int)payload)
{ // setup ping pong buffer { // setup ping pong buffer
data1 = data0 + payload + cOFFSET; // next buffer data1 = data0 + payload + cOFFSET; // next buffer
#ifndef SL811H#ifndef SL811H
SL11Write(data1,pid); // PID SL11Write(data1,pid); // PID
SL11BufWrite((short)(data1+1),(BYTE*)&crc,2); SL11BufWrite((short)(data1+1),(BYTE*)&crc,2);
#endif#endif
rLen = payload; rLen = payload;
} }
else else
rLen = (short)len; rLen = (short)len;
SL11Write(EP0XferLen,(BYTE)(cOFFSET+rLen)); // setup 3 SL11Write(EP0XferLen,(BYTE)(cOFFSET+rLen)); // setup 3--byte header + pabyte header + payloadyload
SL11Write(EP0Address, (BYTE)data0); // DATA0 SL11Write(EP0Address, (BYTE)data0); // DATA0
#ifndef SL811H#ifndef SL811H
if (pid == PID_SOF) // Send Software SOF if (pid == PID_SOF) // Send Software SOF
{ {
SL11Write(EP0Control, 1); SL11Write(EP0Control, 1); // arm and return // arm and return
return len; return len;
} }
#endif#endif
if (iso) C if (iso) Cmd |= ISO_BIT; // if iso setup ISO modemd |= ISO_BIT; // if iso setup ISO mode
if (pid != PID_IN) if (pid != PID_IN)
{ SL11BufWrite((short)(data0+cOFFSET),buf, rLen); // DATA to SL11 Memory { SL11BufWrite((short)(data0+cOFFSET),buf, rLen); // DATA to SL11 Memory
Cmd = DATA0_WR; Cmd = DATA0_WR;
} }
Vista de página 33
1 2 ... 29 30 31 32 33 34 35 36 37 38 39 ... 42 43

Comentários a estes Manuais

Sem comentários