USB pipe drivers
[USB low level drivers]

These macros manage the common features of the pipes. More...

Defines

#define Host_select_pipe(p)   (UPNUM = (U8)p)
 selects pipe for CPU interface
#define Host_get_selected_pipe()   (UPNUM )
 get the currently selected pipe number
#define Host_enable_pipe()   (UPCONX |= (1<<PEN))
 enables pipe
#define Host_disable_pipe()   (UPCONX &= ~(1<<PEN))
 disables pipe
#define Host_set_token_setup()   (UPCFG0X = UPCFG0X & ~MSK_TOKEN_SETUP)
 sets SETUP token
#define Host_set_token_in()   (UPCFG0X = (UPCFG0X & ~MSK_TOKEN_SETUP) | MSK_TOKEN_IN)
 sets IN token
#define Host_set_token_out()   (UPCFG0X = (UPCFG0X & ~MSK_TOKEN_SETUP) | MSK_TOKEN_OUT)
 sets OUT token
#define Host_get_endpoint_number()   (UPCFG0X & (MSK_PEPNUM))
 returns the number of the endpoint associated to the current pipe
#define Host_get_pipe_interrupt()   (UPINT)
 returns pipe interrupt register
#define Host_set_interrupt_frequency(frq)   (UPCFG2X = (U8)frq)
 sets the interrupt frequency
#define Is_pipe_configured()   (UPSTAX & (1<<CFGOK))
 tests if current pipe is configured
#define Is_host_one_bank_busy()   ((UPSTAX & MSK_NBUSYBK) != 0)
 tests if at least one bank is busy
#define Host_number_of_busy_bank()   (UPSTAX & MSK_NBUSYBK)
 returns the number of busy banks
#define Host_reset_pipe(p)   (UPRST = 1<<p , UPRST = 0)
 resets the pipe
#define Host_write_byte(dat)   (UPDATX = dat)
 writes a byte into the pipe FIFO
#define Host_read_byte()   (UPDATX)
 reads a byte from the pipe FIFO
#define Host_freeze_pipe()   (UPCONX |= (1<<PFREEZE))
 freezes the pipe
#define Host_unfreeze_pipe()   (UPCONX &= ~(1<<PFREEZE))
 un-freezees the pipe
#define Is_host_pipe_freeze()   (UPCONX & (1<<PFREEZE))
 tests if the current pipe is frozen
#define Host_reset_pipe_data_toggle()   (UPCONX |= (1<<RSTDT) )
 resets data toggle
#define Is_host_setup_sent()   ((UPINTX & (1<<TXSTPI)) ? TRUE : FALSE)
 tests if SETUP has been sent
#define Is_host_control_in_received()   ((UPINTX & (1<<RXINI)) ? TRUE : FALSE)
 tests if control IN has been received
#define Is_host_control_out_sent()   ((UPINTX & (1<<TXOUTI)) ? TRUE : FALSE)
 tests if control OUT has been sent
#define Is_host_stall()   ((UPINTX & (1<<RXSTALLI)) ? TRUE : FALSE)
 tests if a STALL has been received
#define Is_host_pipe_error()   ((UPINTX & (1<<PERRI)) ? TRUE : FALSE)
 tests if an error occurs on current pipe
#define Host_send_setup()   (UPINTX &= ~(1<<FIFOCON))
 sends a setup
#define Host_send_control_in()   (UPINTX &= ~(1<<FIFOCON))
 sends a control IN
#define Host_send_control_out()   (UPINTX &= ~(1<<FIFOCON))
 sends a control OUT
#define Host_ack_control_out()   (UPINTX &= ~(1<<TXOUTI))
 acks control OUT
#define Host_ack_control_in()   (UPINTX &= ~(1<<RXINI))
 acks control IN
#define Host_ack_setup()   (UPINTX &= ~(1<<TXSTPI))
 acks setup
#define Host_ack_stall()   (UPINTX &= ~(1<<RXSTALLI))
 acks STALL reception
