Classes | Macros
usbhs_device.h File Reference

USB Device Driver for USBHS. Compliant with common UDD driver. More...

#include "compiler.h"
#include "preprocessor.h"
Include dependency graph for usbhs_device.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sam_uotghs_dmach_t
 Structure for DMA registers in a channel. More...
 
struct  sam_uotghs_dmadesc_t
 Structure for DMA descriptor. More...
 
struct  uotghs_dma_control_t
 Structure for DMA control register. More...
 
struct  uotghs_dma_nextdesc_t
 Structure for DMA next descriptor register. More...
 
struct  uotghs_dma_status_t
 Structure for DMA status register. More...
 

Macros

#define USBHS_DEVEPTCFG_EPDIR_Pos   8
 
#define USBHS_RAM_ADDR   0xA0100000u
 
USBHS Device IP properties

These macros give access to IP properties

#define udd_get_endpoint_max_nbr()   (9)
 Get maximal number of endpoints. More...
 
#define UDD_MAX_PEP_NB   (udd_get_endpoint_max_nbr() + 1)
 
#define udd_get_endpoint_bank_max_nbr(ep)   ((ep == 0) ? 1 : (( ep <= 2) ? 3 : 2))
 Get maximal number of banks of endpoints. More...
 
#define udd_get_endpoint_size_max(ep)   (((ep) == 0) ? 64 : 1024)
 Get maximal size of endpoint (3X, 1024/64) More...
 
#define Is_udd_endpoint_dma_supported(ep)   ((((ep) >= 1) && ((ep) <= 7)) ? true : false)
 Get DMA support of endpoints. More...
 
#define Is_udd_endpoint_high_bw_supported(ep)   (((ep) >= 2) ? true : false)
 Get High Band Width support of endpoints. More...
 
USBHS Device speeds management
#define udd_low_speed_enable()   (Set_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_LS))
 Enable/disable device low-speed mode. More...
 
#define udd_low_speed_disable()   (Clr_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_LS))
 
#define Is_udd_low_speed_enable()   (Tst_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_LS))
 Test if device low-speed mode is forced. More...
 
#define udd_high_speed_enable()   do { } while (0)
 
#define udd_high_speed_disable()   do { } while (0)
 
#define Is_udd_full_speed_mode()   true
 
USBHS device attach control

These macros manage the USBHS Device attach.

#define udd_detach_device()   (Set_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_DETACH))
 Detaches from USB bus. More...
 
#define udd_attach_device()   (Clr_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_DETACH))
 Attaches to USB bus. More...
 
#define Is_udd_detached()   (Tst_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_DETACH))
 Test if the device is detached. More...
 
USBHS device bus events control

These macros manage the USBHS Device bus events.

#define udd_initiate_remote_wake_up()   (Set_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_RMWKUP))
 
#define Is_udd_pending_remote_wake_up()   (Tst_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_RMWKUP))
 
#define udd_enable_remote_wake_up_interrupt()   (USBHS->USBHS_DEVIER = USBHS_DEVIER_UPRSMES)
 
#define udd_disable_remote_wake_up_interrupt()   (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_UPRSMEC)
 
#define Is_udd_remote_wake_up_interrupt_enabled()   (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_UPRSME))
 
#define udd_ack_remote_wake_up_start()   (USBHS->USBHS_DEVICR = USBHS_DEVICR_UPRSMC)
 
#define udd_raise_remote_wake_up_start()   (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_UPRSMS)
 
#define Is_udd_remote_wake_up_start()   (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_UPRSM))
 
#define udd_enable_resume_interrupt()   (USBHS->USBHS_DEVIER = USBHS_DEVIER_EORSMES)
 
#define udd_disable_resume_interrupt()   (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_EORSMEC)
 
#define Is_udd_resume_interrupt_enabled()   (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_EORSME))
 
#define udd_ack_resume()   (USBHS->USBHS_DEVICR = USBHS_DEVICR_EORSMC)
 
#define udd_raise_resume()   (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_EORSMS)
 
#define Is_udd_resume()   (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_EORSM))
 
#define udd_enable_wake_up_interrupt()   (USBHS->USBHS_DEVIER = USBHS_DEVIER_WAKEUPES)
 
#define udd_disable_wake_up_interrupt()   (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_WAKEUPEC)
 
#define Is_udd_wake_up_interrupt_enabled()   (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_WAKEUPE))
 
#define udd_ack_wake_up()   (USBHS->USBHS_DEVICR = USBHS_DEVICR_WAKEUPC)
 
#define udd_raise_wake_up()   (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_WAKEUPS)
 
#define Is_udd_wake_up()   (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_WAKEUP))
 
#define udd_enable_reset_interrupt()   (USBHS->USBHS_DEVIER = USBHS_DEVIER_EORSTES)
 
#define udd_disable_reset_interrupt()   (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_EORSTEC)
 
#define Is_udd_reset_interrupt_enabled()   (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_EORSTE))
 
#define udd_ack_reset()   (USBHS->USBHS_DEVICR = USBHS_DEVICR_EORSTC)
 
#define udd_raise_reset()   (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_EORSTS)
 
#define Is_udd_reset()   (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_EORST))
 
#define udd_enable_sof_interrupt()   (USBHS->USBHS_DEVIER = USBHS_DEVIER_SOFES)
 
#define udd_disable_sof_interrupt()   (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_SOFEC)
 
#define Is_udd_sof_interrupt_enabled()   (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_SOFE))
 
#define udd_ack_sof()   (USBHS->USBHS_DEVICR = USBHS_DEVICR_SOFC)
 
#define udd_raise_sof()   (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_SOFS)
 
#define Is_udd_sof()   (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_SOF))
 
#define udd_frame_number()   (Rd_bitfield(USBHS->USBHS_DEVFNUM, USBHS_DEVFNUM_FNUM_Msk))
 
#define Is_udd_frame_number_crc_error()   (Tst_bits(USBHS->USBHS_DEVFNUM, USBHS_DEVFNUM_FNCERR))
 
#define udd_enable_msof_interrupt()   (USBHS->USBHS_DEVIER = USBHS_DEVIER_MSOFES)
 
#define udd_disable_msof_interrupt()   (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_MSOFEC)
 
#define Is_udd_msof_interrupt_enabled()   (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_MSOFE))
 
#define udd_ack_msof()   (USBHS->USBHS_DEVICR = USBHS_DEVIMR_MSOFE)
 
#define udd_raise_msof()   (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_MSOFS)
 
#define Is_udd_msof()   (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_MSOF))
 
#define udd_micro_frame_number()   (Rd_bitfield(USBHS->USBHS_DEVFNUM, (USBHS_DEVFNUM_FNUM_Msk|USBHS_DEVFNUM_MFNUM_Msk)))
 
#define udd_enable_suspend_interrupt()   (USBHS->USBHS_DEVIER = USBHS_DEVIER_SUSPES)
 
#define udd_disable_suspend_interrupt()   (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_SUSPEC)
 
#define Is_udd_suspend_interrupt_enabled()   (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_SUSPE))
 
#define udd_ack_suspend()   (USBHS->USBHS_DEVICR = USBHS_DEVICR_SUSPC)
 
#define udd_raise_suspend()   (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_SUSPS)
 
#define Is_udd_suspend()   (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_SUSP))
 
USBHS device address control

These macros manage the USBHS Device address.

#define udd_enable_address()   (Set_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_ADDEN))
 enables USB device address More...
 
#define udd_disable_address()   (Clr_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_ADDEN))
 disables USB device address More...
 
