summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorGavin.Bai <gavin_8724@163.com>2019-04-18 15:46:39 (GMT)
committer Gavin.Bai <gavin_8724@163.com>2019-04-18 15:46:39 (GMT)
commit99629e1ad32b3f53b9aa981d816d5e8b73642f00 (patch)
tree05f245985aefec385d37bcd77ecc242b9acb64b1
parent92baf5d4e755f48b70a9223c932e9cb383fc2b6f (diff)
downloadAIC-OS-99629e1ad32b3f53b9aa981d816d5e8b73642f00.zip
Add SJA1000 CAN filter ioctl command.
-rw-r--r--SylixOS/driver/can/sja1000.c15
-rw-r--r--SylixOS/driver/can/sja1000.h2
2 files changed, 9 insertions, 8 deletions
diff --git a/SylixOS/driver/can/sja1000.c b/SylixOS/driver/can/sja1000.c
index 2761c15..d3cb6d4 100644
--- a/SylixOS/driver/can/sja1000.c
+++ b/SylixOS/driver/can/sja1000.c
@@ -700,14 +700,13 @@ static INT sja1000Ioctl (SJA1000_CHAN *pcanchan, INT cmd, LONG arg)
sja1000TxStartup(pcanchan);
break;
- case CAN_DEV_GET_DEV_ECC_CODE: /* 获取错误代码捕捉寄存器的值 */
- mode = GET_REG(pcanchan, ECC);
- *(UINT8 *)arg = mode;
- break;
-
- case CAN_DEV_GET_DEV_IDT_CODE: /* 获取仲裁丢失捕捉寄存器的值 */
- mode = GET_REG(pcanchan, ALC);
- *(UINT8 *)arg = mode;
+ case SJA1000_SET_FLITER: /* sja1000 filter */
+ if (arg) {
+ SJA1000_FILTER *pfilter = (SJA1000_FILTER *)arg;
+ pcanchan->filter.acr_code = pfilter->acr_code;
+ pcanchan->filter.amr_code = pfilter->amr_code;
+ pcanchan->filter.mode = pfilter->mode;
+ }
break;
default:
diff --git a/SylixOS/driver/can/sja1000.h b/SylixOS/driver/can/sja1000.h
index 46fe39c..145ec4b 100644
--- a/SylixOS/driver/can/sja1000.h
+++ b/SylixOS/driver/can/sja1000.h
@@ -185,6 +185,8 @@ typedef struct sja1000_filter {
int mode; /* 1:singel 0:double */
} SJA1000_FILTER;
+#define SJA1000_SET_FLITER (FIOUSRFUNC + 1) /* set sja1000 filter */
+
/*********************************************************************************************************
sja1000 can channel
*********************************************************************************************************/