drivers/net/can/usb/peak_usb/pcan_usb_fd.c
Source file repositories/reference/linux-study-clean/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/can/usb/peak_usb/pcan_usb_fd.c- Extension
.c- Size
- 39988 bytes
- Lines
- 1437
- 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.
- 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/ethtool.hlinux/module.hlinux/netdevice.hlinux/usb.hlinux/can.hlinux/can/dev.hlinux/can/error.hlinux/can/dev/peak_canfd.hpcan_usb_core.hpcan_usb_pro.h
Detected Declarations
struct pcan_usb_fd_ifstruct pcan_usb_fd_devicefunction pufd_omsg_get_channelfunction pcan_usb_fd_send_cmdfunction pcan_usb_fd_read_fwinfofunction pcan_usb_fd_build_restart_cmdfunction pcan_usb_fd_set_busfunction pcan_usb_fd_set_filter_stdfunction setfunction pcan_usb_fd_set_can_ledfunction pcan_usb_fd_set_clock_domainfunction pcan_usb_fd_set_bittiming_slowfunction pcan_usb_fd_set_bittiming_fastfunction pcan_usb_fd_get_can_channel_idfunction pcan_usb_fd_set_can_channel_idfunction pcan_usb_fd_restart_asyncfunction pcan_usb_fd_drv_loadedfunction pcan_usb_fd_decode_canmsgfunction pcan_usb_fd_decode_statusfunction pcan_usb_fd_decode_errorfunction pcan_usb_fd_decode_overrunfunction pcan_usb_fd_decode_tsfunction pcan_usb_fd_decode_buffunction pcan_usb_fd_encode_msgfunction pcan_usb_fd_startfunction pcan_usb_fd_get_berr_counterfunction pcan_usb_fd_probefunction pcan_usb_fd_stopfunction pcan_usb_fd_initfunction usedfunction pcan_usb_fd_exitfunction pcan_usb_fd_freefunction pcan_usb_fd_set_phys_id
Annotated Snippet
struct pcan_usb_fd_if {
struct peak_usb_device *dev[PCAN_USB_MAX_CHANNEL];
struct pcan_ufd_fw_info fw_info;
struct peak_time_ref time_ref;
int cm_ignore_count;
int dev_opened_count;
};
/* device information */
struct pcan_usb_fd_device {
struct peak_usb_device dev;
struct can_berr_counter bec;
struct pcan_usb_fd_if *usb_if;
u8 *cmd_buffer_addr;
};
/* Extended USB commands (non uCAN commands) */
/* Clock Modes command */
#define PCAN_UFD_CMD_CLK_SET 0x80
#define PCAN_UFD_CLK_80MHZ 0x0
#define PCAN_UFD_CLK_60MHZ 0x1
#define PCAN_UFD_CLK_40MHZ 0x2
#define PCAN_UFD_CLK_30MHZ 0x3
#define PCAN_UFD_CLK_24MHZ 0x4
#define PCAN_UFD_CLK_20MHZ 0x5
#define PCAN_UFD_CLK_DEF PCAN_UFD_CLK_80MHZ
struct __packed pcan_ufd_clock {
__le16 opcode_channel;
u8 mode;
u8 unused[5];
};
/* LED control command */
#define PCAN_UFD_CMD_LED_SET 0x86
#define PCAN_UFD_LED_DEV 0x00
#define PCAN_UFD_LED_FAST 0x01
#define PCAN_UFD_LED_SLOW 0x02
#define PCAN_UFD_LED_ON 0x03
#define PCAN_UFD_LED_OFF 0x04
#define PCAN_UFD_LED_DEF PCAN_UFD_LED_DEV
struct __packed pcan_ufd_led {
__le16 opcode_channel;
u8 mode;
u8 unused[5];
};
/* Extended usage of uCAN commands CMD_xxx_xx_OPTION for PCAN-USB Pro FD */
#define PCAN_UFD_FLTEXT_CALIBRATION 0x8000
struct __packed pcan_ufd_options {
__le16 opcode_channel;
__le16 ucan_mask;
u16 unused;
__le16 usb_mask;
};
/* Extended usage of uCAN messages for PCAN-USB Pro FD */
#define PCAN_UFD_MSG_CALIBRATION 0x100
struct __packed pcan_ufd_ts_msg {
__le16 size;
__le16 type;
__le32 ts_low;
__le32 ts_high;
__le16 usb_frame_index;
u16 unused;
};
#define PCAN_UFD_MSG_OVERRUN 0x101
#define PCAN_UFD_OVMSG_CHANNEL(o) ((o)->channel & 0xf)
struct __packed pcan_ufd_ovr_msg {
__le16 size;
__le16 type;
__le32 ts_low;
__le32 ts_high;
u8 channel;
u8 unused[3];
};
#define PCAN_UFD_CMD_DEVID_SET 0x81
Annotation
- Immediate include surface: `linux/ethtool.h`, `linux/module.h`, `linux/netdevice.h`, `linux/usb.h`, `linux/can.h`, `linux/can/dev.h`, `linux/can/error.h`, `linux/can/dev/peak_canfd.h`.
- Detected declarations: `struct pcan_usb_fd_if`, `struct pcan_usb_fd_device`, `function pufd_omsg_get_channel`, `function pcan_usb_fd_send_cmd`, `function pcan_usb_fd_read_fwinfo`, `function pcan_usb_fd_build_restart_cmd`, `function pcan_usb_fd_set_bus`, `function pcan_usb_fd_set_filter_std`, `function set`, `function pcan_usb_fd_set_can_led`.
- Atlas domain: Driver Families / drivers/net.
- 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.