#include <round.h>
#include <stdio.h>
#include <string.h>
#include <kernel/bitmap.h>
#include "threads/pte.h"
#include "threads/malloc.h"
#include "threads/palloc.h"
#include "threads/synch.h"
#include "threads/interrupt.h"
#include "threads/thread.h"
#include "devices/pci.h"
#include "devices/usb.h"
#include "devices/timer.h"
Go to the source code of this file.
Data Structures | |
struct | frame_list_ptr |
struct | td_token |
struct | td_control |
struct | tx_descriptor |
struct | queue_head |
struct | uhci_info |
struct | usb_wait |
struct | uhci_dev_info |
struct | uhci_eop_info |
Defines | |
#define | UHCI_MAX_PORTS 8 |
#define | FRAME_LIST_ENTRIES 1024 |
#define | TD_ENTRIES (4096/32) |
#define | QH_ENTRIES (4096/16) |
#define | UHCI_REG_USBCMD 0x00 |
#define | UHCI_REG_USBSTS 0x02 |
#define | UHCI_REG_USBINTR 0x04 |
#define | UHCI_REG_FRNUM 0x06 |
#define | UHCI_REG_FLBASEADD 0x08 |
#define | UHCI_REG_SOFMOD 0x0c |
#define | UHCI_REG_PORTSC1 0x10 |
#define | UHCI_REG_PORTSC2 0x12 |
#define | UHCI_REGSZ 0x20 |
#define | UHCI_REG_LEGSUP 0xC0 |
#define | USB_CMD_MAX_PACKET (1 << 7) |
#define | USB_CMD_CONFIGURE (1 << 6) |
#define | USB_CMD_FGR (1 << 4) |
#define | USB_CMD_EGSM (1 << 3) |
#define | USB_CMD_GRESET (1 << 2) |
#define | USB_CMD_HCRESET (1 << 1) |
#define | USB_CMD_RS (1 << 0) |
#define | USB_STATUS_HALTED (1 << 5) |
#define | USB_STATUS_PROCESSERR (1 << 4) |
#define | USB_STATUS_HOSTERR (1 << 3) |
#define | USB_STATUS_RESUME (1 << 2) |
#define | USB_STATUS_INTERR (1 << 1) |
#define | USB_STATUS_USBINT (1 << 0) |
#define | USB_INTR_SHORT (1 << 3) |
#define | USB_INTR_IOC (1 << 2) |
#define | USB_INTR_RESUME (1 << 1) |
#define | USB_INTR_TIMEOUT (1 << 0) |
#define | USB_PORT_SUSPEND (1 << 12) |
#define | USB_PORT_RESET (1 << 9) |
#define | USB_PORT_LOWSPEED (1 << 8) |
#define | USB_PORT_RESUMED (1 << 6) |
#define | USB_PORT_CHANGE (1 << 3) |
#define | USB_PORT_ENABLE (1 << 2) |
#define | USB_PORT_CONNECTCHG (1 << 1) |
#define | USB_PORT_CONNECTSTATUS (1 << 0) |
#define | ptr_to_flp(x) (((uintptr_t)x) >> 4) |
#define | flp_to_ptr(x) (uintptr_t)(((uintptr_t)x) << 4) |
#define | TD_FL_ASYNC 1 |
#define | TD_FL_USED 0x80000000 |
#define | uhci_lock(x) lock_acquire(&(x)->lock) |
#define | uhci_unlock(x) lock_release(&(x)->lock) |
#define | dev_lock(x) lock_acquire(&(x)->lock) |
#define | dev_unlock(x) lock_release(&(x)->lock) |
#define | uhci_is_stopped(x) |
#define | uhci_port_enabled(x, y) (pci_reg_read16((x)->io, (y)) & USB_PORT_ENABLE) |
#define | UHCI_PORT_TIMEOUT 1000 |
Functions | |
static int | token_to_pid (int token) |
static int | uhci_tx_pkt (host_eop_info eop, int token, void *pkt, int min_sz, int max_sz, int *in_sz, bool wait) |
static int | uhci_detect_change (host_info) |
static int | uhci_tx_pkt_now (struct uhci_eop_info *ue, int token, void *pkt, int sz) |
static int | uhci_tx_pkt_wait (struct uhci_eop_info *ue, int token, void *pkt, int max_sz, int *in_sz) |
static int | uhci_tx_pkt_bulk (struct uhci_eop_info *ue, int token, void *buf, int sz, int *tx) |
static int | uhci_process_completed (struct uhci_info *ui) |
static struct tx_descriptor * | uhci_acquire_td (struct uhci_info *) |
static void | uhci_release_td (struct uhci_info *, struct tx_descriptor *) |
static void | uhci_remove_qh (struct uhci_info *ui, struct queue_head *qh) |
static void | qh_free (struct uhci_info *ui, struct queue_head *qh) |
static struct queue_head * | qh_alloc (struct uhci_info *ui) |
static struct uhci_info * | uhci_create_info (struct pci_io *io) |
static void | uhci_destroy_info (struct uhci_info *ui) UNUSED |
static host_eop_info | uhci_create_eop (host_dev_info hd, int eop, int maxpkt) |
static void | uhci_remove_eop (host_eop_info hei) |
static host_dev_info | uhci_create_chan (host_info hi, int dev_addr, int ver) |
static void | uhci_destroy_chan (host_dev_info) |
static void | uhci_modify_chan (host_dev_info, int dev_addr, int ver) |
static void | uhci_set_toggle (host_eop_info, int toggle) |
static struct tx_descriptor * | td_from_pool (struct uhci_info *ui, int idx) |
static int | check_and_flip_change (struct uhci_info *ui, int reg) |
static void | uhci_stop (struct uhci_info *ui) |
static void | uhci_run (struct uhci_info *ui) |
static void | uhci_stop_unlocked (struct uhci_info *ui) |
static void | uhci_run_unlocked (struct uhci_info *ui) |
static void | uhci_add_td_to_qh (struct queue_head *qh, struct tx_descriptor *td) |
static void | uhci_remove_error_td (struct tx_descriptor *td) |
static void | uhci_setup_td (struct tx_descriptor *td, int dev_addr, int token, int eop, void *pkt, int sz, int toggle, bool ls) |
static int | uhci_enable_port (struct uhci_info *ui, int port) |
static void | uhci_irq (void *uhci_data) |
static void | uhci_detect_ports (struct uhci_info *ui) |
static int | uhci_remove_stalled (struct uhci_info *ui) |
static void | uhci_stall_watchdog (struct uhci_info *ui) UNUSED |
static void | dump_all_qh (struct uhci_info *ui) |
static void | dump_qh (struct queue_head *qh) |
static void | dump_regs (struct uhci_info *ui) |
void | uhci_init (void) |
Variables | |
static struct usb_host | uhci_host |
Definition at line 198 of file usb_uhci.c.
Definition at line 199 of file usb_uhci.c.
Definition at line 78 of file usb_uhci.c.
Referenced by dump_qh(), uhci_add_td_to_qh(), uhci_remove_error_td(), and uhci_remove_qh().
#define FRAME_LIST_ENTRIES 1024 |
Definition at line 25 of file usb_uhci.c.
Referenced by uhci_create_chan(), uhci_create_info(), and uhci_remove_qh().
Definition at line 77 of file usb_uhci.c.
Referenced by uhci_add_td_to_qh(), uhci_create_chan(), uhci_remove_error_td(), and uhci_remove_qh().
#define QH_ENTRIES (4096/16) |
#define TD_ENTRIES (4096/32) |
Definition at line 26 of file usb_uhci.c.
Referenced by td_from_pool(), uhci_create_info(), uhci_process_completed(), and uhci_release_td().
#define TD_FL_ASYNC 1 |
Definition at line 125 of file usb_uhci.c.
Referenced by uhci_process_completed(), and uhci_tx_pkt_now().
#define TD_FL_USED 0x80000000 |
Definition at line 126 of file usb_uhci.c.
Referenced by uhci_process_completed(), uhci_tx_pkt_now(), and uhci_tx_pkt_wait().
#define uhci_is_stopped | ( | x | ) |
Value:
(pci_reg_read16((x)->io, UHCI_REG_USBSTS) \ & USB_STATUS_HALTED)
Definition at line 244 of file usb_uhci.c.
Referenced by uhci_remove_qh(), uhci_stop_unlocked(), and uhci_tx_pkt_now().
Definition at line 196 of file usb_uhci.c.
Referenced by uhci_create_chan(), uhci_destroy_chan(), uhci_detect_change(), uhci_stall_watchdog(), uhci_tx_pkt_now(), and uhci_tx_pkt_wait().
#define UHCI_MAX_PORTS 8 |
3194302259845385 Universal Host Controller Interface driver TODO: Stall timeouts Better (any) root hub handling
Definition at line 23 of file usb_uhci.c.
Referenced by uhci_detect_ports().
Definition at line 246 of file usb_uhci.c.
#define UHCI_PORT_TIMEOUT 1000 |
Definition at line 352 of file usb_uhci.c.
#define UHCI_REG_FLBASEADD 0x08 |
#define UHCI_REG_FRNUM 0x06 |
#define UHCI_REG_LEGSUP 0xC0 |
#define UHCI_REG_PORTSC1 0x10 |
Definition at line 36 of file usb_uhci.c.
Referenced by check_and_flip_change(), uhci_detect_ports(), uhci_enable_port(), and uhci_init().
#define UHCI_REG_PORTSC2 0x12 |
#define UHCI_REG_SOFMOD 0x0c |
#define UHCI_REG_USBCMD 0x00 |
Definition at line 30 of file usb_uhci.c.
Referenced by uhci_init(), uhci_run_unlocked(), and uhci_stop_unlocked().
#define UHCI_REG_USBINTR 0x04 |
#define UHCI_REG_USBSTS 0x02 |
#define UHCI_REGSZ 0x20 |
Definition at line 197 of file usb_uhci.c.
Referenced by uhci_create_chan(), uhci_destroy_chan(), uhci_detect_change(), uhci_stall_watchdog(), uhci_tx_pkt_now(), and uhci_tx_pkt_wait().
#define USB_CMD_CONFIGURE (1 << 6) |
#define USB_CMD_EGSM (1 << 3) |
Definition at line 48 of file usb_uhci.c.
#define USB_CMD_FGR (1 << 4) |
Definition at line 47 of file usb_uhci.c.
#define USB_CMD_GRESET (1 << 2) |
Definition at line 49 of file usb_uhci.c.
#define USB_CMD_HCRESET (1 << 1) |
#define USB_CMD_MAX_PACKET (1 << 7) |
#define USB_CMD_RS (1 << 0) |
Definition at line 51 of file usb_uhci.c.
Referenced by uhci_init(), uhci_run_unlocked(), and uhci_stop_unlocked().
#define USB_INTR_IOC (1 << 2) |
#define USB_INTR_RESUME (1 << 1) |
#define USB_INTR_SHORT (1 << 3) |
#define USB_INTR_TIMEOUT (1 << 0) |
#define USB_PORT_CHANGE (1 << 3) |
Definition at line 72 of file usb_uhci.c.
Referenced by check_and_flip_change(), and uhci_enable_port().
#define USB_PORT_CONNECTCHG (1 << 1) |
#define USB_PORT_CONNECTSTATUS (1 << 0) |
#define USB_PORT_ENABLE (1 << 2) |
#define USB_PORT_LOWSPEED (1 << 8) |
Definition at line 70 of file usb_uhci.c.
#define USB_PORT_RESET (1 << 9) |
#define USB_PORT_RESUMED (1 << 6) |
Definition at line 71 of file usb_uhci.c.
#define USB_PORT_SUSPEND (1 << 12) |
Definition at line 68 of file usb_uhci.c.
#define USB_STATUS_HALTED (1 << 5) |
Definition at line 54 of file usb_uhci.c.
#define USB_STATUS_HOSTERR (1 << 3) |
#define USB_STATUS_INTERR (1 << 1) |
#define USB_STATUS_PROCESSERR (1 << 4) |
#define USB_STATUS_RESUME (1 << 2) |
Definition at line 57 of file usb_uhci.c.
#define USB_STATUS_USBINT (1 << 0) |
static int check_and_flip_change | ( | struct uhci_info * | ui, | |
int | reg | |||
) | [static] |
Definition at line 895 of file usb_uhci.c.
References uhci_info::io, pci_reg_read16(), pci_reg_write16(), UHCI_REG_PORTSC1, and USB_PORT_CHANGE.
Referenced by uhci_detect_change().
static void dump_all_qh | ( | struct uhci_info * | ui | ) | [static] |
Definition at line 1132 of file usb_uhci.c.
References uhci_info::devices, dump_qh(), uhci_info::frame_list, list_begin(), list_end(), list_entry, list_next(), uhci_dev_info::peers, printf(), uhci_dev_info::qh, and vtop().
Referenced by uhci_irq().
static void dump_qh | ( | struct queue_head * | qh | ) | [static] |
Definition at line 1149 of file usb_uhci.c.
References flp_to_ptr, printf(), ptov(), queue_head::qelp, frame_list_ptr::terminate, and vtop().
Referenced by dump_all_qh().
static void dump_regs | ( | struct uhci_info * | ui | ) | [static] |
Definition at line 419 of file usb_uhci.c.
References uhci_info::io, name, pci_reg_read16(), pci_reg_read32(), and printf().
Referenced by uhci_irq().
static struct queue_head * qh_alloc | ( | struct uhci_info * | ui | ) | [static, read] |
Definition at line 1277 of file usb_uhci.c.
References ASSERT, BITMAP_ERROR, bitmap_scan_and_flip(), uhci_info::lock, lock_held_by_current_thread(), PANIC, uhci_info::qh_pool, and uhci_info::qh_used.
Referenced by uhci_create_chan().
static void qh_free | ( | struct uhci_info * | ui, | |
struct queue_head * | qh | |||
) | [static] |
Definition at line 1295 of file usb_uhci.c.
References ASSERT, bitmap_reset(), uhci_info::lock, lock_held_by_current_thread(), uhci_info::qh_pool, and uhci_info::qh_used.
Referenced by uhci_destroy_chan().
static struct tx_descriptor * td_from_pool | ( | struct uhci_info * | ui, | |
int | idx | |||
) | [static, read] |
Definition at line 1163 of file usb_uhci.c.
References ASSERT, TD_ENTRIES, and uhci_info::td_pool.
Referenced by uhci_acquire_td(), and uhci_process_completed().
static int token_to_pid | ( | int | token | ) | [static] |
Definition at line 571 of file usb_uhci.c.
References PANIC, USB_PID_IN, USB_PID_OUT, USB_PID_SETUP, USB_TOKEN_IN, USB_TOKEN_OUT, and USB_TOKEN_SETUP.
Referenced by uhci_setup_td().
static struct tx_descriptor * uhci_acquire_td | ( | struct uhci_info * | ui | ) | [static, read] |
Definition at line 1097 of file usb_uhci.c.
References ASSERT, BITMAP_ERROR, bitmap_scan_and_flip(), uhci_info::lock, lock_held_by_current_thread(), sema_down(), td_from_pool(), uhci_info::td_sem, and uhci_info::td_used.
Referenced by uhci_tx_pkt_now(), and uhci_tx_pkt_wait().
static void uhci_add_td_to_qh | ( | struct queue_head * | qh, | |
struct tx_descriptor * | td | |||
) | [static] |
Definition at line 722 of file usb_uhci.c.
References ASSERT, barrier, frame_list_ptr::depth_select, frame_list_ptr::flp, tx_descriptor::flp, flp_to_ptr, tx_descriptor::head, NULL, ptov(), ptr_to_flp, queue_head::qelp, frame_list_ptr::qh_select, frame_list_ptr::terminate, and vtop().
Referenced by uhci_tx_pkt_now(), and uhci_tx_pkt_wait().
static host_dev_info uhci_create_chan | ( | host_info | hi, | |
int | dev_addr, | |||
int | ver | |||
) | [static] |
Definition at line 912 of file usb_uhci.c.
References ASSERT, barrier, uhci_dev_info::dev_addr, uhci_info::devices, uhci_dev_info::errors, frame_list_ptr::flp, uhci_info::frame_list, FRAME_LIST_ENTRIES, list_push_back(), uhci_dev_info::lock, lock_init(), uhci_dev_info::low_speed, malloc(), memset(), uhci_dev_info::peers, ptr_to_flp, queue_head::qelp, uhci_dev_info::qh, qh_alloc(), frame_list_ptr::qh_select, queue_head::qhlp, frame_list_ptr::terminate, uhci_lock, uhci_run(), uhci_stop(), uhci_unlock, uhci_dev_info::ui, USB_VERSION_1_0, and vtop().
static host_eop_info uhci_create_eop | ( | host_dev_info | hd, | |
int | eop, | |||
int | maxpkt | |||
) | [static] |
Definition at line 1254 of file usb_uhci.c.
References uhci_eop_info::eop, malloc(), uhci_eop_info::maxpkt, uhci_eop_info::toggle, and uhci_eop_info::ud.
Definition at line 448 of file usb_uhci.c.
References bitmap_create(), uhci_info::devices, uhci_info::frame_list, FRAME_LIST_ENTRIES, uhci_info::io, list_init(), uhci_info::lock, lock_init(), malloc(), memset(), PAL_ASSERT, PAL_NOCACHE, palloc_get_page(), PGSIZE, QH_ENTRIES, uhci_info::qh_pool, uhci_info::qh_used, sema_init(), TD_ENTRIES, uhci_info::td_pool, uhci_info::td_sem, uhci_info::td_used, frame_list_ptr::terminate, uhci_info::timeouts, and uhci_info::waiting.
Referenced by uhci_init().
static void uhci_destroy_chan | ( | host_dev_info | hd | ) | [static] |
Definition at line 964 of file usb_uhci.c.
References free(), list_begin(), list_end(), list_entry, list_next(), list_remove(), uhci_dev_info::peers, usb_wait::peers, uhci_dev_info::qh, qh_free(), usb_wait::sem, sema_up(), usb_wait::ud, uhci_lock, uhci_remove_qh(), uhci_run(), uhci_stop(), uhci_unlock, uhci_dev_info::ui, and uhci_info::waiting.
static void uhci_destroy_info | ( | struct uhci_info * | ui | ) | [static] |
Definition at line 437 of file usb_uhci.c.
References bitmap_destroy(), uhci_info::frame_list, free(), palloc_free_page(), uhci_info::qh_pool, uhci_info::qh_used, uhci_info::td_pool, and uhci_info::td_used.
static int uhci_detect_change | ( | host_info | hi | ) | [static] |
Definition at line 874 of file usb_uhci.c.
References check_and_flip_change(), uhci_info::num_ports, uhci_lock, and uhci_unlock.
static void uhci_detect_ports | ( | struct uhci_info * | ui | ) | [static] |
Definition at line 1170 of file usb_uhci.c.
References uhci_info::io, uhci_info::num_ports, pci_reg_read16(), UHCI_MAX_PORTS, and UHCI_REG_PORTSC1.
Referenced by uhci_init().
static int uhci_enable_port | ( | struct uhci_info * | ui, | |
int | port | |||
) | [static] |
Definition at line 354 of file usb_uhci.c.
References uhci_info::io, pci_reg_read16(), pci_reg_write16(), timer_msleep(), timer_usleep(), UHCI_REG_PORTSC1, USB_PORT_CHANGE, USB_PORT_CONNECTCHG, USB_PORT_CONNECTSTATUS, USB_PORT_ENABLE, and USB_PORT_RESET.
Referenced by uhci_init().
void uhci_init | ( | void | ) |
static void uhci_irq | ( | void * | uhci_data | ) | [static] |
Definition at line 760 of file usb_uhci.c.
References dump_all_qh(), dump_regs(), uhci_info::io, PANIC, pci_reg_read16(), pci_reg_write16(), uhci_process_completed(), UHCI_REG_USBSTS, uhci_run_unlocked(), uhci_stop_unlocked(), USB_STATUS_HOSTERR, USB_STATUS_INTERR, USB_STATUS_PROCESSERR, and USB_STATUS_USBINT.
Referenced by uhci_init().
static void uhci_modify_chan | ( | host_dev_info | hd, | |
int | dev_addr, | |||
int | ver | |||
) | [static] |
Definition at line 1113 of file usb_uhci.c.
References uhci_dev_info::dev_addr, uhci_dev_info::low_speed, and USB_VERSION_1_0.
static int uhci_process_completed | ( | struct uhci_info * | ui | ) | [static] |
Definition at line 796 of file usb_uhci.c.
References td_control::active, BITMAP_ERROR, bitmap_scan(), tx_descriptor::control, td_control::error_limit, tx_descriptor::flags, list_begin(), list_end(), list_entry, list_next(), list_remove(), next(), usb_wait::sem, sema_up(), td_control::stalled, start, usb_wait::td, TD_ENTRIES, TD_FL_ASYNC, TD_FL_USED, td_from_pool(), uhci_info::td_used, uhci_release_td(), uhci_remove_error_td(), and uhci_info::waiting.
Referenced by uhci_irq().
static void uhci_release_td | ( | struct uhci_info * | ui, | |
struct tx_descriptor * | td | |||
) | [static] |
Definition at line 1241 of file usb_uhci.c.
References ASSERT, bitmap_reset(), tx_descriptor::flags, sema_up(), TD_ENTRIES, uhci_info::td_pool, uhci_info::td_sem, and uhci_info::td_used.
Referenced by uhci_process_completed(), and uhci_tx_pkt_wait().
static void uhci_remove_eop | ( | host_eop_info | hei | ) | [static] |
static void uhci_remove_error_td | ( | struct tx_descriptor * | td | ) | [static] |
Definition at line 856 of file usb_uhci.c.
References ASSERT, tx_descriptor::flp, frame_list_ptr::flp, flp_to_ptr, tx_descriptor::head, NULL, ptov(), ptr_to_flp, frame_list_ptr::terminate, and vtop().
Referenced by uhci_process_completed(), and uhci_remove_stalled().
static void uhci_remove_qh | ( | struct uhci_info * | ui, | |
struct queue_head * | qh | |||
) | [static] |
Remove a queue from the UHCI schedule
Definition at line 1005 of file usb_uhci.c.
References ASSERT, frame_list_ptr::flp, flp_to_ptr, uhci_info::frame_list, FRAME_LIST_ENTRIES, uhci_info::lock, lock_held_by_current_thread(), NULL, ptov(), ptr_to_flp, queue_head::qhlp, frame_list_ptr::terminate, uhci_is_stopped, and vtop().
Referenced by uhci_destroy_chan().
static int uhci_remove_stalled | ( | struct uhci_info * | ui | ) | [static] |
Definition at line 1203 of file usb_uhci.c.
References td_control::active, tx_descriptor::control, intr_disable(), intr_enable(), list_begin(), list_end(), list_entry, list_next(), list_remove(), memcpy(), td_control::nak, next(), printf(), usb_wait::sem, sema_up(), td_control::stalled, usb_wait::td, uhci_remove_error_td(), and uhci_info::waiting.
Referenced by uhci_stall_watchdog().
static void uhci_run | ( | struct uhci_info * | ui | ) | [static] |
Put UHCI into 'Run' State
Definition at line 1090 of file usb_uhci.c.
References ASSERT, uhci_info::lock, lock_held_by_current_thread(), and uhci_run_unlocked().
Referenced by uhci_create_chan(), uhci_destroy_chan(), uhci_stall_watchdog(), and uhci_tx_pkt_wait().
static void uhci_run_unlocked | ( | struct uhci_info * | ui | ) | [static] |
Definition at line 1078 of file usb_uhci.c.
References uhci_info::io, pci_reg_read16(), pci_reg_write16(), UHCI_REG_USBCMD, USB_CMD_MAX_PACKET, and USB_CMD_RS.
Referenced by uhci_irq(), and uhci_run().
static void uhci_set_toggle | ( | host_eop_info | he, | |
int | toggle | |||
) | [static] |
static void uhci_setup_td | ( | struct tx_descriptor * | td, | |
int | dev_addr, | |||
int | token, | |||
int | eop, | |||
void * | pkt, | |||
int | sz, | |||
int | toggle, | |||
bool ls | UNUSED | |||
) | [static] |
Definition at line 587 of file usb_uhci.c.
References td_control::active, td_control::actual_len, tx_descriptor::buf_ptr, tx_descriptor::control, td_token::data_toggle, frame_list_ptr::depth_select, td_token::dev_addr, td_token::end_point, td_control::error_limit, tx_descriptor::flp, td_token::maxlen, td_token::pid, frame_list_ptr::qh_select, tx_descriptor::token, token_to_pid(), and vtop().
Referenced by uhci_tx_pkt_now(), and uhci_tx_pkt_wait().
static void uhci_stall_watchdog | ( | struct uhci_info * | ui | ) | [static] |
Definition at line 1185 of file usb_uhci.c.
References printf(), timer_msleep(), uhci_lock, uhci_remove_stalled(), uhci_run(), uhci_stop(), and uhci_unlock.
static void uhci_stop | ( | struct uhci_info * | ui | ) | [static] |
Put UHCI into stop state Wait until status register reflects setting
Definition at line 1047 of file usb_uhci.c.
References ASSERT, intr_get_level(), INTR_OFF, uhci_info::lock, lock_held_by_current_thread(), and uhci_stop_unlocked().
Referenced by uhci_create_chan(), uhci_destroy_chan(), uhci_stall_watchdog(), uhci_tx_pkt_now(), and uhci_tx_pkt_wait().
static void uhci_stop_unlocked | ( | struct uhci_info * | ui | ) | [static] |
Definition at line 1056 of file usb_uhci.c.
References uhci_info::io, PANIC, pci_reg_read16(), pci_reg_write16(), uhci_is_stopped, UHCI_REG_USBCMD, and USB_CMD_RS.
Referenced by uhci_irq(), and uhci_stop().
static int uhci_tx_pkt | ( | host_eop_info | eop, | |
int | token, | |||
void * | pkt, | |||
int | min_sz, | |||
int | max_sz, | |||
int * | in_sz, | |||
bool | wait | |||
) | [static] |
Definition at line 482 of file usb_uhci.c.
References ASSERT, uhci_info::attached_ports, NULL, pg_no(), uhci_eop_info::toggle, uhci_eop_info::ud, uhci_tx_pkt_bulk(), uhci_tx_pkt_now(), uhci_tx_pkt_wait(), uhci_dev_info::ui, USB_HOST_ERR_NODEV, and USB_TOKEN_SETUP.
Referenced by uhci_tx_pkt_bulk().
static int uhci_tx_pkt_bulk | ( | struct uhci_eop_info * | ue, | |
int | token, | |||
void * | buf, | |||
int | sz, | |||
int * | tx | |||
) | [static] |
Definition at line 532 of file usb_uhci.c.
References uhci_eop_info::maxpkt, NULL, uhci_tx_pkt(), and USB_HOST_ERR_NONE.
Referenced by uhci_tx_pkt().
static int uhci_tx_pkt_now | ( | struct uhci_eop_info * | ue, | |
int | token, | |||
void * | pkt, | |||
int | sz | |||
) | [static] |
Definition at line 609 of file usb_uhci.c.
References uhci_dev_info::dev_addr, uhci_eop_info::eop, tx_descriptor::flags, uhci_dev_info::low_speed, memset(), uhci_dev_info::qh, TD_FL_ASYNC, TD_FL_USED, uhci_eop_info::toggle, uhci_eop_info::ud, uhci_acquire_td(), uhci_add_td_to_qh(), uhci_is_stopped, uhci_lock, uhci_setup_td(), uhci_stop(), uhci_unlock, uhci_dev_info::ui, and USB_HOST_ERR_NONE.
Referenced by uhci_tx_pkt().
static int uhci_tx_pkt_wait | ( | struct uhci_eop_info * | ue, | |
int | token, | |||
void * | pkt, | |||
int | max_sz, | |||
int * | in_sz | |||
) | [static] |
Definition at line 638 of file usb_uhci.c.
References td_control::actual_len, td_control::babble, td_control::bitstuff, td_control::buffer_error, tx_descriptor::control, uhci_dev_info::dev_addr, uhci_eop_info::eop, tx_descriptor::flags, hex_dump(), intr_disable(), intr_set_level(), td_control::ioc, list_push_back(), uhci_dev_info::low_speed, memset(), td_control::nak, NULL, usb_wait::peers, printf(), uhci_dev_info::qh, usb_wait::sem, sema_down(), sema_init(), td_control::stalled, usb_wait::td, TD_FL_USED, td_control::timeout, uhci_eop_info::toggle, usb_wait::ud, uhci_eop_info::ud, uhci_acquire_td(), uhci_add_td_to_qh(), uhci_lock, uhci_release_td(), uhci_run(), uhci_setup_td(), uhci_stop(), uhci_unlock, uhci_dev_info::ui, USB_HOST_ERR_BABBLE, USB_HOST_ERR_BITSTUFF, USB_HOST_ERR_BUFFER, USB_HOST_ERR_NAK, USB_HOST_ERR_NONE, USB_HOST_ERR_STALL, USB_HOST_ERR_TIMEOUT, USB_TOKEN_IN, USB_TOKEN_OUT, USB_TOKEN_SETUP, and uhci_info::waiting.
Referenced by uhci_tx_pkt().
Initial value:
{ .name = "UHCI", .tx_pkt = uhci_tx_pkt, .detect_change = uhci_detect_change, .create_dev_channel = uhci_create_chan, .remove_dev_channel = uhci_destroy_chan, .modify_dev_channel = uhci_modify_chan, .set_toggle = uhci_set_toggle, .create_eop = uhci_create_eop, .remove_eop = uhci_remove_eop }
Definition at line 266 of file usb_uhci.c.