Macros | Fonctions
Référence du fichier samd21_host.h

Macros

#define USB_EP_DIR_IN   0x80
 
#define USB_EP_DIR_OUT   0x00
 
#define USB_HOST_PTYPE_DIS   USB_HOST_PCFG_PTYPE(0x0)
 
#define USB_HOST_PTYPE_CTRL   USB_HOST_PCFG_PTYPE(0x1)
 
#define USB_HOST_PTYPE_ISO   USB_HOST_PCFG_PTYPE(0x2)
 
#define USB_HOST_PTYPE_BULK   USB_HOST_PCFG_PTYPE(0x3)
 
#define USB_HOST_PTYPE_INT   USB_HOST_PCFG_PTYPE(0x4)
 
#define USB_HOST_PTYPE_EXT   USB_HOST_PCFG_PTYPE(0x5)
 
#define USB_HOST_NB_BK_1   1
 
#define USB_HOST_PCFG_PTOKEN_SETUP   USB_HOST_PCFG_PTOKEN(0x0)
 
#define USB_HOST_PCFG_PTOKEN_IN   USB_HOST_PCFG_PTOKEN(0x1)
 
#define USB_HOST_PCFG_PTOKEN_OUT   USB_HOST_PCFG_PTOKEN(0x2)
 
#define USB_ERRORFLOW   USB_HOST_STATUS_BK_ERRORFLOW
 
#define USB_ERRORTIMEOUT   USB_HOST_STATUS_PIPE_TOUTER
 
#define USB_ERROR_DATATOGGLE   USB_HOST_STATUS_PIPE_DTGLER
 
#define USB_PCKSIZE_SIZE_8_BYTES   0
 
#define USB_PCKSIZE_SIZE_16_BYTES   1
 
#define USB_PCKSIZE_SIZE_32_BYTES   2
 
#define USB_PCKSIZE_SIZE_64_BYTES   3
 
#define USB_PCKSIZE_SIZE_128_BYTES   4
 
#define USB_PCKSIZE_SIZE_256_BYTES   5
 
#define USB_PCKSIZE_SIZE_512_BYTES   6
 
#define USB_PCKSIZE_SIZE_1023_BYTES_FS   7
 
#define USB_PCKSIZE_SIZE_1024_BYTES_HS   7
 
#define USB_HOST_DTGL(p)   (USB->HOST.HostPipe[p].PSTATUS.reg & USB_HOST_PSTATUS_DTGL)>>USB_HOST_PSTATUS_DTGL_Pos
 
#define uhd_enable_connection_int()   USB->HOST.INTENSET.reg = USB_HOST_INTENSET_DCONN
 
#define uhd_disable_connection_int()   USB->HOST.INTENCLR.reg = USB_HOST_INTENCLR_DCONN
 
#define uhd_ack_connection()   USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_DCONN
 
#define uhd_enable_disconnection_int()   USB->HOST.INTENSET.reg = USB_HOST_INTENSET_DDISC
 
#define uhd_disable_disconnection_int()   USB->HOST.INTENCLR.reg = USB_HOST_INTENCLR_DDISC
 
#define uhd_ack_disconnection()   USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_DDISC
 
#define uhd_start_USB_reg_reset()   USB->HOST.CTRLA.bit.SWRST = 1;
 
#define Is_uhd_starting_reset()   (USB->HOST.CTRLB.bit.BUSRESET == 1)
 
#define UHD_BusReset()   USB->HOST.CTRLB.bit.BUSRESET = 1
 
#define uhd_stop_reset()
 
#define uhd_ack_reset_sent()   USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_RST
 
#define Is_uhd_reset_sent()   (USB->HOST.INTFLAG.reg & USB_HOST_INTFLAG_RST)
 
#define uhd_enable_sof()   USB->HOST.CTRLB.bit.SOFE = 1
 
#define uhd_disable_sof()   USB->HOST.CTRLB.bit.SOFE = 0
 
#define Is_uhd_sof_enabled()   (USB->HOST.CTRLB & USB_HOST_CTRLB_SOFE)
 
#define Is_uhd_sof()   (USB->HOST.INTFLAG.reg & USB_HOST_INTFLAG_HSOF)
 
#define uhd_configure_address(pipe_num, addr)   usb_pipe_table[pipe_num].HostDescBank[0].CTRL_PIPE.bit.PDADDR = addr
 
#define uhd_get_configured_address(pipe_num)   usb_pipe_table[pipe_num].HostDescBank[0].CTRL_PIPE.bit.PDADDR
 
#define uhd_freeze_pipe(p)   USB->HOST.HostPipe[p].PSTATUSSET.reg = USB_HOST_PSTATUSSET_PFREEZE
 
