Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CTU CAN FD IP Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canbus
CTU CAN FD IP Core
Commits
900a162b
Commit
900a162b
authored
Jun 21, 2019
by
Pavel Pisa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
driver: report captured error type and position.
Signed-off-by:
Pavel Pisa
<
pisa@cmp.felk.cvut.cz
>
parent
39913733
Pipeline
#8746
passed with stage
in 21 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
5 deletions
+38
-5
driver/ctu_can_fd.c
driver/ctu_can_fd.c
+7
-2
driver/ctu_can_fd_hw.h
driver/ctu_can_fd_hw.h
+16
-0
driver/ctu_can_fd_userspace.cpp
driver/ctu_can_fd_userspace.cpp
+15
-3
No files found.
driver/ctu_can_fd.c
View file @
900a162b
...
...
@@ -385,11 +385,16 @@ static void ctucan_err_interrupt(struct net_device *ndev,
struct
can_frame
*
cf
;
struct
sk_buff
*
skb
;
struct
can_berr_counter
berr
;
union
ctu_can_fd_err_capt_alc
err_capt_alc
;
ctu_can_fd_read_err_ctrs
(
&
priv
->
p
,
&
berr
);
netdev_info
(
ndev
,
"%s: ISR = 0x%08x, rxerr %d, txerr %d"
,
__func__
,
isr
.
u32
,
berr
.
rxerr
,
berr
.
txerr
);
err_capt_alc
=
ctu_can_fd_read_err_capt_alc
(
&
priv
->
p
);
netdev_info
(
ndev
,
"%s: ISR = 0x%08x, rxerr %d, txerr %d, error type %u, pos %u, ALC id_field %u, bit %u
\n
"
,
__func__
,
isr
.
u32
,
berr
.
rxerr
,
berr
.
txerr
,
err_capt_alc
.
s
.
err_type
,
err_capt_alc
.
s
.
err_pos
,
err_capt_alc
.
s
.
alc_id_field
,
err_capt_alc
.
s
.
alc_bit
);
skb
=
alloc_can_err_skb
(
ndev
,
&
cf
);
...
...
driver/ctu_can_fd_hw.h
View file @
900a162b
...
...
@@ -566,6 +566,22 @@ enum can_state ctu_can_fd_read_error_state(struct ctucanfd_priv *priv);
void
ctu_can_fd_set_err_ctrs
(
struct
ctucanfd_priv
*
priv
,
const
struct
can_berr_counter
*
ctr
);
/*
* Read core captured last error or arbitration lost reason.
*
* Arguments:
* priv Private info
* Returns:
* Error state of the CTU CAN FD.
*/
static
inline
union
ctu_can_fd_err_capt_alc
ctu_can_fd_read_err_capt_alc
(
struct
ctucanfd_priv
*
priv
)
{
union
ctu_can_fd_err_capt_alc
res
;
res
.
u32
=
priv
->
read_reg
(
priv
,
CTU_CAN_FD_ERR_CAPT
);
return
res
;
}
/*
* Check Mask filters support of given filter.
*
...
...
driver/ctu_can_fd_userspace.cpp
View file @
900a162b
...
...
@@ -191,7 +191,6 @@ timespec_sub (struct timespec *diff, const struct timespec *left,
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
uintptr_t
addr_base
=
0
;
...
...
@@ -428,11 +427,16 @@ int main(int argc, char *argv[])
union
ctu_can_fd_rx_mem_info
reg
;
reg
.
u32
=
ctu_can_fd_read32
(
priv
,
CTU_CAN_FD_RX_MEM_INFO
);
u32
rxsz
=
reg
.
s
.
rx_buff_size
-
reg
.
s
.
rx_mem_free
;
union
ctu_can_fd_status
status
=
ctu_can_get_status
(
priv
);
union
ctu_can_fd_err_capt_alc
err_capt_alc
;
union
ctu_can_fd_int_stat
int_stat
=
ctu_can_fd_int_sts
(
priv
);
ctu_can_fd_int_clr
(
priv
,
int_stat
);
printf
(
"%u RX frames, %u words"
,
nrxf
,
rxsz
);
printf
(
", status 0x%08h
hx"
,
ctu_can_fd_read32
(
priv
,
CTU_CAN_FD_STATUS
)
);
printf
(
", status 0x%08h
x"
,
status
.
u32
);
printf
(
", settings 0x%04hhx"
,
ctu_can_fd_read16
(
priv
,
CTU_CAN_FD_SETTINGS
));
printf
(
", INT_STAT 0x%04h
hx"
,
ctu_can_fd_read16
(
priv
,
CTU_CAN_FD_INT_STAT
)
);
printf
(
", INT_STAT 0x%04h
x"
,
int_stat
.
u32
);
printf
(
", INT_ENA_SET 0x%04hx"
,
priv
->
read_reg
(
priv
,
CTU_CAN_FD_INT_ENA_SET
));
printf
(
", INT_MASK_SET 0x%04hx"
,
priv
->
read_reg
(
priv
,
CTU_CAN_FD_INT_MASK_SET
));
printf
(
", TX_STATUS 0x%04hx"
,
priv
->
read_reg
(
priv
,
CTU_CAN_FD_TX_STATUS
));
...
...
@@ -440,6 +444,14 @@ int main(int argc, char *argv[])
printf
(
", TRV_DELAY 0x%0hx"
,
priv
->
read_reg
(
priv
,
CTU_CAN_FD_TRV_DELAY
));
printf
(
"
\n
"
);
if
(
status
.
s
.
ewl
)
{
err_capt_alc
=
ctu_can_fd_read_err_capt_alc
(
priv
);
printf
(
"ERROR type %u pos %u ALC id_field %u bit %u
\n
"
,
err_capt_alc
.
s
.
err_type
,
err_capt_alc
.
s
.
err_pos
,
err_capt_alc
.
s
.
alc_id_field
,
err_capt_alc
.
s
.
alc_bit
);
}
/*
while (rxsz--) {
u32 data = priv->read_reg(priv, CTU_CAN_FD_RX_DATA);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment