www.ti.com

Introduction

Example 3. Programming the USB Endpoints in Host Mode (continued)

usbRegs->TXFIFOSZ = fifosize ((double_buffer & 1)<<4); usbRegs->TXFIFOADDR = fifo_start_address + (1<<(fifosize+double_buffer)); usbRegs->RXMAXP = FIFO_MAXP;

usbRegs->TXMAXP = FIFO_MAXP;

//Configure the endpoint switch (device_speed) {

case LOW_SPEED : type = (3<<6) ((device_protocol & 3) << 4) (device_ep & 0xf); break;

case FULL_SPEED: type = (2<<6) ((device_protocol & 3) << 4) (device_ep & 0xf); break;

case HIGH_SPEED: type = (1<<6) ((device_protocol & 3) << 4) (device_ep & 0xf); break; default:error++;

}

usbRegs->EPCSR[CHAN_NUM+1].HOST_TYPE0 = type; // TXTYPE usbRegs->EPCSR[CHAN_NUM+1].HOST_RXTYPE = type;

//Set NAK limit / Polling interval (Interrupt & Iso protocols) if ((device_protocol == INT) (device_protocol == ISO)) {

usbRegs->EPCSR[CHAN_NUM+1].HOST_NAKLIMIT0 = TXINTERVAL;

// TX Polling interval

usbRegs->EPCSR[CHAN_NUM+1].HOST_RXINTERVAL = RXINTERVAL;

// RX Polling interval

} else {

 

 

usbRegs->EPCSR[CHAN_NUM+1].HOST_NAKLIMIT0 = 2;

// Frames to timeout from NAKs

usbRegs->EPCSR[CHAN_NUM+1].HOST_RXINTERVAL = 2;

// Frames to timeout from NAKs

}

 

 

//Set the address for transactions after SET ADDRESS successfully completed usbRegs->EPTRG[CHAN_NUM+1].TXFUNCADDR = device_address; usbRegs->EPTRG[CHAN_NUM+1].RXFUNCADDR = device_address;

SPRUGH3–November 2008

Universal Serial Bus (USB) Controller

19

Submit Documentation Feedback

Page 19
Image 19
Texas Instruments TMS320DM357 manual Else