drivers/usb/storage/freecom.c
Source file repositories/reference/linux-study-clean/drivers/usb/storage/freecom.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/storage/freecom.c- Extension
.c- Size
- 15498 bytes
- Lines
- 578
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hscsi/scsi.hscsi/scsi_cmnd.husb.htransport.hprotocol.hdebug.hscsiglue.hunusual_freecom.h
Detected Declarations
struct freecom_cb_wrapstruct freecom_xfer_wrapstruct freecom_ide_outstruct freecom_ide_instruct freecom_statusfunction freecom_readdatafunction freecom_writedatafunction freecom_transportfunction init_freecomfunction usb_stor_freecom_resetfunction pdumpfunction freecom_probe
Annotated Snippet
struct freecom_cb_wrap {
u8 Type; /* Command type. */
u8 Timeout; /* Timeout in seconds. */
u8 Atapi[12]; /* An ATAPI packet. */
u8 Filler[50]; /* Padding Data. */
};
struct freecom_xfer_wrap {
u8 Type; /* Command type. */
u8 Timeout; /* Timeout in seconds. */
__le32 Count; /* Number of bytes to transfer. */
u8 Pad[58];
} __attribute__ ((packed));
struct freecom_ide_out {
u8 Type; /* Type + IDE register. */
u8 Pad;
__le16 Value; /* Value to write. */
u8 Pad2[60];
};
struct freecom_ide_in {
u8 Type; /* Type | IDE register. */
u8 Pad[63];
};
struct freecom_status {
u8 Status;
u8 Reason;
__le16 Count;
u8 Pad[60];
};
/*
* Freecom stuffs the interrupt status in the INDEX_STAT bit of the ide
* register.
*/
#define FCM_INT_STATUS 0x02 /* INDEX_STAT */
#define FCM_STATUS_BUSY 0x80
/*
* These are the packet types. The low bit indicates that this command
* should wait for an interrupt.
*/
#define FCM_PACKET_ATAPI 0x21
#define FCM_PACKET_STATUS 0x20
/*
* Receive data from the IDE interface. The ATAPI packet has already
* waited, so the data should be immediately available.
*/
#define FCM_PACKET_INPUT 0x81
/* Send data to the IDE interface. */
#define FCM_PACKET_OUTPUT 0x01
/*
* Write a value to an ide register. Or the ide register to write after
* munging the address a bit.
*/
#define FCM_PACKET_IDE_WRITE 0x40
#define FCM_PACKET_IDE_READ 0xC0
/* All packets (except for status) are 64 bytes long. */
#define FCM_PACKET_LENGTH 64
#define FCM_STATUS_PACKET_LENGTH 4
static int init_freecom(struct us_data *us);
/*
* The table of devices
*/
#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
vendorName, productName, useProtocol, useTransport, \
initFunction, flags) \
{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
.driver_info = (flags) }
static const struct usb_device_id freecom_usb_ids[] = {
# include "unusual_freecom.h"
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE(usb, freecom_usb_ids);
#undef UNUSUAL_DEV
/*
* The flags table
*/
Annotation
- Immediate include surface: `linux/module.h`, `scsi/scsi.h`, `scsi/scsi_cmnd.h`, `usb.h`, `transport.h`, `protocol.h`, `debug.h`, `scsiglue.h`.
- Detected declarations: `struct freecom_cb_wrap`, `struct freecom_xfer_wrap`, `struct freecom_ide_out`, `struct freecom_ide_in`, `struct freecom_status`, `function freecom_readdata`, `function freecom_writedata`, `function freecom_transport`, `function init_freecom`, `function usb_stor_freecom_reset`.
- 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.