USB FIFO access. More...
#include <stdio.h>
#include "xpal_extmem.h"
Functions | |
void | USBInit (void) |
Initialises the USB Interface. | |
void | USB_assign_stdio (void) |
assign USB interface to stdio streams | |
int8_t | USB_set_flags (USB_stream_sel_t usb_stream, USB_flag_action_t action, USB_flags_t flags) |
set blocking/non-blocking characteristic for USB FIFO | |
int8_t | USB_get_flags (USB_stream_sel_t usb_stream, USB_flags_t *flags) |
get current flags for USB FIFO | |
Variables | |
USB_statistics_t | USB_statistics |
USB I/O statistics. |
USB FIFO access.
int8_t USB_set_flags | ( | USB_stream_sel_t | usb_stream, | |
USB_flag_action_t | action, | |||
USB_flags_t | flags | |||
) |
set blocking/non-blocking characteristic for USB FIFO
{ FILE * stream; unsigned int udata; stream = get_stream_from_sel (usb_stream); if (!stream) return -1; udata = (unsigned int)stream->udata; switch (action) { case USB_flag_clear: udata &= ~flags; break; case USB_flag_toggle: udata ^= flags; break; case USB_flag_set: udata |= flags; break; case USB_flag_assign: udata = flags; break; default: return -1; } stream->udata = (void*)udata; return 0; }
void USBInit | ( | void | ) |
Initialises the USB Interface.
initialize USB interface
{ /* Init USB specific signals */ HL_USB_TXE_DDR &= ~( _BV(HL_USB_TXE) ); // in HL_USB_RXF_DDR &= ~( _BV(HL_USB_RXF) ); // in HL_USB_PWREN_DDR &= ~( _BV(HL_USB_PWREN) ); // in HL_USB_RESET_PORT |= ( _BV(HL_USB_RESET) ); // high HL_USB_RESET_DDR |= ( _BV(HL_USB_RESET) ); // out /* Reset USB Controller */ // HL_USB_RESET_PORT &= ~( _BV(HL_USB_RESET) ); // low // HL_USB_RESET_PORT |= ( _BV(HL_USB_RESET) ); // high }