#define uhd_unfreeze_pipe(p)   USB->HOST.HostPipe[p].PSTATUSCLR.reg = USB_HOST_PSTATUSCLR_PFREEZE
 
#define Is_uhd_pipe_frozen(p)   ((USB->HOST.HostPipe[p].PSTATUS.reg&USB_HOST_PSTATUS_PFREEZE)==USB_HOST_PSTATUS_PFREEZE)
 
#define uhd_configure_pipe_token(p, token)   USB->HOST.HostPipe[p].PCFG.bit.PTOKEN = token
 
#define uhd_byte_count(p)   usb_pipe_table[p].HostDescBank[0].PCKSIZE.bit.BYTE_COUNT
 
#define uhd_ack_setup_ready(p)   USB->HOST.HostPipe[p].PINTFLAG.reg = USB_HOST_PINTFLAG_TXSTP
 
#define Is_uhd_setup_ready(p)   ((USB->HOST.HostPipe[p].PINTFLAG.reg&USB_HOST_PINTFLAG_TXSTP) == USB_HOST_PINTFLAG_TXSTP)
 
#define uhd_ack_in_received(p)   USB->HOST.HostPipe[p].PINTFLAG.reg = USB_HOST_PINTFLAG_TRCPT(1)
 
#define Is_uhd_in_received(p)   ((USB->HOST.HostPipe[p].PINTFLAG.reg&USB_HOST_PINTFLAG_TRCPT(1)) == USB_HOST_PINTFLAG_TRCPT(1))
 
#define uhd_ack_out_ready(p)   USB->HOST.HostPipe[p].PINTFLAG.reg = USB_HOST_PINTFLAG_TRCPT(1)
 
#define Is_uhd_out_ready(p)   ((USB->HOST.HostPipe[p].PINTFLAG.reg&USB_HOST_PINTFLAG_TRCPT(1)) == USB_HOST_PINTFLAG_TRCPT(1))
 
#define uhd_ack_nak_received(p)   usb_pipe_table[p].HostDescBank[1].STATUS_BK.reg &= ~USB_HOST_STATUS_BK_ERRORFLOW
 
#define Is_uhd_nak_received(p)   (usb_pipe_table[p].HostDescBank[1].STATUS_BK.reg & USB_HOST_STATUS_BK_ERRORFLOW)
 
#define uhd_endpoint_interrupt()   USB->HOST.PINTSMRY.reg
 
#define uhd_run_in_standby()   USB->HOST.CTRLA.reg |= USB_CTRLA_RUNSTDBY
 
#define uhd_force_host_mode()   USB->HOST.CTRLA.reg |= USB_CTRLA_MODE
 
#define uhd_enable()   USB->HOST.CTRLA.reg |= USB_CTRLA_ENABLE
 
#define uhd_disable()   USB->HOST.CTRLA.reg &= ~USB_CTRLA_ENABLE
 
#define uhd_force_full_speed()   USB->HOST.CTRLB.reg &= ~USB_HOST_CTRLB_SPDCONF_Msk
 

Fonctions

 __attribute__ ((__aligned__(4))) volatile UsbHostDescriptor usb_pipe_table[USB_EPT_NUM]
 Initialize the SAMD21 host driver. Plus de détails...
 

Documentation des macros

◆ Is_uhd_in_received

#define Is_uhd_in_received (   p)    ((USB->HOST.HostPipe[p].PINTFLAG.reg&USB_HOST_PINTFLAG_TRCPT(1)) == USB_HOST_PINTFLAG_TRCPT(1))

◆ Is_uhd_nak_received

#define Is_uhd_nak_received (   p)    (usb_pipe_table[p].HostDescBank[1].STATUS_BK.reg & USB_HOST_STATUS_BK_ERRORFLOW)

◆ Is_uhd_out_ready

#define Is_uhd_out_ready (   p)    ((USB->HOST.HostPipe[p].PINTFLAG.reg&USB_HOST_PINTFLAG_TRCPT(1)) == USB_HOST_PINTFLAG_TRCPT(1))

◆ Is_uhd_pipe_frozen

#define Is_uhd_pipe_frozen (   p)    ((USB->HOST.HostPipe[p].PSTATUS.reg&USB_HOST_PSTATUS_PFREEZE)==USB_HOST_PSTATUS_PFREEZE)

◆ Is_uhd_reset_sent

#define Is_uhd_reset_sent ( )    (USB->HOST.INTFLAG.reg & USB_HOST_INTFLAG_RST)

◆ Is_uhd_setup_ready

