![]() |
Contiki-NG
|
Driver for the cc2538 USB controller. More...
Files | |
| file | arch/cpu/cc2538/dev/usb-regs.h |
| Header file with declarations for the cc2538 USB registers. | |
| file | arch/cpu/cc2538/usb/cdc-acm-descriptors.c |
| CDC-ACM mode USB descriptor for the cc2538 USB controller. | |
| file | arch/cpu/cc2538/usb/usb-arch.c |
| Arch-specific routines for the cc2538 USB controller. | |
| file | arch/cpu/cc2538/usb/usb-serial.c |
| Platform process which implements a UART-like functionality over the cc2538's USB hardware. | |
| file | arch/cpu/cc2538/usb/usb-serial.h |
| Header file for cc2538's UART-like I/O over USB. | |
Functions | |
| static uint8_t | ep0_tx (void) |
| static uint8_t | ep_tx (uint8_t ep_hw) |
| static void | in_ep_interrupt_handler (uint8_t ep_hw) |
| static void | out_ep_interrupt_handler (uint8_t ep_hw) |
| static void | ep0_interrupt_handler (void) |
| static void | read_hw_buffer (uint8_t *to, uint8_t hw_ep, unsigned int len) |
| static void | write_hw_buffer (uint8_t hw_ep, uint8_t *from, unsigned int len) |
| static bool | permit_pm1 (void) |
| void | usb_arch_setup (void) |
| void | usb_submit_recv_buffer (uint8_t addr, usb_buffer *buffer) |
| void | usb_submit_xmit_buffer (uint8_t addr, usb_buffer *buffer) |
| static void | ep0_setup (void) |
| static void | in_ep_setup (uint8_t addr) |
| static void | out_ep_setup (uint8_t addr) |
| static void | ep_setup (uint8_t addr) |
| static void | ep0_dis (void) |
| static void | in_ep_dis (uint8_t addr) |
| static void | out_ep_dis (uint8_t addr) |
| void | usb_arch_disable_endpoint (uint8_t addr) |
| static void | set_stall (uint8_t addr, uint8_t stall) |
| void | usb_arch_set_address (uint8_t addr) |
| int | usb_arch_send_pending (uint8_t addr) |
| static uint8_t | ep0_get_setup_pkt (void) |
| static uint8_t | ep0_get_data_pkt (void) |
| static uint8_t | ep_get_data_pkt (uint8_t ep_hw) |
| void | usb_isr (void) |
| void | usb_serial_flush (void) |
| Immediately transmit the content of Serial-over-USB TX buffers. | |
| void | usb_serial_writeb (uint8_t b) |
| Write a byte over USB. | |
| void | usb_serial_set_input (int(*input)(unsigned char c)) |
| Set an input hook for bytes received over USB. | |
| void | usb_serial_init (void) |
| Initialise the Serial-over-USB process. | |
USB_ADDR Register Bit-Masks | |
| #define | USB_ADDR_UPDATE 0x00000080 |
| 1 while address updating | |
| #define | USB_ADDR_USBADDR 0x0000007F |
| Device address. | |
USB_FRML Register Bit-Masks | |
| #define | USB_FRML_FRAME 0x000000FF |
| Low byte of 11-bit frame number. | |
USB_FRMH Register Bit-Masks | |
| #define | USB_FRMH_FRAME 0x00000007 |
| 3 MSBs of 11-bit frame number | |
USB_INDEX Register Bit-Masks | |
| #define | USB_INDEX_USBINDEX 0x0000000F |
| Endpoint selected. | |
USB_CTRL Register Bit-Masks | |
| #define | USB_CTRL_PLL_LOCKED 0x00000080 |
| PLL locked status. | |
| #define | USB_CTRL_PLL_EN 0x00000002 |
| 48-MHz USB PLL enable | |
| #define | USB_CTRL_USB_EN 0x00000001 |
| USB enable. | |
USB_MAXI Register Bit-Masks | |
| #define | USB_MAXI_USBMAXI 0x000000FF |
| Maximum packet size. | |
USB_CS0_CSIL Register Bit-Masks | |
| #define | USB_CS0_CLR_SETUP_END 0x00000080 |
| Listed as reserved in the UG, is this right? | |
| #define | USB_CS0_CSIL_CLR_OUTPKT_RDY_or_CLR_DATA_TOG 0x00000040 |
| Deassert OUTPKT_RDY bit of this register or reset the data toggle to 0. | |
| #define | USB_CS0_CSIL_SEND_STALL_or_SENT_STALL 0x00000020 |
| Set this bit to 1 to terminate the current transaction or is set when a STALL handshake has been sent. | |
| #define | USB_CS0_CSIL_SETUP_END_or_SEND_STALL 0x00000010 |
| Is set if the control transfer ends due to a premature end-of-control transfer or set to 1 to make the USB controller reply with a STALL handshake when receiving IN tokens. | |
| #define | USB_CS0_CSIL_DATA_END_or_FLUSH_PACKET 0x00000008 |
| Signal the end of a data transfer or set to 1 to flush next packet that is ready to transfer from the IN FIFO. | |
| #define | USB_CS0_CSIL_SENT_STALL_or_UNDERRUN 0x00000004 |
| Set when a STALL handshake is sent or set if an IN token is received when INPKT_RDY = 0, and a zero-length data packet is transmitted in response to the IN token. | |
| #define | USB_CS0_CSIL_INPKT_RDY_or_PKT_PRESENT 0x00000002 |
| Data packet has been loaded into the EP0 FIFO or at least one packet in the IN FIFO. | |
| #define | USB_CS0_CSIL_OUTPKT_RDY_or_INPKT_RDY 0x00000001 |
| Data packet received or data packet has been loaded into the IN FIFO. | |
USB_MAXO Register Bit-Masks | |
| #define | USB_MAXO_USBMAXO 0x000000FF |
| Maximum packet size. | |
USB_CNTH Register Bit-Masks | |
| #define | USB_CNTH_USBCNT 0x00000007 |
| 3 MSBs of RX byte number | |
Driver for the cc2538 USB controller.
We use the USB core in cpu/cc253x/usb which is known to work on Linux as well as on OS X.
| #define USB_CS0_CSIL_SENT_STALL_or_UNDERRUN 0x00000004 |
Set when a STALL handshake is sent or set if an IN token is received when INPKT_RDY = 0, and a zero-length data packet is transmitted in response to the IN token.
In bulk/interrupt mode, this bit is set when a NAK is returned in response to an IN token
Definition at line 260 of file usb-regs.h.
|
static |
< IN EPs and EP0 interrupt mask
< EP0 interrupt enable
< EP0 Control and Status (Alias for USB_CS0_CSIL)
Definition at line 600 of file usb-arch.c.
References USB_CS0, USB_IIE, and USB_IIE_EP0IE.
Referenced by usb_arch_disable_endpoint().
|
static |
< Number of RX bytes in EP0 FIFO (Alias for USB_CNT0_CNTL)
< Endpoint-0 FIFO
< EP0 Control and Status (Alias for USB_CS0_CSIL)
< EP0 Control and Status (Alias for USB_CS0_CSIL)
Definition at line 924 of file usb-arch.c.
References USB_CNT0, USB_CS0, and USB_F0.
Referenced by ep0_interrupt_handler().
|
static |
< EP0 Control and Status (Alias for USB_CS0_CSIL)
Definition at line 890 of file usb-arch.c.
References read_hw_buffer(), and USB_CS0.
Referenced by ep0_interrupt_handler().
|
static |
< Current endpoint index register
< EP0 Control and Status (Alias for USB_CS0_CSIL)
< EP0 Control and Status (Alias for USB_CS0_CSIL)
< EP0 Control and Status (Alias for USB_CS0_CSIL)
Definition at line 1048 of file usb-arch.c.
References ep0_get_data_pkt(), ep0_get_setup_pkt(), ep0_tx(), USB_CS0, USB_CS0_CLR_SETUP_END, and USB_INDEX.
Referenced by usb_isr(), and usb_submit_recv_buffer().
|
static |
< IN EPs and EP0 interrupt mask
< EP0 interrupt enable
Definition at line 483 of file usb-arch.c.
References USB_IIE, and USB_IIE_EP0IE.
Referenced by ep_setup().
|
static |
< EP0 Control and Status (Alias for USB_CS0_CSIL)
< EP0 Control and Status (Alias for USB_CS0_CSIL)
< EP0 Control and Status (Alias for USB_CS0_CSIL)
Definition at line 974 of file usb-arch.c.
References USB_CS0, and write_hw_buffer().
Referenced by ep0_interrupt_handler(), and usb_submit_xmit_buffer().
|
static |
< OUT EPs control and status (low)
< Reply with STALL to OUT tokens
< OUT EPs control and status (low)
< Reply with STALL to OUT tokens
< Number of bytes in EP{1-5} OUT FIFO (low) (Alias for USB_CNT0_CNTL)
< Number of bytes in EP{1-5} OUT FIFO (high)
< OUT EPs control and status (low)
< OUT packet read in OUT FIFO
Definition at line 1151 of file usb-arch.c.
References USB_CNTH, USB_CNTL, USB_CSOL, USB_CSOL_OUTPKT_RDY, and USB_CSOL_SEND_STALL.
Referenced by out_ep_interrupt_handler().
|
static |
< Current endpoint index register
Definition at line 527 of file usb-arch.c.
References addr, ep0_setup(), in_ep_setup(), out_ep_setup(), and USB_INDEX.
|
static |
< IN EPs control and status (low) (Alias for USB_CS0_CSIL)
< IN EPs control and status (low) (Alias for USB_CS0_CSIL)
Definition at line 1089 of file usb-arch.c.
References USB_CSIL, and write_hw_buffer().
Referenced by in_ep_interrupt_handler(), and usb_submit_xmit_buffer().
|
static |
< MAX packet size for IN EPs{1-5}
< IN EPs and EP0 interrupt mask
< IN EPs control and status (low) (Alias for USB_CS0_CSIL)
Definition at line 608 of file usb-arch.c.
References addr, USB_CSIL, USB_IIE, and USB_MAXI.
Referenced by usb_arch_disable_endpoint().
|
static |
< Current endpoint index register
< IN EPs control and status (low) (Alias for USB_CS0_CSIL)
< IN EPs control and status (low) (Alias for USB_CS0_CSIL)
< IN EPs control and status (low) (Alias for USB_CS0_CSIL)
Definition at line 1217 of file usb-arch.c.
References ep_tx(), USB_CSIL, and USB_INDEX.
Referenced by usb_isr().
|
static |
< IN EPs and EP0 interrupt mask
< MAX packet size for IN EPs{1-5}
< IN EPs control and status (high)
< Selects OUT endpoint type
< IN EPs control and status (high)
< Selects OUT endpoint type
Definition at line 489 of file usb-arch.c.
References addr, USB_CSIH, USB_CSOH_ISO, USB_IIE, and USB_MAXI.
Referenced by ep_setup().
|
static |
< MAX packet size for OUT EPs
< Out EPs interrupt-enable mask
< OUT EPs control and status (low)
Definition at line 618 of file usb-arch.c.
References addr, USB_CSOL, USB_MAXO, and USB_OIE.
Referenced by usb_arch_disable_endpoint().
|
static |
< Current endpoint index register
< OUT EPs control and status (low)
< STALL handshake sent
< OUT EPs control and status (low)
< STALL handshake sent
< OUT packet can not be loaded into OUT FIFO
< OUT EPs control and status (low)
< OUT packet can not be loaded into OUT FIFO
< OUT packet read in OUT FIFO
Definition at line 1188 of file usb-arch.c.
References ep_get_data_pkt(), USB_CSOL, USB_CSOL_OUTPKT_RDY, USB_CSOL_OVERRUN, USB_CSOL_SENT_STALL, and USB_INDEX.
Referenced by usb_isr(), and usb_submit_recv_buffer().
|
static |
< Out EPs interrupt-enable mask
< MAX packet size for OUT EPs
< OUT EPs control and status (high)
< Selects OUT endpoint type
< OUT EPs control and status (high)
< Selects OUT endpoint type
Definition at line 508 of file usb-arch.c.
References addr, USB_CSOH, USB_CSOH_ISO, USB_MAXO, and USB_OIE.
Referenced by ep_setup().
|
static |
|
static |
< Endpoint-0 FIFO
Definition at line 253 of file usb-arch.c.
References udma_channel_enable(), udma_channel_get_mode(), udma_channel_sw_request(), udma_set_channel_control_word(), udma_set_channel_dst(), udma_set_channel_src(), udma_xfer_size, USB_ARCH_CONF_DMA, USB_ARCH_CONF_RX_DMA_CHAN, and USB_F0.
Referenced by ep0_get_setup_pkt().
|
static |
< Current endpoint index register
< EP0 Control and Status (Alias for USB_CS0_CSIL)
< IN EPs control and status (low) (Alias for USB_CS0_CSIL)
< IN EPs control and status (low) (Alias for USB_CS0_CSIL)
< OUT EPs control and status (low)
< Reply with STALL to OUT tokens
< OUT EPs control and status (low)
< Reply with STALL to OUT tokens
Definition at line 671 of file usb-arch.c.
References addr, USB_CS0, USB_CSIL, USB_CSOL, USB_CSOL_SEND_STALL, and USB_INDEX.
| void usb_arch_disable_endpoint | ( | uint8_t | addr | ) |
< Current endpoint index register
Definition at line 628 of file usb-arch.c.
References addr, ep0_dis(), in_ep_dis(), out_ep_dis(), and USB_INDEX.
| int usb_arch_send_pending | ( | uint8_t | addr | ) |
| void usb_arch_set_address | ( | uint8_t | addr | ) |
| void usb_arch_setup | ( | void | ) |
< USB control register
< USB enable
< 48-MHz USB PLL enable
< USB control register
< PLL locked status
< IN EPs and EP0 interrupt mask
< Out EPs interrupt-enable mask
Definition at line 344 of file usb-arch.c.
References GPIO_SET_OUTPUT, GPIO_SET_PIN, udma_channel_mask_set(), USB_ARCH_CONF_DMA, USB_ARCH_CONF_RX_DMA_CHAN, USB_ARCH_CONF_TX_DMA_CHAN, USB_CTRL, USB_CTRL_PLL_EN, USB_CTRL_PLL_LOCKED, USB_CTRL_USB_EN, USB_IIE, USB_IRQn, and USB_OIE.
| void usb_isr | ( | void | ) |
< IN EPs and EP0 interrupt flags
< IN EPs and EP0 interrupt mask
< OUT endpoint interrupt flags
< Out EPs interrupt-enable mask
< Common USB interrupt flags
< Common USB interrupt mask
< EP0 Interrupt flag
< Reset interrupt flag
< Resume interrupt flag
< Suspend interrupt flag
Definition at line 1247 of file usb-arch.c.
References ep0_interrupt_handler(), in_ep_interrupt_handler(), out_ep_interrupt_handler(), USB_CIE, USB_CIF, USB_CIF_RESUMEIF, USB_CIF_RSTIF, USB_CIF_SUSPENDIF, USB_IIE, USB_IIF, USB_IIF_EP0IF, USB_OIE, and USB_OIF.
| void usb_serial_flush | ( | void | ) |
Immediately transmit the content of Serial-over-USB TX buffers.
Definition at line 234 of file usb-serial.c.
References usb_submit_xmit_buffer().
Referenced by usb_serial_writeb().
| void usb_serial_set_input | ( | int(* | input )(unsigned char c) | ) |
Set an input hook for bytes received over USB.
| input | A pointer to a function to be called when a byte is received |
Definition at line 295 of file usb-serial.c.
Referenced by platform_init_stage_two(), and platform_init_stage_two().
| void usb_serial_writeb | ( | uint8_t | b | ) |
Write a byte over USB.
| b | The byte |
USB-Serial output is buffered. The buffer is actually submitted to the USB controller for transmission when:
Definition at line 250 of file usb-serial.c.
References usb_serial_flush().
| void usb_submit_recv_buffer | ( | uint8_t | addr, |
| usb_buffer * | buffer ) |
< Current endpoint index register
< EP0 Control and Status (Alias for USB_CS0_CSIL)
< OUT EPs control and status (low)
< OUT packet read in OUT FIFO
Definition at line 384 of file usb-arch.c.
References addr, ep0_interrupt_handler(), out_ep_interrupt_handler(), USB_CS0, USB_CSOL, USB_CSOL_OUTPKT_RDY, and USB_INDEX.
| void usb_submit_xmit_buffer | ( | uint8_t | addr, |
| usb_buffer * | buffer ) |
< Current endpoint index register
< EP0 Control and Status (Alias for USB_CS0_CSIL)
< Current endpoint index register
< EP0 Control and Status (Alias for USB_CS0_CSIL)
< Current endpoint index register
Definition at line 428 of file usb-arch.c.
References addr, ep0_tx(), ep_tx(), USB_CS0, and USB_INDEX.
Referenced by usb_serial_flush().
|
static |
< Endpoint-0 FIFO
Definition at line 283 of file usb-arch.c.
References udma_channel_enable(), udma_channel_get_mode(), udma_channel_sw_request(), udma_set_channel_control_word(), udma_set_channel_dst(), udma_set_channel_src(), udma_xfer_size, USB_ARCH_CONF_DMA, USB_ARCH_CONF_TX_DMA_CHAN, and USB_F0.