#define Is_udd_address_enabled()   (Tst_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_ADDEN))
 
#define udd_configure_address(addr)   (Wr_bitfield(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_UADD_Msk, addr))
 configures the USB device address More...
 
#define udd_get_configured_address()   (Rd_bitfield(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_UADD_Msk))
 gets the currently configured USB device address More...
 
USBHS Device endpoint drivers

These macros manage the common features of the endpoints.

#define USBHS_ARRAY(reg, index)   ((&(USBHS->reg))[(index)])
 
USBHS Device endpoint configuration
#define udd_enable_endpoint(ep)   (Set_bits(USBHS->USBHS_DEVEPT, USBHS_DEVEPT_EPEN0 << (ep)))
 enables the selected endpoint More...
 
#define udd_disable_endpoint(ep)   (Clr_bits(USBHS->USBHS_DEVEPT, USBHS_DEVEPT_EPEN0 << (ep)))
 disables the selected endpoint More...
 
#define Is_udd_endpoint_enabled(ep)   (Tst_bits(USBHS->USBHS_DEVEPT, USBHS_DEVEPT_EPEN0 << (ep)))
 tests if the selected endpoint is enabled More...
 
#define udd_reset_endpoint(ep)
 resets the selected endpoint More...
 
#define Is_udd_resetting_endpoint(ep)   (Tst_bits(USBHS->USBHS_DEVEPT, USBHS_DEVEPT_EPRST0 << (ep)))
 Tests if the selected endpoint is being reset. More...
 
#define udd_configure_endpoint_type(ep, type)   (Wr_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPTYPE_Msk, type))
 Configures the selected endpoint type. More...
 
#define udd_get_endpoint_type(ep)   (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPTYPE_Msk))
 Gets the configured selected endpoint type. More...
 
#define udd_enable_endpoint_bank_autoswitch(ep)   (Set_bits(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_AUTOSW))
 Enables the bank autoswitch for the selected endpoint. More...
 
#define udd_disable_endpoint_bank_autoswitch(ep)   (Clr_bits(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_AUTOSW))
 Disables the bank autoswitch for the selected endpoint. More...
 
#define Is_udd_endpoint_bank_autoswitch_enabled(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_AUTOSW))
 
#define udd_configure_endpoint_direction(ep, dir)   (Wr_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPDIR, dir))
 Configures the selected endpoint direction. More...
 
#define udd_get_endpoint_direction(ep)   (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPDIR))
 Gets the configured selected endpoint direction. More...
 
#define Is_udd_endpoint_in(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPDIR))
 
#define udd_format_endpoint_size(size)   (32 - clz(((uint32_t)min(max(size, 8), 1024) << 1) - 1) - 1 - 3)
 
#define udd_configure_endpoint_size(ep, size)   (Wr_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPSIZE_Msk, udd_format_endpoint_size(size)))
 Configures the selected endpoint size. More...
 
#define udd_get_endpoint_size(ep)   (8 << Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPSIZE_Msk))
 Gets the configured selected endpoint size. More...
 
#define udd_configure_endpoint_bank(ep, bank)   (Wr_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPBK_Msk, bank))
 Configures the selected endpoint number of banks. More...
 
#define udd_get_endpoint_bank(ep)   (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPBK_Msk)+1)
 Gets the configured selected endpoint number of banks. More...
 
#define udd_allocate_memory(ep)   (Set_bits(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_ALLOC))
 Allocates the configuration selected endpoint in DPRAM memory. More...
 
#define udd_unallocate_memory(ep)   (Clr_bits(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_ALLOC))
 un-allocates the configuration selected endpoint in DPRAM memory More...
 
#define Is_udd_memory_allocated(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_ALLOC))
 
#define udd_configure_endpoint(ep, type, dir, size, bank)
 Configures selected endpoint in one step. More...
 
#define Is_udd_endpoint_configured(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_CFGOK))
 Tests if current endpoint is configured. More...
 
#define udd_control_direction()   (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTISR[0], EP_CONTROL), USBHS_DEVEPTISR_CTRLDIR))
 Returns the control direction. More...
 
#define udd_reset_data_toggle(ep)   (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_RSTDTS)
 Resets the data toggle sequence. More...
 
#define Is_udd_data_toggle_reset(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_RSTDT))
 Tests if the data toggle sequence is being reset. More...
 
#define udd_data_toggle(ep)   (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_DTSEQ_Msk))
 Returns data toggle. More...
 
USBHS Device control endpoint interrupts

These macros control the endpoints interrupts.

#define udd_enable_endpoint_interrupt(ep)   (USBHS->USBHS_DEVIER = USBHS_DEVIER_PEP_0 << (ep))
 Enables the selected endpoint interrupt. More...
 
#define udd_disable_endpoint_interrupt(ep)   (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_PEP_0 << (ep))
 Disables the selected endpoint interrupt. More...
 
#define Is_udd_endpoint_interrupt_enabled(ep)   (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_PEP_0 << (ep)))
 Tests if the selected endpoint interrupt is enabled. More...
 
#define Is_udd_endpoint_interrupt(ep)   (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_PEP_0 << (ep)))
 Tests if an interrupt is triggered by the selected endpoint. More...
 
#define udd_get_interrupt_endpoint_number()
 Returns the lowest endpoint number generating an endpoint interrupt or MAX_PEP_NB if none. More...
 
#define USBHS_DEVISR_PEP_Pos   12
 
#define USBHS_DEVIMR_PEP_Pos   12
 
USBHS Device control endpoint errors

These macros control the endpoint errors.

#define udd_enable_stall_handshake(ep)   (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_STALLRQS)
 Enables the STALL handshake. More...
 
#define udd_disable_stall_handshake(ep)   (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_STALLRQC)
 Disables the STALL handshake. More...
 
#define Is_udd_endpoint_stall_requested(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_STALLRQ))
 Tests if STALL handshake request is running. More...
 
#define Is_udd_stall(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_STALLEDI))
 Tests if STALL sent. More...
 
#define udd_ack_stall(ep)   (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_STALLEDIC)
 ACKs STALL sent. More...
 
#define udd_raise_stall(ep)   (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_STALLEDIS)
 Raises STALL sent. More...
 
#define udd_enable_stall_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_STALLEDES)
 Enables STALL sent interrupt. More...
 
#define udd_disable_stall_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_STALLEDEC)
 Disables STALL sent interrupt. More...
 
#define Is_udd_stall_interrupt_enabled(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_STALLEDE))
 Tests if STALL sent interrupt is enabled. More...
 
#define Is_udd_nak_out(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_NAKOUTI))
 Tests if NAK OUT received. More...
 
#define udd_ack_nak_out(ep)   (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_NAKOUTIC)
 ACKs NAK OUT received. More...
 
#define udd_raise_nak_out(ep)   (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_NAKOUTIS)
 Raises NAK OUT received. More...
 
#define udd_enable_nak_out_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_NAKOUTES)
 Enables NAK OUT interrupt. More...
 
#define udd_disable_nak_out_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_NAKOUTEC)
 Disables NAK OUT interrupt. More...
 
#define Is_udd_nak_out_interrupt_enabled(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_NAKOUTE))
 Tests if NAK OUT interrupt is enabled. More...
 
#define Is_udd_nak_in(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_NAKINI))
 Tests if NAK IN received. More...
 
#define udd_ack_nak_in(ep)   (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_NAKINIC)
 ACKs NAK IN received. More...
 
#define udd_raise_nak_in(ep)   (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_NAKINIS)
 Raises NAK IN received. More...
 