#define Is_uhd_setup_ready (   p)    ((USB->HOST.HostPipe[p].PINTFLAG.reg&USB_HOST_PINTFLAG_TXSTP) == USB_HOST_PINTFLAG_TXSTP)

◆ Is_uhd_sof

#define Is_uhd_sof ( )    (USB->HOST.INTFLAG.reg & USB_HOST_INTFLAG_HSOF)

◆ Is_uhd_sof_enabled

#define Is_uhd_sof_enabled ( )    (USB->HOST.CTRLB & USB_HOST_CTRLB_SOFE)

◆ Is_uhd_starting_reset

#define Is_uhd_starting_reset ( )    (USB->HOST.CTRLB.bit.BUSRESET == 1)

◆ uhd_ack_connection

#define uhd_ack_connection ( )    USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_DCONN

◆ uhd_ack_disconnection

#define uhd_ack_disconnection ( )    USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_DDISC

◆ uhd_ack_in_received

#define uhd_ack_in_received (   p)    USB->HOST.HostPipe[p].PINTFLAG.reg = USB_HOST_PINTFLAG_TRCPT(1)

◆ uhd_ack_nak_received

#define uhd_ack_nak_received (   p)    usb_pipe_table[p].HostDescBank[1].STATUS_BK.reg &= ~USB_HOST_STATUS_BK_ERRORFLOW

◆ uhd_ack_out_ready

#define uhd_ack_out_ready (   p)    USB->HOST.HostPipe[p].PINTFLAG.reg = USB_HOST_PINTFLAG_TRCPT(1)

◆ uhd_ack_reset_sent

#define uhd_ack_reset_sent ( )    USB->HOST.INTFLAG.reg = USB_HOST_INTFLAG_RST

◆ uhd_ack_setup_ready

#define uhd_ack_setup_ready (   p)    USB->HOST.HostPipe[p].PINTFLAG.reg = USB_HOST_PINTFLAG_TXSTP

◆ UHD_BusReset

#define UHD_BusReset ( )    USB->HOST.CTRLB.bit.BUSRESET = 1

◆ uhd_byte_count

#define uhd_byte_count (   p)    usb_pipe_table[p].HostDescBank[0].PCKSIZE.bit.BYTE_COUNT

◆ uhd_configure_address

#define uhd_configure_address (   pipe_num,
  addr 
)    usb_pipe_table[pipe_num].HostDescBank[0].CTRL_PIPE.bit.PDADDR = addr

◆ uhd_configure_pipe_token

#define uhd_configure_pipe_token (   p,
  token 
)    USB->HOST.HostPipe[p].PCFG.bit.PTOKEN = token

◆ uhd_disable

#define uhd_disable ( )    USB->HOST.CTRLA.reg &= ~USB_CTRLA_ENABLE

◆ uhd_disable_connection_int

#define uhd_disable_connection_int ( )    USB->HOST.INTENCLR.reg = USB_HOST_INTENCLR_DCONN

◆ uhd_disable_disconnection_int

#define uhd_disable_disconnection_int ( )    USB->HOST.INTENCLR.reg = USB_HOST_INTENCLR_DDISC

◆ uhd_disable_sof

#define uhd_disable_sof ( )    USB->HOST.CTRLB.bit.SOFE = 0

◆ uhd_enable

#define uhd_enable ( )    USB->HOST.CTRLA.reg |= USB_CTRLA_ENABLE

◆ uhd_enable_connection_int

#define uhd_enable_connection_int ( )    USB->HOST.INTENSET.reg = USB_HOST_INTENSET_DCONN

◆ uhd_enable_disconnection_int

#define uhd_enable_disconnection_int ( )    USB->HOST.INTENSET.reg = USB_HOST_INTENSET_DDISC

◆ uhd_enable_sof

#define uhd_enable_sof ( )    USB->HOST.CTRLB.bit.SOFE = 1

◆ uhd_endpoint_interrupt

#define uhd_endpoint_interrupt ( )    USB->HOST.PINTSMRY.reg

◆ uhd_force_full_speed

#define uhd_force_full_speed ( )    USB->HOST.CTRLB.reg &= ~USB_HOST_CTRLB_SPDCONF_Msk

◆ uhd_force_host_mode

#define uhd_force_host_mode ( )    USB->HOST.CTRLA.reg |= USB_CTRLA_MODE

◆ uhd_freeze_pipe

#define uhd_freeze_pipe (   p)    USB->HOST.HostPipe[p].PSTATUSSET.reg = USB_HOST_PSTATUSSET_PFREEZE

◆ uhd_get_configured_address

