drivers/usb/atm/speedtch.c
Source file repositories/reference/linux-study-clean/drivers/usb/atm/speedtch.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/atm/speedtch.c- Extension
.c- Size
- 28055 bytes
- Lines
- 950
- 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.
- 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
asm/page.hlinux/device.hlinux/errno.hlinux/firmware.hlinux/hex.hlinux/kernel.hlinux/module.hlinux/moduleparam.hlinux/slab.hlinux/stat.hlinux/timer.hlinux/types.hlinux/usb/ch9.hlinux/workqueue.husbatm.h
Detected Declarations
struct speedtch_paramsstruct speedtch_instance_datafunction speedtch_set_swbufffunction speedtch_test_sequencefunction speedtch_upload_firmwarefunction speedtch_find_firmwarefunction speedtch_heavy_initfunction speedtch_read_statusfunction speedtch_start_synchrofunction speedtch_check_statusfunction speedtch_status_pollfunction speedtch_resubmit_intfunction speedtch_handle_intfunction speedtch_atm_startfunction speedtch_atm_stopfunction speedtch_pre_resetfunction speedtch_post_resetfunction speedtch_release_interfacesfunction speedtch_bindfunction speedtch_unbindfunction speedtch_usb_probe
Annotated Snippet
struct speedtch_params {
unsigned int altsetting;
unsigned int BMaxDSL;
unsigned char ModemMode;
unsigned char ModemOption[MODEM_OPTION_LENGTH];
};
struct speedtch_instance_data {
struct usbatm_data *usbatm;
struct speedtch_params params; /* set in probe, constant afterwards */
struct timer_list status_check_timer;
struct work_struct status_check_work;
unsigned char last_status;
int poll_delay; /* milliseconds */
struct timer_list resubmit_timer;
struct urb *int_urb;
unsigned char int_data[16];
unsigned char scratch_buffer[16];
};
/***************
** firmware **
***************/
static void speedtch_set_swbuff(struct speedtch_instance_data *instance, int state)
{
struct usbatm_data *usbatm = instance->usbatm;
struct usb_device *usb_dev = usbatm->usb_dev;
int ret;
ret = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
0x32, 0x40, state ? 0x01 : 0x00, 0x00, NULL, 0, CTRL_TIMEOUT);
if (ret < 0)
usb_warn(usbatm,
"%sabling SW buffering: usb_control_msg returned %d\n",
state ? "En" : "Dis", ret);
else
usb_dbg(usbatm, "speedtch_set_swbuff: %sbled SW buffering\n", state ? "En" : "Dis");
}
static void speedtch_test_sequence(struct speedtch_instance_data *instance)
{
struct usbatm_data *usbatm = instance->usbatm;
struct usb_device *usb_dev = usbatm->usb_dev;
unsigned char *buf = instance->scratch_buffer;
int ret;
/* URB 147 */
buf[0] = 0x1c;
buf[1] = 0x50;
ret = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
0x01, 0x40, 0x0b, 0x00, buf, 2, CTRL_TIMEOUT);
if (ret < 0)
usb_warn(usbatm, "%s failed on URB147: %d\n", __func__, ret);
/* URB 148 */
buf[0] = 0x32;
buf[1] = 0x00;
ret = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
0x01, 0x40, 0x02, 0x00, buf, 2, CTRL_TIMEOUT);
if (ret < 0)
usb_warn(usbatm, "%s failed on URB148: %d\n", __func__, ret);
/* URB 149 */
buf[0] = 0x01;
buf[1] = 0x00;
buf[2] = 0x01;
ret = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
0x01, 0x40, 0x03, 0x00, buf, 3, CTRL_TIMEOUT);
if (ret < 0)
usb_warn(usbatm, "%s failed on URB149: %d\n", __func__, ret);
/* URB 150 */
buf[0] = 0x01;
buf[1] = 0x00;
buf[2] = 0x01;
ret = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
0x01, 0x40, 0x04, 0x00, buf, 3, CTRL_TIMEOUT);
if (ret < 0)
usb_warn(usbatm, "%s failed on URB150: %d\n", __func__, ret);
/* Extra initialisation in recent drivers - gives higher speeds */
/* URBext1 */
Annotation
- Immediate include surface: `asm/page.h`, `linux/device.h`, `linux/errno.h`, `linux/firmware.h`, `linux/hex.h`, `linux/kernel.h`, `linux/module.h`, `linux/moduleparam.h`.
- Detected declarations: `struct speedtch_params`, `struct speedtch_instance_data`, `function speedtch_set_swbuff`, `function speedtch_test_sequence`, `function speedtch_upload_firmware`, `function speedtch_find_firmware`, `function speedtch_heavy_init`, `function speedtch_read_status`, `function speedtch_start_synchro`, `function speedtch_check_status`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
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.