drivers/usb/serial/io_edgeport.c
Source file repositories/reference/linux-study-clean/drivers/usb/serial/io_edgeport.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/serial/io_edgeport.c- Extension
.c- Size
- 98404 bytes
- Lines
- 3132
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/kernel.hlinux/jiffies.hlinux/errno.hlinux/slab.hlinux/tty.hlinux/tty_driver.hlinux/tty_flip.hlinux/module.hlinux/spinlock.hlinux/serial.hlinux/ioctl.hlinux/wait.hlinux/firmware.hlinux/ihex.hlinux/uaccess.hlinux/usb.hlinux/usb/serial.hio_edgeport.hio_ionsp.hio_16654.h
Detected Declarations
struct TxFifostruct edgeport_portstruct edgeport_serialstruct divisor_table_entryenum RXSTATEfunction update_edgeport_E2PROMfunction dump_product_infofunction get_product_infofunction get_epic_descriptorfunction edge_interrupt_callbackfunction edge_bulk_in_callbackfunction edge_bulk_out_data_callbackfunction edge_bulk_out_cmd_callbackfunction edge_openfunction block_until_chase_responsefunction block_until_tx_emptyfunction edge_closefunction edge_writefunction send_more_port_datafunction edge_write_roomfunction portfunction edge_throttlefunction portfunction edge_set_termiosfunction get_lsr_infofunction edge_tiocmsetfunction edge_tiocmgetfunction edge_ioctlfunction edge_breakfunction process_rcvd_datafunction process_rcvd_statusfunction edge_tty_recvfunction handle_new_msrfunction handle_new_lsrfunction sram_writefunction rom_writefunction rom_readfunction send_iosp_ext_cmdfunction write_cmd_usbfunction send_cmd_write_baud_ratefunction calc_baud_rate_divisorfunction send_cmd_write_uart_registerfunction change_port_settingsfunction unicode_to_asciifunction get_manufacturing_descfunction get_boot_descfunction load_application_firmwarefunction edge_startup
Annotated Snippet
struct TxFifo {
unsigned int head; /* index to head pointer (write) */
unsigned int tail; /* index to tail pointer (read) */
unsigned int count; /* Bytes in queue */
unsigned int size; /* Max size of queue (equal to Max number of TxCredits) */
unsigned char *fifo; /* allocated Buffer */
};
/* This structure holds all of the local port information */
struct edgeport_port {
__u16 txCredits; /* our current credits for this port */
__u16 maxTxCredits; /* the max size of the port */
struct TxFifo txfifo; /* transmit fifo -- size will be maxTxCredits */
struct urb *write_urb; /* write URB for this port */
bool write_in_progress; /* 'true' while a write URB is outstanding */
spinlock_t ep_lock;
__u8 shadowLCR; /* last LCR value received */
__u8 shadowMCR; /* last MCR value received */
__u8 shadowMSR; /* last MSR value received */
__u8 shadowLSR; /* last LSR value received */
__u8 shadowXonChar; /* last value set as XON char in Edgeport */
__u8 shadowXoffChar; /* last value set as XOFF char in Edgeport */
__u8 validDataMask;
__u32 baudRate;
bool open;
bool openPending;
bool commandPending;
bool closePending;
bool chaseResponsePending;
wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */
wait_queue_head_t wait_open; /* for handling sleeping while waiting for open to finish */
wait_queue_head_t wait_command; /* for handling sleeping while waiting for command to finish */
struct usb_serial_port *port; /* loop back to the owner of this object */
};
/* This structure holds all of the individual device information */
struct edgeport_serial {
char name[MAX_NAME_LEN+2]; /* string name of this device */
struct edge_manuf_descriptor manuf_descriptor; /* the manufacturer descriptor */
struct edge_boot_descriptor boot_descriptor; /* the boot firmware descriptor */
struct edgeport_product_info product_info; /* Product Info */
struct edge_compatibility_descriptor epic_descriptor; /* Edgeport compatible descriptor */
int is_epic; /* flag if EPiC device or not */
__u8 interrupt_in_endpoint; /* the interrupt endpoint handle */
unsigned char *interrupt_in_buffer; /* the buffer we use for the interrupt endpoint */
struct urb *interrupt_read_urb; /* our interrupt urb */
__u8 bulk_in_endpoint; /* the bulk in endpoint handle */
unsigned char *bulk_in_buffer; /* the buffer we use for the bulk in endpoint */
struct urb *read_urb; /* our bulk read urb */
bool read_in_progress;
spinlock_t es_lock;
__u8 bulk_out_endpoint; /* the bulk out endpoint handle */
__s16 rxBytesAvail; /* the number of bytes that we need to read from this device */
enum RXSTATE rxState; /* the current state of the bulk receive processor */
__u8 rxHeader1; /* receive header byte 1 */
__u8 rxHeader2; /* receive header byte 2 */
__u8 rxHeader3; /* receive header byte 3 */
__u8 rxPort; /* the port that we are currently receiving data for */
__u8 rxStatusCode; /* the receive status code */
__u8 rxStatusParam; /* the receive status parameter */
__s16 rxBytesRemaining; /* the number of port bytes left to read */
struct usb_serial *serial; /* loop back to the owner of this object */
};
/* baud rate information */
struct divisor_table_entry {
__u32 BaudRate;
__u16 Divisor;
};
/*
* Define table of divisors for Rev A EdgePort/4 hardware
* These assume a 3.6864MHz crystal, the standard /16, and
* MCR.7 = 0.
*/
static const struct divisor_table_entry divisor_table[] = {
{ 50, 4608},
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/jiffies.h`, `linux/errno.h`, `linux/slab.h`, `linux/tty.h`, `linux/tty_driver.h`, `linux/tty_flip.h`, `linux/module.h`.
- Detected declarations: `struct TxFifo`, `struct edgeport_port`, `struct edgeport_serial`, `struct divisor_table_entry`, `enum RXSTATE`, `function update_edgeport_E2PROM`, `function dump_product_info`, `function get_product_info`, `function get_epic_descriptor`, `function edge_interrupt_callback`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.