![Texas Instruments AM1808 Скачать руководство пользователя страница 1686](http://html.mh-extra.com/html/texas-instruments/am1808/am1808_technical-reference-manual_10945581686.webp)
Use Cases
1686
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
Universal Serial Bus 2.0 (USB) Controller
Example 34-5. Programming the USB DMA Controller (continued)
if (DESCsetup==SINGLE_DESC_SETUP)
// One additonal Rx Desc Needs to be Queued for
Handling Null Packet
initSingleHPDorHBD(1,RECEIVE,BUFFER_DESC,rxCompQ);
//Usage:
initSingleHPDorHBD(descNum,dir,TypeOfDesc,returnQueue)
else
initSingleHPDorHBD(2,RECEIVE,BUFFER_DESC,rxCompQ);
//Usage: initSingleHPDorHBD(descNum,dir,TypeOfDesc,returnQueue)
}
// ****************** Initialize Transmit Packet and Buffer Descriptors*************************
// See comment above to understand the reasons for the total number of descriptors.
// Initialize transmit descriptors (HPD and HBDs)
//Initialize HPD Descriptor 16 for Transmit.
initSingleHPDorHBD(16,TRANSMIT,PACKET_DESC,txCompQ);
//Usage:
initSingleHPDorHBD(descNum,dir,TypeOfDesc,returnQueue)
if (DESCsetup==MULTIPLE_DESC_SETUP) {
if(DMAmode==TRANSPARENT) {
initSingleHPDorHBD(17,TRANSMIT,PACKET_DESC,txCompQ);
//Usage:
initSingleHPDorHBD(descNum,dir,TypeOfDesc,returnQueue)
//
initSingleHPDorHBD(18,TRANSMIT,PACKET_DESC,txCompQ);
//Usage:
initSingleHPDorHBD(descNum,dir,TypeOfDesc,returnQueue)
//
initSingleHPDorHBD(19,TRANSMIT,PACKET_DESC,txCompQ);
//Usage:
initSingleHPDorHBD(descNum,dir,TypeOfDesc,returnQueue)
}
else {
initSingleHPDorHBD(17,TRANSMIT,BUFFER_DESC,txCompQ);
//Usage:
initSingleHPDorHBD(descNum,dir,TypeOfDesc,returnQueue)
//
initSingleHPDorHBD(18,TRANSMIT,BUFFER_DESC,txCompQ);
//Usage:
initSingleHPDorHBD(descNum,dir,TypeOfDesc,returnQueue)
//
initSingleHPDorHBD(19,TRANSMIT,BUFFER_DESC,txCompQ);
//Usage:
initSingleHPDorHBD(descNum,dir,TypeOfDesc,returnQueue)
}
}
// ****************** Submit Receive Buffer Descriptors ****************************************
//Submit Receive Descriptors
qDesc2SubmitQ(rxSubmitQ,0);
//Queue Number, HPDdescriptorNumber
if (DESCsetup==MULTIPLE_DESC_SETUP)
qDesc2SubmitQ(rxSubmitQ,1);
//Queue Number, HPDdescriptorNumber
if (DMAmode!=TRANSPARENT) {
// Need to Submit the Descriptor to be used for the Null
Packet.
if (DESCsetup==SINGLE_DESC_SETUP)
// One additonal Rx Desc Needs to be Queued
for Handling Null Packet
qDesc2SubmitQ(rxSubmitQ,1);
//Queue Number, HPDdescriptorNumber
else
qDesc2SubmitQ(rxSubmitQ,2);
//Queue Number, HPDdescriptorNumber
}
//Enable Rx DMA
enableCoreRxDMA(endpoint);
// ****************** Submit Transmit Buffer Descriptors ***************************************
// wait till all data is received here <<<<<<<
//Submit Transmit Descriptors
qDesc2SubmitQ(txSubmitQ,16);
//Queue Number, HPDdescriptorNumber
if (DESCsetup==MULTIPLE_DESC_SETUP)
qDesc2SubmitQ(txSubmitQ,17);
//Queue Number, HPDdescriptorNumber
//
qDesc2SubmitQ(txSubmitQ,18);
//Queue Number, HPDdescriptorNumber
enableCoreTxDMA(endpoint);
// *************************************************************************************
// wait till all data is received here <<<<<<<