Microchip® Advanced Software Framework

usb_drv.h File Reference
#include "compiler.h"
#include "preprocessor.h"
#include "usbb.h"
#include "conf_usb.h"

Macros

#define AWAITVRISE_TIMER   AVR32_USBB_USBCON_TIMPAGE_A_WAIT_VRISE
 
#define AWAITVRISE_TMOUT_100_MS   AVR32_USBB_USBCON_TIMVALUE_A_WAIT_VRISE_100_MS
 
#define AWAITVRISE_TMOUT_20_MS   AVR32_USBB_USBCON_TIMVALUE_A_WAIT_VRISE_20_MS
 
#define AWAITVRISE_TMOUT_50_MS   AVR32_USBB_USBCON_TIMVALUE_A_WAIT_VRISE_50_MS
 
#define AWAITVRISE_TMOUT_70_MS   AVR32_USBB_USBCON_TIMVALUE_A_WAIT_VRISE_70_MS
 
#define BANK_PID_DATA0   0
 
#define BANK_PID_DATA1   1
 
#define DIRECTION_IN   AVR32_USBB_UECFGX_EPDIR_IN
 
#define DIRECTION_OUT   AVR32_USBB_UECFGX_EPDIR_OUT
 
#define DMA_BUFFER_SIZE_16_BITS   AVR32_USBB_UFEATURES_DMA_BUFFER_SIZE_16_BITS
 
#define DMA_BUFFER_SIZE_24_BITS   AVR32_USBB_UFEATURES_DMA_BUFFER_SIZE_24_BITS
 
#define DOUBLE_BANK   AVR32_USBB_UECFGX_EPBK_DOUBLE
 
#define EP_0   0
 
#define EP_1   1
 
#define EP_2   2
 
#define EP_3   3
 
#define EP_4   4
 
#define EP_5   5
 
#define EP_6   6
 
#define EP_CONTROL   0
 
#define Host_ack_all_errors(p)
 acks all pipe error More...
 
#define Host_ack_bad_data_toggle(p)   (Clr_bits(AVR32_USBB_uperrx(p), AVR32_USBB_UPERRX_DATATGL_MASK))
 acks bad data toggle More...
 
#define Host_ack_control_in_received()   (AVR32_USBB_upstaxclr(P_CONTROL) = AVR32_USBB_UPSTAXCLR_RXINIC_MASK)
 acks control IN More...
 
#define Host_ack_control_in_received_free()   (Host_ack_control_in_received(), Host_free_control_in())
 acks control IN and frees current bank More...
 
#define Host_ack_control_out_ready()   (AVR32_USBB_upstaxclr(P_CONTROL) = AVR32_USBB_UPSTAXCLR_TXOUTIC_MASK)
 acks control OUT More...
 
#define Host_ack_control_out_ready_send()   (Host_ack_control_out_ready(), Host_send_control_out())
 acks control OUT and sends current bank More...
 
#define Host_ack_crc16_error(p)   (Clr_bits(AVR32_USBB_uperrx(p), AVR32_USBB_UPERRX_CRC16_MASK))
 acks CRC16 error More...
 
#define Host_ack_crc_error(p)   (AVR32_USBB_upstaxclr(p) = AVR32_USBB_UPSTAXCLR_RXSTALLDIC_MASK)
 acks CRC ERROR ISO IN detected More...
 
#define Host_ack_data_pid_error(p)   (Clr_bits(AVR32_USBB_uperrx(p), AVR32_USBB_UPERRX_DATAPID_MASK))
 acks data PID error More...
 
#define Host_ack_device_connection()   (AVR32_USBB_uhintclr = AVR32_USBB_UHINTCLR_DCONNIC_MASK)
 acks device connection More...
 
#define Host_ack_device_disconnection()   (AVR32_USBB_uhintclr = AVR32_USBB_UHINTCLR_DDISCIC_MASK)
 acks device disconnection More...
 
#define Host_ack_down_stream_resume()   (AVR32_USBB_uhintclr = AVR32_USBB_UHINTCLR_RSMEDIC_MASK)
 acks host down stream resume sent More...
 
#define Host_ack_fifocon(p)   (AVR32_USBB_upconxclr(p) = AVR32_USBB_UPCONXCLR_FIFOCONC_MASK)
 clears FIFOCON bit More...
 
#define Host_ack_hwup()   (AVR32_USBB_uhintclr = AVR32_USBB_UHINTCLR_HWUPIC_MASK)
 acks host wake-up detection More...
 
#define Host_ack_in_received(p)   (AVR32_USBB_upstaxclr(p) = AVR32_USBB_UPSTAXCLR_RXINIC_MASK)
 acks IN reception More...
 
#define Host_ack_in_received_free(p)   (Host_ack_in_received(p), Host_free_in(p))
 acks IN reception and frees current bank More...
 
#define Host_ack_nak_received(p)   (AVR32_USBB_upstaxclr(p) = AVR32_USBB_UPSTAXCLR_NAKEDIC_MASK)
 acks NAK received More...
 
#define Host_ack_out_ready(p)   (AVR32_USBB_upstaxclr(p) = AVR32_USBB_UPSTAXCLR_TXOUTIC_MASK)
 acks OUT sent More...
 
#define Host_ack_out_ready_send(p)   (Host_ack_out_ready(p), Host_send_out(p))
 acks OUT sent and sends current bank More...
 
#define Host_ack_overflow_interrupt(p)   (AVR32_USBB_upstaxclr(p) = AVR32_USBB_UPSTAXCLR_OVERFIC_MASK)
 acks pipe overflow interrupt More...
 
#define Host_ack_pid_error(p)   (Clr_bits(AVR32_USBB_uperrx(p), AVR32_USBB_UPERRX_PID_MASK))
 acks PID error More...
 
#define Host_ack_pipe_error(p)   (AVR32_USBB_upstaxset(p) = (Is_host_pipe_error(p)) ? AVR32_USBB_UPSTAXSET_PERRIS_MASK : 0)
 acks pipe error More...
 
#define Host_ack_remote_wakeup()   (AVR32_USBB_uhintclr = AVR32_USBB_UHINTCLR_RXRSMIC_MASK)
 acks host remote wake-up detection More...
 
#define Host_ack_reset_sent()   (AVR32_USBB_uhintclr = AVR32_USBB_UHINTCLR_RSTIC_MASK)
 acks host USB reset sent More...
 
#define Host_ack_setup_ready()   (AVR32_USBB_upstaxclr(P_CONTROL) = AVR32_USBB_UPSTAXCLR_TXSTPIC_MASK)
 acks setup More...
 
#define Host_ack_setup_ready_send()   (Host_ack_setup_ready(), Host_send_setup())
 acks setup and sends current bank More...
 
#define Host_ack_short_packet(p)   (AVR32_USBB_upstaxclr(p) = AVR32_USBB_UPSTAXCLR_SHORTPACKETIC_MASK)
 acks SHORT PACKET received More...
 
#define Host_ack_sof()   (AVR32_USBB_uhintclr = AVR32_USBB_UHINTCLR_HSOFIC_MASK)
 acks SOF detection More...
 
#define Host_ack_stall(p)   (AVR32_USBB_upstaxclr(p) = AVR32_USBB_UPSTAXCLR_RXSTALLDIC_MASK)
 acks STALL reception More...
 
#define Host_ack_timeout_error(p)   (Clr_bits(AVR32_USBB_uperrx(p), AVR32_USBB_UPERRX_TIMEOUT_MASK))
 acks time-out error More...
 
#define Host_ack_underflow_interrupt(p)   (AVR32_USBB_upstaxclr(p) = AVR32_USBB_UPSTAXCLR_TXSTPIC_MASK)
 acks pipe underflow interrupt More...
 
#define Host_allocate_memory(p)   (Set_bits(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_ALLOC_MASK))
 allocates the configuration x in DPRAM memory More...
 
#define Host_byte_count(p)   (Rd_bitfield(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_PBYCT_MASK))
 returns the byte count More...
 
#define Host_clear_error_counter(p)   (Clr_bits(AVR32_USBB_uperrx(p), AVR32_USBB_UPERRX_COUNTER_MASK))
 clears the error counter More...
 
#define Host_configure_address(p, addr)   (Wr_bitfield(AVR32_USBB_uhaddrx(1 + ((p) >> 2)), AVR32_USBB_UHADDR1_UHADDR_P0_MASK << (((p) & 0x03) << 3), addr))
 configures the USB device address associated with the selected pipe More...
 
#define Host_configure_pipe(p, freq, ep_num, type, token, size, bank)
 configures selected pipe in one step More...
 
#define Host_configure_pipe_bank(p, bank)   (Wr_bitfield(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_PBK_MASK, bank))
 configures the selected pipe number of banks More...
 
#define Host_configure_pipe_endpoint_number(p, ep_num)   (Wr_bitfield(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_PEPNUM_MASK, ep_num))
 configures the selected pipe endpoint number More...
 
#define Host_configure_pipe_int_req_freq(p, freq)   (Wr_bitfield(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_INTFRQ_MASK, freq))
 configures the interrupt pipe request frequency (period in ms) for the selected pipe More...
 
#define Host_configure_pipe_size(p, size)   (Wr_bitfield(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_PSIZE_MASK, Host_format_pipe_size(size)))
 configures the selected pipe size More...
 
#define Host_configure_pipe_token(p, token)   (Wr_bitfield(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_PTOKEN_MASK, token))
 configures the selected pipe token More...
 
#define Host_configure_pipe_type(p, type)   (Wr_bitfield(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_PTYPE_MASK, type))
 configures the selected pipe type More...
 
#define Host_current_bank(p)   (Rd_bitfield(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_CURRBK_MASK))
 returns the number of the current bank More...
 
#define Host_data_toggle(p)   (Rd_bitfield(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_DTSEQ_MASK))
 returns data toggle More...
 
#define Host_disable_bank_interrupt(p)   (AVR32_USBB_upconxclr(p) = AVR32_USBB_UPCONXCLR_NBUSYBKEC_MASK)
 disables all banks full (IN) or free (OUT) interrupt More...
 
#define Host_disable_continuous_in_mode(p)   (Clr_bits(AVR32_USBB_upinrqx(p), AVR32_USBB_UPINRQX_INMODE_MASK))
 disables continuous IN mode More...
 
#define Host_disable_control_in_received_interrupt()   (AVR32_USBB_upconxclr(P_CONTROL) = AVR32_USBB_UPCONXCLR_RXINEC_MASK)
 disables IN control pipe reception interrupt More...
 
#define Host_disable_control_out_ready_interrupt()   (AVR32_USBB_upconxclr(P_CONTROL) = AVR32_USBB_UPCONXCLR_TXOUTEC_MASK)
 disables OUT control pipe ready interrupt More...
 
#define Host_disable_crc_error_interrupt(p)   (AVR32_USBB_upconxclr(p) = AVR32_USBB_UPCONXCLR_RXSTALLDEC_MASK)
 disables CRC ERROR ISO IN detected interrupt More...
 
#define Host_disable_device_connection_interrupt()   (AVR32_USBB_uhinteclr = AVR32_USBB_UHINTECLR_DCONNIEC_MASK)
 disables USB device connection interrupt More...
 
#define Host_disable_device_disconnection_interrupt()   (AVR32_USBB_uhinteclr = AVR32_USBB_UHINTECLR_DDISCIEC_MASK)
 disables USB device connection interrupt More...
 
#define Host_disable_down_stream_resume_interrupt()   (AVR32_USBB_uhinteclr = AVR32_USBB_UHINTECLR_RSMEDIEC_MASK)
 disables host down stream resume sent interrupt detection More...
 
#define Host_disable_hwup_interrupt()   (AVR32_USBB_uhinteclr = AVR32_USBB_UHINTECLR_HWUPIEC_MASK)
 disables host wake-up interrupt detection More...
 
#define Host_disable_in_received_interrupt(p)   (AVR32_USBB_upconxclr(p) = AVR32_USBB_UPCONXCLR_RXINEC_MASK)
 disables IN pipe reception interrupt More...
 
#define Host_disable_nak_received_interrupt(p)   (AVR32_USBB_upconxclr(p) = AVR32_USBB_UPCONXCLR_NAKEDEC_MASK)
 disables NAK received interrupt More...
 
#define Host_disable_out_ready_interrupt(p)   (AVR32_USBB_upconxclr(p) = AVR32_USBB_UPCONXCLR_TXOUTEC_MASK)
 disables OUT pipe ready interrupt More...
 
#define Host_disable_overflow_interrupt(p)   (AVR32_USBB_upconxclr(p) = AVR32_USBB_UPCONXCLR_OVERFIEC_MASK)
 disables overflow interrupt More...
 
#define Host_disable_pipe(p)   (Clr_bits(AVR32_USBB_uprst, AVR32_USBB_UPRST_PEN0_MASK << (p)))
 disables the selected pipe More...
 
#define Host_disable_pipe_bank_autoswitch(p)   (Clr_bits(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_AUTOSW_MASK))
 disables the bank autoswitch for the selected pipe More...
 
#define Host_disable_pipe_dma_interrupt(pdma)   (AVR32_USBB_uhinteclr = AVR32_USBB_UHINTECLR_DMA1INTEC_MASK << ((pdma) - 1))
 disables the selected pipe DMA channel interrupt More...
 
#define Host_disable_pipe_error_interrupt(p)   (AVR32_USBB_upconxclr(p) = AVR32_USBB_UPCONXCLR_PERREC_MASK)
 disables pipe error interrupt More...
 
#define Host_disable_pipe_int_dis_hdma_req(p)   (AVR32_USBB_upconxclr(p) = AVR32_USBB_UPCONXCLR_PDISHDMAC_MASK)
 disables the disabling of HDMA requests by pipe interrupts More...
 
#define Host_disable_pipe_interrupt(p)   (AVR32_USBB_uhinteclr = AVR32_USBB_UHINTECLR_P0INTEC_MASK << (p))
 disables the selected pipe interrupt More...
 
