FreeBSD kernel usb device Code
usb_pf.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  usbpf_pkthdr
 
struct  usbpf_framehdr
 

Macros

#define USBPF_MODE_HOST   0
 
#define USBPF_MODE_DEVICE   1
 
#define USBPF_FLAG_FORCE_SHORT_XFER   (1 << 0)
 
#define USBPF_FLAG_SHORT_XFER_OK   (1 << 1)
 
#define USBPF_FLAG_SHORT_FRAMES_OK   (1 << 2)
 
#define USBPF_FLAG_PIPE_BOF   (1 << 3)
 
#define USBPF_FLAG_PROXY_BUFFER   (1 << 4)
 
#define USBPF_FLAG_EXT_BUFFER   (1 << 5)
 
#define USBPF_FLAG_MANUAL_STATUS   (1 << 6)
 
#define USBPF_FLAG_NO_PIPE_OK   (1 << 7)
 
#define USBPF_FLAG_STALL_PIPE   (1 << 8)
 
#define USBPF_STATUS_OPEN   (1 << 0)
 
#define USBPF_STATUS_TRANSFERRING   (1 << 1)
 
#define USBPF_STATUS_DID_DMA_DELAY   (1 << 2)
 
#define USBPF_STATUS_DID_CLOSE   (1 << 3)
 
#define USBPF_STATUS_DRAINING   (1 << 4)
 
#define USBPF_STATUS_STARTED   (1 << 5)
 
#define USBPF_STATUS_BW_RECLAIMED   (1 << 6)
 
#define USBPF_STATUS_CONTROL_XFR   (1 << 7)
 
#define USBPF_STATUS_CONTROL_HDR   (1 << 8)
 
#define USBPF_STATUS_CONTROL_ACT   (1 << 9)
 
#define USBPF_STATUS_CONTROL_STALL   (1 << 10)
 
#define USBPF_STATUS_SHORT_FRAMES_OK   (1 << 11)
 
#define USBPF_STATUS_SHORT_XFER_OK   (1 << 12)
 
#define USBPF_STATUS_BDMA_ENABLE   (1 << 13)
 
#define USBPF_STATUS_BDMA_NO_POST_SYNC   (1 << 14)
 
#define USBPF_STATUS_BDMA_SETUP   (1 << 15)
 
#define USBPF_STATUS_ISOCHRONOUS_XFR   (1 << 16)
 
#define USBPF_STATUS_CURR_DMA_SET   (1 << 17)
 
#define USBPF_STATUS_CAN_CANCEL_IMMED   (1 << 18)
 
#define USBPF_STATUS_DOING_CALLBACK   (1 << 19)
 
#define USBPF_FRAME_ALIGN(x)   (((x) + 3) & ~3)
 
#define USBPF_FRAMEFLAG_READ   (1 << 0)
 
#define USBPF_FRAMEFLAG_DATA_FOLLOWS   (1 << 1)
 
#define USBPF_HDR_LEN   128 /* bytes */
 
#define USBPF_FRAME_HDR_LEN   8 /* bytes */
 
#define USBPF_XFERTAP_SUBMIT   0
 
#define USBPF_XFERTAP_DONE   1
 

Functions

void usbpf_attach (struct usb_bus *)
 
void usbpf_detach (struct usb_bus *)
 
void usbpf_xfertap (struct usb_xfer *, int)
 

Variables

uint8_t usbpf_pkthdr_size_ok [(sizeof(struct usbpf_pkthdr)==USBPF_HDR_LEN) ? 1 :-1]
 
uint8_t usbpf_framehdr_size_ok [(sizeof(struct usbpf_framehdr)==USBPF_FRAME_HDR_LEN) ? 1 :-1]
 

Macro Definition Documentation

◆ USBPF_FLAG_EXT_BUFFER

#define USBPF_FLAG_EXT_BUFFER   (1 << 5)

Definition at line 57 of file usb_pf.h.

◆ USBPF_FLAG_FORCE_SHORT_XFER

#define USBPF_FLAG_FORCE_SHORT_XFER   (1 << 0)

Definition at line 52 of file usb_pf.h.

◆ USBPF_FLAG_MANUAL_STATUS

#define USBPF_FLAG_MANUAL_STATUS   (1 << 6)

Definition at line 58 of file usb_pf.h.

◆ USBPF_FLAG_NO_PIPE_OK

#define USBPF_FLAG_NO_PIPE_OK   (1 << 7)

Definition at line 59 of file usb_pf.h.

◆ USBPF_FLAG_PIPE_BOF

#define USBPF_FLAG_PIPE_BOF   (1 << 3)