#define Host_send_out()   (UPINTX &= ~(1<<FIFOCON))
 sends a OUT
#define Is_host_out_sent()   ((UPINTX & (1<<TXOUTI)) ? TRUE : FALSE)
 tests if OUT has been sent
#define Host_ack_out_sent()   (UPINTX &= ~(1<<TXOUTI))
 acks OUT sent
#define Is_host_in_received()   ((UPINTX & (1<<RXINI)) ? TRUE : FALSE)
 tests if IN received
#define Host_ack_in_received()   (UPINTX &= ~(1<<RXINI))
 acks IN reception
#define Host_send_in()   (UPINTX &= ~(1<<FIFOCON))
 sends a IN
#define Is_host_nak_received()   ((UPINTX & (1<<NAKEDI)) ? TRUE : FALSE)
 tests if nak handshake has been received
#define Host_ack_nak_received()   (UPINTX &= ~(1<<NAKEDI))
 acks NAk received sent
#define Is_host_read_enabled()   (UPINTX&(1<<RWAL))
 tests if endpoint read allowed
#define Is_host_write_enabled()   (UPINTX&(1<<RWAL))
 tests if endpoint read allowed
#define Host_standard_in_mode()   (UPCONX &= ~(1<<INMODE))
 sets IN in standard mode
#define Host_continuous_in_mode()   (UPCONX |= (1<<INMODE))
 sets IN in continuous mode
#define Host_in_request_number(in_num)   (UPINRQX = (U8)in_num)
 sets number of IN requests to perform before freeze
#define Host_get_in_request_number()   (UPINRQX)
 returns number of remaining IN requests
#define Host_data_length_U8()   (UPBCLX)
 returns number of bytes (8 bits)
#define Host_data_length_U16()   ((((U16)UPBCHX)<<8) | UPBCLX)
 returns number of bytes (16 bits)
#define Host_byte_counter()   Host_data_length_U16()
 for device compatibility
#define Host_byte_counter_8()   Host_data_length_U8()
 for device compatibility
#define Host_get_pipe_length()   ((U16)0x08 << ((UPCFG1X & MSK_PSIZE)>>4))
 returns the size of the current pipe
#define Host_get_pipe_type()   (UPCFG0X>>6)
 returns the type of the current pipe
#define Host_error_status()   (UPERRX & MSK_ERROR)
 tests if error occurs on pipe
#define Host_ack_all_errors()   (UPERRX = 0x00)
 acks all pipe error
#define Host_enable_transmit_interrupt()   (UPIENX |= (1<<TXOUTE))
 Enable pipe end transmission interrupt.
#define Host_disable_transmit_interrupt()   (UPIENX &= ~(1<<TXOUTE))
 Disable pipe end transmission interrupt.
#define Host_enable_receive_interrupt()   (UPIENX |= (1<<RXINE))
 Enable pipe reception interrupt.
#define Host_disable_receive_interrupt()   (UPIENX &= ~(1<<RXINE))
 Disable pipe recption interrupt.
#define Host_enable_stall_interrupt()   (UPIENX |= (1<<RXSTALLE))
 Enable pipe stall interrupt.
#define Host_disable_stall_interrupt()   (UPIENX &= ~(1<<RXSTALLE))
 Disable pipe stall interrupt.
#define Host_enable_error_interrupt()   (UPIENX |= (1<<PERRE))
 Enable pipe error interrupt.
#define Host_disable_error_interrupt()   (UPIENX &= ~(1<<PERRE))
 Disable pipe error interrupt.
#define Host_enable_nak_interrupt()   (UPIENX |= (1<<NAKEDE))
 Enable pipe NAK interrupt.
#define Host_disable_nak_interrupt()   (UPIENX &= ~(1<<NAKEDE))
 Disable pipe NAK interrupt.
#define Get_pipe_token(x)   ((x & (0x80)) ? TOKEN_IN : TOKEN_OUT)

Detailed Description