#define Host_disable_remote_wakeup_interrupt()   (AVR32_USBB_uhinteclr = AVR32_USBB_UHINTECLR_RXRSMIEC_MASK)
 disables host remote wake-up interrupt detection More...
 
#define Host_disable_reset_sent_interrupt()   (AVR32_USBB_uhinteclr = AVR32_USBB_UHINTECLR_RSTIEC_MASK)
 disables host USB reset sent interrupt More...
 
#define Host_disable_setup_ready_interrupt()   (AVR32_USBB_upconxclr(P_CONTROL) = AVR32_USBB_UPCONXCLR_TXSTPEC_MASK)
 disables SETUP pipe ready interrupt More...
 
#define Host_disable_short_packet_interrupt(p)   (AVR32_USBB_upconxclr(p) = AVR32_USBB_UPCONXCLR_SHORTPACKETIEC_MASK)
 disables SHORT PACKET received interrupt More...
 
#define Host_disable_sof()   (Clr_bits(AVR32_USBB_uhcon, AVR32_USBB_UHCON_SOFE_MASK))
 disables SOF generation More...
 
#define Host_disable_sof_interrupt()   (AVR32_USBB_uhinteclr = AVR32_USBB_UHINTECLR_HSOFIEC_MASK)
 enables host Start-of-Frame interrupt More...
 
#define Host_disable_stall_interrupt(p)   (AVR32_USBB_upconxclr(p) = AVR32_USBB_UPCONXCLR_RXSTALLDEC_MASK)
 disables STALL received interrupt More...
 
#define Host_disable_underflow_interrupt(p)   (AVR32_USBB_upconxclr(p) = AVR32_USBB_UPCONXCLR_TXSTPEC_MASK)
 disables underflow interrupt More...
 
#define Host_enable_bank_interrupt(p)   (AVR32_USBB_upconxset(p) = AVR32_USBB_UPCONXSET_NBUSYBKES_MASK)
 enables all banks full (IN) or free (OUT) interrupt More...
 
#define Host_enable_continuous_in_mode(p)   (Set_bits(AVR32_USBB_upinrqx(p), AVR32_USBB_UPINRQX_INMODE_MASK))
 enables continuous IN mode More...
 
#define Host_enable_control_in_received_interrupt()   (AVR32_USBB_upconxset(P_CONTROL) = AVR32_USBB_UPCONXSET_RXINES_MASK)
 enables IN control pipe reception interrupt More...
 
#define Host_enable_control_out_ready_interrupt()   (AVR32_USBB_upconxset(P_CONTROL) = AVR32_USBB_UPCONXSET_TXOUTES_MASK)
 enables OUT control pipe ready interrupt More...
 
#define Host_enable_crc_error_interrupt(p)   (AVR32_USBB_upconxset(p) = AVR32_USBB_UPCONXSET_RXSTALLDES_MASK)
 enables CRC ERROR ISO IN detected interrupt More...
 
#define Host_enable_device_connection_interrupt()   (AVR32_USBB_uhinteset = AVR32_USBB_UHINTESET_DCONNIES_MASK)
 enables host device connection interrupt More...
 
#define Host_enable_device_disconnection_interrupt()   (AVR32_USBB_uhinteset = AVR32_USBB_UHINTESET_DDISCIES_MASK)
 enables host device disconnection interrupt More...
 
#define Host_enable_down_stream_resume_interrupt()   (AVR32_USBB_uhinteset = AVR32_USBB_UHINTESET_RSMEDIES_MASK)
 enables host down stream resume sent interrupt detection More...
 
#define Host_enable_hwup_interrupt()   (AVR32_USBB_uhinteset = AVR32_USBB_UHINTESET_HWUPIES_MASK)
 enables host wake-up interrupt detection More...
 
#define Host_enable_in_received_interrupt(p)   (AVR32_USBB_upconxset(p) = AVR32_USBB_UPCONXSET_RXINES_MASK)
 enables IN pipe reception interrupt More...
 
#define Host_enable_nak_received_interrupt(p)   (AVR32_USBB_upconxset(p) = AVR32_USBB_UPCONXSET_NAKEDES_MASK)
 enables NAK received interrupt More...
 
#define Host_enable_out_ready_interrupt(p)   (AVR32_USBB_upconxset(p) = AVR32_USBB_UPCONXSET_TXOUTES_MASK)
 enables OUT pipe ready interrupt More...
 
#define Host_enable_overflow_interrupt(p)   (AVR32_USBB_upconxset(p) = AVR32_USBB_UPCONXSET_OVERFIES_MASK)
 enables overflow interrupt More...
 
#define Host_enable_ping(p)   (Set_bits(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_PINGEN_MASK))
 Enable PING management for the endpoint p. More...
 
#define Host_enable_pipe(p)   (Set_bits(AVR32_USBB_uprst, AVR32_USBB_UPRST_PEN0_MASK << (p)))
 enables the selected pipe More...
 
#define Host_enable_pipe_bank_autoswitch(p)   (Set_bits(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_AUTOSW_MASK))
 enables the bank autoswitch for the selected pipe More...
 
#define Host_enable_pipe_dma_interrupt(pdma)   (AVR32_USBB_uhinteset = AVR32_USBB_UHINTESET_DMA1INTES_MASK << ((pdma) - 1))
 enables the selected pipe DMA channel interrupt More...
 
#define Host_enable_pipe_error_interrupt(p)   (AVR32_USBB_upconxset(p) = AVR32_USBB_UPCONXSET_PERRES_MASK)
 enables pipe error interrupt More...
 
#define Host_enable_pipe_int_dis_hdma_req(p)   (AVR32_USBB_upconxset(p) = AVR32_USBB_UPCONXSET_PDISHDMAS_MASK)
 enables the disabling of HDMA requests by pipe interrupts More...
 
#define Host_enable_pipe_interrupt(p)   (AVR32_USBB_uhinteset = AVR32_USBB_UHINTESET_P0INTES_MASK << (p))
 enables the selected pipe interrupt More...
 
#define Host_enable_remote_wakeup_interrupt()   (AVR32_USBB_uhinteset = AVR32_USBB_UHINTESET_RXRSMIES_MASK)
 enables host remote wake-up interrupt detection More...
 
#define Host_enable_reset_sent_interrupt()   (AVR32_USBB_uhinteset = AVR32_USBB_UHINTESET_RSTIES_MASK)
 enables host USB reset sent interrupt More...
 
#define Host_enable_setup_ready_interrupt()   (AVR32_USBB_upconxset(P_CONTROL) = AVR32_USBB_UPCONXSET_TXSTPES_MASK)
 enables SETUP pipe ready interrupt More...
 
#define Host_enable_short_packet_interrupt(p)   (AVR32_USBB_upconxset(p) = AVR32_USBB_UPCONXSET_SHORTPACKETIES_MASK)
 enables SHORT PACKET received interrupt More...
 
#define Host_enable_sof()   (Set_bits(AVR32_USBB_uhcon, AVR32_USBB_UHCON_SOFE_MASK))
 enables SOF generation More...
 
#define Host_enable_sof_interrupt()   (AVR32_USBB_uhinteset = AVR32_USBB_UHINTESET_HSOFIES_MASK)
 enables host Start-of-Frame interrupt More...
 
#define Host_enable_stall_interrupt(p)   (AVR32_USBB_upconxset(p) = AVR32_USBB_UPCONXSET_RXSTALLDES_MASK)
 enables STALL received interrupt More...
 
#define Host_enable_underflow_interrupt(p)   (AVR32_USBB_upconxset(p) = AVR32_USBB_UPCONXSET_TXSTPES_MASK)
 enables underflow interrupt More...
 
#define Host_error_status(p)
 tests if error occurs on pipe More...
 
#define Host_force_bank_interrupt(p)   (AVR32_USBB_upstaxset(p) = AVR32_USBB_UPSTAXSET_NBUSYBKS_MASK)
 forces all banks full (OUT) or free (IN) interrupt More...
 
#define Host_format_pipe_size(size)   (32 - clz(((U32)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 USBB controller for pipe size bit-field. More...
 
#define Host_frame_length()   (Rd_bitfield(AVR32_USBB_uhfnum, AVR32_USBB_UHFNUM_FLENHIGH_MASK))
 returns the current frame length More...
 
#define Host_frame_number()   (Rd_bitfield(AVR32_USBB_uhfnum, AVR32_USBB_UHFNUM_FNUM_MASK))
 returns the current frame number More...
 
#define Host_free_control_in()   (Host_ack_fifocon(P_CONTROL))
 frees current bank for IN control pipe More...
 
#define Host_free_in(p)   (Host_ack_fifocon(p))
 frees current bank for IN pipe More...
 
#define Host_freeze_pipe(p)   (AVR32_USBB_upconxset(p) = AVR32_USBB_UPCONXSET_PFREEZES_MASK)
 freezes the pipe More...
 
#define Host_get_configured_address(p)   (Rd_bitfield(AVR32_USBB_uhaddrx(1 + ((p) >> 2)), AVR32_USBB_UHADDR1_UHADDR_P0_MASK << (((p) & 0x03) << 3)))
 gets the currently configured USB device address associated with the selected pipe More...
 
#define Host_get_error_counter(p)   (Rd_bitfield(AVR32_USBB_uperrx(p), AVR32_USBB_UPERRX_COUNTER_MASK))
 
#define Host_get_in_request_number(p)   (Rd_bitfield(AVR32_USBB_upinrqx(p), AVR32_USBB_UPINRQX_INRQ_MASK) + 1)
 returns number of remaining IN requests More...
 
#define Host_get_interrupt_pipe_number()
 returns the lowest pipe number generating a pipe interrupt or MAX_PEP_NB if none More...
 
#define Host_get_pipe_bank(p)   (Rd_bitfield(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_PBK_MASK))
 gets the configured selected pipe number of banks More...
 
#define Host_get_pipe_endpoint_number(p)   (Rd_bitfield(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_PEPNUM_MASK))
 gets the configured selected pipe endpoint number More...
 
#define Host_get_pipe_fifo_access(p, scale)   (AVR32_USBB_FIFOX_DATA(p, scale))
 Get 64-, 32-, 16- or 8-bit access to FIFO data register of selected pipe. More...
 
#define Host_get_pipe_int_req_freq(p)   (Rd_bitfield(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_INTFRQ_MASK))
 gets the configured interrupt pipe request frequency (period in ms) for the selected pipe More...
 
#define Host_get_pipe_size(p)   (8 << Rd_bitfield(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_PSIZE_MASK))
 gets the configured selected pipe size More...
 
#define Host_get_pipe_token(p)   (Rd_bitfield(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_PTOKEN_MASK))
 gets the configured selected pipe token More...
 
#define Host_get_pipe_type(p)   (Rd_bitfield(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_PTYPE_MASK))
 gets the configured selected pipe type More...
 
#define Host_in_request_number(p, in_num)   (Wr_bitfield(AVR32_USBB_upinrqx(p), AVR32_USBB_UPINRQX_INRQ_MASK, (in_num) - 1))
 sets number of IN requests to perform before freeze More...
 
#define Host_nb_busy_bank(p)   (Rd_bitfield(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_NBUSYBK_MASK))
 returns the number of busy banks More...
 
#define Host_raise_control_in_received()   (AVR32_USBB_upstaxset(P_CONTROL) = AVR32_USBB_UPSTAXSET_RXINIS_MASK)
 raises control IN More...
 
#define Host_raise_control_out_ready()   (AVR32_USBB_upstaxset(P_CONTROL) = AVR32_USBB_UPSTAXSET_TXOUTIS_MASK)
 raises control OUT More...
 
#define Host_raise_crc_error(p)   (AVR32_USBB_upstaxset(p) = AVR32_USBB_UPSTAXSET_RXSTALLDIS_MASK)
 raises CRC ERROR ISO IN detected More...
 
#define Host_raise_device_connection()   (AVR32_USBB_uhintset = AVR32_USBB_UHINTSET_DCONNIS_MASK)
 raises device connection More...
 
#define Host_raise_device_disconnection()   (AVR32_USBB_uhintset = AVR32_USBB_UHINTSET_DDISCIS_MASK)
 raises device disconnection More...
 
#define Host_raise_down_stream_resume()   (AVR32_USBB_uhintset = AVR32_USBB_UHINTSET_RSMEDIS_MASK)
 raises host down stream resume sent More...
 
#define Host_raise_hwup()   (AVR32_USBB_uhintset = AVR32_USBB_UHINTSET_HWUPIS_MASK)
 raises host wake-up detection More...
 
#define Host_raise_in_received(p)   (AVR32_USBB_upstaxset(p) = AVR32_USBB_UPSTAXSET_RXINIS_MASK)
 raises IN reception More...
 
#define Host_raise_nak_received(p)   (AVR32_USBB_upstaxset(p) = AVR32_USBB_UPSTAXSET_NAKEDIS_MASK)
 raises NAK received More...
 
#define Host_raise_out_ready(p)   (AVR32_USBB_upstaxset(p) = AVR32_USBB_UPSTAXSET_TXOUTIS_MASK)
 raises OUT sent More...
 
#define Host_raise_overflow_interrupt(p)   (AVR32_USBB_upstaxset(p) = AVR32_USBB_UPSTAXSET_OVERFIS_MASK)
 raises pipe overflow interrupt More...
 
#define Host_raise_pipe_dma_interrupt(pdma)   (AVR32_USBB_uhintset = AVR32_USBB_UHINTSET_DMA1INTS_MASK << ((pdma) - 1))
 raises the selected pipe DMA channel interrupt More...
 
#define Host_raise_pipe_error(p)   (AVR32_USBB_upstaxset(p) = (Is_host_pipe_error(p)) ? 0 : AVR32_USBB_UPSTAXSET_PERRIS_MASK)
 raises pipe error More...
 