#define udd_enable_nak_in_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_NAKINES)
 Enables NAK IN interrupt. More...
 
#define udd_disable_nak_in_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_NAKINEC)
 Disables NAK IN interrupt. More...
 
#define Is_udd_nak_in_interrupt_enabled(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_NAKINE))
 Tests if NAK IN interrupt is enabled. More...
 
#define udd_ack_overflow_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_OVERFIC)
 ACKs endpoint isochronous overflow interrupt. More...
 
#define udd_raise_overflow_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_OVERFIS)
 Raises endpoint isochronous overflow interrupt. More...
 
#define Is_udd_overflow(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_OVERFI))
 Tests if an overflow occurs. More...
 
#define udd_enable_overflow_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_OVERFES)
 Enables overflow interrupt. More...
 
#define udd_disable_overflow_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_OVERFEC)
 Disables overflow interrupt. More...
 
#define Is_udd_overflow_interrupt_enabled(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_OVERFE))
 Tests if overflow interrupt is enabled. More...
 
#define udd_ack_underflow_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_UNDERFIC)
 ACKs endpoint isochronous underflow interrupt. More...
 
#define udd_raise_underflow_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_UNDERFIS)
 Raises endpoint isochronous underflow interrupt. More...
 
#define Is_udd_underflow(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_UNDERFI))
 Tests if an underflow occurs. More...
 
#define udd_enable_underflow_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_UNDERFES)
 Enables underflow interrupt. More...
 
#define udd_disable_underflow_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_UNDERFEC)
 Disables underflow interrupt. More...
 
#define Is_udd_underflow_interrupt_enabled(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_UNDERFE))
 Tests if underflow interrupt is enabled. More...
 
#define Is_udd_crc_error(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_CRCERRI))
 Tests if CRC ERROR ISO OUT detected. More...
 
#define udd_ack_crc_error(ep)   (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_CRCERRIC)
 ACKs CRC ERROR ISO OUT detected. More...
 
#define udd_raise_crc_error(ep)   (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_CRCERRIS)
 Raises CRC ERROR ISO OUT detected. More...
 
#define udd_enable_crc_error_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_CRCERRES)
 Enables CRC ERROR ISO OUT detected interrupt. More...
 
#define udd_disable_crc_error_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_CRCERREC)
 Disables CRC ERROR ISO OUT detected interrupt. More...
 
#define Is_udd_crc_error_interrupt_enabled(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_CRCERRE))
 Tests if CRC ERROR ISO OUT detected interrupt is enabled. More...
 
USBHS Device control endpoint transfer

These macros control the endpoint transfer.

#define Is_udd_read_enabled(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_RWALL))
 Tests if endpoint read allowed. More...
 
#define Is_udd_write_enabled(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_RWALL))
 Tests if endpoint write allowed. More...
 
#define udd_byte_count(ep)   (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_BYCT_Msk))
 Returns the byte count. More...
 
#define udd_ack_fifocon(ep)   (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_FIFOCONC)
 Clears FIFOCON bit. More...
 
#define Is_udd_fifocon(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_FIFOCON))
 Tests if FIFOCON bit set. More...
 
#define udd_nb_busy_bank(ep)   (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_NBUSYBK_Msk))
 Returns the number of busy banks. More...
 
#define udd_current_bank(ep)   (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_CURRBK_Msk))
 Returns the number of the current bank. More...
 
#define udd_kill_last_in_bank(ep)   (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_KILLBKS)
 Kills last bank. More...
 
#define Is_udd_kill_last(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_KILLBK))
 
#define Is_udd_last_in_bank_killed(ep)   (!Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_KILLBK))
 Tests if last bank killed. More...
 
#define udd_force_bank_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_NBUSYBKS)
 Forces all banks full (OUT) or free (IN) interrupt. More...
 
#define udd_unforce_bank_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_NBUSYBKS)
 Unforces all banks full (OUT) or free (IN) interrupt. More...
 
#define udd_enable_bank_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_NBUSYBKES)
 Enables all banks full (OUT) or free (IN) interrupt. More...
 
#define udd_disable_bank_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_NBUSYBKEC)
 Disables all banks full (OUT) or free (IN) interrupt. More...
 
#define Is_udd_bank_interrupt_enabled(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_NBUSYBKE))
 Tests if all banks full (OUT) or free (IN) interrupt enabled. More...
 
#define Is_udd_short_packet(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_SHORTPACKET))
 Tests if SHORT PACKET received. More...
 
#define udd_ack_short_packet(ep)   (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_SHORTPACKETC)
 ACKs SHORT PACKET received. More...
 
#define udd_raise_short_packet(ep)   (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_SHORTPACKETS)
 Raises SHORT PACKET received. More...
 
#define udd_enable_short_packet_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_SHORTPACKETES)
 Enables SHORT PACKET received interrupt. More...
 
#define udd_disable_short_packet_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_SHORTPACKETEC)
 Disables SHORT PACKET received interrupt. More...
 
#define Is_udd_short_packet_interrupt_enabled(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_SHORTPACKETE))
 Tests if SHORT PACKET received interrupt is enabled. More...
 
#define Is_udd_setup_received(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_RXSTPI))
 Tests if SETUP received. More...
 
#define udd_ack_setup_received(ep)   (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_RXSTPIC)
 ACKs SETUP received. More...
 
#define udd_raise_setup_received(ep)   (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_RXSTPIS)
 Raises SETUP received. More...
 
#define udd_enable_setup_received_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_RXSTPES)
 Enables SETUP received interrupt. More...
 
#define udd_disable_setup_received_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_RXSTPEC)
 Disables SETUP received interrupt. More...
 
#define Is_udd_setup_received_interrupt_enabled(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_RXSTPE))
 Tests if SETUP received interrupt is enabled. More...
 
#define Is_udd_out_received(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_RXOUTI))
 Tests if OUT received. More...
 
#define udd_ack_out_received(ep)   (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_RXOUTIC)
 ACKs OUT received. More...
 
#define udd_raise_out_received(ep)   (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_RXOUTIS)
 Raises OUT received. More...
 
#define udd_enable_out_received_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_RXOUTES)
 Enables OUT received interrupt. More...
 
#define udd_disable_out_received_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_RXOUTEC)
 Disables OUT received interrupt. More...
 
#define Is_udd_out_received_interrupt_enabled(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_RXOUTE))
 Tests if OUT received interrupt is enabled. More...
 
#define Is_udd_in_send(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_TXINI))
 Tests if IN sending. More...
 
#define udd_ack_in_send(ep)   (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_TXINIC)
 ACKs IN sending. More...
 
#define udd_raise_in_send(ep)   (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_TXINIS)
 Raises IN sending. More...
 
#define udd_enable_in_send_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_TXINES)
 Enables IN sending interrupt. More...
 
#define udd_disable_in_send_interrupt(ep)   (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_TXINEC)
 Disables IN sending interrupt. More...
 
#define Is_udd_in_send_interrupt_enabled(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_TXINE))
 Tests if IN sending interrupt is enabled. More...
 
#define udd_get_endpoint_fifo_access(ep, scale)   (((volatile TPASTE2(U, scale) (*)[0x8000 / ((scale) / 8)])USBHS_RAM_ADDR)[(ep)])
 

USBHS endpoint DMA drivers

These macros manage the common features of the endpoint DMA channels.

#define UDD_ENDPOINT_MAX_TRANS   0x10000
 Maximum transfer size on USB DMA. More...
 
