drivers/usb/c67x00/c67x00-sched.c
Source file repositories/reference/linux-study-clean/drivers/usb/c67x00/c67x00-sched.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/c67x00/c67x00-sched.c- Extension
.c- Size
- 29456 bytes
- Lines
- 1149
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kthread.hlinux/slab.hc67x00.hc67x00-hcd.h
Detected Declarations
struct c67x00_ep_datastruct c67x00_tdstruct c67x00_urb_privfunction dbg_tdfunction c67x00_get_current_frame_numberfunction frame_addfunction frame_afterfunction frame_after_eqfunction c67x00_release_urbfunction c67x00_ep_data_allocfunction list_for_each_entryfunction c67x00_ep_data_freefunction c67x00_endpoint_disablefunction get_root_portfunction c67x00_urb_enqueuefunction c67x00_urb_dequeuefunction c67x00_giveback_urbfunction c67x00_claim_frame_bwfunction FSfunction c67x00_create_tdfunction c67x00_release_tdfunction c67x00_add_data_urbfunction c67x00_add_ctrl_urbfunction c67x00_add_int_urbfunction c67x00_add_iso_urbfunction c67x00_fill_from_listfunction c67x00_fill_framefunction list_for_each_entry_safefunction c67x00_parse_tdfunction c67x00_td_to_errorfunction c67x00_end_of_datafunction c67x00_clear_pipefunction c67x00_handle_successful_tdfunction c67x00_handle_isocfunction c67x00_check_td_listfunction list_for_each_entry_safefunction c67x00_all_tds_processedfunction c67x00_send_tdfunction c67x00_send_framefunction list_for_each_entryfunction c67x00_do_workfunction c67x00_sched_workfunction c67x00_sched_kickfunction c67x00_sched_start_schedulerfunction c67x00_sched_stop_scheduler
Annotated Snippet
struct c67x00_ep_data {
struct list_head queue;
struct list_head node;
struct usb_host_endpoint *hep;
struct usb_device *dev;
u16 next_frame; /* For int/isoc transactions */
};
/*
* struct c67x00_td
*
* Hardware parts are little endiannes, SW in CPU endianess.
*/
struct c67x00_td {
/* HW specific part */
__le16 ly_base_addr; /* Bytes 0-1 */
__le16 port_length; /* Bytes 2-3 */
u8 pid_ep; /* Byte 4 */
u8 dev_addr; /* Byte 5 */
u8 ctrl_reg; /* Byte 6 */
u8 status; /* Byte 7 */
u8 retry_cnt; /* Byte 8 */
#define TT_OFFSET 2
#define TT_CONTROL 0
#define TT_ISOCHRONOUS 1
#define TT_BULK 2
#define TT_INTERRUPT 3
u8 residue; /* Byte 9 */
__le16 next_td_addr; /* Bytes 10-11 */
/* SW part */
struct list_head td_list;
u16 td_addr;
void *data;
struct urb *urb;
unsigned long privdata;
/* These are needed for handling the toggle bits:
* an urb can be dequeued while a td is in progress
* after checking the td, the toggle bit might need to
* be fixed */
struct c67x00_ep_data *ep_data;
unsigned int pipe;
};
struct c67x00_urb_priv {
struct list_head hep_node;
struct urb *urb;
int port;
int cnt; /* packet number for isoc */
int status;
struct c67x00_ep_data *ep_data;
};
#define td_udev(td) ((td)->ep_data->dev)
#define CY_TD_SIZE 12
#define TD_PIDEP_OFFSET 0x04
#define TD_PIDEPMASK_PID 0xF0
#define TD_PIDEPMASK_EP 0x0F
#define TD_PORTLENMASK_DL 0x03FF
#define TD_PORTLENMASK_PN 0xC000
#define TD_STATUS_OFFSET 0x07
#define TD_STATUSMASK_ACK 0x01
#define TD_STATUSMASK_ERR 0x02
#define TD_STATUSMASK_TMOUT 0x04
#define TD_STATUSMASK_SEQ 0x08
#define TD_STATUSMASK_SETUP 0x10
#define TD_STATUSMASK_OVF 0x20
#define TD_STATUSMASK_NAK 0x40
#define TD_STATUSMASK_STALL 0x80
#define TD_ERROR_MASK (TD_STATUSMASK_ERR | TD_STATUSMASK_TMOUT | \
TD_STATUSMASK_STALL)
#define TD_RETRYCNT_OFFSET 0x08
#define TD_RETRYCNTMASK_ACT_FLG 0x10
#define TD_RETRYCNTMASK_TX_TYPE 0x0C
#define TD_RETRYCNTMASK_RTY_CNT 0x03
#define TD_RESIDUE_OVERFLOW 0x80
#define TD_PID_IN 0x90
/* Residue: signed 8bits, neg -> OVERFLOW, pos -> UNDERFLOW */
#define td_residue(td) ((__s8)(td->residue))
#define td_ly_base_addr(td) (__le16_to_cpu((td)->ly_base_addr))
#define td_port_length(td) (__le16_to_cpu((td)->port_length))
#define td_next_td_addr(td) (__le16_to_cpu((td)->next_td_addr))
Annotation
- Immediate include surface: `linux/kthread.h`, `linux/slab.h`, `c67x00.h`, `c67x00-hcd.h`.
- Detected declarations: `struct c67x00_ep_data`, `struct c67x00_td`, `struct c67x00_urb_priv`, `function dbg_td`, `function c67x00_get_current_frame_number`, `function frame_add`, `function frame_after`, `function frame_after_eq`, `function c67x00_release_urb`, `function c67x00_ep_data_alloc`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.