#define Host_raise_remote_wakeup()   (AVR32_USBB_uhintset = AVR32_USBB_UHINTSET_RXRSMIS_MASK)
 raises host remote wake-up detection More...
 
#define Host_raise_reset_sent()   (AVR32_USBB_uhintset = AVR32_USBB_UHINTSET_RSTIS_MASK)
 raises host USB reset sent More...
 
#define Host_raise_setup_ready()   (AVR32_USBB_upstaxset(P_CONTROL) = AVR32_USBB_UPSTAXSET_TXSTPIS_MASK)
 raises setup More...
 
#define Host_raise_short_packet(p)   (AVR32_USBB_upstaxset(p) = AVR32_USBB_UPSTAXSET_SHORTPACKETIS_MASK)
 raises SHORT PACKET received More...
 
#define Host_raise_sof()   (AVR32_USBB_uhintset = AVR32_USBB_UHINTSET_HSOFIS_MASK)
 raises SOF detection More...
 
#define Host_raise_stall(p)   (AVR32_USBB_upstaxset(p) = AVR32_USBB_UPSTAXSET_RXSTALLDIS_MASK)
 raises STALL reception More...
 
#define Host_raise_underflow_interrupt(p)   (AVR32_USBB_upstaxset(p) = AVR32_USBB_UPSTAXSET_TXSTPIS_MASK)
 raises pipe underflow interrupt More...
 
#define Host_read_pipe_data(p, scale)
 Read 64-, 32-, 16- or 8-bit data from FIFO data register of selected pipe. More...
 
#define Host_read_pipe_indexed_data(p, scale, index)   (AVR32_USBB_FIFOX_DATA(p, scale)[(index)])
 Read 64-, 32-, 16- or 8-bit indexed data from FIFO data register of selected pipe. More...
 
#define Host_reset_data_toggle(p)   (AVR32_USBB_upconxset(p) = AVR32_USBB_UPCONXSET_RSTDTS_MASK)
 resets the data toggle sequence More...
 
#define Host_reset_pipe(p)
 resets the selected pipe More...
 
#define Host_reset_pipe_fifo_access(p)   (pep_fifo[(p)].u64ptr = Host_get_pipe_fifo_access(p, 64))
 Reset known position inside FIFO data register of selected pipe. More...
 
#define Host_send_control_out()   (Host_ack_fifocon(P_CONTROL))
 sends current bank for OUT control pipe More...
 
#define Host_send_out(p)   (Host_ack_fifocon(p))
 sends current bank for OUT pipe More...
 
#define Host_send_reset()   (Set_bits(AVR32_USBB_uhcon, AVR32_USBB_UHCON_RESET_MASK))
 sends a USB Reset to the device More...
 
#define Host_send_resume()   (Set_bits(AVR32_USBB_uhcon, AVR32_USBB_UHCON_RESUME_MASK))
 sends a USB Resume to the device More...
 
#define Host_send_setup()   (Host_ack_fifocon(P_CONTROL))
 sends current bank for SETUP pipe More...
 
#define Host_set_frame_number(fnum)   (Wr_bitfield(AVR32_USBB_uhfnum, AVR32_USBB_UHFNUM_FNUM_MASK, fnum))
 sets the current frame number More...
 
#define Host_stop_sending_reset()   (Clr_bits(AVR32_USBB_uhcon, AVR32_USBB_UHCON_RESET_MASK))
 stops sending a USB Reset to the device More...
 
#define Host_unallocate_memory(p)   (Clr_bits(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_ALLOC_MASK))
 un-allocates the configuration x in DPRAM memory More...
 
#define Host_unforce_bank_interrupt(p)   (AVR32_USBB_upstaxset(p) = AVR32_USBB_UPSTAXSET_NBUSYBKS_MASK)
 unforces all banks full (OUT) or free (IN) interrupt More...
 
#define Host_unfreeze_pipe(p)   (AVR32_USBB_upconxclr(p) = AVR32_USBB_UPCONXCLR_PFREEZEC_MASK)
 unfreezees the pipe More...
 
#define Host_write_pipe_data(p, scale, data)
 Write 64-, 32-, 16- or 8-bit data to FIFO data register of selected pipe. More...
 
#define Host_write_pipe_indexed_data(p, scale, index, data)   (AVR32_USBB_FIFOX_DATA(p, scale)[(index)] = (data))
 Write 64-, 32-, 16- or 8-bit indexed data to FIFO data register of selected pipe. More...
 
#define IP_NAME_PART_1   1
 
#define IP_NAME_PART_2   2
 
#define Is_host_bad_data_toggle(p)   (Tst_bits(AVR32_USBB_uperrx(p), AVR32_USBB_UPERRX_DATATGL_MASK))
 
#define Is_host_bank_interrupt_enabled(p)   (Tst_bits(AVR32_USBB_upconx(p), AVR32_USBB_UPCONX_NBUSYBKE_MASK))
 tests if all banks full (IN) or free (OUT) interrupt is enabled More...
 
#define Is_host_continuous_in_mode_enabled(p)   (Tst_bits(AVR32_USBB_upinrqx(p), AVR32_USBB_UPINRQX_INMODE_MASK))
 tests if continuous IN mode is enabled More...
 
#define Is_host_control_in_filled()   (Is_host_fifocon(P_CONTROL))
 tests if IN received in current bank for control pipe More...
 
#define Is_host_control_in_received()   (Tst_bits(AVR32_USBB_upstax(P_CONTROL), AVR32_USBB_UPSTAX_RXINI_MASK))
 tests if control IN has been received More...
 
#define Is_host_control_in_received_interrupt_enabled()   (Tst_bits(AVR32_USBB_upconx(P_CONTROL), AVR32_USBB_UPCONX_RXINE_MASK))
 tests if IN control pipe reception interrupt is enabled More...
 
#define Is_host_control_out_ready()   (Tst_bits(AVR32_USBB_upstax(P_CONTROL), AVR32_USBB_UPSTAX_TXOUTI_MASK))
 tests if control OUT has been sent More...
 
#define Is_host_control_out_ready_interrupt_enabled()   (Tst_bits(AVR32_USBB_upconx(P_CONTROL), AVR32_USBB_UPCONX_TXOUTE_MASK))
 tests if OUT control pipe ready interrupt is enabled More...
 
#define Is_host_control_out_sent()   (Is_host_fifocon(P_CONTROL))
 tests if current bank sent for OUT control pipe More...
 
#define Is_host_crc16_error(p)   (Tst_bits(AVR32_USBB_uperrx(p), AVR32_USBB_UPERRX_CRC16_MASK))
 
#define Is_host_crc_error(p)   (Tst_bits(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_RXSTALLDI_MASK))
 tests if CRC ERROR ISO IN detected More...
 
#define Is_host_crc_error_interrupt_enabled(p)   (Tst_bits(AVR32_USBB_upconx(p), AVR32_USBB_UPCONX_RXSTALLDE_MASK))
 tests if CRC ERROR ISO IN detected interrupt is enabled More...
 
#define Is_host_data_pid_error(p)   (Tst_bits(AVR32_USBB_uperrx(p), AVR32_USBB_UPERRX_DATAPID_MASK))
 
#define Is_host_data_toggle_reset(p)   (Tst_bits(AVR32_USBB_upconx(p), AVR32_USBB_UPCONX_RSTDT_MASK))
 tests if the data toggle sequence is being reset More...
 
#define Is_host_device_connection()   (Tst_bits(AVR32_USBB_uhint, AVR32_USBB_UHINT_DCONNI_MASK))
 tests if a USB device has been detected More...
 
#define Is_host_device_connection_interrupt_enabled()   (Tst_bits(AVR32_USBB_uhinte, AVR32_USBB_UHINTE_DCONNIE_MASK))
 
#define Is_host_device_disconnection()   (Tst_bits(AVR32_USBB_uhint, AVR32_USBB_UHINT_DDISCI_MASK))
 tests if a USB device has been removed More...
 
#define Is_host_device_disconnection_interrupt_enabled()   (Tst_bits(AVR32_USBB_uhinte, AVR32_USBB_UHINTE_DDISCIE_MASK))
 
#define Is_host_down_stream_resume()   (Tst_bits(AVR32_USBB_uhint, AVR32_USBB_UHINT_RSMEDI_MASK))
 
#define Is_host_down_stream_resume_interrupt_enabled()   (Tst_bits(AVR32_USBB_uhinte, AVR32_USBB_UHINTE_RSMEDIE_MASK))
 
#define Is_host_fifocon(p)   (Tst_bits(AVR32_USBB_upconx(p), AVR32_USBB_UPCONX_FIFOCON_MASK))
 tests if FIFOCON bit set More...
 
#define Is_host_hwup()   (Tst_bits(AVR32_USBB_uhint, AVR32_USBB_UHINT_HWUPI_MASK))
 tests if host wake-up detected More...
 
#define Is_host_hwup_interrupt_enabled()   (Tst_bits(AVR32_USBB_uhinte, AVR32_USBB_UHINTE_HWUPIE_MASK))
 
#define Is_host_in_filled(p)   (Is_host_fifocon(p))
 tests if IN received in current bank More...
 
#define Is_host_in_received(p)   (Tst_bits(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_RXINI_MASK))
 tests if IN received More...
 
#define Is_host_in_received_interrupt_enabled(p)   (Tst_bits(AVR32_USBB_upconx(p), AVR32_USBB_UPCONX_RXINE_MASK))
 tests if IN pipe reception interrupt is enabled More...
 
#define Is_host_memory_allocated(p)   (Tst_bits(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_ALLOC_MASK))
 
#define Is_host_nak_received(p)   (Tst_bits(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_NAKEDI_MASK))
 tests if NAK handshake has been received More...
 
#define Is_host_nak_received_interrupt_enabled(p)   (Tst_bits(AVR32_USBB_upconx(p), AVR32_USBB_UPCONX_NAKEDE_MASK))
 tests if NAK received interrupt is enabled More...
 
#define Is_host_out_ready(p)   (Tst_bits(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_TXOUTI_MASK))
 tests if OUT has been sent More...
 
#define Is_host_out_ready_interrupt_enabled(p)   (Tst_bits(AVR32_USBB_upconx(p), AVR32_USBB_UPCONX_TXOUTE_MASK))
 tests if OUT pipe ready interrupt is enabled More...
 
#define Is_host_out_sent(p)   (Is_host_fifocon(p))
 tests if current bank sent for OUT pipe More...
 
#define Is_host_overflow(p)   (Tst_bits(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_OVERFI_MASK))
 tests if an overflow occurs More...
 
#define Is_host_overflow_interrupt_enabled(p)   (Tst_bits(AVR32_USBB_upconx(p), AVR32_USBB_UPCONX_OVERFIE_MASK))
 tests if overflow interrupt is enabled More...
 
#define Is_host_pid_error(p)   (Tst_bits(AVR32_USBB_uperrx(p), AVR32_USBB_UPERRX_PID_MASK))
 
#define Is_host_pipe_bank_autoswitch_enabled(p)   (Tst_bits(AVR32_USBB_upcfgx(p), AVR32_USBB_UPCFGX_AUTOSW_MASK))
 
#define Is_host_pipe_configured(p)   (Tst_bits(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_CFGOK_MASK))
 tests if current pipe is configured More...
 
#define Is_host_pipe_dma_interrupt(pdma)   (Tst_bits(AVR32_USBB_uhint, AVR32_USBB_UHINT_DMA1INT_MASK << ((pdma) - 1)))
 tests if an interrupt is triggered by the selected pipe DMA channel More...
 
#define Is_host_pipe_dma_interrupt_enabled(pdma)   (Tst_bits(AVR32_USBB_uhinte, AVR32_USBB_UHINTE_DMA1INTE_MASK << ((pdma) - 1)))
 tests if the selected pipe DMA channel interrupt is enabled More...
 
#define Is_host_pipe_enabled(p)   (Tst_bits(AVR32_USBB_uprst, AVR32_USBB_UPRST_PEN0_MASK << (p)))
 tests if the selected pipe is enabled More...
 
#define Is_host_pipe_error(p)   (Tst_bits(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_PERRI_MASK))
 tests if an error occurs on current pipe More...
 
#define Is_host_pipe_error_interrupt_enabled(p)   (Tst_bits(AVR32_USBB_upconx(p), AVR32_USBB_UPCONX_PERRE_MASK))
 tests if pipe error interrupt is enabled More...
 
#define Is_host_pipe_frozen(p)   (Tst_bits(AVR32_USBB_upconx(p), AVR32_USBB_UPCONX_PFREEZE_MASK))
 tests if the current pipe is frozen More...
 
#define Is_host_pipe_int_dis_hdma_req_enabled(p)   (Tst_bits(AVR32_USBB_upconx(p), AVR32_USBB_UPCONX_PDISHDMA_MASK))
 tests if the disabling of HDMA requests by pipe interrupts si enabled More...
 
#define Is_host_pipe_interrupt(p)   (Tst_bits(AVR32_USBB_uhint, AVR32_USBB_UHINT_P0INT_MASK << (p)))
 tests if an interrupt is triggered by the selected pipe More...
 
#define Is_host_pipe_interrupt_enabled(p)   (Tst_bits(AVR32_USBB_uhinte, AVR32_USBB_UHINTE_P0INTE_MASK << (p)))
 tests if the selected pipe interrupt is enabled More...
 
#define Is_host_read_enabled(p)   (Tst_bits(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_RWALL_MASK))
 tests if pipe read allowed More...
 
#define Is_host_remote_wakeup()   (Tst_bits(AVR32_USBB_uhint, AVR32_USBB_UHINT_RXRSMI_MASK))
 tests if host remote wake-up detected More...
 
#define Is_host_remote_wakeup_interrupt_enabled()   (Tst_bits(AVR32_USBB_uhinte, AVR32_USBB_UHINTE_RXRSMIE_MASK))
 