#define udd_enable_endpoint_int_dis_hdma_req(ep)   (USBHS_ARRAY(USBHS_DEVEPTIER[0](ep) = USBHS_DEVEPTIER_EPDISHDMAS)
 Enables the disabling of HDMA requests by endpoint interrupts. More...
 
#define udd_disable_endpoint_int_dis_hdma_req(ep)   (USBHS_ARRAY(USBHS_DEVEPTIDR[0](ep) = USBHS_DEVEPTIDR_EPDISHDMAC)
 Disables the disabling of HDMA requests by endpoint interrupts. More...
 
#define Is_udd_endpoint_int_dis_hdma_req_enabled(ep)   (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0](ep), USBHS_DEVEPTIMR_EPDISHDMA))
 Tests if the disabling of HDMA requests by endpoint interrupts is enabled. More...
 
#define udd_raise_endpoint_dma_interrupt(ep)   (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_DMA_1 << ((ep) - 1))
 Raises the selected endpoint DMA channel interrupt. More...
 
#define udd_clear_endpoint_dma_interrupt(ep)   (USBHS->USBHS_DEVICR = USBHS_DEVISR_DMA_1 << ((ep) - 1))
 Raises the selected endpoint DMA channel interrupt. More...
 
#define Is_udd_endpoint_dma_interrupt(ep)   (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_DMA_1 << ((ep) - 1)))
 Tests if an interrupt is triggered by the selected endpoint DMA channel. More...
 
#define udd_enable_endpoint_dma_interrupt(ep)   (USBHS->USBHS_DEVIER = USBHS_DEVIER_DMA_1 << ((ep) - 1))
 Enables the selected endpoint DMA channel interrupt. More...
 
#define udd_disable_endpoint_dma_interrupt(ep)   (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_DMA_1 << ((ep) - 1))
 Disables the selected endpoint DMA channel interrupt. More...
 
#define Is_udd_endpoint_dma_interrupt_enabled(ep)   (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_DMA_1 << ((ep) - 1)))
 Tests if the selected endpoint DMA channel interrupt is enabled. More...
 
#define UDD_ENDPOINT_DMA_STOP_NOW   (0)
 DMA channel control command. More...
 
#define UDD_ENDPOINT_DMA_RUN_AND_STOP   (USBHS_DEVDMACONTROL_CHANN_ENB)
 
#define UDD_ENDPOINT_DMA_LOAD_NEXT_DESC   (USBHS_DEVDMACONTROL_LDNXT_DSC)
 
#define UDD_ENDPOINT_DMA_RUN_AND_LINK   (USBHS_DEVDMACONTROL_CHANN_ENB|USBHS_DEVDMACONTROL_LDNXT_DSC)
 
#define USBHS_UDDMA_ARRAY(ep)   (((volatile uotghs_dmach_t *)USBHS->USBHS_DEVDMA)[(ep) - 1])
 Structure for DMA registers. More...
 
#define udd_endpoint_dma_set_control(ep, desc)   (USBHS_UDDMA_ARRAY(ep).control = desc)
 Set control desc to selected endpoint DMA channel. More...
 
#define udd_endpoint_dma_get_control(ep)   (USBHS_UDDMA_ARRAY(ep).control)
 Get control desc to selected endpoint DMA channel. More...
 
#define udd_endpoint_dma_set_addr(ep, add)   (USBHS_UDDMA_ARRAY(ep).addr = add)
 Set RAM address to selected endpoint DMA channel. More...
 
#define udd_endpoint_dma_get_status(ep)   (USBHS_UDDMA_ARRAY(ep).status)
 Get status to selected endpoint DMA channel. More...
 
typedef struct sam_uotghs_dmadesc_t uotghs_dmadesc_t
 
typedef struct sam_uotghs_dmach_t uotghs_dmach_t
 

Detailed Description

USB Device Driver for USBHS. Compliant with common UDD driver.

Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.

Definition in file usbhs_device.h.

Macro Definition Documentation

◆ Is_udd_address_enabled

#define Is_udd_address_enabled ( )    (Tst_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_ADDEN))

Definition at line 224 of file usbhs_device.h.

◆ Is_udd_bank_interrupt_enabled

#define Is_udd_bank_interrupt_enabled (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_NBUSYBKE))

Tests if all banks full (OUT) or free (IN) interrupt enabled.

Definition at line 460 of file usbhs_device.h.

◆ Is_udd_crc_error

#define Is_udd_crc_error (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_CRCERRI))

Tests if CRC ERROR ISO OUT detected.

Definition at line 413 of file usbhs_device.h.

◆ Is_udd_crc_error_interrupt_enabled

#define Is_udd_crc_error_interrupt_enabled (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_CRCERRE))

Tests if CRC ERROR ISO OUT detected interrupt is enabled.

Definition at line 423 of file usbhs_device.h.

◆ Is_udd_data_toggle_reset

#define Is_udd_data_toggle_reset (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_RSTDT))

Tests if the data toggle sequence is being reset.

Definition at line 309 of file usbhs_device.h.

◆ Is_udd_endpoint_bank_autoswitch_enabled

#define Is_udd_endpoint_bank_autoswitch_enabled (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_AUTOSW))

Definition at line 266 of file usbhs_device.h.

◆ Is_udd_endpoint_configured

#define Is_udd_endpoint_configured (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_CFGOK))

Tests if current endpoint is configured.

Definition at line 302 of file usbhs_device.h.

◆ Is_udd_endpoint_dma_interrupt

#define Is_udd_endpoint_dma_interrupt (   ep)    (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_DMA_1 << ((ep) - 1)))

Tests if an interrupt is triggered by the selected endpoint DMA channel.

Definition at line 545 of file usbhs_device.h.

◆ Is_udd_endpoint_dma_interrupt_enabled

#define Is_udd_endpoint_dma_interrupt_enabled (   ep)    (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_DMA_1 << ((ep) - 1)))

Tests if the selected endpoint DMA channel interrupt is enabled.

Definition at line 551 of file usbhs_device.h.

◆ Is_udd_endpoint_enabled

#define Is_udd_endpoint_enabled (   ep)    (Tst_bits(USBHS->USBHS_DEVEPT, USBHS_DEVEPT_EPEN0 << (ep)))

tests if the selected endpoint is enabled

Definition at line 248 of file usbhs_device.h.

◆ Is_udd_endpoint_in

#define Is_udd_endpoint_in (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPDIR))

Definition at line 271 of file usbhs_device.h.

◆ Is_udd_endpoint_int_dis_hdma_req_enabled

#define Is_udd_endpoint_int_dis_hdma_req_enabled (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0](ep), USBHS_DEVEPTIMR_EPDISHDMA))

Tests if the disabling of HDMA requests by endpoint interrupts is enabled.

Definition at line 538 of file usbhs_device.h.

◆ Is_udd_endpoint_interrupt

#define Is_udd_endpoint_interrupt (   ep)    (Tst_bits(USBHS->USBHS_DEVISR, USBHS_DEVISR_PEP_0 << (ep)))

Tests if an interrupt is triggered by the selected endpoint.

Definition at line 329 of file usbhs_device.h.

◆ Is_udd_endpoint_interrupt_enabled

#define Is_udd_endpoint_interrupt_enabled (   ep)    (Tst_bits(USBHS->USBHS_DEVIMR, USBHS_DEVIMR_PEP_0 << (ep)))

Tests if the selected endpoint interrupt is enabled.

Definition at line 327 of file usbhs_device.h.

◆ Is_udd_endpoint_stall_requested

#define Is_udd_endpoint_stall_requested (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_STALLRQ))