#define uhd_get_configured_address (   pipe_num)    usb_pipe_table[pipe_num].HostDescBank[0].CTRL_PIPE.bit.PDADDR

◆ uhd_run_in_standby

#define uhd_run_in_standby ( )    USB->HOST.CTRLA.reg |= USB_CTRLA_RUNSTDBY

◆ uhd_start_USB_reg_reset

#define uhd_start_USB_reg_reset ( )    USB->HOST.CTRLA.bit.SWRST = 1;

◆ uhd_stop_reset

#define uhd_stop_reset ( )

◆ uhd_unfreeze_pipe

#define uhd_unfreeze_pipe (   p)    USB->HOST.HostPipe[p].PSTATUSCLR.reg = USB_HOST_PSTATUSCLR_PFREEZE

◆ USB_EP_DIR_IN

#define USB_EP_DIR_IN   0x80

◆ USB_EP_DIR_OUT

#define USB_EP_DIR_OUT   0x00

◆ USB_ERROR_DATATOGGLE

#define USB_ERROR_DATATOGGLE   USB_HOST_STATUS_PIPE_DTGLER

◆ USB_ERRORFLOW

#define USB_ERRORFLOW   USB_HOST_STATUS_BK_ERRORFLOW

◆ USB_ERRORTIMEOUT

#define USB_ERRORTIMEOUT   USB_HOST_STATUS_PIPE_TOUTER

◆ USB_HOST_DTGL

#define USB_HOST_DTGL (   p)    (USB->HOST.HostPipe[p].PSTATUS.reg & USB_HOST_PSTATUS_DTGL)>>USB_HOST_PSTATUS_DTGL_Pos

◆ USB_HOST_NB_BK_1

#define USB_HOST_NB_BK_1   1

◆ USB_HOST_PCFG_PTOKEN_IN

#define USB_HOST_PCFG_PTOKEN_IN   USB_HOST_PCFG_PTOKEN(0x1)

◆ USB_HOST_PCFG_PTOKEN_OUT

#define USB_HOST_PCFG_PTOKEN_OUT   USB_HOST_PCFG_PTOKEN(0x2)

◆ USB_HOST_PCFG_PTOKEN_SETUP

#define USB_HOST_PCFG_PTOKEN_SETUP   USB_HOST_PCFG_PTOKEN(0x0)

◆ USB_HOST_PTYPE_BULK

#define USB_HOST_PTYPE_BULK   USB_HOST_PCFG_PTYPE(0x3)

◆ USB_HOST_PTYPE_CTRL

#define USB_HOST_PTYPE_CTRL   USB_HOST_PCFG_PTYPE(0x1)

◆ USB_HOST_PTYPE_DIS

#define USB_HOST_PTYPE_DIS   USB_HOST_PCFG_PTYPE(0x0)

◆ USB_HOST_PTYPE_EXT

#define USB_HOST_PTYPE_EXT   USB_HOST_PCFG_PTYPE(0x5)

◆ USB_HOST_PTYPE_INT

#define USB_HOST_PTYPE_INT   USB_HOST_PCFG_PTYPE(0x4)

◆ USB_HOST_PTYPE_ISO

#define USB_HOST_PTYPE_ISO   USB_HOST_PCFG_PTYPE(0x2)

◆ USB_PCKSIZE_SIZE_1023_BYTES_FS

#define USB_PCKSIZE_SIZE_1023_BYTES_FS   7

◆ USB_PCKSIZE_SIZE_1024_BYTES_HS

#define USB_PCKSIZE_SIZE_1024_BYTES_HS   7

◆ USB_PCKSIZE_SIZE_128_BYTES

#define USB_PCKSIZE_SIZE_128_BYTES   4

◆ USB_PCKSIZE_SIZE_16_BYTES

#define USB_PCKSIZE_SIZE_16_BYTES   1

◆ USB_PCKSIZE_SIZE_256_BYTES

#define USB_PCKSIZE_SIZE_256_BYTES   5

◆ USB_PCKSIZE_SIZE_32_BYTES

#define USB_PCKSIZE_SIZE_32_BYTES   2

◆ USB_PCKSIZE_SIZE_512_BYTES

#define USB_PCKSIZE_SIZE_512_BYTES   6

◆ USB_PCKSIZE_SIZE_64_BYTES

#define USB_PCKSIZE_SIZE_64_BYTES   3

◆ USB_PCKSIZE_SIZE_8_BYTES

#define USB_PCKSIZE_SIZE_8_BYTES   0

Documentation des fonctions

◆ __attribute__()

__attribute__ ( (__aligned__(4))  ) volatile

Initialize the SAMD21 host driver.