These macros manage the common features of the pipes.


Define Documentation

#define Host_select_pipe (  )     (UPNUM = (U8)p)

selects pipe for CPU interface

Definition at line 771 of file usb_drv.h.

Referenced by host_disable_all_pipe(), and usb_general_interrupt().

 
#define Host_get_selected_pipe (  )     (UPNUM )

get the currently selected pipe number

Definition at line 774 of file usb_drv.h.

Referenced by usb_general_interrupt().

 
#define Host_enable_pipe (  )     (UPCONX |= (1<<PEN))

enables pipe

Definition at line 777 of file usb_drv.h.

Referenced by host_config_pipe().

 
#define Host_disable_pipe (  )     (UPCONX &= ~(1<<PEN))

disables pipe

Definition at line 779 of file usb_drv.h.

Referenced by host_disable_all_pipe().

 
#define Host_set_token_setup (  )     (UPCFG0X = UPCFG0X & ~MSK_TOKEN_SETUP)

sets SETUP token

Definition at line 782 of file usb_drv.h.

 
#define Host_set_token_in (  )     (UPCFG0X = (UPCFG0X & ~MSK_TOKEN_SETUP) | MSK_TOKEN_IN)

sets IN token

Definition at line 784 of file usb_drv.h.

 
#define Host_set_token_out (  )     (UPCFG0X = (UPCFG0X & ~MSK_TOKEN_SETUP) | MSK_TOKEN_OUT)

sets OUT token

Definition at line 786 of file usb_drv.h.

 
#define Host_get_endpoint_number (  )     (UPCFG0X & (MSK_PEPNUM))

returns the number of the endpoint associated to the current pipe

Definition at line 789 of file usb_drv.h.

 
#define Host_get_pipe_interrupt (  )     (UPINT)

returns pipe interrupt register

Definition at line 792 of file usb_drv.h.

Referenced by usb_get_nb_pipe_interrupt().

#define Host_set_interrupt_frequency ( frq   )     (UPCFG2X = (U8)frq)

sets the interrupt frequency

Definition at line 795 of file usb_drv.h.

 
#define Is_pipe_configured (  )     (UPSTAX & (1<<CFGOK))

tests if current pipe is configured

Definition at line 798 of file usb_drv.h.

Referenced by host_config_pipe().

 
#define Is_host_one_bank_busy (  )     ((UPSTAX & MSK_NBUSYBK) != 0)

tests if at least one bank is busy

Definition at line 800 of file usb_drv.h.

 
#define Host_number_of_busy_bank (  )     (UPSTAX & MSK_NBUSYBK)

returns the number of busy banks

Definition at line 802 of file usb_drv.h.

#define Host_reset_pipe (  )     (UPRST = 1<<p , UPRST = 0)

resets the pipe

Definition at line 805 of file usb_drv.h.

Referenced by host_disable_all_pipe().

#define Host_write_byte ( dat   )     (UPDATX = dat)

writes a byte into the pipe FIFO

Definition at line 808 of file usb_drv.h.

 
#define Host_read_byte (  )     (UPDATX)

reads a byte from the pipe FIFO

Definition at line 810 of file usb_drv.h.

 
#define Host_freeze_pipe (  )     (UPCONX |= (1<<PFREEZE))

freezes the pipe

Definition at line 813 of file usb_drv.h.

 
#define Host_unfreeze_pipe (  )     (UPCONX &= ~(1<<PFREEZE))

un-freezees the pipe

Definition at line 815 of file usb_drv.h.

 
#define Is_host_pipe_freeze (  )     (UPCONX & (1<<PFREEZE))

tests if the current pipe is frozen

Definition at line 817 of file usb_drv.h.

 
#define Host_reset_pipe_data_toggle (  )     (UPCONX |= (1<<RSTDT) )

resets data toggle

Definition at line 820 of file usb_drv.h.

 
#define Is_host_setup_sent (  )     ((UPINTX & (1<<TXSTPI)) ? TRUE : FALSE)