#define Is_host_reset_sent()   (Tst_bits(AVR32_USBB_uhint, AVR32_USBB_UHINT_RSTI_MASK))
 tests if host USB reset sent More...
 
#define Is_host_reset_sent_interrupt_enabled()   (Tst_bits(AVR32_USBB_uhinte, AVR32_USBB_UHINTE_RSTIE_MASK))
 
#define Is_host_resetting_pipe(p)   (Tst_bits(AVR32_USBB_uprst, AVR32_USBB_UPRST_PRST0_MASK << (p)))
 tests if the selected pipe is being reset More...
 
#define Is_host_sending_reset()   (Tst_bits(AVR32_USBB_uhcon, AVR32_USBB_UHCON_RESET_MASK))
 tests if USB Reset running More...
 
#define Is_host_sending_resume()   (Tst_bits(AVR32_USBB_uhcon, AVR32_USBB_UHCON_RESUME_MASK))
 tests if USB Resume running More...
 
#define Is_host_setup_ready()   (Tst_bits(AVR32_USBB_upstax(P_CONTROL), AVR32_USBB_UPSTAX_TXSTPI_MASK))
 tests if SETUP has been sent More...
 
#define Is_host_setup_ready_interrupt_enabled()   (Tst_bits(AVR32_USBB_upconx(P_CONTROL), AVR32_USBB_UPCONX_TXSTPE_MASK))
 tests if SETUP pipe ready interrupt is enabled More...
 
#define Is_host_setup_sent()   (Is_host_fifocon(P_CONTROL))
 tests if current bank sent for SETUP pipe More...
 
#define Is_host_short_packet(p)   (Tst_bits(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_SHORTPACKETI_MASK))
 tests if SHORT PACKET received More...
 
#define Is_host_short_packet_interrupt_enabled(p)   (Tst_bits(AVR32_USBB_upconx(p), AVR32_USBB_UPCONX_SHORTPACKETIE_MASK))
 tests if SHORT PACKET received interrupt is enabled More...
 
#define Is_host_sof()   (Tst_bits(AVR32_USBB_uhint, AVR32_USBB_UHINT_HSOFI_MASK))
 tests if SOF detected More...
 
#define Is_host_sof_enabled()   (Tst_bits(AVR32_USBB_uhcon, AVR32_USBB_UHCON_SOFE_MASK))
 tests if SOF generation enabled More...
 
#define Is_host_sof_interrupt_enabled()   (Tst_bits(AVR32_USBB_uhinte, AVR32_USBB_UHINTE_HSOFIE_MASK))
 
#define Is_host_stall(p)   (Tst_bits(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_RXSTALLDI_MASK))
 tests if a STALL has been received More...
 
#define Is_host_stall_interrupt_enabled(p)   (Tst_bits(AVR32_USBB_upconx(p), AVR32_USBB_UPCONX_RXSTALLDE_MASK))
 tests if STALL received interrupt is enabled More...
 
#define Is_host_timeout_error(p)   (Tst_bits(AVR32_USBB_uperrx(p), AVR32_USBB_UPERRX_TIMEOUT_MASK))
 
#define Is_host_underflow(p)   (Tst_bits(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_TXSTPI_MASK))
 tests if an underflow occurs More...
 
#define Is_host_underflow_interrupt_enabled(p)   (Tst_bits(AVR32_USBB_upconx(p), AVR32_USBB_UPCONX_TXSTPE_MASK))
 tests if underflow interrupt is enabled More...
 
#define Is_host_write_enabled(p)   (Tst_bits(AVR32_USBB_upstax(p), AVR32_USBB_UPSTAX_RWALL_MASK))
 tests if pipe write allowed More...
 
#define Is_usb_address_enabled()   (Tst_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_ADDEN_MASK))
 
#define Is_usb_bank_interrupt_enabled(ep)   (Tst_bits(AVR32_USBB_ueconx(ep), AVR32_USBB_UECONX_NBUSYBKE_MASK))
 tests if all banks full (OUT) or free (IN) interrupt enabled More...
 
#define Is_usb_bconnection_error_interrupt()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_BCERRI_MASK))
 tests if a B-device connection error occurs More...
 
#define Is_usb_bconnection_error_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_BCERRE_MASK))
 
#define Is_usb_clock_frozen()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_FRZCLK_MASK))
 
#define Is_usb_control_in_ready()   (Tst_bits(AVR32_USBB_uestax(EP_CONTROL), AVR32_USBB_UESTAX_TXINI_MASK))
 tests if IN ready on control endpoint More...
 
#define Is_usb_control_in_ready_interrupt_enabled()   (Tst_bits(AVR32_USBB_ueconx(EP_CONTROL), AVR32_USBB_UECONX_TXINE_MASK))
 tests if IN ready on control endpoint interrupt is enabled More...
 
#define Is_usb_control_out_received()   (Tst_bits(AVR32_USBB_uestax(EP_CONTROL), AVR32_USBB_UESTAX_RXOUTI_MASK))
 tests if OUT received on control endpoint More...
 
#define Is_usb_control_out_received_interrupt_enabled()   (Tst_bits(AVR32_USBB_ueconx(EP_CONTROL), AVR32_USBB_UECONX_RXOUTE_MASK))
 tests if OUT received on control endpoint interrupt is enabled More...
 
#define Is_usb_crc_error(ep)   (Tst_bits(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_STALLEDI_MASK))
 tests if CRC ERROR ISO OUT detected More...
 
#define Is_usb_crc_error_interrupt_enabled(ep)   (Tst_bits(AVR32_USBB_ueconx(ep), AVR32_USBB_UECONX_STALLEDE_MASK))
 tests if CRC ERROR ISO OUT detected interrupt is enabled More...
 
#define Is_usb_data_srp_method_selected()   (!Is_usb_vbus_srp_method_selected())
 
#define Is_usb_data_toggle_reset(ep)   (Tst_bits(AVR32_USBB_ueconx(ep), AVR32_USBB_UECONX_RSTDT_MASK))
 tests if the data toggle sequence is being reset More...
 
#define Is_usb_detached()   (Tst_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_DETACH_MASK))
 test if the device is detached More...
 
#define Is_usb_device_mode_forced()   (!Is_usb_id_pin_enabled() && Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIMOD_MASK))
 Test if device mode is forced. More...
 
#define Is_usb_device_srp()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPREQ_MASK))
 tests if a SRP from device occurs More...
 
#define Is_usb_dpram_byte_write_capable()   (Tst_bits(AVR32_USBB_ufeatures, AVR32_USBB_UFEATURES_BYTE_WRITE_DPRAM_MASK))
 Test if DPRAM is natively byte write capable. More...
 
#define Is_usb_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_USBE_MASK))
 
#define Is_usb_endpoint_bank_autoswitch_enabled(ep)   (Tst_bits(AVR32_USBB_uecfgx(ep), AVR32_USBB_UECFGX_AUTOSW_MASK))
 
#define Is_usb_endpoint_configured(ep)   (Tst_bits(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_CFGOK_MASK))
 tests if current endpoint is configured More...
 
#define Is_usb_endpoint_dma_interrupt(epdma)   (Tst_bits(AVR32_USBB_udint, AVR32_USBB_UDINT_DMA1INT_MASK << ((epdma) - 1)))
 tests if an interrupt is triggered by the selected endpoint DMA channel More...
 
#define Is_usb_endpoint_dma_interrupt_enabled(epdma)   (Tst_bits(AVR32_USBB_udinte, AVR32_USBB_UDINTE_DMA1INTE_MASK << ((epdma) - 1)))
 tests if the selected endpoint DMA channel interrupt is enabled More...
 
#define Is_usb_endpoint_enabled(ep)   (Tst_bits(AVR32_USBB_uerst, AVR32_USBB_UERST_EPEN0_MASK << (ep)))
 tests if the selected endpoint is enabled More...
 
#define Is_usb_endpoint_int_dis_hdma_req_enabled(ep)   (Tst_bits(AVR32_USBB_ueconx(ep), AVR32_USBB_UECONX_EPDISHDMA_MASK))
 tests if the disabling of HDMA requests by endpoint interrupts is enabled More...
 
#define Is_usb_endpoint_interrupt(ep)   (Tst_bits(AVR32_USBB_udint, AVR32_USBB_UDINT_EP0INT_MASK << (ep)))
 tests if an interrupt is triggered by the selected endpoint More...
 
#define Is_usb_endpoint_interrupt_enabled(ep)   (Tst_bits(AVR32_USBB_udinte, AVR32_USBB_UDINTE_EP0INTE_MASK << (ep)))
 tests if the selected endpoint interrupt is enabled More...
 
#define Is_usb_endpoint_stall_requested(ep)   (Tst_bits(AVR32_USBB_ueconx(ep), AVR32_USBB_UECONX_STALLRQ_MASK))
 tests if STALL handshake request is running More...
 
#define Is_usb_fifocon(ep)   (Tst_bits(AVR32_USBB_ueconx(ep), AVR32_USBB_UECONX_FIFOCON_MASK))
 tests if FIFOCON bit set More...
 
#define Is_usb_frame_number_crc_error()   (Tst_bits(AVR32_USBB_udfnum, AVR32_USBB_UDFNUM_FNCERR_MASK))
 tests if a crc error occurs in frame number More...
 
#define Is_usb_full_speed_mode()   (Rd_bitfield(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_SPEED_MASK) == AVR32_USBB_USBSTA_SPEED_FULL)
 Test if controller is in full speed mode. More...
 
#define Is_usb_full_speed_mode_used()   (!Is_usb_low_speed_mode_forced())
 Test if device full speed mode is used. More...
 
#define Is_usb_hnp()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPREQ_MASK))
 tests if a HNP occurs More...
 
#define Is_usb_hnp_error_interrupt()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_HNPERRI_MASK))
 tests if a HNP error occurs More...
 
#define Is_usb_hnp_error_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPERRE_MASK))
 
#define Is_usb_host_mode_forced()   (!Is_usb_id_pin_enabled() && !Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIMOD_MASK))
 Test if host mode is forced. More...
 
#define Is_usb_id_device()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_ID_MASK))
 
#define Is_usb_id_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_IDTE_MASK))
 
#define Is_usb_id_pin_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIDE_MASK))
 Test if external USB_ID pin enabled (listened to by USB) More...
 
#define Is_usb_id_pin_input()
 Test if USB_ID is input from its pin. More...
 
#define Is_usb_id_transition()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_IDTI_MASK))
 
#define Is_usb_in_ready(ep)   (Tst_bits(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_TXINI_MASK))
 tests if IN ready More...
 
#define Is_usb_in_ready_interrupt_enabled(ep)   (Tst_bits(AVR32_USBB_ueconx(ep), AVR32_USBB_UECONX_TXINE_MASK))
 tests if IN ready interrupt is enabled More...
 
#define Is_usb_in_sent(ep)   (Is_usb_fifocon(ep))
 tests if current bank sent for IN endpoint More...
 
#define Is_usb_last_in_bank_killed(ep)   (Tst_bits(AVR32_USBB_ueconx(ep), AVR32_USBB_UECONX_KILLBK_MASK))
 tests if last bank killed More...
 
#define Is_usb_low_speed_mode()   (Rd_bitfield(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_SPEED_MASK) == AVR32_USBB_USBSTA_SPEED_LOW)
 Test if controller is in low-speed mode. More...
 
#define Is_usb_low_speed_mode_forced()   (Tst_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_LS_MASK))
 Test if device low-speed mode is forced. More...
 
#define Is_usb_memory_allocated(ep)   (Tst_bits(AVR32_USBB_uecfgx(ep), AVR32_USBB_UECFGX_ALLOC_MASK))
 
#define Is_usb_nak_in(ep)   (Tst_bits(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_NAKINI_MASK))
 tests if NAK IN received More...
 
#define Is_usb_nak_in_interrupt_enabled(ep)   (Tst_bits(AVR32_USBB_ueconx(ep), AVR32_USBB_UECONX_NAKINE_MASK))
 tests if NAK IN interrupt is enabled More...
 
#define Is_usb_nak_out(ep)   (Tst_bits(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_NAKOUTI_MASK))
 tests if NAK OUT received More...
 
#define Is_usb_nak_out_interrupt_enabled(ep)   (Tst_bits(AVR32_USBB_ueconx(ep), AVR32_USBB_UECONX_NAKOUTE_MASK))
 tests if NAK OUT interrupt is enabled More...
 
#define Is_usb_otg_pad_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_OTGPADE_MASK))
 
#define Is_usb_out_filled(ep)   (Is_usb_fifocon(ep))
 tests if current bank filled for OUT endpoint More...
 
#define Is_usb_out_received(ep)   (Tst_bits(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_RXOUTI_MASK))
 tests if OUT received More...
 
#define Is_usb_out_received_interrupt_enabled(ep)   (Tst_bits(AVR32_USBB_ueconx(ep), AVR32_USBB_UECONX_RXOUTE_MASK))
 tests if OUT received interrupt is enabled More...
 
#define Is_usb_overflow(ep)   (Tst_bits(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_OVERFI_MASK))
 tests if an overflow occurs More...
 
#define Is_usb_overflow_interrupt_enabled(ep)   (Tst_bits(AVR32_USBB_ueconx(ep), AVR32_USBB_UECONX_OVERFE_MASK))
 tests if overflow interrupt is enabled More...
 
#define Is_usb_pending_remote_wake_up()   (Tst_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_RMWKUP_MASK))
 test if remote wake-up still running More...
 
#define Is_usb_read_enabled(ep)   (Tst_bits(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_RWALL_MASK))
 tests if endpoint read allowed More...
 
#define Is_usb_remote_wake_up_interrupt_enabled()   (Tst_bits(AVR32_USBB_udinte, AVR32_USBB_UDINTE_UPRSME_MASK))
 
#define Is_usb_remote_wake_up_start()   (Tst_bits(AVR32_USBB_udint, AVR32_USBB_UDINT_UPRSM_MASK))
 tests if remote wake-up still running More...
 
