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
e7ca61e4
Commit
e7ca61e4
authored
Aug 02, 2018
by
Martin Jeřábek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
driver: timing: correctly distribute tseg1 into prop_seg and phase_seg1
Closes
#177
parent
beb8f7ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
5 deletions
+37
-5
driver/ctu_can_fd_hw.c
driver/ctu_can_fd_hw.c
+37
-5
No files found.
driver/ctu_can_fd_hw.c
View file @
e7ca61e4
...
...
@@ -356,9 +356,25 @@ void ctu_can_fd_set_nom_bittiming(struct ctucanfd_priv *priv,
const
struct
can_bittiming
*
nbt
)
{
union
ctu_can_fd_btr
btr
;
btr
.
u32
=
0
;
btr
.
s
.
prop
=
nbt
->
prop_seg
;
btr
.
s
.
ph1
=
nbt
->
phase_seg1
;
/*
* The timing calculation functions have only constraints on tseg1,
* which is prop_seg + phase1_seg combined. tseg1 is then split in half
* and stored into prog_seg and phase_seg1. In CTU CAN FD, PROP is 7 bits
* wide but PH1 only 6, so we must re-distribute the values here.
* TODO: get the fixed values to the kernel, so that they are displayed
* accurately
*/
u32
prop_seg
=
nbt
->
prop_seg
;
u32
phase_seg1
=
nbt
->
phase_seg1
;
if
(
phase_seg1
>
63
)
{
prop_seg
+=
phase_seg1
-
63
;
phase_seg1
=
63
;
}
btr
.
u32
=
0
;
btr
.
s
.
prop
=
prop_seg
;
btr
.
s
.
ph1
=
phase_seg1
;
btr
.
s
.
ph2
=
nbt
->
phase_seg2
;
btr
.
s
.
brp
=
nbt
->
brp
;
btr
.
s
.
sjw
=
nbt
->
sjw
;
...
...
@@ -370,9 +386,25 @@ void ctu_can_fd_set_data_bittiming(struct ctucanfd_priv *priv,
const
struct
can_bittiming
*
dbt
)
{
union
ctu_can_fd_btr_fd
btr_fd
;
/*
* The timing calculation functions have only constraints on tseg1,
* which is prop_seg + phase1_seg combined. tseg1 is then split in half
* and stored into prog_seg and phase_seg1. In CTU CAN FD, PROP_FD is 6 bits
* wide but PH1_FD only 5, so we must re-distribute the values here.
* TODO: get the fixed values to the kernel, so that they are displayed
* accurately
*/
u32
prop_seg
=
dbt
->
prop_seg
;
u32
phase_seg1
=
dbt
->
phase_seg1
;
if
(
phase_seg1
>
31
)
{
prop_seg
+=
phase_seg1
-
31
;
phase_seg1
=
31
;
}
btr_fd
.
u32
=
0
;
btr_fd
.
s
.
prop_fd
=
dbt
->
prop_seg
;
btr_fd
.
s
.
ph1_fd
=
dbt
->
phase_seg1
;
btr_fd
.
s
.
prop_fd
=
prop_seg
;
btr_fd
.
s
.
ph1_fd
=
phase_seg1
;
btr_fd
.
s
.
ph2_fd
=
dbt
->
phase_seg2
;
btr_fd
.
s
.
brp_fd
=
dbt
->
brp
;
btr_fd
.
s
.
sjw_fd
=
dbt
->
sjw
;
...
...
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