Definition at line 55 of file usb_pf.h.

◆ USBPF_FLAG_PROXY_BUFFER

#define USBPF_FLAG_PROXY_BUFFER   (1 << 4)

Definition at line 56 of file usb_pf.h.

◆ USBPF_FLAG_SHORT_FRAMES_OK

#define USBPF_FLAG_SHORT_FRAMES_OK   (1 << 2)

Definition at line 54 of file usb_pf.h.

◆ USBPF_FLAG_SHORT_XFER_OK

#define USBPF_FLAG_SHORT_XFER_OK   (1 << 1)

Definition at line 53 of file usb_pf.h.

◆ USBPF_FLAG_STALL_PIPE

#define USBPF_FLAG_STALL_PIPE   (1 << 8)

Definition at line 60 of file usb_pf.h.

◆ USBPF_FRAME_ALIGN

#define USBPF_FRAME_ALIGN (   x)    (((x) + 3) & ~3)

Definition at line 99 of file usb_pf.h.

◆ USBPF_FRAME_HDR_LEN

#define USBPF_FRAME_HDR_LEN   8 /* bytes */

Definition at line 106 of file usb_pf.h.

◆ USBPF_FRAMEFLAG_DATA_FOLLOWS

#define USBPF_FRAMEFLAG_DATA_FOLLOWS   (1 << 1)

Definition at line 102 of file usb_pf.h.

◆ USBPF_FRAMEFLAG_READ

#define USBPF_FRAMEFLAG_READ   (1 << 0)

Definition at line 101 of file usb_pf.h.

◆ USBPF_HDR_LEN

#define USBPF_HDR_LEN   128 /* bytes */

Definition at line 105 of file usb_pf.h.

◆ USBPF_MODE_DEVICE

#define USBPF_MODE_DEVICE   1

Definition at line 48 of file usb_pf.h.

◆ USBPF_MODE_HOST

#define USBPF_MODE_HOST   0

Definition at line 47 of file usb_pf.h.

◆ USBPF_STATUS_BDMA_ENABLE

#define USBPF_STATUS_BDMA_ENABLE   (1 << 13)

Definition at line 75 of file usb_pf.h.

◆ USBPF_STATUS_BDMA_NO_POST_SYNC

#define USBPF_STATUS_BDMA_NO_POST_SYNC   (1 << 14)

Definition at line 76 of file usb_pf.h.

◆ USBPF_STATUS_BDMA_SETUP

#define USBPF_STATUS_BDMA_SETUP   (1 << 15)

Definition at line 77 of file usb_pf.h.

◆ USBPF_STATUS_BW_RECLAIMED

#define USBPF_STATUS_BW_RECLAIMED   (1 << 6)

Definition at line 68 of file usb_pf.h.

◆ USBPF_STATUS_CAN_CANCEL_IMMED

#define USBPF_STATUS_CAN_CANCEL_IMMED   (1 << 18)

Definition at line 80 of file usb_pf.h.

◆ USBPF_STATUS_CONTROL_ACT

#define USBPF_STATUS_CONTROL_ACT   (1 << 9)

Definition at line 71 of file usb_pf.h.

◆ USBPF_STATUS_CONTROL_HDR

#define USBPF_STATUS_CONTROL_HDR   (1 << 8)

Definition at line 70 of file usb_pf.h.

◆ USBPF_STATUS_CONTROL_STALL

#define USBPF_STATUS_CONTROL_STALL   (1 << 10)

Definition at line 72 of file usb_pf.h.

◆ USBPF_STATUS_CONTROL_XFR

#define USBPF_STATUS_CONTROL_XFR   (1 << 7)

Definition at line 69 of file usb_pf.h.

◆ USBPF_STATUS_CURR_DMA_SET

#define USBPF_STATUS_CURR_DMA_SET   (1 << 17)

Definition at line 79 of file usb_pf.h.

◆ USBPF_STATUS_DID_CLOSE

#define USBPF_STATUS_DID_CLOSE   (1 << 3)

Definition at line 65 of file usb_pf.h.

◆ USBPF_STATUS_DID_DMA_DELAY

#define USBPF_STATUS_DID_DMA_DELAY   (1 << 2)

Definition at line 64 of file usb_pf.h.

◆ USBPF_STATUS_DOING_CALLBACK

#define USBPF_STATUS_DOING_CALLBACK   (1 << 19)

Definition at line 81 of file usb_pf.h.

◆ USBPF_STATUS_DRAINING

#define USBPF_STATUS_DRAINING   (1 << 4)

Definition at line 66 of file usb_pf.h.

◆ USBPF_STATUS_ISOCHRONOUS_XFR

#define USBPF_STATUS_ISOCHRONOUS_XFR   (1 << 16)

Definition at line 78 of file usb_pf.h.

◆ USBPF_STATUS_OPEN

#define USBPF_STATUS_OPEN   (1 << 0)

Definition at line 62 of file usb_pf.h.

◆ USBPF_STATUS_SHORT_FRAMES_OK

#define USBPF_STATUS_SHORT_FRAMES_OK   (1 << 11)

Definition at line 73 of file usb_pf.h.

◆ USBPF_STATUS_SHORT_XFER_OK

#define USBPF_STATUS_SHORT_XFER_OK   (1 << 12)

Definition at line 74 of file usb_pf.h.

◆ USBPF_STATUS_STARTED

#define USBPF_STATUS_STARTED   (1 << 5)

Definition at line 67 of file usb_pf.h.

◆ USBPF_STATUS_TRANSFERRING

#define USBPF_STATUS_TRANSFERRING   (1 << 1)

Definition at line 63 of file usb_pf.h.

◆ USBPF_XFERTAP_DONE

#define USBPF_XFERTAP_DONE   1

Definition at line 114 of file usb_pf.h.

◆ USBPF_XFERTAP_SUBMIT

#define USBPF_XFERTAP_SUBMIT   0

Definition at line 113 of file usb_pf.h.

Function Documentation

◆ usbpf_attach()

void usbpf_attach ( struct usb_bus ubus)

Definition at line 242 of file usb_pf.c.

References usb_bus::parent.

Referenced by usb_attach_sub().

Here is the caller graph for this function:

◆ usbpf_detach()

void usbpf_detach ( struct usb_bus ubus)

Definition at line 250 of file usb_pf.c.

References usb_bus::ifp, usb_bus::parent, usbpf_clone_destroy(), and usbpf_cloner.

Referenced by usb_detach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ usbpf_xfertap()

void usbpf_xfertap ( struct usb_xfer xfer,
int  type 
)

Definition at line 389 of file usb_pf.c.

References usb_xfer::aframes, usb_endpoint_descriptor::bmAttributes, usb_xfer_root::bus, bus, usb_device::device_index, usb_endpoint::edesc, usb_xfer::endpoint, usb_xfer::endpointno, usb_xfer::error, usb_xfer::flags, usbpf_framehdr::flags, usb_xfer::flags_int, usb_xfer::frbuffers, usb_xfer::frlengths, usb_xfer::interval, usb_xfer_flags_int::isochronous_xfr, usbpf_framehdr::length, usb_xfer::max_packet_count, usb_xfer::max_packet_size, usb_xfer::nframes, offset, usb_device::speed, type, usb_xfer_root::udev, UE_XFERTYPE, usbpf_pkthdr::up_address, usbpf_pkthdr::up_busunit, usbpf_pkthdr::up_endpoint, usbpf_pkthdr::up_error, usbpf_pkthdr::up_flags, usbpf_pkthdr::up_frames, usbpf_pkthdr::up_interval, usbpf_pkthdr::up_mode, usbpf_pkthdr::up_packet_count, usbpf_pkthdr::up_packet_size, usbpf_pkthdr::up_reserved, usbpf_pkthdr::up_speed, usbpf_pkthdr::up_status, usbpf_pkthdr::up_totlen, usbpf_pkthdr::up_type, usbpf_pkthdr::up_xfertype, usb_xfer_flags_int::usb_mode, USB_MODE_DEVICE, usbd_copy_out(), usbd_xfer_old_frame_length(), usbpf_aggregate_status(), usbpf_aggregate_xferflags(), USBPF_FRAME_ALIGN, USBPF_FRAME_HDR_LEN, USBPF_FRAMEFLAG_DATA_FOLLOWS, USBPF_FRAMEFLAG_READ, USBPF_HDR_LEN, USBPF_MODE_DEVICE, USBPF_MODE_HOST, usbpf_xfer_frame_is_read(), usbpf_xfer_precompute_size(), USBPF_XFERTAP_SUBMIT, and usb_xfer::xroot.

Referenced by usbd_callback_wrapper(), usbd_pipe_start(), and usbd_transfer_start_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ usbpf_framehdr_size_ok

uint8_t usbpf_framehdr_size_ok[(sizeof(struct usbpf_framehdr)==USBPF_FRAME_HDR_LEN) ? 1 :-1]
extern

◆ usbpf_pkthdr_size_ok

uint8_t usbpf_pkthdr_size_ok[(sizeof(struct usbpf_pkthdr)==USBPF_HDR_LEN) ? 1 :-1]
extern