#define Is_usb_reset()   (Tst_bits(AVR32_USBB_udint, AVR32_USBB_UDINT_EORST_MASK))
 tests if USB reset occurs More...
 
#define Is_usb_reset_interrupt_enabled()   (Tst_bits(AVR32_USBB_udinte, AVR32_USBB_UDINTE_EORSTE_MASK))
 
#define Is_usb_resetting_endpoint(ep)   (Tst_bits(AVR32_USBB_uerst, AVR32_USBB_UERST_EPRST0_MASK << (ep)))
 tests if the selected endpoint is being reset More...
 
#define Is_usb_resume()   (Tst_bits(AVR32_USBB_udint, AVR32_USBB_UDINT_EORSM_MASK))
 tests if resume occurs More...
 
#define Is_usb_resume_interrupt_enabled()   (Tst_bits(AVR32_USBB_udinte, AVR32_USBB_UDINTE_EORSME_MASK))
 
#define Is_usb_role_exchange_interrupt()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_ROLEEXI_MASK))
 tests if a role exchange occurs More...
 
#define Is_usb_role_exchange_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_ROLEEXE_MASK))
 
#define Is_usb_setup_received()   (Tst_bits(AVR32_USBB_uestax(EP_CONTROL), AVR32_USBB_UESTAX_RXSTPI_MASK))
 tests if SETUP received More...
 
#define Is_usb_setup_received_interrupt_enabled()   (Tst_bits(AVR32_USBB_ueconx(EP_CONTROL), AVR32_USBB_UECONX_RXSTPE_MASK))
 tests if SETUP received interrupt is enabled More...
 
#define Is_usb_short_packet(ep)   (Tst_bits(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_SHORTPACKETI_MASK))
 tests if SHORT PACKET received More...
 
#define Is_usb_short_packet_interrupt_enabled(ep)   (Tst_bits(AVR32_USBB_ueconx(ep), AVR32_USBB_UECONX_SHORTPACKETE_MASK))
 tests if SHORT PACKET received interrupt is enabled More...
 
#define Is_usb_sof()   (Tst_bits(AVR32_USBB_udint, AVR32_USBB_UDINT_SOF_MASK))
 tests if Start-of-Frame occurs More...
 
#define Is_usb_sof_interrupt_enabled()   (Tst_bits(AVR32_USBB_udinte, AVR32_USBB_UDINTE_SOFE_MASK))
 
#define Is_usb_srp_interrupt()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_SRPI_MASK))
 tests if a SRP occurs More...
 
#define Is_usb_srp_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPE_MASK))
 
#define Is_usb_stall(ep)   (Tst_bits(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_STALLEDI_MASK))
 tests if STALL sent More...
 
#define Is_usb_stall_interrupt_enabled(ep)   (Tst_bits(AVR32_USBB_ueconx(ep), AVR32_USBB_UECONX_STALLEDE_MASK))
 tests if STALL sent interrupt is enabled More...
 
#define Is_usb_suspend()   (Tst_bits(AVR32_USBB_udint, AVR32_USBB_UDINT_SUSP_MASK))
 tests if Suspend state detected More...
 
#define Is_usb_suspend_interrupt_enabled()   (Tst_bits(AVR32_USBB_udinte, AVR32_USBB_UDINTE_SUSPE_MASK))
 
#define Is_usb_suspend_time_out_interrupt()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_STOI_MASK))
 tests if a suspend time out occurs More...
 
#define Is_usb_suspend_time_out_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_STOE_MASK))
 
#define Is_usb_underflow(ep)   (Tst_bits(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_RXSTPI_MASK))
 tests if an underflow occurs More...
 
#define Is_usb_underflow_interrupt_enabled(ep)   (Tst_bits(AVR32_USBB_ueconx(ep), AVR32_USBB_UECONX_RXSTPE_MASK))
 tests if underflow interrupt is enabled More...
 
#define Is_usb_vbof_active_high()   (!Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSPO_MASK))
 Get USB_VBOF output pin polarity. More...
 
#define Is_usb_vbof_active_low()   (!Is_usb_vbof_active_high())
 
#define Is_usb_vbof_pin_output()
 Test if USB_VBOF is output onto its pin. More...
 
#define Is_usb_vbus_enabled()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_VBUSRQ_MASK))
 tests if VBus activation has been requested More...
 
#define Is_usb_vbus_error_interrupt()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_VBERRI_MASK))
 tests if a VBus error occurs More...
 
#define Is_usb_vbus_error_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBERRE_MASK))
 
#define Is_usb_vbus_high()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_VBUS_MASK))
 
#define Is_usb_vbus_hw_control_enabled()   (!Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSHWC_MASK))
 
#define Is_usb_vbus_interrupt_enabled()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSTE_MASK))
 
#define Is_usb_vbus_low()   (!Is_usb_vbus_high())
 
#define Is_usb_vbus_srp_method_selected()   (Tst_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPSEL_MASK))
 
#define Is_usb_vbus_transition()   (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_VBUSTI_MASK))
 
#define Is_usb_wake_up()   (Tst_bits(AVR32_USBB_udint, AVR32_USBB_UDINT_WAKEUP_MASK))
 tests if wake-up occurs More...
 
#define Is_usb_wake_up_interrupt_enabled()   (Tst_bits(AVR32_USBB_udinte, AVR32_USBB_UDINTE_WAKEUPE_MASK))
 
#define Is_usb_write_enabled(ep)   (Tst_bits(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_RWALL_MASK))
 tests if endpoint write allowed More...
 
#define MAX_PEP_NB   AVR32_USBB_EPT_NUM
 Maximal number of USBB pipes/endpoints. More...
 
#define P_0   0
 
#define P_1   1
 
#define P_2   2
 
#define P_3   3
 
#define P_4   4
 
#define P_5   5
 
#define P_6   6
 
#define P_CONTROL   0
 
#define PDTMOUTCNT_TIMER   AVR32_USBB_USBCON_TIMPAGE_PD_TMOUT_CNT
 
#define PDTMOUTCNT_TMOUT_105_MS   AVR32_USBB_USBCON_TIMVALUE_PD_TMOUT_CNT_105_MS
 
#define PDTMOUTCNT_TMOUT_118_MS   AVR32_USBB_USBCON_TIMVALUE_PD_TMOUT_CNT_118_MS
 
#define PDTMOUTCNT_TMOUT_131_MS   AVR32_USBB_USBCON_TIMVALUE_PD_TMOUT_CNT_131_MS
 
#define PDTMOUTCNT_TMOUT_93_MS   AVR32_USBB_USBCON_TIMVALUE_PD_TMOUT_CNT_93_MS
 
#define SINGLE_BANK   AVR32_USBB_UECFGX_EPBK_SINGLE
 
#define SRPDETTMOUT_TIMER   AVR32_USBB_USBCON_TIMPAGE_SRP_DET_TMOUT
 
#define SRPDETTMOUT_TMOUT_100_US   AVR32_USBB_USBCON_TIMVALUE_SRP_DET_TMOUT_100_US
 
#define SRPDETTMOUT_TMOUT_10_US   AVR32_USBB_USBCON_TIMVALUE_SRP_DET_TMOUT_10_US
 
#define SRPDETTMOUT_TMOUT_11_MS   AVR32_USBB_USBCON_TIMVALUE_SRP_DET_TMOUT_11_MS
 
#define SRPDETTMOUT_TMOUT_1_MS   AVR32_USBB_USBCON_TIMVALUE_SRP_DET_TMOUT_1_MS
 
#define SYNCHRONIZATION_TYPE_MASK   0x0c
 
#define TOKEN_IN   AVR32_USBB_UPCFGX_PTOKEN_IN
 
#define TOKEN_OUT   AVR32_USBB_UPCFGX_PTOKEN_OUT
 
#define TOKEN_SETUP   AVR32_USBB_UPCFGX_PTOKEN_SETUP
 
#define TRANSFER_TYPE_MASK   0x03
 
#define TRIPLE_BANK   AVR32_USBB_UECFGX_EPBK_TRIPLE
 
#define TYPE_BULK   AVR32_USBB_UECFGX_EPTYPE_BULK
 
#define TYPE_CONTROL   AVR32_USBB_UECFGX_EPTYPE_CONTROL
 
#define TYPE_INTERRUPT   AVR32_USBB_UECFGX_EPTYPE_INTERRUPT
 
#define TYPE_ISOCHRONOUS   AVR32_USBB_UECFGX_EPTYPE_ISOCHRONOUS
 
#define USAGE_TYPE_MASK   0x30
 
#define Usb_ack_bconnection_error_interrupt()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_BCERRIC_MASK)
 acks B-device connection error interrupt More...
 
#define Usb_ack_control_in_ready_send()   (AVR32_USBB_uestaxclr(EP_CONTROL) = AVR32_USBB_UESTAXCLR_TXINIC_MASK)
 acks IN ready on control endpoint and sends current bank More...
 
#define Usb_ack_control_out_received_free()   (AVR32_USBB_uestaxclr(EP_CONTROL) = AVR32_USBB_UESTAXCLR_RXOUTIC_MASK)
 acks OUT received on control endpoint and frees current bank More...
 
#define Usb_ack_crc_error(ep)   (AVR32_USBB_uestaxclr(ep) = AVR32_USBB_UESTAXCLR_STALLEDIC_MASK)
 acks CRC ERROR ISO OUT detected More...
 
#define Usb_ack_fifocon(ep)   (AVR32_USBB_ueconxclr(ep) = AVR32_USBB_UECONXCLR_FIFOCONC_MASK)
 clears FIFOCON bit More...
 
#define Usb_ack_hnp_error_interrupt()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_HNPERRIC_MASK)
 acks HNP error interrupt More...
 
#define Usb_ack_id_transition()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_IDTIC_MASK)
 
#define Usb_ack_in_ready(ep)   (AVR32_USBB_uestaxclr(ep) = AVR32_USBB_UESTAXCLR_TXINIC_MASK)
 acks IN ready More...
 
#define Usb_ack_in_ready_send(ep)   (Usb_ack_in_ready(ep), Usb_send_in(ep))
 acks IN ready and sends current bank More...
 
#define Usb_ack_nak_in(ep)   (AVR32_USBB_uestaxclr(ep) = AVR32_USBB_UESTAXCLR_NAKINIC_MASK)
 acks NAK IN received More...
 
#define Usb_ack_nak_out(ep)   (AVR32_USBB_uestaxclr(ep) = AVR32_USBB_UESTAXCLR_NAKOUTIC_MASK)
 acks NAK OUT received More...
 
#define Usb_ack_out_received(ep)   (AVR32_USBB_uestaxclr(ep) = AVR32_USBB_UESTAXCLR_RXOUTIC_MASK)
 acks OUT received More...
 
#define Usb_ack_out_received_free(ep)   (Usb_ack_out_received(ep), Usb_free_out(ep))
 acks OUT received and frees current bank More...
 
#define Usb_ack_overflow_interrupt(ep)   (AVR32_USBB_uestaxclr(ep) = AVR32_USBB_UESTAXCLR_OVERFIC_MASK)
 acks endpoint overflow interrupt More...
 
#define Usb_ack_remote_wake_up_start()   (AVR32_USBB_udintclr = AVR32_USBB_UDINTCLR_UPRSMC_MASK)
 acks remote wake-up More...
 
#define Usb_ack_reset()   (AVR32_USBB_udintclr = AVR32_USBB_UDINTCLR_EORSTC_MASK)
 acks USB reset More...
 
#define Usb_ack_resume()   (AVR32_USBB_udintclr = AVR32_USBB_UDINTCLR_EORSMC_MASK)
 acks resume More...
 
#define Usb_ack_role_exchange_interrupt()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_ROLEEXIC_MASK)
 acks role exchange interrupt More...
 
#define Usb_ack_setup_received_free()   (AVR32_USBB_uestaxclr(EP_CONTROL) = AVR32_USBB_UESTAXCLR_RXSTPIC_MASK)
 acks SETUP received More...
 
#define Usb_ack_short_packet(ep)   (AVR32_USBB_uestaxclr(ep) = AVR32_USBB_UESTAXCLR_SHORTPACKETIC_MASK)
 acks SHORT PACKET received More...
 
#define Usb_ack_sof()   (AVR32_USBB_udintclr = AVR32_USBB_UDINTCLR_SOFC_MASK)
 acks Start-of-Frame More...
 
#define Usb_ack_srp_interrupt()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_SRPIC_MASK)
 acks SRP interrupt More...
 
#define Usb_ack_stall(ep)   (AVR32_USBB_uestaxclr(ep) = AVR32_USBB_UESTAXCLR_STALLEDIC_MASK)
 acks STALL sent More...
 
#define Usb_ack_suspend()   (AVR32_USBB_udintclr = AVR32_USBB_UDINTCLR_SUSPC_MASK)
 acks Suspend More...
 
#define Usb_ack_suspend_time_out_interrupt()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_STOIC_MASK)
 acks suspend time out interrupt More...
 
#define Usb_ack_underflow_interrupt(ep)   (AVR32_USBB_uestaxclr(ep) = AVR32_USBB_UESTAXCLR_RXSTPIC_MASK)
 acks endpoint underflow interrupt More...
 
#define Usb_ack_vbus_error_interrupt()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_VBERRIC_MASK)
 acks VBus error interrupt More...
 
#define Usb_ack_vbus_transition()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_VBUSTIC_MASK)
 
#define Usb_ack_wake_up()   (AVR32_USBB_udintclr = AVR32_USBB_UDINTCLR_WAKEUPC_MASK)
 acks wake-up More...
 
#define Usb_allocate_memory(ep)   (Set_bits(AVR32_USBB_uecfgx(ep), AVR32_USBB_UECFGX_ALLOC_MASK))
 allocates the configuration x in DPRAM memory More...
 
