Commit 3ef5247e authored by Stephane Grosjean's avatar Stephane Grosjean Committed by Marc Kleine-Budde

can: peak_usb: rename usb option cmds definition and structs

The PUCAN_CMD_RX_FRAME_(ENABLE|DISABLE) command has extended its purpose
and was therefore renamed to PUCAN_CMD_SET_(EN|DIS)_OPTION.
Signed-off-by: default avatarStephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Tested-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 37920a74
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#define PUCAN_CMD_FILTER_STD 0x008 #define PUCAN_CMD_FILTER_STD 0x008
#define PUCAN_CMD_TX_ABORT 0x009 #define PUCAN_CMD_TX_ABORT 0x009
#define PUCAN_CMD_WR_ERR_CNT 0x00a #define PUCAN_CMD_WR_ERR_CNT 0x00a
#define PUCAN_CMD_RX_FRAME_ENABLE 0x00b #define PUCAN_CMD_SET_EN_OPTION 0x00b
#define PUCAN_CMD_RX_FRAME_DISABLE 0x00c #define PUCAN_CMD_CLR_DIS_OPTION 0x00c
#define PUCAN_CMD_END_OF_COLLECTION 0x3ff #define PUCAN_CMD_END_OF_COLLECTION 0x3ff
/* uCAN received messages list */ /* uCAN received messages list */
...@@ -101,14 +101,14 @@ struct __packed pucan_wr_err_cnt { ...@@ -101,14 +101,14 @@ struct __packed pucan_wr_err_cnt {
u16 unused; u16 unused;
}; };
/* uCAN RX_FRAME_ENABLE command fields */ /* uCAN SET_EN/CLR_DIS _OPTION command fields */
#define PUCAN_FLTEXT_ERROR 0x0001 #define PUCAN_OPTION_ERROR 0x0001
#define PUCAN_FLTEXT_BUSLOAD 0x0002 #define PUCAN_OPTION_BUSLOAD 0x0002
struct __packed pucan_filter_ext { struct __packed pucan_options {
__le16 opcode_channel; __le16 opcode_channel;
__le16 ext_mask; __le16 options;
u32 unused; u32 unused;
}; };
......
...@@ -110,13 +110,13 @@ struct __packed pcan_ufd_led { ...@@ -110,13 +110,13 @@ struct __packed pcan_ufd_led {
u8 unused[5]; u8 unused[5];
}; };
/* Extended usage of uCAN commands CMD_RX_FRAME_xxxABLE for PCAN-USB Pro FD */ /* Extended usage of uCAN commands CMD_xxx_xx_OPTION for PCAN-USB Pro FD */
#define PCAN_UFD_FLTEXT_CALIBRATION 0x8000 #define PCAN_UFD_FLTEXT_CALIBRATION 0x8000
struct __packed pcan_ufd_filter_ext { struct __packed pcan_ufd_options {
__le16 opcode_channel; __le16 opcode_channel;
__le16 ext_mask; __le16 ucan_mask;
u16 unused; u16 unused;
__le16 usb_mask; __le16 usb_mask;
}; };
...@@ -321,21 +321,21 @@ static int pcan_usb_fd_set_filter_std(struct peak_usb_device *dev, int idx, ...@@ -321,21 +321,21 @@ static int pcan_usb_fd_set_filter_std(struct peak_usb_device *dev, int idx,
return pcan_usb_fd_send_cmd(dev, cmd); return pcan_usb_fd_send_cmd(dev, cmd);
} }
/* set/unset notifications filter: /* set/unset options
* *
* onoff sets(1)/unset(0) notifications * onoff set(1)/unset(0) options
* mask each bit defines a kind of notification to set/unset * mask each bit defines a kind of options to set/unset
*/ */
static int pcan_usb_fd_set_filter_ext(struct peak_usb_device *dev, static int pcan_usb_fd_set_options(struct peak_usb_device *dev,
bool onoff, u16 ext_mask, u16 usb_mask) bool onoff, u16 ucan_mask, u16 usb_mask)
{ {
struct pcan_ufd_filter_ext *cmd = pcan_usb_fd_cmd_buffer(dev); struct pcan_ufd_options *cmd = pcan_usb_fd_cmd_buffer(dev);
cmd->opcode_channel = pucan_cmd_opcode_channel(dev, cmd->opcode_channel = pucan_cmd_opcode_channel(dev,
(onoff) ? PUCAN_CMD_RX_FRAME_ENABLE : (onoff) ? PUCAN_CMD_SET_EN_OPTION :
PUCAN_CMD_RX_FRAME_DISABLE); PUCAN_CMD_CLR_DIS_OPTION);
cmd->ext_mask = cpu_to_le16(ext_mask); cmd->ucan_mask = cpu_to_le16(ucan_mask);
cmd->usb_mask = cpu_to_le16(usb_mask); cmd->usb_mask = cpu_to_le16(usb_mask);
/* send the command */ /* send the command */
...@@ -770,9 +770,9 @@ static int pcan_usb_fd_start(struct peak_usb_device *dev) ...@@ -770,9 +770,9 @@ static int pcan_usb_fd_start(struct peak_usb_device *dev)
&pcan_usb_pro_fd); &pcan_usb_pro_fd);
/* enable USB calibration messages */ /* enable USB calibration messages */
err = pcan_usb_fd_set_filter_ext(dev, 1, err = pcan_usb_fd_set_options(dev, 1,
PUCAN_FLTEXT_ERROR, PUCAN_OPTION_ERROR,
PCAN_UFD_FLTEXT_CALIBRATION); PCAN_UFD_FLTEXT_CALIBRATION);
} }
pdev->usb_if->dev_opened_count++; pdev->usb_if->dev_opened_count++;
...@@ -806,9 +806,9 @@ static int pcan_usb_fd_stop(struct peak_usb_device *dev) ...@@ -806,9 +806,9 @@ static int pcan_usb_fd_stop(struct peak_usb_device *dev)
/* turn off special msgs for that interface if no other dev opened */ /* turn off special msgs for that interface if no other dev opened */
if (pdev->usb_if->dev_opened_count == 1) if (pdev->usb_if->dev_opened_count == 1)
pcan_usb_fd_set_filter_ext(dev, 0, pcan_usb_fd_set_options(dev, 0,
PUCAN_FLTEXT_ERROR, PUCAN_OPTION_ERROR,
PCAN_UFD_FLTEXT_CALIBRATION); PCAN_UFD_FLTEXT_CALIBRATION);
pdev->usb_if->dev_opened_count--; pdev->usb_if->dev_opened_count--;
return 0; return 0;
...@@ -937,9 +937,9 @@ static void pcan_usb_fd_exit(struct peak_usb_device *dev) ...@@ -937,9 +937,9 @@ static void pcan_usb_fd_exit(struct peak_usb_device *dev)
if (dev->ctrl_idx == 0) { if (dev->ctrl_idx == 0) {
/* turn off calibration message if any device were opened */ /* turn off calibration message if any device were opened */
if (pdev->usb_if->dev_opened_count > 0) if (pdev->usb_if->dev_opened_count > 0)
pcan_usb_fd_set_filter_ext(dev, 0, pcan_usb_fd_set_options(dev, 0,
PUCAN_FLTEXT_ERROR, PUCAN_OPTION_ERROR,
PCAN_UFD_FLTEXT_CALIBRATION); PCAN_UFD_FLTEXT_CALIBRATION);
/* tell USB adapter that the driver is being unloaded */ /* tell USB adapter that the driver is being unloaded */
pcan_usb_fd_drv_loaded(dev, 0); pcan_usb_fd_drv_loaded(dev, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment