FreeBSD kernel usb device Code
usb_process.c File Reference
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
#include <sys/sysctl.h>
#include <sys/sx.h>
#include <sys/unistd.h>
#include <sys/callout.h>
#include <sys/malloc.h>
#include <sys/priv.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
#include <dev/usb/usb_process.h>
#include <dev/usb/usb_debug.h>
#include <dev/usb/usb_util.h>
#include <sys/proc.h>
#include <sys/kthread.h>
#include <sys/sched.h>
Include dependency graph for usb_process.c:

Go to the source code of this file.

Macros

#define USB_DEBUG_VAR   usb_proc_debug
 
#define thread_lock(td)   mtx_lock_spin(&sched_lock)
 
#define thread_unlock(td)   mtx_unlock_spin(&sched_lock)
 
#define USB_THREAD_CREATE(f, s, p, ...)    kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__)
 
#define USB_THREAD_SUSPEND_CHECK()   kthread_suspend_check(curproc)
 
#define USB_THREAD_SUSPEND(p)   kthread_suspend(p,0)
 
#define USB_THREAD_EXIT(err)   kthread_exit(err)
 

Functions

static void usb_process (void *arg)
 
int usb_proc_create (struct usb_process *up, struct mtx *p_mtx, const char *pmesg, uint8_t prio)
 
void usb_proc_free (struct usb_process *up)
 
void * usb_proc_msignal (struct usb_process *up, void *_pm0, void *_pm1)
 
uint8_t usb_proc_is_gone (struct usb_process *up)
 
void usb_proc_mwait (struct usb_process *up, void *_pm0, void *_pm1)
 
void usb_proc_drain (struct usb_process *up)
 
void usb_proc_rewakeup (struct usb_process *up)
 
int usb_proc_is_called_from (struct usb_process *up)
 

Macro Definition Documentation

◆ thread_lock

#define thread_lock (   td)    mtx_lock_spin(&sched_lock)

Definition at line 66 of file usb_process.c.

◆ thread_unlock

#define thread_unlock (   td)    mtx_unlock_spin(&sched_lock)

Definition at line 67 of file usb_process.c.

◆ USB_DEBUG_VAR

#define USB_DEBUG_VAR   usb_proc_debug

Definition at line 56 of file usb_process.c.

◆ USB_THREAD_CREATE

#define USB_THREAD_CREATE (   f,
  s,
  p,
  ... 
)     kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__)

Definition at line 84 of file usb_process.c.

◆ USB_THREAD_EXIT

#define USB_THREAD_EXIT (   err)    kthread_exit(err)

Definition at line 88 of file usb_process.c.

◆ USB_THREAD_SUSPEND

#define USB_THREAD_SUSPEND (   p)    kthread_suspend(p,0)

Definition at line 87 of file usb_process.c.

◆ USB_THREAD_SUSPEND_CHECK

#define USB_THREAD_SUSPEND_CHECK ( )    kthread_suspend_check(curproc)

Definition at line 86 of file usb_process.c.

Function Documentation

◆ usb_proc_create()

int usb_proc_create ( struct usb_process up,
struct mtx *  p_mtx,
const char *  pmesg,
uint8_t  prio 
)

Definition at line 224 of file usb_process.c.

References error, usb_process::up_cv, usb_process::up_drain, usb_process::up_mtx, usb_process::up_prio, usb_process::up_ptr, usb_proc_free(), and USB_THREAD_CREATE.

Referenced by ucom_attach(), uether_ifattach(), and usb_attach_sub().

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

◆ usb_proc_drain()

◆ usb_proc_free()

void usb_proc_free ( struct usb_process up)

Definition at line 261 of file usb_process.c.

References usb_process::up_cv, usb_process::up_drain, usb_process::up_mtx, and usb_proc_drain().

Referenced by ucom_detach(), uether_ifdetach(), usb_detach(), and usb_proc_create().

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

◆ usb_proc_is_called_from()

int usb_proc_is_called_from ( struct usb_process up)

Definition at line 514 of file usb_process.c.

References usb_process::up_curtd.

◆ usb_proc_is_gone()

uint8_t usb_proc_is_gone ( struct usb_process up)

Definition at line 372 of file usb_process.c.

References usb_process::up_gone, usb_process::up_mtx, and USB_MTX_ASSERT.

Referenced by ucom_cfg_is_gone(), ucom_queue_command(), ue_queue_command(), uether_is_gone(), uether_pause(), and usbd_do_request_proc().

Here is the caller graph for this function:

◆ usb_proc_msignal()

◆ usb_proc_mwait()

◆ usb_proc_rewakeup()

void usb_proc_rewakeup ( struct usb_process up)

Definition at line 490 of file usb_process.c.

References usb_process::up_cv, usb_process::up_gone, usb_process::up_msleep, usb_process::up_mtx, and USB_MTX_ASSERT.

Referenced by usb_bus_explore(), and usb_power_wdog().

Here is the caller graph for this function:

◆ usb_process()