I cannot find any examples of using the Tiva processor as a host and setting a CDC channel baud rate
Below is what I think is the correct code, would really like some confirmation if this is correct.
//*****************************************************************************
//
// USB_CDC_GET_LINE_CODING
//
//*****************************************************************************
#define USB_CDC_STOP_BITS_1 0x00
#define USB_CDC_STOP_BITS_1_5 0x01
#define USB_CDC_STOP_BITS_2 0x02
#define USB_CDC_PARITY_NONE 0x00
#define USB_CDC_PARITY_ODD 0x01
#define USB_CDC_PARITY_EVEN 0x02
#define USB_CDC_PARITY_MARK 0x03
#define USB_CDC_PARITY_SPACE 0x04
//*****************************************************************************
//
//! USB_CDC_GET/SET_LINE_CODING request-specific data.
//
//*****************************************************************************
typedef struct
{
//
//! The data terminal rate in bits per second.
//
uint32_t ui32Rate;
//
//! The number of stop bits. Valid values are USB_CDC_STOP_BITS_1,
//! USB_CDC_STOP_BITS_1_5 or USB_CDC_STOP_BITS_2
//
uint8_t ui8Stop;
//
//! The parity setting. Valid values are USB_CDC_PARITY_NONE,
//! USB_CDC_PARITY_ODD, USB_CDC_PARITY_EVEN, USB_CDC_PARITY_MARK and
//! USB_CDC_PARITY_SPACE.
//
uint8_t ui8Parity;
//
//! The number of data bits per character. Valid values are 5, 6, 7 and 8
//! in this implementation.
//
uint8_t ui8Databits;
}
PACKED tLineCoding;
static uint16_t USBHVENDSetLineCoding(void *pvInstance, uint16_t interface)
{
tUSBRequest sSetupPacket;
tVENDInstance *psInst;
tLineCoding LineConfig;
if (USBMDMH_Connected())
{
// Get our instance pointer.
psInst = (tVENDInstance *)pvInstance;
// This is a Standard Device IN request.
sSetupPacket.bmRequestType = USB_RTYPE_DIR_OUT | USB_RTYPE_CLASS | USB_RTYPE_INTERFACE;
sSetupPacket.bRequest = 0x20; // Set Line Coding
sSetupPacket.wValue = 0; // Line Coding
sSetupPacket.wIndex = interface; // Interface number
sSetupPacket.wLength = sizeof(tLineCoding);
// Set the config
LineConfig.ui32Rate = 115200;
LineConfig.ui8Databits = 8; // 8 databits
LineConfig.ui8Parity = USB_CDC_PARITY_NONE; // No parity
LineConfig.ui8Stop = USB_CDC_STOP_BITS_1; // 1 stop bit
// Send the command
USBHCDControlTransfer(0, &sSetupPacket, psInst->psDevice, (uint8_t *)&LineConfig, sizeof(tLineCoding),
psInst->psDevice->sDeviceDescriptor.bMaxPacketSize0);
}
return(0);
}