tests if SETUP has been sent

Definition at line 823 of file usb_drv.h.

 
#define Is_host_control_in_received (  )     ((UPINTX & (1<<RXINI)) ? TRUE : FALSE)

tests if control IN has been received

Definition at line 825 of file usb_drv.h.

 
#define Is_host_control_out_sent (  )     ((UPINTX & (1<<TXOUTI)) ? TRUE : FALSE)

tests if control OUT has been sent

Definition at line 827 of file usb_drv.h.

 
#define Is_host_stall (  )     ((UPINTX & (1<<RXSTALLI)) ? TRUE : FALSE)

tests if a STALL has been received

Definition at line 829 of file usb_drv.h.

 
#define Is_host_pipe_error (  )     ((UPINTX & (1<<PERRI)) ? TRUE : FALSE)

tests if an error occurs on current pipe

Definition at line 831 of file usb_drv.h.

 
#define Host_send_setup (  )     (UPINTX &= ~(1<<FIFOCON))

sends a setup

Definition at line 833 of file usb_drv.h.

 
#define Host_send_control_in (  )     (UPINTX &= ~(1<<FIFOCON))

sends a control IN

Definition at line 835 of file usb_drv.h.

 
#define Host_send_control_out (  )     (UPINTX &= ~(1<<FIFOCON))

sends a control OUT

Definition at line 837 of file usb_drv.h.

 
#define Host_ack_control_out (  )     (UPINTX &= ~(1<<TXOUTI))

acks control OUT

Definition at line 839 of file usb_drv.h.

 
#define Host_ack_control_in (  )     (UPINTX &= ~(1<<RXINI))

acks control IN

Definition at line 841 of file usb_drv.h.

 
#define Host_ack_setup (  )     (UPINTX &= ~(1<<TXSTPI))

acks setup

Definition at line 843 of file usb_drv.h.

 
#define Host_ack_stall (  )     (UPINTX &= ~(1<<RXSTALLI))

acks STALL reception

Definition at line 845 of file usb_drv.h.

 
#define Host_send_out (  )     (UPINTX &= ~(1<<FIFOCON))

sends a OUT

Definition at line 848 of file usb_drv.h.

 
#define Is_host_out_sent (  )     ((UPINTX & (1<<TXOUTI)) ? TRUE : FALSE)

tests if OUT has been sent

Definition at line 850 of file usb_drv.h.

 
#define Host_ack_out_sent (  )     (UPINTX &= ~(1<<TXOUTI))

acks OUT sent

Definition at line 852 of file usb_drv.h.

 
#define Is_host_in_received (  )     ((UPINTX & (1<<RXINI)) ? TRUE : FALSE)

tests if IN received

Definition at line 854 of file usb_drv.h.

 
#define Host_ack_in_received (  )     (UPINTX &= ~(1<<RXINI))

acks IN reception

Definition at line 856 of file usb_drv.h.

 
#define Host_send_in (  )     (UPINTX &= ~(1<<FIFOCON))

sends a IN

Definition at line 858 of file usb_drv.h.

 
#define Is_host_nak_received (  )     ((UPINTX & (1<<NAKEDI)) ? TRUE : FALSE)

tests if nak handshake has been received

Definition at line 860 of file usb_drv.h.

 
#define Host_ack_nak_received (  )     (UPINTX &= ~(1<<NAKEDI))

acks NAk received sent

Definition at line 862 of file usb_drv.h.

 
#define Is_host_read_enabled (  )     (UPINTX&(1<<RWAL))

tests if endpoint read allowed

Definition at line 867 of file usb_drv.h.

 
#define Is_host_write_enabled (  )     (UPINTX&(1<<RWAL))

tests if endpoint read allowed

Definition at line 869 of file usb_drv.h.

 
#define Host_standard_in_mode (  )     (UPCONX &= ~(1<<INMODE))

sets IN in standard mode