Tests if STALL handshake request is running.

Definition at line 346 of file usbhs_device.h.

◆ Is_udd_fifocon

#define Is_udd_fifocon (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_FIFOCON))

Tests if FIFOCON bit set.

Definition at line 440 of file usbhs_device.h.

◆ Is_udd_in_send

#define Is_udd_in_send (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_TXINI))

Tests if IN sending.

Definition at line 502 of file usbhs_device.h.

◆ Is_udd_in_send_interrupt_enabled

#define Is_udd_in_send_interrupt_enabled (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_TXINE))

Tests if IN sending interrupt is enabled.

Definition at line 512 of file usbhs_device.h.

◆ Is_udd_kill_last

#define Is_udd_kill_last (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_KILLBK))

Definition at line 448 of file usbhs_device.h.

◆ Is_udd_last_in_bank_killed

#define Is_udd_last_in_bank_killed (   ep)    (!Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_KILLBK))

Tests if last bank killed.

Definition at line 450 of file usbhs_device.h.

◆ Is_udd_memory_allocated

#define Is_udd_memory_allocated (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_ALLOC))

Definition at line 288 of file usbhs_device.h.

◆ Is_udd_nak_in

#define Is_udd_nak_in (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_NAKINI))

Tests if NAK IN received.

Definition at line 374 of file usbhs_device.h.

◆ Is_udd_nak_in_interrupt_enabled

#define Is_udd_nak_in_interrupt_enabled (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_NAKINE))

Tests if NAK IN interrupt is enabled.

Definition at line 384 of file usbhs_device.h.

◆ Is_udd_nak_out

#define Is_udd_nak_out (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_NAKOUTI))

Tests if NAK OUT received.

Definition at line 361 of file usbhs_device.h.

◆ Is_udd_nak_out_interrupt_enabled

#define Is_udd_nak_out_interrupt_enabled (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_NAKOUTE))

Tests if NAK OUT interrupt is enabled.

Definition at line 371 of file usbhs_device.h.

◆ Is_udd_out_received

#define Is_udd_out_received (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_RXOUTI))

Tests if OUT received.

Definition at line 489 of file usbhs_device.h.

◆ Is_udd_out_received_interrupt_enabled

#define Is_udd_out_received_interrupt_enabled (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_RXOUTE))

Tests if OUT received interrupt is enabled.

Definition at line 499 of file usbhs_device.h.

◆ Is_udd_overflow

#define Is_udd_overflow (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_OVERFI))

Tests if an overflow occurs.

Definition at line 391 of file usbhs_device.h.

◆ Is_udd_overflow_interrupt_enabled

#define Is_udd_overflow_interrupt_enabled (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_OVERFE))

Tests if overflow interrupt is enabled.

Definition at line 397 of file usbhs_device.h.

◆ Is_udd_read_enabled

#define Is_udd_read_enabled (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_RWALL))

Tests if endpoint read allowed.

Definition at line 431 of file usbhs_device.h.

◆ Is_udd_resetting_endpoint

#define Is_udd_resetting_endpoint (   ep)    (Tst_bits(USBHS->USBHS_DEVEPT, USBHS_DEVEPT_EPRST0 << (ep)))

Tests if the selected endpoint is being reset.

Definition at line 256 of file usbhs_device.h.

◆ Is_udd_setup_received

#define Is_udd_setup_received (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_RXSTPI))

Tests if SETUP received.

Definition at line 476 of file usbhs_device.h.

◆ Is_udd_setup_received_interrupt_enabled

#define Is_udd_setup_received_interrupt_enabled (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_RXSTPE))

Tests if SETUP received interrupt is enabled.

Definition at line 486 of file usbhs_device.h.

◆ Is_udd_short_packet

#define Is_udd_short_packet (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_SHORTPACKET))

Tests if SHORT PACKET received.

Definition at line 463 of file usbhs_device.h.

◆ Is_udd_short_packet_interrupt_enabled

#define Is_udd_short_packet_interrupt_enabled (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_SHORTPACKETE))

Tests if SHORT PACKET received interrupt is enabled.

Definition at line 473 of file usbhs_device.h.

◆ Is_udd_stall

#define Is_udd_stall (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_STALLEDI))

Tests if STALL sent.

Definition at line 348 of file usbhs_device.h.

◆ Is_udd_stall_interrupt_enabled

#define Is_udd_stall_interrupt_enabled (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_STALLEDE))

Tests if STALL sent interrupt is enabled.

Definition at line 358 of file usbhs_device.h.

◆ Is_udd_underflow

#define Is_udd_underflow (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_UNDERFI))

Tests if an underflow occurs.

Definition at line 404 of file usbhs_device.h.

◆ Is_udd_underflow_interrupt_enabled

#define Is_udd_underflow_interrupt_enabled (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTIMR[0], ep), USBHS_DEVEPTIMR_UNDERFE))

Tests if underflow interrupt is enabled.

Definition at line 410 of file usbhs_device.h.

◆ Is_udd_write_enabled

#define Is_udd_write_enabled (   ep)    (Tst_bits(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_RWALL))

Tests if endpoint write allowed.

Definition at line 433 of file usbhs_device.h.

◆ udd_ack_crc_error

#define udd_ack_crc_error (   ep)    (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_CRCERRIC)

ACKs CRC ERROR ISO OUT detected.

Definition at line 415 of file usbhs_device.h.

◆ udd_ack_fifocon

#define udd_ack_fifocon (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_FIFOCONC)

Clears FIFOCON bit.

Definition at line 438 of file usbhs_device.h.

◆ udd_ack_in_send

#define udd_ack_in_send (   ep)    (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_TXINIC)

ACKs IN sending.

Definition at line 504 of file usbhs_device.h.

◆ udd_ack_nak_in

#define udd_ack_nak_in (   ep)    (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_NAKINIC)

ACKs NAK IN received.

Definition at line 376 of file usbhs_device.h.

◆ udd_ack_nak_out

#define udd_ack_nak_out (   ep)    (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_NAKOUTIC)

ACKs NAK OUT received.

Definition at line 363 of file usbhs_device.h.

◆ udd_ack_out_received

#define udd_ack_out_received (   ep)    (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_RXOUTIC)

ACKs OUT received.

Definition at line 491 of file usbhs_device.h.

◆ udd_ack_overflow_interrupt

#define udd_ack_overflow_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_OVERFIC)

ACKs endpoint isochronous overflow interrupt.

Definition at line 387 of file usbhs_device.h.

◆ udd_ack_setup_received

#define udd_ack_setup_received (   ep)    (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_RXSTPIC)

ACKs SETUP received.

Definition at line 478 of file usbhs_device.h.

◆ udd_ack_short_packet

#define udd_ack_short_packet (   ep)    (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_SHORTPACKETC)

ACKs SHORT PACKET received.

Definition at line 465 of file usbhs_device.h.

◆ udd_ack_stall

#define udd_ack_stall (   ep)    (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_STALLEDIC)

ACKs STALL sent.

Definition at line 350 of file usbhs_device.h.

◆ udd_ack_underflow_interrupt

#define udd_ack_underflow_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTICR[0], ep) = USBHS_DEVEPTICR_UNDERFIC)

ACKs endpoint isochronous underflow interrupt.

Definition at line 400 of file usbhs_device.h.

◆ udd_allocate_memory

#define udd_allocate_memory (   ep)    (Set_bits(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_ALLOC))

Allocates the configuration selected endpoint in DPRAM memory.

Definition at line 285 of file usbhs_device.h.

◆ udd_byte_count

