drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
Source file repositories/reference/linux-study-clean/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c- Extension
.c- Size
- 58537 bytes
- Lines
- 2247
- Domain
- Driver Families
- Bucket
- drivers/net
- 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/bitfield.hlinux/completion.hlinux/device.hlinux/gfp.hlinux/jiffies.hlinux/kernel.hlinux/netdevice.hlinux/spinlock.hlinux/string.hlinux/types.hlinux/units.hlinux/usb.hlinux/can.hlinux/can/dev.hlinux/can/error.hlinux/can/netlink.hkvaser_usb.h
Detected Declarations
struct kvaser_cmd_map_ch_reqstruct kvaser_cmd_map_ch_resstruct kvaser_cmd_card_infostruct kvaser_cmd_sw_infostruct kvaser_cmd_sw_detail_reqstruct kvaser_cmd_sw_detail_resstruct kvaser_cmd_cap_reqstruct kvaser_cmd_cap_resstruct kvaser_cmd_error_eventstruct kvaser_cmd_chip_state_eventstruct kvaser_cmd_set_busparamsstruct kvaser_cmd_get_busparams_reqstruct kvaser_cmd_get_busparams_resstruct kvaser_cmd_led_action_reqstruct kvaser_cmd_set_ctrlmodestruct kvaser_err_frame_datastruct kvaser_cmd_rx_canstruct kvaser_cmd_tx_canstruct kvaser_cmd_tx_ackstruct kvaser_cmd_headerstruct kvaser_cmdstruct kvaser_cmd_ext_rx_canstruct kvaser_cmd_ext_tx_canstruct kvaser_cmd_ext_tx_ackstruct kvaser_cmd_extstruct kvaser_usb_net_hydra_privfunction GENMASKfunction kvaser_usb_hydra_set_cmd_transidfunction kvaser_usb_hydra_get_cmd_src_hefunction kvaser_usb_hydra_set_cmd_dest_hefunction kvaser_usb_hydra_channel_from_cmdfunction kvaser_usb_hydra_get_next_transidfunction kvaser_usb_hydra_cmd_sizefunction kvaser_usb_hydra_net_priv_from_cmdfunction kvaser_usb_hydra_ktime_from_cmdfunction kvaser_usb_hydra_send_simple_cmdfunction kvaser_usb_hydra_send_simple_cmd_asyncfunction kvaser_usb_hydra_wait_cmdfunction kvaser_usb_hydra_map_channel_respfunction kvaser_usb_hydra_map_channelfunction kvaser_usb_hydra_get_single_capabilityfunction kvaser_usb_hydra_start_chip_replyfunction kvaser_usb_hydra_stop_chip_replyfunction kvaser_usb_hydra_flush_queue_replyfunction kvaser_usb_hydra_get_busparams_replyfunction kvaser_usb_hydra_bus_status_to_can_statefunction kvaser_usb_hydra_change_statefunction kvaser_usb_hydra_update_state
Annotated Snippet
struct kvaser_cmd_map_ch_req {
char name[16];
u8 channel;
u8 reserved[11];
} __packed;
struct kvaser_cmd_map_ch_res {
u8 he_addr;
u8 channel;
u8 reserved[26];
} __packed;
struct kvaser_cmd_card_info {
__le32 serial_number;
__le32 clock_res;
__le32 mfg_date;
__le32 ean[2];
u8 hw_revision;
u8 usb_mode;
u8 hw_type;
u8 reserved0;
u8 nchannels;
u8 reserved1[3];
} __packed;
struct kvaser_cmd_sw_info {
u8 reserved0[8];
__le16 max_outstanding_tx;
u8 reserved1[18];
} __packed;
struct kvaser_cmd_sw_detail_req {
u8 use_ext_cmd;
u8 reserved[27];
} __packed;
/* Software detail flags */
#define KVASER_USB_HYDRA_SW_FLAG_FW_BETA BIT(2)
#define KVASER_USB_HYDRA_SW_FLAG_FW_BAD BIT(4)
#define KVASER_USB_HYDRA_SW_FLAG_FREQ_80M BIT(5)
#define KVASER_USB_HYDRA_SW_FLAG_EXT_CMD BIT(9)
#define KVASER_USB_HYDRA_SW_FLAG_CANFD BIT(10)
#define KVASER_USB_HYDRA_SW_FLAG_NONISO BIT(11)
#define KVASER_USB_HYDRA_SW_FLAG_EXT_CAP BIT(12)
#define KVASER_USB_HYDRA_SW_FLAG_CAN_FREQ_80M BIT(13)
struct kvaser_cmd_sw_detail_res {
__le32 sw_flags;
__le32 sw_version;
__le32 sw_name;
__le32 ean[2];
__le32 max_bitrate;
u8 reserved[4];
} __packed;
/* Sub commands for cap_req and cap_res */
#define KVASER_USB_HYDRA_CAP_CMD_LISTEN_MODE 0x02
#define KVASER_USB_HYDRA_CAP_CMD_ERR_REPORT 0x05
#define KVASER_USB_HYDRA_CAP_CMD_ONE_SHOT 0x06
struct kvaser_cmd_cap_req {
__le16 cap_cmd;
u8 reserved[26];
} __packed;
/* Status codes for cap_res */
#define KVASER_USB_HYDRA_CAP_STAT_OK 0x00
#define KVASER_USB_HYDRA_CAP_STAT_NOT_IMPL 0x01
#define KVASER_USB_HYDRA_CAP_STAT_UNAVAIL 0x02
struct kvaser_cmd_cap_res {
__le16 cap_cmd;
__le16 status;
__le32 mask;
__le32 value;
u8 reserved[16];
} __packed;
/* CMD_ERROR_EVENT error codes */
#define KVASER_USB_HYDRA_ERROR_EVENT_CAN 0x01
#define KVASER_USB_HYDRA_ERROR_EVENT_PARAM 0x09
struct kvaser_cmd_error_event {
__le16 timestamp[3];
u8 reserved;
u8 error_code;
__le16 info1;
__le16 info2;
} __packed;
/* Chip state status flags. Used for chip_state_event and err_frame_data. */
#define KVASER_USB_HYDRA_BUS_ERR_ACT 0x00
#define KVASER_USB_HYDRA_BUS_ERR_PASS BIT(5)
#define KVASER_USB_HYDRA_BUS_BUS_OFF BIT(6)
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/completion.h`, `linux/device.h`, `linux/gfp.h`, `linux/jiffies.h`, `linux/kernel.h`, `linux/netdevice.h`, `linux/spinlock.h`.
- Detected declarations: `struct kvaser_cmd_map_ch_req`, `struct kvaser_cmd_map_ch_res`, `struct kvaser_cmd_card_info`, `struct kvaser_cmd_sw_info`, `struct kvaser_cmd_sw_detail_req`, `struct kvaser_cmd_sw_detail_res`, `struct kvaser_cmd_cap_req`, `struct kvaser_cmd_cap_res`, `struct kvaser_cmd_error_event`, `struct kvaser_cmd_chip_state_event`.
- Atlas domain: Driver Families / drivers/net.
- 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.