Definition at line 872 of file usb_drv.h.

 
#define Host_continuous_in_mode (  )     (UPCONX |= (1<<INMODE))

sets IN in continuous mode

Definition at line 874 of file usb_drv.h.

#define Host_in_request_number ( in_num   )     (UPINRQX = (U8)in_num)

sets number of IN requests to perform before freeze

Definition at line 877 of file usb_drv.h.

 
#define Host_get_in_request_number (  )     (UPINRQX)

returns number of remaining IN requests

Definition at line 879 of file usb_drv.h.

 
#define Host_data_length_U8 (  )     (UPBCLX)

returns number of bytes (8 bits)

Definition at line 882 of file usb_drv.h.

 
#define Host_data_length_U16 (  )     ((((U16)UPBCHX)<<8) | UPBCLX)

returns number of bytes (16 bits)

Definition at line 884 of file usb_drv.h.

 
#define Host_byte_counter (  )     Host_data_length_U16()

for device compatibility

Definition at line 886 of file usb_drv.h.

 
#define Host_byte_counter_8 (  )     Host_data_length_U8()

for device compatibility

Definition at line 888 of file usb_drv.h.

 
#define Host_get_pipe_length (  )     ((U16)0x08 << ((UPCFG1X & MSK_PSIZE)>>4))

returns the size of the current pipe

Definition at line 891 of file usb_drv.h.

 
#define Host_get_pipe_type (  )     (UPCFG0X>>6)

returns the type of the current pipe

Definition at line 894 of file usb_drv.h.

Referenced by usb_general_interrupt().

 
#define Host_error_status (  )     (UPERRX & MSK_ERROR)

tests if error occurs on pipe

Definition at line 897 of file usb_drv.h.

 
#define Host_ack_all_errors (  )     (UPERRX = 0x00)

acks all pipe error

Definition at line 899 of file usb_drv.h.

 
#define Host_enable_transmit_interrupt (  )     (UPIENX |= (1<<TXOUTE))

Enable pipe end transmission interrupt.

Definition at line 902 of file usb_drv.h.

 
#define Host_disable_transmit_interrupt (  )     (UPIENX &= ~(1<<TXOUTE))

Disable pipe end transmission interrupt.

Definition at line 904 of file usb_drv.h.

 
#define Host_enable_receive_interrupt (  )     (UPIENX |= (1<<RXINE))

Enable pipe reception interrupt.

Definition at line 907 of file usb_drv.h.

 
#define Host_disable_receive_interrupt (  )     (UPIENX &= ~(1<<RXINE))

Disable pipe recption interrupt.

Definition at line 909 of file usb_drv.h.

 
#define Host_enable_stall_interrupt (  )     (UPIENX |= (1<<RXSTALLE))

Enable pipe stall interrupt.

Definition at line 912 of file usb_drv.h.

 
#define Host_disable_stall_interrupt (  )     (UPIENX &= ~(1<<RXSTALLE))

Disable pipe stall interrupt.

Definition at line 914 of file usb_drv.h.

 
#define Host_enable_error_interrupt (  )     (UPIENX |= (1<<PERRE))

Enable pipe error interrupt.

Definition at line 917 of file usb_drv.h.

 
#define Host_disable_error_interrupt (  )     (UPIENX &= ~(1<<PERRE))

Disable pipe error interrupt.

Definition at line 919 of file usb_drv.h.

 
#define Host_enable_nak_interrupt (  )     (UPIENX |= (1<<NAKEDE))

Enable pipe NAK interrupt.

Definition at line 922 of file usb_drv.h.

 
#define Host_disable_nak_interrupt (  )     (UPIENX &= ~(1<<NAKEDE))

Disable pipe NAK interrupt.

Definition at line 924 of file usb_drv.h.

#define Get_pipe_token (  )     ((x & (0x80)) ? TOKEN_IN : TOKEN_OUT)

Definition at line 926 of file usb_drv.h.


Generated on Mon Sep 14 13:51:29 2009 for ATMEL by  doxygen 1.5.3