#define udd_byte_count (   ep)    (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_BYCT_Msk))

Returns the byte count.

Definition at line 436 of file usbhs_device.h.

◆ udd_clear_endpoint_dma_interrupt

#define udd_clear_endpoint_dma_interrupt (   ep)    (USBHS->USBHS_DEVICR = USBHS_DEVISR_DMA_1 << ((ep) - 1))

Raises the selected endpoint DMA channel interrupt.

Definition at line 543 of file usbhs_device.h.

◆ udd_configure_address

#define udd_configure_address (   addr)    (Wr_bitfield(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_UADD_Msk, addr))

configures the USB device address

Definition at line 226 of file usbhs_device.h.

◆ udd_configure_endpoint

#define udd_configure_endpoint (   ep,
  type,
  dir,
  size,
  bank 
)
Value:
(\
Wr_bits(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPTYPE_Msk |\
(((uint32_t)(dir ) << USBHS_DEVEPTCFG_EPDIR_Pos ) & USBHS_DEVEPTCFG_EPDIR) |\
)
#define USBHS_DEVEPTCFG_EPBK_Msk
(USBHS_DEVEPTCFG[10]) Endpoint Banks
#define USBHS_ARRAY(reg, index)
Definition: usbhs_device.h:238
#define USBHS_DEVEPTCFG_EPDIR_Pos
Definition: usbhs_device.h:63
#define udd_format_endpoint_size(size)
Definition: usbhs_device.h:275
#define USBHS_DEVEPTCFG_EPSIZE_Msk
(USBHS_DEVEPTCFG[10]) Endpoint Size
#define USBHS_DEVEPTCFG_EPTYPE_Msk
(USBHS_DEVEPTCFG[10]) Endpoint Type
#define USBHS_DEVEPTCFG_EPDIR
(USBHS_DEVEPTCFG[10]) Endpoint Direction

Configures selected endpoint in one step.

Definition at line 291 of file usbhs_device.h.

◆ udd_configure_endpoint_bank

#define udd_configure_endpoint_bank (   ep,
  bank 
)    (Wr_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPBK_Msk, bank))

Configures the selected endpoint number of banks.

Definition at line 281 of file usbhs_device.h.

◆ udd_configure_endpoint_direction

#define udd_configure_endpoint_direction (   ep,
  dir 
)    (Wr_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPDIR, dir))

Configures the selected endpoint direction.

Definition at line 268 of file usbhs_device.h.

◆ udd_configure_endpoint_size

#define udd_configure_endpoint_size (   ep,
  size 
)    (Wr_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPSIZE_Msk, udd_format_endpoint_size(size)))

Configures the selected endpoint size.

Definition at line 277 of file usbhs_device.h.

◆ udd_configure_endpoint_type

#define udd_configure_endpoint_type (   ep,
  type 
)    (Wr_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPTYPE_Msk, type))

Configures the selected endpoint type.

Definition at line 259 of file usbhs_device.h.

◆ udd_control_direction

#define udd_control_direction ( )    (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTISR[0], EP_CONTROL), USBHS_DEVEPTISR_CTRLDIR))

Returns the control direction.

Definition at line 304 of file usbhs_device.h.

◆ udd_current_bank

#define udd_current_bank (   ep)    (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_CURRBK_Msk))

Returns the number of the current bank.

Definition at line 445 of file usbhs_device.h.

◆ udd_data_toggle

#define udd_data_toggle (   ep)    (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_DTSEQ_Msk))

Returns data toggle.

Definition at line 311 of file usbhs_device.h.

◆ udd_disable_address

#define udd_disable_address ( )    (Clr_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_ADDEN))

disables USB device address

Definition at line 223 of file usbhs_device.h.

◆ udd_disable_bank_interrupt

#define udd_disable_bank_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_NBUSYBKEC)

Disables all banks full (OUT) or free (IN) interrupt.

Definition at line 458 of file usbhs_device.h.

◆ udd_disable_crc_error_interrupt

#define udd_disable_crc_error_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_CRCERREC)

Disables CRC ERROR ISO OUT detected interrupt.

Definition at line 421 of file usbhs_device.h.

◆ udd_disable_endpoint

#define udd_disable_endpoint (   ep)    (Clr_bits(USBHS->USBHS_DEVEPT, USBHS_DEVEPT_EPEN0 << (ep)))

disables the selected endpoint

Definition at line 246 of file usbhs_device.h.

◆ udd_disable_endpoint_bank_autoswitch

#define udd_disable_endpoint_bank_autoswitch (   ep)    (Clr_bits(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_AUTOSW))

Disables the bank autoswitch for the selected endpoint.

Definition at line 265 of file usbhs_device.h.

◆ udd_disable_endpoint_dma_interrupt

#define udd_disable_endpoint_dma_interrupt (   ep)    (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_DMA_1 << ((ep) - 1))

Disables the selected endpoint DMA channel interrupt.

Definition at line 549 of file usbhs_device.h.

◆ udd_disable_endpoint_int_dis_hdma_req

#define udd_disable_endpoint_int_dis_hdma_req (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIDR[0](ep) = USBHS_DEVEPTIDR_EPDISHDMAC)

Disables the disabling of HDMA requests by endpoint interrupts.

Definition at line 536 of file usbhs_device.h.

◆ udd_disable_endpoint_interrupt

#define udd_disable_endpoint_interrupt (   ep)    (USBHS->USBHS_DEVIDR = USBHS_DEVIDR_PEP_0 << (ep))

Disables the selected endpoint interrupt.

Definition at line 325 of file usbhs_device.h.

◆ udd_disable_in_send_interrupt

#define udd_disable_in_send_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_TXINEC)

Disables IN sending interrupt.

Definition at line 510 of file usbhs_device.h.

◆ udd_disable_nak_in_interrupt

#define udd_disable_nak_in_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_NAKINEC)

Disables NAK IN interrupt.

Definition at line 382 of file usbhs_device.h.

◆ udd_disable_nak_out_interrupt

#define udd_disable_nak_out_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_NAKOUTEC)

Disables NAK OUT interrupt.

Definition at line 369 of file usbhs_device.h.

◆ udd_disable_out_received_interrupt

#define udd_disable_out_received_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_RXOUTEC)

Disables OUT received interrupt.

Definition at line 497 of file usbhs_device.h.

◆ udd_disable_overflow_interrupt

#define udd_disable_overflow_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_OVERFEC)

Disables overflow interrupt.

Definition at line 395 of file usbhs_device.h.

◆ udd_disable_setup_received_interrupt

#define udd_disable_setup_received_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_RXSTPEC)

Disables SETUP received interrupt.

Definition at line 484 of file usbhs_device.h.

◆ udd_disable_short_packet_interrupt

#define udd_disable_short_packet_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_SHORTPACKETEC)

Disables SHORT PACKET received interrupt.

Definition at line 471 of file usbhs_device.h.

◆ udd_disable_stall_handshake

#define udd_disable_stall_handshake (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_STALLRQC)

Disables the STALL handshake.

Definition at line 344 of file usbhs_device.h.

◆ udd_disable_stall_interrupt

#define udd_disable_stall_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_STALLEDEC)

Disables STALL sent interrupt.

Definition at line 356 of file usbhs_device.h.

◆ udd_disable_underflow_interrupt

#define udd_disable_underflow_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIDR[0], ep) = USBHS_DEVEPTIDR_UNDERFEC)

Disables underflow interrupt.

Definition at line 408 of file usbhs_device.h.

◆ udd_enable_address

