USB pipe drivers
[USB low level drivers module]

Collaboration diagram for USB pipe 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_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 & (1<<MSK_PEPNUM))
 returns the number of the endpoint associated to the current pipe
#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 & (1<<MSK_NBUSYBK)) != 0)
 tests if at least one bank is busy
#define Host_number_of_busy_bank()   (UPSTAX & (1<<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<<TXOUTI))
 acks setup
#define Host_ack_stall()   (UPINTX &= ~(1<<RXSTALLI))
 acks STALL reception
#define Host_send_out()   (UPINTX = 0x7B)
 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 = 0xFB)
 acks OUT sent
#define Is_host_in_received()   ((UPINTX & (1<<FIFOCON)) ? TRUE : FALSE)
 tests if IN received
#define Host_ack_in_received()   (UPINTX = 0x7E)
 acks IN reception
#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_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 Get_pipe_token(x)   ((x & (0x80)) ? TOKEN_IN : TOKEN_OUT)
#define Host_set_device_supported()   (device_status |= 0x01)
#define Host_clear_device_supported()   (device_status &= ~0x01)
#define Is_host_device_supported()   (device_status & 0x01)
#define Host_set_device_ready()   (device_status |= 0x02)
#define Host_clear_device_ready()   (device_status &= ~0x02)
#define Is_host_device_ready()   (device_status & 0x02)
#define Host_set_configured()   (device_status |= 0x04)
#define Host_clear_configured()   (device_status &= ~0x04)
#define Is_host_configured()   (device_status & 0x04)
#define Host_clear_device_status()   (device_status = 0x00)

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 685 of file usb_drv.h.

Referenced by host_disable_all_pipe().

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

enables pipe

Definition at line 688 of file usb_drv.h.

Referenced by host_config_pipe().

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

disables pipe

Definition at line 690 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 693 of file usb_drv.h.

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

sets IN token

Definition at line 695 of file usb_drv.h.

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

sets OUT token

Definition at line 697 of file usb_drv.h.

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

returns the number of the endpoint associated to the current pipe

Definition at line 700 of file usb_drv.h.

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

sets the interrupt frequency

Definition at line 703 of file usb_drv.h.

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

tests if current pipe is configured

Definition at line 706 of file usb_drv.h.

Referenced by host_config_pipe().

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

tests if at least one bank is busy

Definition at line 708 of file usb_drv.h.

 
#define Host_number_of_busy_bank  )     (UPSTAX & (1<<MSK_NBUSYBK))
 

returns the number of busy banks

Definition at line 710 of file usb_drv.h.

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

resets the pipe

Definition at line 713 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 716 of file usb_drv.h.

 
#define Host_read_byte  )     (UPDATX)
 

reads a byte from the pipe FIFO

Definition at line 718 of file usb_drv.h.

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

freezes the pipe

Definition at line 721 of file usb_drv.h.

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

un-freezees the pipe

Definition at line 723 of file usb_drv.h.

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

tests if the current pipe is frozen

Definition at line 725 of file usb_drv.h.

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

resets data toggle

Definition at line 728 of file usb_drv.h.

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

tests if SETUP has been sent

Definition at line 731 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 733 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 735 of file usb_drv.h.

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

tests if a STALL has been received

Definition at line 737 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 739 of file usb_drv.h.

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

sends a setup

Definition at line 741 of file usb_drv.h.

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

sends a control IN

Definition at line 743 of file usb_drv.h.

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

sends a control OUT

Definition at line 745 of file usb_drv.h.

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

acks control OUT

Definition at line 747 of file usb_drv.h.

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

acks control IN

Definition at line 749 of file usb_drv.h.

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

acks setup

Definition at line 751 of file usb_drv.h.

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

acks STALL reception

Definition at line 753 of file usb_drv.h.

 
#define Host_send_out  )     (UPINTX = 0x7B)
 

sends a OUT

Definition at line 756 of file usb_drv.h.

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

tests if OUT has been sent

Definition at line 758 of file usb_drv.h.

 
#define Host_ack_out_sent  )     (UPINTX = 0xFB)
 

acks OUT sent

Definition at line 760 of file usb_drv.h.

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

tests if IN received

Definition at line 762 of file usb_drv.h.

 
#define Host_ack_in_received  )     (UPINTX = 0x7E)
 

acks IN reception

Definition at line 764 of file usb_drv.h.

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

tests if endpoint read allowed

Definition at line 767 of file usb_drv.h.

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

tests if endpoint read allowed

Definition at line 769 of file usb_drv.h.

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

sets IN in standard mode

Definition at line 772 of file usb_drv.h.

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

sets IN in continuous mode

Definition at line 774 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 777 of file usb_drv.h.

 
#define Host_get_in_request_number  )     (UPINRQX)
 

returns number of remaining IN requests

Definition at line 779 of file usb_drv.h.

 
#define Host_data_length_U8  )     (UPBCLX)
 

returns number of bytes (8 bits)

Definition at line 782 of file usb_drv.h.

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

returns number of bytes (16 bits)

Definition at line 784 of file usb_drv.h.

 
#define Host_byte_counter  )     Host_data_length_U16()
 

for device compatibility

Definition at line 786 of file usb_drv.h.

 
#define Host_byte_counter_8  )     Host_data_length_U8()
 

for device compatibility

Definition at line 788 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 791 of file usb_drv.h.

 
#define Host_error_status  )     (UPERRX & MSK_ERROR)
 

tests if error occurs on pipe

Definition at line 794 of file usb_drv.h.

 
#define Host_ack_all_errors  )     (UPERRX = 0x00)
 

acks all pipe error

Definition at line 796 of file usb_drv.h.

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

Enable pipe end transmission interrupt.

Definition at line 799 of file usb_drv.h.

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

Disable pipe end transmission interrupt.

Definition at line 801 of file usb_drv.h.

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

Enable pipe reception interrupt.

Definition at line 804 of file usb_drv.h.

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

Disable pipe recption interrupt.

Definition at line 806 of file usb_drv.h.

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

Definition at line 808 of file usb_drv.h.

 
#define Host_set_device_supported  )     (device_status |= 0x01)
 

Definition at line 810 of file usb_drv.h.

 
#define Host_clear_device_supported  )     (device_status &= ~0x01)
 

Definition at line 811 of file usb_drv.h.

 
#define Is_host_device_supported  )     (device_status & 0x01)
 

Definition at line 812 of file usb_drv.h.

 
#define Host_set_device_ready  )     (device_status |= 0x02)
 

Definition at line 814 of file usb_drv.h.

 
#define Host_clear_device_ready  )     (device_status &= ~0x02)
 

Definition at line 815 of file usb_drv.h.

 
#define Is_host_device_ready  )     (device_status & 0x02)
 

Definition at line 816 of file usb_drv.h.

 
#define Host_set_configured  )     (device_status |= 0x04)
 

Definition at line 818 of file usb_drv.h.

 
#define Host_clear_configured  )     (device_status &= ~0x04)
 

Definition at line 819 of file usb_drv.h.

 
#define Is_host_configured  )     (device_status & 0x04)
 

Definition at line 820 of file usb_drv.h.

 
#define Host_clear_device_status  )     (device_status = 0x00)
 

Definition at line 822 of file usb_drv.h.


Generated on Fri Mar 17 16:02:12 2006 for Atmel by  doxygen 1.4.6-NO