#define Usb_attach()   (Clr_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_DETACH_MASK))
 attaches to USB bus More...
 
#define Usb_byte_count(ep)   (Rd_bitfield(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_BYCT_MASK))
 returns the byte count More...
 
#define Usb_configure_address(addr)   (Wr_bitfield(AVR32_USBB_udcon, AVR32_USBB_UDCON_UADD_MASK, addr))
 configures the USB device address More...
 
#define Usb_configure_endpoint(ep, type, dir, size, bank)
 configures selected endpoint in one step More...
 
#define Usb_configure_endpoint_bank(ep, bank)   (Wr_bitfield(AVR32_USBB_uecfgx(ep), AVR32_USBB_UECFGX_EPBK_MASK, bank))
 configures the selected endpoint number of banks More...
 
#define Usb_configure_endpoint_direction(ep, dir)   (Wr_bitfield(AVR32_USBB_uecfgx(ep), AVR32_USBB_UECFGX_EPDIR_MASK, dir))
 configures the selected endpoint direction More...
 
#define Usb_configure_endpoint_size(ep, size)   (Wr_bitfield(AVR32_USBB_uecfgx(ep), AVR32_USBB_UECFGX_EPSIZE_MASK, Usb_format_endpoint_size(size)))
 configures the selected endpoint size More...
 
#define Usb_configure_endpoint_type(ep, type)   (Wr_bitfield(AVR32_USBB_uecfgx(ep), AVR32_USBB_UECFGX_EPTYPE_MASK, type))
 configures the selected endpoint type More...
 
#define Usb_configure_timeout(timer, timeout)
 Configure time-out of specified OTG timer. More...
 
#define Usb_control_direction()   (Rd_bitfield(AVR32_USBB_uestax(EP_CONTROL), AVR32_USBB_UESTAX_CTRLDIR_MASK))
 returns the control direction More...
 
#define Usb_current_bank(ep)   (Rd_bitfield(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_CURRBK_MASK))
 returns the number of the current bank More...
 
#define Usb_data_toggle(ep)   (Rd_bitfield(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_DTSEQ_MASK))
 returns data toggle More...
 
#define Usb_detach()   (Set_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_DETACH_MASK))
 detaches from USB bus More...
 
#define Usb_device_initiate_hnp()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPREQ_MASK))
 initiates a Host negotiation Protocol More...
 
#define Usb_device_initiate_srp()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPREQ_MASK))
 initiates a Session Request Protocol More...
 
#define Usb_disable()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_USBE_MASK))
 Disable USB macro. More...
 
#define Usb_disable_address()   (Clr_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_ADDEN_MASK))
 disables USB device address More...
 
#define Usb_disable_bank_interrupt(ep)   (AVR32_USBB_ueconxclr(ep) = AVR32_USBB_UECONXCLR_NBUSYBKEC_MASK)
 disables all banks full (OUT) or free (IN) interrupt More...
 
#define Usb_disable_bconnection_error_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_BCERRE_MASK))
 disables B-device connection error interrupt More...
 
#define Usb_disable_control_in_ready_interrupt()   (AVR32_USBB_ueconxclr(EP_CONTROL) = AVR32_USBB_UECONXCLR_TXINEC_MASK)
 disables IN ready on control endpoint interrupt More...
 
#define Usb_disable_control_out_received_interrupt()   (AVR32_USBB_ueconxclr(EP_CONTROL) = AVR32_USBB_UECONXCLR_RXOUTEC_MASK)
 disables OUT received on control endpoint interrupt More...
 
#define Usb_disable_crc_error_interrupt(ep)   (AVR32_USBB_ueconxclr(ep) = AVR32_USBB_UECONXCLR_STALLEDEC_MASK)
 disables CRC ERROR ISO OUT detected interrupt More...
 
#define Usb_disable_endpoint(ep)   (Clr_bits(AVR32_USBB_uerst, AVR32_USBB_UERST_EPEN0_MASK << (ep)))
 disables the selected endpoint More...
 
#define Usb_disable_endpoint_bank_autoswitch(ep)   (Clr_bits(AVR32_USBB_uecfgx(ep), AVR32_USBB_UECFGX_AUTOSW_MASK))
 disables the bank autoswitch for the selected endpoint More...
 
#define Usb_disable_endpoint_dma_interrupt(epdma)   (AVR32_USBB_udinteclr = AVR32_USBB_UDINTECLR_DMA1INTEC_MASK << ((epdma) - 1))
 disables the selected endpoint DMA channel interrupt More...
 
#define Usb_disable_endpoint_int_dis_hdma_req(ep)   (AVR32_USBB_ueconxclr(ep) = AVR32_USBB_UECONXCLR_EPDISHDMAC_MASK)
 disables the disabling of HDMA requests by endpoint interrupts More...
 
#define Usb_disable_endpoint_interrupt(ep)   (AVR32_USBB_udinteclr = AVR32_USBB_UDINTECLR_EP0INTEC_MASK << (ep))
 disables the selected endpoint interrupt More...
 
#define Usb_disable_hnp_error_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPERRE_MASK))
 disables HNP error interrupt More...
 
#define Usb_disable_id_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_IDTE_MASK))
 
#define Usb_disable_id_pin()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIDE_MASK))
 Disable external USB_ID pin (ignored by USB) More...
 
#define Usb_disable_in_ready_interrupt(ep)   (AVR32_USBB_ueconxclr(ep) = AVR32_USBB_UECONXCLR_TXINEC_MASK)
 disables IN ready interrupt More...
 
#define Usb_disable_nak_in_interrupt(ep)   (AVR32_USBB_ueconxclr(ep) = AVR32_USBB_UECONXCLR_NAKINEC_MASK)
 disables NAK IN interrupt More...
 
#define Usb_disable_nak_out_interrupt(ep)   (AVR32_USBB_ueconxclr(ep) = AVR32_USBB_UECONXCLR_NAKOUTEC_MASK)
 disables NAK OUT interrupt More...
 
#define Usb_disable_otg_pad()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_OTGPADE_MASK))
 Disable OTG pad. More...
 
#define Usb_disable_out_received_interrupt(ep)   (AVR32_USBB_ueconxclr(ep) = AVR32_USBB_UECONXCLR_RXOUTEC_MASK)
 disables OUT received interrupt More...
 
#define Usb_disable_overflow_interrupt(ep)   (AVR32_USBB_ueconxclr(ep) = AVR32_USBB_UECONXCLR_OVERFEC_MASK)
 disables overflow interrupt More...
 
#define Usb_disable_remote_wake_up_interrupt()   (AVR32_USBB_udinteclr = AVR32_USBB_UDINTECLR_UPRSMEC_MASK)
 disables remote wake-up interrupt More...
 
#define Usb_disable_reset_interrupt()   (AVR32_USBB_udinteclr = AVR32_USBB_UDINTECLR_EORSTEC_MASK)
 disables USB reset interrupt More...
 
#define Usb_disable_resume_interrupt()   (AVR32_USBB_udinteclr = AVR32_USBB_UDINTECLR_EORSMEC_MASK)
 disables resume interrupt More...
 
#define Usb_disable_role_exchange_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_ROLEEXE_MASK))
 disables role exchange interrupt More...
 
#define Usb_disable_setup_received_interrupt()   (AVR32_USBB_ueconxclr(EP_CONTROL) = AVR32_USBB_UECONXCLR_RXSTPEC_MASK)
 disables SETUP received interrupt More...
 
#define Usb_disable_short_packet_interrupt(ep)   (AVR32_USBB_ueconxclr(ep) = AVR32_USBB_UECONXCLR_SHORTPACKETEC_MASK)
 disables SHORT PACKET received interrupt More...
 
#define Usb_disable_sof_interrupt()   (AVR32_USBB_udinteclr = AVR32_USBB_UDINTECLR_SOFEC_MASK)
 disables Start-of-Frame Interrupt More...
 
#define Usb_disable_srp_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPE_MASK))
 disables SRP interrupt More...
 
#define Usb_disable_stall_handshake(ep)   (AVR32_USBB_ueconxclr(ep) = AVR32_USBB_UECONXCLR_STALLRQC_MASK)
 disables the STALL handshake More...
 
#define Usb_disable_stall_interrupt(ep)   (AVR32_USBB_ueconxclr(ep) = AVR32_USBB_UECONXCLR_STALLEDEC_MASK)
 disables STALL sent interrupt More...
 
#define Usb_disable_suspend_interrupt()   (AVR32_USBB_udinteclr = AVR32_USBB_UDINTECLR_SUSPEC_MASK)
 disables suspend state interrupt More...
 
#define Usb_disable_suspend_time_out_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_STOE_MASK))
 disables suspend time out interrupt More...
 
#define Usb_disable_underflow_interrupt(ep)   (AVR32_USBB_ueconxclr(ep) = AVR32_USBB_UECONXCLR_RXSTPEC_MASK)
 disables underflow interrupt More...
 
#define Usb_disable_vbus()   (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_VBUSRQC_MASK)
 requests VBus deactivation More...
 
#define Usb_disable_vbus_error_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBERRE_MASK))
 disables VBus error interrupt More...
 
#define Usb_disable_vbus_hw_control()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSHWC_MASK))
 disables hardware control over the USB_VBOF output pin More...
 
#define Usb_disable_vbus_interrupt()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSTE_MASK))
 
#define Usb_disable_wake_up_interrupt()   (AVR32_USBB_udinteclr = AVR32_USBB_UDINTECLR_WAKEUPEC_MASK)
 disables wake-up interrupt More...
 
#define Usb_enable()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_USBE_MASK))
 Enable USB macro. More...
 
#define Usb_enable_address()   (Set_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_ADDEN_MASK))
 enables USB device address More...
 
#define Usb_enable_bank_interrupt(ep)   (AVR32_USBB_ueconxset(ep) = AVR32_USBB_UECONXSET_NBUSYBKES_MASK)
 enables all banks full (OUT) or free (IN) interrupt More...
 
#define Usb_enable_bconnection_error_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_BCERRE_MASK))
 enables B-device connection error interrupt More...
 
#define Usb_enable_control_in_ready_interrupt()   (AVR32_USBB_ueconxset(EP_CONTROL) = AVR32_USBB_UECONXSET_TXINES_MASK)
 enables IN ready on control endpoint interrupt More...
 
#define Usb_enable_control_out_received_interrupt()   (AVR32_USBB_ueconxset(EP_CONTROL) = AVR32_USBB_UECONXSET_RXOUTES_MASK)
 enables OUT received on control endpoint interrupt More...
 
#define Usb_enable_crc_error_interrupt(ep)   (AVR32_USBB_ueconxset(ep) = AVR32_USBB_UECONXSET_STALLEDES_MASK)
 enables CRC ERROR ISO OUT detected interrupt More...
 
#define Usb_enable_endpoint(ep)   (Set_bits(AVR32_USBB_uerst, AVR32_USBB_UERST_EPEN0_MASK << (ep)))
 enables the selected endpoint More...
 
#define Usb_enable_endpoint_bank_autoswitch(ep)   (Set_bits(AVR32_USBB_uecfgx(ep), AVR32_USBB_UECFGX_AUTOSW_MASK))
 enables the bank autoswitch for the selected endpoint More...
 
#define Usb_enable_endpoint_dma_interrupt(epdma)   (AVR32_USBB_udinteset = AVR32_USBB_UDINTESET_DMA1INTES_MASK << ((epdma) - 1))
 enables the selected endpoint DMA channel interrupt More...
 
#define Usb_enable_endpoint_int_dis_hdma_req(ep)   (AVR32_USBB_ueconxset(ep) = AVR32_USBB_UECONXSET_EPDISHDMAS_MASK)
 enables the disabling of HDMA requests by endpoint interrupts More...
 
#define Usb_enable_endpoint_interrupt(ep)   (AVR32_USBB_udinteset = AVR32_USBB_UDINTESET_EP0INTES_MASK << (ep))
 enables the selected endpoint interrupt More...
 
#define Usb_enable_hnp_error_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPERRE_MASK))
 enables HNP error interrupt More...
 
#define Usb_enable_id_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_IDTE_MASK))
 
#define Usb_enable_id_pin()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIDE_MASK))
 Enable external USB_ID pin (listened to by USB) More...
 
#define Usb_enable_in_ready_interrupt(ep)   (AVR32_USBB_ueconxset(ep) = AVR32_USBB_UECONXSET_TXINES_MASK)
 enables IN ready interrupt More...
 
#define Usb_enable_nak_in_interrupt(ep)   (AVR32_USBB_ueconxset(ep) = AVR32_USBB_UECONXSET_NAKINES_MASK)
 enables NAK IN interrupt More...
 
#define Usb_enable_nak_out_interrupt(ep)   (AVR32_USBB_ueconxset(ep) = AVR32_USBB_UECONXSET_NAKOUTES_MASK)
 enables NAK OUT interrupt More...
 
#define Usb_enable_otg_pad()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_OTGPADE_MASK))
 Enable OTG pad. More...
 
#define Usb_enable_out_received_interrupt(ep)   (AVR32_USBB_ueconxset(ep) = AVR32_USBB_UECONXSET_RXOUTES_MASK)
 enables OUT received interrupt More...
 
#define Usb_enable_overflow_interrupt(ep)   (AVR32_USBB_ueconxset(ep) = AVR32_USBB_UECONXSET_OVERFES_MASK)
 enables overflow interrupt More...
 
#define Usb_enable_remote_wake_up_interrupt()   (AVR32_USBB_udinteset = AVR32_USBB_UDINTESET_UPRSMES_MASK)
 enables remote wake-up interrupt More...
 
#define Usb_enable_reset_interrupt()   (AVR32_USBB_udinteset = AVR32_USBB_UDINTESET_EORSTES_MASK)
 enables USB reset interrupt More...
 
#define Usb_enable_resume_interrupt()   (AVR32_USBB_udinteset = AVR32_USBB_UDINTESET_EORSMES_MASK)
 enables resume interrupt More...
 