#define udd_enable_address ( )    (Set_bits(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_ADDEN))

enables USB device address

Definition at line 221 of file usbhs_device.h.

◆ udd_enable_bank_interrupt

#define udd_enable_bank_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_NBUSYBKES)

Enables all banks full (OUT) or free (IN) interrupt.

Definition at line 456 of file usbhs_device.h.

◆ udd_enable_crc_error_interrupt

#define udd_enable_crc_error_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_CRCERRES)

Enables CRC ERROR ISO OUT detected interrupt.

Definition at line 419 of file usbhs_device.h.

◆ udd_enable_endpoint

#define udd_enable_endpoint (   ep)    (Set_bits(USBHS->USBHS_DEVEPT, USBHS_DEVEPT_EPEN0 << (ep)))

enables the selected endpoint

Definition at line 244 of file usbhs_device.h.

◆ udd_enable_endpoint_bank_autoswitch

#define udd_enable_endpoint_bank_autoswitch (   ep)    (Set_bits(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_AUTOSW))

Enables the bank autoswitch for the selected endpoint.

Definition at line 263 of file usbhs_device.h.

◆ udd_enable_endpoint_dma_interrupt

#define udd_enable_endpoint_dma_interrupt (   ep)    (USBHS->USBHS_DEVIER = USBHS_DEVIER_DMA_1 << ((ep) - 1))

Enables the selected endpoint DMA channel interrupt.

Definition at line 547 of file usbhs_device.h.

◆ udd_enable_endpoint_int_dis_hdma_req

#define udd_enable_endpoint_int_dis_hdma_req (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIER[0](ep) = USBHS_DEVEPTIER_EPDISHDMAS)

Enables the disabling of HDMA requests by endpoint interrupts.

Definition at line 534 of file usbhs_device.h.

◆ udd_enable_endpoint_interrupt

#define udd_enable_endpoint_interrupt (   ep)    (USBHS->USBHS_DEVIER = USBHS_DEVIER_PEP_0 << (ep))

Enables the selected endpoint interrupt.

Definition at line 323 of file usbhs_device.h.

◆ udd_enable_in_send_interrupt

#define udd_enable_in_send_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_TXINES)

Enables IN sending interrupt.

Definition at line 508 of file usbhs_device.h.

◆ udd_enable_nak_in_interrupt

#define udd_enable_nak_in_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_NAKINES)

Enables NAK IN interrupt.

Definition at line 380 of file usbhs_device.h.

◆ udd_enable_nak_out_interrupt

#define udd_enable_nak_out_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_NAKOUTES)

Enables NAK OUT interrupt.

Definition at line 367 of file usbhs_device.h.

◆ udd_enable_out_received_interrupt

#define udd_enable_out_received_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_RXOUTES)

Enables OUT received interrupt.

Definition at line 495 of file usbhs_device.h.

◆ udd_enable_overflow_interrupt

#define udd_enable_overflow_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_OVERFES)

Enables overflow interrupt.

Definition at line 393 of file usbhs_device.h.

◆ udd_enable_setup_received_interrupt

#define udd_enable_setup_received_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_RXSTPES)

Enables SETUP received interrupt.

Definition at line 482 of file usbhs_device.h.

◆ udd_enable_short_packet_interrupt

#define udd_enable_short_packet_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_SHORTPACKETES)

Enables SHORT PACKET received interrupt.

Definition at line 469 of file usbhs_device.h.

◆ udd_enable_stall_handshake

#define udd_enable_stall_handshake (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_STALLRQS)

Enables the STALL handshake.

Definition at line 342 of file usbhs_device.h.

◆ udd_enable_stall_interrupt

#define udd_enable_stall_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_STALLEDES)

Enables STALL sent interrupt.

Definition at line 354 of file usbhs_device.h.

◆ udd_enable_underflow_interrupt

#define udd_enable_underflow_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_UNDERFES)

Enables underflow interrupt.

Definition at line 406 of file usbhs_device.h.

◆ udd_endpoint_dma_get_control

#define udd_endpoint_dma_get_control (   ep)    (USBHS_UDDMA_ARRAY(ep).control)

Get control desc to selected endpoint DMA channel.

Definition at line 623 of file usbhs_device.h.

◆ udd_endpoint_dma_get_status

#define udd_endpoint_dma_get_status (   ep)    (USBHS_UDDMA_ARRAY(ep).status)

Get status to selected endpoint DMA channel.

Definition at line 627 of file usbhs_device.h.

◆ UDD_ENDPOINT_DMA_LOAD_NEXT_DESC

#define UDD_ENDPOINT_DMA_LOAD_NEXT_DESC   (USBHS_DEVDMACONTROL_LDNXT_DSC)

Definition at line 615 of file usbhs_device.h.

◆ UDD_ENDPOINT_DMA_RUN_AND_LINK

#define UDD_ENDPOINT_DMA_RUN_AND_LINK   (USBHS_DEVDMACONTROL_CHANN_ENB|USBHS_DEVDMACONTROL_LDNXT_DSC)

Definition at line 616 of file usbhs_device.h.

◆ UDD_ENDPOINT_DMA_RUN_AND_STOP

#define UDD_ENDPOINT_DMA_RUN_AND_STOP   (USBHS_DEVDMACONTROL_CHANN_ENB)

Definition at line 614 of file usbhs_device.h.

◆ udd_endpoint_dma_set_addr

#define udd_endpoint_dma_set_addr (   ep,
  add 
)    (USBHS_UDDMA_ARRAY(ep).addr = add)

Set RAM address to selected endpoint DMA channel.

Definition at line 625 of file usbhs_device.h.

◆ udd_endpoint_dma_set_control

#define udd_endpoint_dma_set_control (   ep,
  desc 
)    (USBHS_UDDMA_ARRAY(ep).control = desc)

Set control desc to selected endpoint DMA channel.

Definition at line 621 of file usbhs_device.h.

◆ UDD_ENDPOINT_DMA_STOP_NOW

#define UDD_ENDPOINT_DMA_STOP_NOW   (0)

DMA channel control command.

Definition at line 613 of file usbhs_device.h.

◆ UDD_ENDPOINT_MAX_TRANS

#define UDD_ENDPOINT_MAX_TRANS   0x10000

Maximum transfer size on USB DMA.

Definition at line 532 of file usbhs_device.h.

◆ udd_force_bank_interrupt

#define udd_force_bank_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_NBUSYBKS)

Forces all banks full (OUT) or free (IN) interrupt.

Definition at line 452 of file usbhs_device.h.

◆ udd_format_endpoint_size

#define udd_format_endpoint_size (   size)    (32 - clz(((uint32_t)min(max(size, 8), 1024) << 1) - 1) - 1 - 3)

Bounds given integer size to allowed range and rounds it up to the nearest available greater size, then applies register format of USBHS controller for endpoint size bit-field.

Definition at line 275 of file usbhs_device.h.

◆ udd_get_configured_address

#define udd_get_configured_address ( )    (Rd_bitfield(USBHS->USBHS_DEVCTRL, USBHS_DEVCTRL_UADD_Msk))

gets the currently configured USB device address

Definition at line 228 of file usbhs_device.h.

◆ udd_get_endpoint_bank

#define udd_get_endpoint_bank (   ep)    (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPBK_Msk)+1)

Gets the configured selected endpoint number of banks.

Definition at line 283 of file usbhs_device.h.

◆ udd_get_endpoint_direction

#define udd_get_endpoint_direction (   ep)    (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPDIR))

Gets the configured selected endpoint direction.

Definition at line 270 of file usbhs_device.h.

