40#ifndef __USBMANAGER_H__
41#define __USBMANAGER_H__
56#include "cdcdf_acm_desc.h"
57#include "hal_usb_device.h"
58#include "hri_mclk_e53.h"
59#include "hri_gclk_e53.h"
61#include "hri_port_e53.h"
68#ifndef USB_SERIAL_BUFFER_SIZE
69#define USB_SERIAL_BUFFER_SIZE 64
74#define USB_STATUS_REG_LIST(Func) \
75 Func(UnhandledSetupReq) \
76 Func(UnhandledDescReq) \
77 Func(UnhandledStringReq) \
78 Func(UnhandledFeatureReq) \
79 Func(FailedStandardSetup) \
80 Func(FailedClassSetup) \
81 Func(FailedDescriptor) \
82 Func(FailedTransferIn) \
83 Func(FailedTransferOut) \
87 Func(RamAccessError) \
88 Func(FrameNumberCrcError) \
89 Func(ReadBufferOverflow) \
96#define STRUCTIFY(item) \
103#define ENUMIFY(item) \
110#define MASKIFY(item) \
111 const uint32_t item##Mask = 1UL << item ;
113#define MIN(a, b) (((a) < (b)) ? (a) : (b))
116#ifndef HIDE_FROM_DOXYGEN
120union UsbStatusRegister {
129 USB_STATUS_REG_LIST(STRUCTIFY)
134#ifndef HIDE_FROM_DOXYGEN
142 USB_STATUS_REG_LIST(ENUMIFY)
143 USB_STATUS_REG_FIELD_LAST_ITEM
146#define UNUSED(expr) (void)(expr)
155USB_STATUS_REG_LIST(MASKIFY)
181#ifndef HIDE_FROM_DOXYGEN
215 void WaitForWriteFinish();
247 const volatile usb_cdc_control_signal_t &LineState() {
267 static bool CBLineStateChanged(usb_cdc_control_signal_t state);
268 static bool TxComplete(
const uint8_t ep,
269 const enum usb_xfer_code rc,
270 const uint32_t count);
271 static bool RxComplete(
const uint8_t ep,
272 const enum usb_xfer_code rc,
273 const uint32_t count);
275 void cdc_device_acm_init(
void);
285 volatile uint32_t m_inHead, m_inTail;
286 volatile uint32_t m_outHead, m_outTail;
288 volatile
bool m_sendActive;
289 volatile
bool m_readActive;
290 usb_cdc_control_signal_t m_lineState;
291 uint8_t *m_readBufPtr;
292 uint32_t m_readBufAvail;
305 void RxCopyToRingBuf();
#define USB_SERIAL_BUFFER_SIZE
Definition UsbManager.h:69
ClearCore Board Supervisory System Manager.
Definition SysManager.h:58
USB manager Class.
Definition UsbManager.h:178
bool Speed(uint32_t bitsPerSecond)
Change the baud rate for the port.
bool SendChar(uint8_t charToSend)
Send an ascii character on the serial channel.
bool PortIsOpen()
Return whether or not the USB port is open.
int16_t CharGet()
Attempt to read the next character from serial channel.
int32_t AvailableForWrite()
Determines the number of characters available in the transmit buffer.
int16_t CharPeek()
Attempt to get the next character from the serial channel without pulling the character out of the bu...
uint32_t Speed()
Get current port speed.
int32_t AvailableForRead()
Namespace to encompass the ClearCore board API.
Definition AdcManager.h:36