#define Usb_enable_role_exchange_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_ROLEEXE_MASK))
 enables role exchange interrupt More...
 
#define Usb_enable_setup_received_interrupt()   (AVR32_USBB_ueconxset(EP_CONTROL) = AVR32_USBB_UECONXSET_RXSTPES_MASK)
 enables SETUP received interrupt More...
 
#define Usb_enable_short_packet_interrupt(ep)   (AVR32_USBB_ueconxset(ep) = AVR32_USBB_UECONXSET_SHORTPACKETES_MASK)
 enables SHORT PACKET received interrupt More...
 
#define Usb_enable_sof_interrupt()   (AVR32_USBB_udinteset = AVR32_USBB_UDINTESET_SOFES_MASK)
 enables Start-of-Frame Interrupt More...
 
#define Usb_enable_srp_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPE_MASK))
 enables SRP interrupt More...
 
#define Usb_enable_stall_handshake(ep)   (AVR32_USBB_ueconxset(ep) = AVR32_USBB_UECONXSET_STALLRQS_MASK)
 enables the STALL handshake More...
 
#define Usb_enable_stall_interrupt(ep)   (AVR32_USBB_ueconxset(ep) = AVR32_USBB_UECONXSET_STALLEDES_MASK)
 enables STALL sent interrupt More...
 
#define Usb_enable_suspend_interrupt()   (AVR32_USBB_udinteset = AVR32_USBB_UDINTESET_SUSPES_MASK)
 enables suspend state interrupt More...
 
#define Usb_enable_suspend_time_out_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_STOE_MASK))
 enables suspend time out interrupt More...
 
#define Usb_enable_underflow_interrupt(ep)   (AVR32_USBB_ueconxset(ep) = AVR32_USBB_UECONXSET_RXSTPES_MASK)
 enables underflow interrupt More...
 
#define Usb_enable_vbus()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_VBUSRQS_MASK)
 requests VBus activation More...
 
#define Usb_enable_vbus_error_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBERRE_MASK))
 enables VBus error interrupt More...
 
#define Usb_enable_vbus_hw_control()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSHWC_MASK))
 enables hardware control over the USB_VBOF output pin More...
 
#define Usb_enable_vbus_interrupt()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSTE_MASK))
 
#define Usb_enable_wake_up_interrupt()   (AVR32_USBB_udinteset = AVR32_USBB_UDINTESET_WAKEUPES_MASK)
 enables wake-up interrupt More...
 
#define Usb_force_bank_interrupt(ep)   (AVR32_USBB_uestaxset(ep) = AVR32_USBB_UESTAXSET_NBUSYBKS_MASK)
 forces all banks full (OUT) or free (IN) interrupt More...
 
#define Usb_force_device_mode()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIMOD_MASK), Usb_disable_id_pin())
 Disable external USB_ID pin and force device mode. More...
 
#define Usb_force_full_speed_mode()   do { } while (0)
 
#define Usb_force_host_mode()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_UIMOD_MASK), Usb_disable_id_pin())
 Disable external USB_ID pin and force host mode. More...
 
#define Usb_force_low_speed_mode()   (Set_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_LS_MASK))
 Force device low-speed mode. More...
 
#define Usb_format_endpoint_size(size)   (32 - clz(((U32)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 USBB controller for endpoint size bit-field. More...
 
#define Usb_frame_number()   (Rd_bitfield(AVR32_USBB_udfnum, AVR32_USBB_UDFNUM_FNUM_MASK))
 returns the current frame number More...
 
#define Usb_free_out(ep)   (Usb_ack_fifocon(ep))
 frees current bank for OUT endpoint More...
 
#define Usb_freeze_clock()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_FRZCLK_MASK))
 Stop (freeze) internal USB clock. More...
 
#define Usb_get_configured_address()   (Rd_bitfield(AVR32_USBB_udcon, AVR32_USBB_UDCON_UADD_MASK))
 gets the currently configured USB device address More...
 
#define Usb_get_dma_buffer_size()   (Rd_bitfield(AVR32_USBB_ufeatures, AVR32_USBB_UFEATURES_DMA_BUFFER_SIZE_MASK))
 Get DMA buffer size. More...
 
#define Usb_get_dma_channel_nbr()   (Rd_bitfield(AVR32_USBB_ufeatures, AVR32_USBB_UFEATURES_DMA_CHANNEL_NBR_MASK))
 Get number of hardware-implemented DMA channels. More...
 
#define Usb_get_dma_fifo_word_depth()   (((Rd_bitfield(AVR32_USBB_ufeatures, AVR32_USBB_UFEATURES_DMA_FIFO_WORD_DEPTH_MASK) - 1) & ((1 << AVR32_USBB_UFEATURES_DMA_FIFO_WORD_DEPTH_SIZE) - 1)) + 1)
 Get DMA FIFO depth in words. More...
 
#define Usb_get_dpram_size()   (128 << Rd_bitfield(AVR32_USBB_ufeatures, AVR32_USBB_UFEATURES_FIFO_MAX_SIZE_MASK))
 Get DPRAM size (FIFO maximal size) in bytes. More...
 
#define Usb_get_endpoint_bank(ep)   (Rd_bitfield(AVR32_USBB_uecfgx(ep), AVR32_USBB_UECFGX_EPBK_MASK))
 gets the configured selected endpoint number of banks More...
 
#define Usb_get_endpoint_direction(ep)   (Rd_bitfield(AVR32_USBB_uecfgx(ep), AVR32_USBB_UECFGX_EPDIR_MASK))
 gets the configured selected endpoint direction More...
 
#define Usb_get_endpoint_fifo_access(ep, scale)   (AVR32_USBB_FIFOX_DATA(ep, scale))
 Get 64-, 32-, 16- or 8-bit access to FIFO data register of selected endpoint. More...
 
#define Usb_get_endpoint_size(ep)   (8 << Rd_bitfield(AVR32_USBB_uecfgx(ep), AVR32_USBB_UECFGX_EPSIZE_MASK))
 gets the configured selected endpoint size More...
 
#define Usb_get_endpoint_type(ep)   (Rd_bitfield(AVR32_USBB_uecfgx(ep), AVR32_USBB_UECFGX_EPTYPE_MASK))
 gets the configured selected endpoint type More...
 
#define Usb_get_fsm_drd_state()   (Rd_bitfield(AVR32_USBB_usbfsm, AVR32_USBB_USBFSM_DRDSTATE_MASK))
 Get the dual-role device state of the internal USB finite state machine of the USBB controller. More...
 
#define Usb_get_interrupt_endpoint_number()
 returns the lowest endpoint number generating an endpoint interrupt or MAX_PEP_NB if none More...
 
#define Usb_get_ip_name(part)   (AVR32_USBB_unamex(part))
 Get IP name part 1 or 2. More...
 
#define Usb_get_ip_paddress_size()   (AVR32_USBB_uaddrsize)
 Get size of USBB PB address space. More...
 
#define Usb_get_ip_version()   (Rd_bitfield(AVR32_USBB_uvers, AVR32_USBB_UVERS_VERSION_NUM_MASK))
 Get IP version. More...
 
#define Usb_get_metal_fix_nbr()   (Rd_bitfield(AVR32_USBB_uvers, AVR32_USBB_UVERS_METAL_FIX_NUM_MASK))
 Get number of metal fixes. More...
 
#define Usb_get_pipe_endpoint_max_nbr()   (((Rd_bitfield(AVR32_USBB_ufeatures, AVR32_USBB_UFEATURES_EPT_NBR_MAX_MASK) - 1) & ((1 << AVR32_USBB_UFEATURES_EPT_NBR_MAX_SIZE) - 1)) + 1)
 Get maximal number of pipes/endpoints (number of hardware-implemented pipes/endpoints) More...
 
#define Usb_get_timeout(timer)
 Get configured time-out of specified OTG timer. More...
 
#define Usb_halt_endpoint(ep)   (Usb_enable_stall_handshake(ep))
 Sends a STALL handshake for the next host request. More...
 
#define Usb_host_accept_hnp()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPREQ_MASK))
 accepts a Host negotiation Protocol More...
 
#define Usb_host_reject_hnp()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_HNPREQ_MASK))
 rejects a Host negotiation Protocol More...
 
#define USB_ID_FUNCTION   ATPASTE2(USB_ID, _FUNCTION)
 
#define USB_ID_PIN   ATPASTE2(USB_ID, _PIN)
 Check that multiplexed pin used for USB_ID is defined. More...
 
#define Usb_initiate_remote_wake_up()   (Set_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_RMWKUP_MASK))
 initiates a remote wake-up More...
 
#define Usb_input_id_pin()
 Input USB_ID from its pin. More...
 
#define Usb_kill_last_in_bank(ep)   (AVR32_USBB_ueconxset(ep) = AVR32_USBB_UECONXSET_KILLBKS_MASK)
 kills last bank More...
 
#define Usb_nb_busy_bank(ep)   (Rd_bitfield(AVR32_USBB_uestax(ep), AVR32_USBB_UESTAX_NBUSYBK_MASK))
 returns the number of busy banks More...
 
#define Usb_output_vbof_pin()
 Output USB_VBOF onto its pin. More...
 
#define Usb_raise_bconnection_error_interrupt()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_BCERRIS_MASK)
 raises B-device connection error interrupt More...
 
#define Usb_raise_control_in_ready()   (AVR32_USBB_uestaxset(EP_CONTROL) = AVR32_USBB_UESTAXSET_TXINIS_MASK)
 raises IN ready on control endpoint More...
 
#define Usb_raise_control_out_received()   (AVR32_USBB_uestaxset(EP_CONTROL) = AVR32_USBB_UESTAXSET_RXOUTIS_MASK)
 raises OUT received on control endpoint More...
 
#define Usb_raise_crc_error(ep)   (AVR32_USBB_uestaxset(ep) = AVR32_USBB_UESTAXSET_STALLEDIS_MASK)
 raises CRC ERROR ISO OUT detected More...
 
#define Usb_raise_endpoint_dma_interrupt(epdma)   (AVR32_USBB_udintset = AVR32_USBB_UDINTSET_DMA1INTS_MASK << ((epdma) - 1))
 raises the selected endpoint DMA channel interrupt More...
 
#define Usb_raise_hnp_error_interrupt()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_HNPERRIS_MASK)
 raises HNP error interrupt More...
 
#define Usb_raise_id_transition()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_IDTIS_MASK)
 
#define Usb_raise_in_ready(ep)   (AVR32_USBB_uestaxset(ep) = AVR32_USBB_UESTAXSET_TXINIS_MASK)
 raises IN ready More...
 
#define Usb_raise_nak_in(ep)   (AVR32_USBB_uestaxset(ep) = AVR32_USBB_UESTAXSET_NAKINIS_MASK)
 raises NAK IN received More...
 
#define Usb_raise_nak_out(ep)   (AVR32_USBB_uestaxset(ep) = AVR32_USBB_UESTAXSET_NAKOUTIS_MASK)
 raises NAK OUT received More...
 
#define Usb_raise_out_received(ep)   (AVR32_USBB_uestaxset(ep) = AVR32_USBB_UESTAXSET_RXOUTIS_MASK)
 raises OUT received More...
 
#define Usb_raise_overflow_interrupt(ep)   (AVR32_USBB_uestaxset(ep) = AVR32_USBB_UESTAXSET_OVERFIS_MASK)
 raises endpoint overflow interrupt More...
 
#define Usb_raise_remote_wake_up_start()   (AVR32_USBB_udintset = AVR32_USBB_UDINTSET_UPRSMS_MASK)
 raises remote wake-up More...
 
#define Usb_raise_reset()   (AVR32_USBB_udintset = AVR32_USBB_UDINTSET_EORSTS_MASK)
 raises USB reset More...
 
#define Usb_raise_resume()   (AVR32_USBB_udintset = AVR32_USBB_UDINTSET_EORSMS_MASK)
 raises resume More...
 
#define Usb_raise_role_exchange_interrupt()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_ROLEEXIS_MASK)
 raises role exchange interrupt More...
 
#define Usb_raise_setup_received()   (AVR32_USBB_uestaxset(EP_CONTROL) = AVR32_USBB_UESTAXSET_RXSTPIS_MASK)
 raises SETUP received More...
 
#define Usb_raise_short_packet(ep)   (AVR32_USBB_uestaxset(ep) = AVR32_USBB_UESTAXSET_SHORTPACKETIS_MASK)
 raises SHORT PACKET received More...
 
#define Usb_raise_sof()   (AVR32_USBB_udintset = AVR32_USBB_UDINTSET_SOFS_MASK)
 raises Start-of-Frame More...
 
#define Usb_raise_srp_interrupt()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_SRPIS_MASK)
 raises SRP interrupt More...
 
#define Usb_raise_stall(ep)   (AVR32_USBB_uestaxset(ep) = AVR32_USBB_UESTAXSET_STALLEDIS_MASK)
 raises STALL sent More...
 
#define Usb_raise_suspend()   (AVR32_USBB_udintset = AVR32_USBB_UDINTSET_SUSPS_MASK)
 raises Suspend More...
 
#define Usb_raise_suspend_time_out_interrupt()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_STOIS_MASK)
 raises suspend time out interrupt More...
 
#define Usb_raise_underflow_interrupt(ep)   (AVR32_USBB_uestaxset(ep) = AVR32_USBB_UESTAXSET_RXSTPIS_MASK)
 raises endpoint underflow interrupt More...
 
#define Usb_raise_vbus_error_interrupt()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_VBERRIS_MASK)
 raises VBus error interrupt More...
 
#define Usb_raise_vbus_transition()   (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_VBUSTIS_MASK)
 
#define Usb_raise_wake_up()   (AVR32_USBB_udintset = AVR32_USBB_UDINTSET_WAKEUPS_MASK)
 raises wake-up More...
 