◆ udd_get_endpoint_fifo_access

#define udd_get_endpoint_fifo_access (   ep,
  scale 
)    (((volatile TPASTE2(U, scale) (*)[0x8000 / ((scale) / 8)])USBHS_RAM_ADDR)[(ep)])

Get 64-, 32-, 16- or 8-bit access to FIFO data register of selected endpoint.

Parameters
epEndpoint of which to access FIFO data register
scaleData scale in bits: 64, 32, 16 or 8
Returns
Volatile 64-, 32-, 16- or 8-bit data pointer to FIFO data register
Warning
It is up to the user of this macro to make sure that all accesses are aligned with their natural boundaries except 64-bit accesses which require only 32-bit alignment.
It is up to the user of this macro to make sure that used HSB addresses are identical to the DPRAM internal pointer modulo 32 bits.

Definition at line 524 of file usbhs_device.h.

◆ udd_get_endpoint_size

#define udd_get_endpoint_size (   ep)    (8 << Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPSIZE_Msk))

Gets the configured selected endpoint size.

Definition at line 279 of file usbhs_device.h.

◆ udd_get_endpoint_type

#define udd_get_endpoint_type (   ep)    (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_EPTYPE_Msk))

Gets the configured selected endpoint type.

Definition at line 261 of file usbhs_device.h.

◆ udd_get_interrupt_endpoint_number

#define udd_get_interrupt_endpoint_number ( )
Value:
(ctz(((USBHS->USBHS_DEVISR >> USBHS_DEVISR_PEP_Pos) & \
(USBHS->USBHS_DEVIMR >> USBHS_DEVIMR_PEP_Pos)) | \
(1 << MAX_PEP_NB)))
#define USBHS_DEVISR_PEP_Pos
Definition: usbhs_device.h:334
#define USBHS
(USBHS ) Base Address
Definition: same70j19.h:508
#define USBHS_DEVIMR_PEP_Pos
Definition: usbhs_device.h:335
#define ctz(u)
Counts the trailing zero bits of the given value considered as a 32-bit integer.
Definition: compiler.h:623

Returns the lowest endpoint number generating an endpoint interrupt or MAX_PEP_NB if none.

Definition at line 331 of file usbhs_device.h.

◆ udd_kill_last_in_bank

#define udd_kill_last_in_bank (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_KILLBKS)

Kills last bank.

Definition at line 447 of file usbhs_device.h.

◆ udd_nb_busy_bank

#define udd_nb_busy_bank (   ep)    (Rd_bitfield(USBHS_ARRAY(USBHS_DEVEPTISR[0], ep), USBHS_DEVEPTISR_NBUSYBK_Msk))

Returns the number of busy banks.

Definition at line 443 of file usbhs_device.h.

◆ udd_raise_crc_error

#define udd_raise_crc_error (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_CRCERRIS)

Raises CRC ERROR ISO OUT detected.

Definition at line 417 of file usbhs_device.h.

◆ udd_raise_endpoint_dma_interrupt

#define udd_raise_endpoint_dma_interrupt (   ep)    (USBHS->USBHS_DEVIFR = USBHS_DEVIFR_DMA_1 << ((ep) - 1))

Raises the selected endpoint DMA channel interrupt.

Definition at line 541 of file usbhs_device.h.

◆ udd_raise_in_send

#define udd_raise_in_send (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_TXINIS)

Raises IN sending.

Definition at line 506 of file usbhs_device.h.

◆ udd_raise_nak_in

#define udd_raise_nak_in (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_NAKINIS)

Raises NAK IN received.

Definition at line 378 of file usbhs_device.h.

◆ udd_raise_nak_out

#define udd_raise_nak_out (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_NAKOUTIS)

Raises NAK OUT received.

Definition at line 365 of file usbhs_device.h.

◆ udd_raise_out_received

#define udd_raise_out_received (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_RXOUTIS)

Raises OUT received.

Definition at line 493 of file usbhs_device.h.

◆ udd_raise_overflow_interrupt

#define udd_raise_overflow_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_OVERFIS)

Raises endpoint isochronous overflow interrupt.

Definition at line 389 of file usbhs_device.h.

◆ udd_raise_setup_received

#define udd_raise_setup_received (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_RXSTPIS)

Raises SETUP received.

Definition at line 480 of file usbhs_device.h.

◆ udd_raise_short_packet

#define udd_raise_short_packet (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_SHORTPACKETS)

Raises SHORT PACKET received.

Definition at line 467 of file usbhs_device.h.

◆ udd_raise_stall

#define udd_raise_stall (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_STALLEDIS)

Raises STALL sent.

Definition at line 352 of file usbhs_device.h.

◆ udd_raise_underflow_interrupt

#define udd_raise_underflow_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_UNDERFIS)

Raises endpoint isochronous underflow interrupt.

Definition at line 402 of file usbhs_device.h.

◆ udd_reset_data_toggle

#define udd_reset_data_toggle (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIER[0], ep) = USBHS_DEVEPTIER_RSTDTS)

Resets the data toggle sequence.

Definition at line 307 of file usbhs_device.h.

◆ udd_reset_endpoint

#define udd_reset_endpoint (   ep)
Value:
do { \
Set_bits(USBHS->USBHS_DEVEPT, USBHS_DEVEPT_EPRST0 << (ep)); \
Clr_bits(USBHS->USBHS_DEVEPT, USBHS_DEVEPT_EPRST0 << (ep)); \
} while (0)
#define USBHS
(USBHS ) Base Address
Definition: same70j19.h:508
#define USBHS_DEVEPT_EPRST0
(USBHS_DEVEPT) Endpoint 0 Reset

resets the selected endpoint

Definition at line 250 of file usbhs_device.h.

◆ udd_unallocate_memory

#define udd_unallocate_memory (   ep)    (Clr_bits(USBHS_ARRAY(USBHS_DEVEPTCFG[0], ep), USBHS_DEVEPTCFG_ALLOC))

un-allocates the configuration selected endpoint in DPRAM memory

Definition at line 287 of file usbhs_device.h.

◆ udd_unforce_bank_interrupt

#define udd_unforce_bank_interrupt (   ep)    (USBHS_ARRAY(USBHS_DEVEPTIFR[0], ep) = USBHS_DEVEPTIFR_NBUSYBKS)

Unforces all banks full (OUT) or free (IN) interrupt.

Definition at line 454 of file usbhs_device.h.

◆ USBHS_ARRAY

#define USBHS_ARRAY (   reg,
  index 
)    ((&(USBHS->reg))[(index)])

Generic macro for USBHS registers that can be arrayed

Definition at line 238 of file usbhs_device.h.

◆ USBHS_DEVIMR_PEP_Pos

#define USBHS_DEVIMR_PEP_Pos   12

Definition at line 335 of file usbhs_device.h.

◆ USBHS_DEVISR_PEP_Pos

#define USBHS_DEVISR_PEP_Pos   12

Definition at line 334 of file usbhs_device.h.

◆ USBHS_RAM_ADDR

#define USBHS_RAM_ADDR   0xA0100000u

Definition at line 52 of file usbhs_device.h.

◆ USBHS_UDDMA_ARRAY

#define USBHS_UDDMA_ARRAY (   ep)    (((volatile uotghs_dmach_t *)USBHS->USBHS_DEVDMA)[(ep) - 1])

Structure for DMA registers.

Definition at line 618 of file usbhs_device.h.

Typedef Documentation

◆ uotghs_dmach_t

◆ uotghs_dmadesc_t



inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:18:00