#define Usb_read_endpoint_data(ep, scale)
 Read 64-, 32-, 16- or 8-bit data from FIFO data register of selected endpoint. More...
 
#define Usb_read_endpoint_indexed_data(ep, scale, index)   (AVR32_USBB_FIFOX_DATA(ep, scale)[(index)])
 Read 64-, 32-, 16- or 8-bit indexed data from FIFO data register of selected endpoint. More...
 
#define Usb_reset_data_toggle(ep)   (AVR32_USBB_ueconxset(ep) = AVR32_USBB_UECONXSET_RSTDTS_MASK)
 resets the data toggle sequence More...
 
#define Usb_reset_endpoint(ep)
 resets the selected endpoint More...
 
#define Usb_reset_endpoint_fifo_access(ep)   (pep_fifo[(ep)].u64ptr = Usb_get_endpoint_fifo_access(ep, 64))
 Reset known position inside FIFO data register of selected endpoint. More...
 
#define Usb_select_data_srp_method()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPSEL_MASK))
 selects data line as SRP method More...
 
#define Usb_select_vbus_srp_method()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_SRPSEL_MASK))
 selects VBus as SRP method More...
 
#define Usb_send_in(ep)   (Usb_ack_fifocon(ep))
 sends current bank for IN endpoint More...
 
#define Usb_set_vbof_active_high()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSPO_MASK))
 Set USB_VBOF output pin polarity. More...
 
#define Usb_set_vbof_active_low()   (Set_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_VBUSPO_MASK))
 
#define Usb_unallocate_memory(ep)   (Clr_bits(AVR32_USBB_uecfgx(ep), AVR32_USBB_UECFGX_ALLOC_MASK))
 un-allocates the configuration x in DPRAM memory More...
 
#define Usb_unforce_bank_interrupt(ep)   (AVR32_USBB_uestaxset(ep) = AVR32_USBB_UESTAXSET_NBUSYBKS_MASK)
 unforces all banks full (OUT) or free (IN) interrupt More...
 
#define Usb_unfreeze_clock()   (Clr_bits(AVR32_USBB_usbcon, AVR32_USBB_USBCON_FRZCLK_MASK))
 
#define Usb_use_dual_speed_mode()   do { } while (0)
 
#define Usb_use_full_speed_mode()   (Clr_bits(AVR32_USBB_udcon, AVR32_USBB_UDCON_LS_MASK))
 Use device full speed mode (default) More...
 
#define USB_VBOF_FUNCTION   ATPASTE2(USB_VBOF, _FUNCTION)
 
#define USB_VBOF_PIN   ATPASTE2(USB_VBOF, _PIN)
 Check that multiplexed pin used for USB_VBOF is defined. More...
 
#define Usb_write_endpoint_data(ep, scale, data)
 Write 64-, 32-, 16- or 8-bit data to FIFO data register of selected endpoint. More...
 
#define Usb_write_endpoint_indexed_data(ep, scale, index, data)   (AVR32_USBB_FIFOX_DATA(ep, scale)[(index)] = (data))
 Write 64-, 32-, 16- or 8-bit indexed data to FIFO data register of selected endpoint. More...
 
#define VBBUSPULSING_TIMER   AVR32_USBB_USBCON_TIMPAGE_VB_BUS_PULSING
 
#define VBBUSPULSING_TMOUT_15_MS   AVR32_USBB_USBCON_TIMVALUE_VB_BUS_PULSING_15_MS
 
#define VBBUSPULSING_TMOUT_23_MS   AVR32_USBB_USBCON_TIMVALUE_VB_BUS_PULSING_23_MS
 
#define VBBUSPULSING_TMOUT_31_MS   AVR32_USBB_USBCON_TIMVALUE_VB_BUS_PULSING_31_MS
 
#define VBBUSPULSING_TMOUT_40_MS   AVR32_USBB_USBCON_TIMVALUE_VB_BUS_PULSING_40_MS
 
#define Pep_fifo_access_64_post_inc()
 Post-increment operations associated with 64-, 32-, 16- and 8-bit accesses to the FIFO data registers of pipes/endpoints. More...
 
#define Pep_fifo_access_32_post_inc()
 
#define Pep_fifo_access_16_post_inc()   ++
 
#define Pep_fifo_access_8_post_inc()   ++
 

Functions

void host_disable_all_pipes (void)
 

------------—— HOST ---------------------------——

More...
 
U32 host_read_p_rxpacket (U8, void *, U32, void **)
 host_read_p_rxpacket More...
 
U32 host_set_p_txpacket (U8, U8, U32)
 host_set_p_txpacket More...
 
U32 host_write_p_txpacket (U8, const void *, U32, const void **)
 host_write_p_txpacket More...
 
Status_bool_t usb_init_device (void)
 

------------—— DEVICE -------------------------——

More...
 
U32 usb_read_ep_rxpacket (U8, void *, U32, void **)
 usb_read_ep_rxpacket More...
 
U32 usb_set_ep_txpacket (U8, U8, U32)
 usb_set_ep_txpacket More...
 
U32 usb_write_ep_txpacket (U8, const void *, U32, const void **)
 usb_write_ep_txpacket More...
 

Variables

UnionVPtr pep_fifo [MAX_PEP_NB]
 Pointers to the FIFO data registers of pipes/endpoints Use aggregated pointers to have several alignments available for a same address. More...
 

void host_disable_all_pipes ( void  )


------------—— HOST ---------------------------——

host_disable_all_pipes

This function disables all pipes for the host controller. Useful to execute upon disconnection.

Returns
Void

References cpu_irq_disable, cpu_irq_enable, cpu_irq_is_enabled, Host_disable_pipe, Host_disable_pipe_interrupt, Host_reset_pipe, Host_unallocate_memory, Is_host_pipe_enabled, MAX_PEP_NB, and void.

Referenced by usb_general_interrupt_non_naked(), and usb_host_task().

U32 host_read_p_rxpacket ( U8  p,
void rxbuf,
U32  data_length,
void **  prxbuf 
)

host_read_p_rxpacket

This function reads the selected pipe FIFO to the buffer pointed to by rxbuf, using as few accesses as possible.

Parameters
pNumber of the addressed pipe
rxbufAddress of buffer to write
data_lengthNumber of bytes to read
prxbufNULL or pointer to the buffer address to update
Returns
Number of non-read bytes
Note
The selected pipe FIFO may be read in several steps by calling host_read_p_rxpacket several times.
Warning
Invoke Host_reset_pipe_fifo_access before this function when at FIFO beginning whether or not the FIFO is to be read in several steps.
Do not mix calls to this function with calls to indexed macros.

References Align_down, Get_align, Host_byte_count, if(), min, Test_align, UnionPtr::u16ptr, UnionCPtr::u16ptr, UnionCVPtr::u16ptr, UnionPtr::u32ptr, UnionCPtr::u32ptr, UnionCVPtr::u32ptr, UnionPtr::u64ptr, UnionCPtr::u64ptr, UnionCVPtr::u64ptr, UnionPtr::u8ptr, UnionVPtr::u8ptr, UnionCPtr::u8ptr, and UnionCVPtr::u8ptr.

Referenced by host_get_data(), and host_transfer_control().

U32 host_set_p_txpacket ( U8  p,
U8  txbyte,
U32  data_length 
)

host_set_p_txpacket

This function fills the selected pipe FIFO with a constant byte, using as few accesses as possible.

Parameters
pNumber of the addressed pipe
txbyteByte to fill the pipe with
data_lengthNumber of bytes to write
Returns
Number of non-written bytes
Note
The selected pipe FIFO may be filled in several steps by calling host_set_p_txpacket several times.
Warning
Invoke Host_reset_pipe_fifo_access before this function when at FIFO beginning whether or not the FIFO is to be filled in several steps.
Do not mix calls to this function with calls to indexed macros.

References Align_down, Host_byte_count, Host_get_pipe_size, min, Test_align, Union64::u16, UnionVPtr::u16ptr, UnionCVPtr::u16ptr, Union64::u32, UnionVPtr::u32ptr, UnionCVPtr::u32ptr, Union64::u64, UnionVPtr::u64ptr, UnionCVPtr::u64ptr, Union64::u8, UnionVPtr::u8ptr, and UnionCVPtr::u8ptr.

U32 host_write_p_txpacket ( U8  p,
const void txbuf,
U32  data_length,
const void **  ptxbuf 
)

host_write_p_txpacket

This function writes the buffer pointed to by txbuf to the selected pipe FIFO, using as few accesses as possible.

Parameters
pNumber of the addressed pipe
txbufAddress of buffer to read
data_lengthNumber of bytes to write
ptxbufNULL or pointer to the buffer address to update
Returns
Number of non-written bytes
Note
The selected pipe FIFO may be written in several steps by calling host_write_p_txpacket several times.
Warning
Invoke Host_reset_pipe_fifo_access before this function when at FIFO beginning whether or not the FIFO is to be written in several steps.
Do not mix calls to this function with calls to indexed macros.

References Align_down, Get_align, Host_byte_count, Host_get_pipe_size, min, Test_align, UnionVPtr::u16ptr, UnionCPtr::u16ptr, UnionVPtr::u32ptr, UnionCPtr::u32ptr, UnionVPtr::u64ptr, UnionCPtr::u64ptr, UnionVPtr::u8ptr, and UnionCPtr::u8ptr.

Referenced by host_send_data(), and host_transfer_control().

Status_bool_t usb_init_device ( void  )


------------—— DEVICE -------------------------——

usb_init_device

This function initializes the USB device controller and configures the Default Control Endpoint.

Returns
Status

References DIRECTION_OUT, EP_CONTROL, EP_CONTROL_LENGTH, Is_usb_endpoint_enabled, Is_usb_id_device, SINGLE_BANK, TYPE_CONTROL, and Usb_configure_endpoint.

Referenced by usb_general_interrupt_non_naked(), and usb_start_device().

U32 usb_read_ep_rxpacket ( U8  ep,
void rxbuf,
U32  data_length,
void **  prxbuf 
)

usb_read_ep_rxpacket

This function reads the selected endpoint FIFO to the buffer pointed to by rxbuf, using as few accesses as possible.

Parameters
epNumber of the addressed endpoint
rxbufAddress of buffer to write
data_lengthNumber of bytes to read
prxbufNULL or pointer to the buffer address to update
Returns
Number of non-read bytes
Note
The selected endpoint FIFO may be read in several steps by calling usb_read_ep_rxpacket several times.
Warning
Invoke Usb_reset_endpoint_fifo_access before this function when at FIFO beginning whether or not the FIFO is to be read in several steps.
Do not mix calls to this function with calls to indexed macros.

References Align_down, Get_align, if(), min, Test_align, UnionPtr::u16ptr, UnionCVPtr::u16ptr, StructCPtr::u16ptr, UnionPtr::u32ptr, UnionCVPtr::u32ptr, StructCPtr::u32ptr, UnionPtr::u64ptr, UnionCVPtr::u64ptr, StructCPtr::u64ptr, UnionPtr::u8ptr, UnionVPtr::u8ptr, UnionCVPtr::u8ptr, StructCPtr::u8ptr, and Usb_byte_count.

Referenced by at45dbx_write_multiple_sector_callback(), sd_mmc_spi_write_multiple_sector_callback(), and usb_mass_storage_cbw().

U32 usb_set_ep_txpacket ( U8  ep,
U8  txbyte,
U32  data_length 
)

usb_set_ep_txpacket

This function fills the selected endpoint FIFO with a constant byte, using as few accesses as possible.

Parameters
epNumber of the addressed endpoint
txbyteByte to fill the endpoint with
data_lengthNumber of bytes to write
Returns
Number of non-written bytes
Note
The selected endpoint FIFO may be filled in several steps by calling usb_set_ep_txpacket several times.
Warning
Invoke Usb_reset_endpoint_fifo_access before this function when at FIFO beginning whether or not the FIFO is to be filled in several steps.
Do not mix calls to this function with calls to indexed macros.

References Align_down, min, Test_align, Union64::u16, UnionVPtr::u16ptr, UnionCVPtr::u16ptr, Union64::u32, UnionVPtr::u32ptr, UnionCVPtr::u32ptr, Union64::u64, UnionVPtr::u64ptr, UnionCVPtr::u64ptr, Union64::u8, UnionVPtr::u8ptr, UnionCVPtr::u8ptr, Usb_byte_count, and Usb_get_endpoint_size.

U32 usb_write_ep_txpacket ( U8  ep,
const void txbuf,
U32  data_length,
const void **  ptxbuf 
)

usb_write_ep_txpacket

This function writes the buffer pointed to by txbuf to the selected endpoint FIFO, using as few accesses as possible.

Parameters
epNumber of the addressed endpoint
txbufAddress of buffer to read
data_lengthNumber of bytes to write
ptxbufNULL or pointer to the buffer address to update
Returns
Number of non-written bytes
Note
The selected endpoint FIFO may be written in several steps by calling usb_write_ep_txpacket several times.
Warning
Invoke Usb_reset_endpoint_fifo_access before this function when at FIFO beginning whether or not the FIFO is to be written in several steps.
Do not mix calls to this function with calls to indexed macros.

References Align_down, Get_align, min, Test_align, UnionVPtr::u16ptr, UnionCPtr::u16ptr, UnionVPtr::u32ptr, UnionCPtr::u32ptr, UnionVPtr::u64ptr, UnionCPtr::u64ptr, UnionVPtr::u8ptr, UnionCPtr::u8ptr, Usb_byte_count, and Usb_get_endpoint_size.

Referenced by at45dbx_read_multiple_sector_callback(), sbc_inquiry(), sbc_request_sense(), sd_mmc_spi_read_multiple_sector_callback(), usb_get_descriptor(), and usb_set_feature().

UnionVPtr pep_fifo[MAX_PEP_NB]

Pointers to the FIFO data registers of pipes/endpoints Use aggregated pointers to have several alignments available for a same address.