Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PPSi
Commits
8e1f78bf
Commit
8e1f78bf
authored
Mar 22, 2023
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fsm.c,ppsi.h: outline pdstate_ functions
parent
5e5b707b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
39 deletions
+48
-39
fsm.c
fsm.c
+44
-0
ppsi.h
include/ppsi/ppsi.h
+4
-39
No files found.
fsm.c
View file @
8e1f78bf
...
...
@@ -359,3 +359,47 @@ int pp_state_machine(struct pp_instance *ppi, void *buf, int len)
return
ppi
->
next_delay
;
}
/* link state functions to manage the extension (Enable/disable) */
void
pdstate_disable_extension
(
struct
pp_instance
*
ppi
)
{
ppi
->
pdstate
=
PP_PDSTATE_FAILURE
;
if
(
ppi
->
extState
==
PP_EXSTATE_ACTIVE
)
{
if
(
ppi
->
ptp_support
)
ppi
->
extState
=
ppi
->
ptp_support
?
PP_EXSTATE_PTP
:
PP_EXSTATE_DISABLE
;
pp_servo_init
(
ppi
);
// Reinitialize the servo
if
(
is_ext_hook_available
(
ppi
,
extension_state_changed
)
)
ppi
->
ext_hooks
->
extension_state_changed
(
ppi
);
}
}
void
pdstate_set_state_pdetection
(
struct
pp_instance
*
ppi
)
{
if
(
ppi
->
pdstate
!=
PP_PDSTATE_NONE
)
{
ppi
->
pdstate
=
PP_PDSTATE_PDETECTION
;
pp_timeout_reset
(
ppi
,
PP_TO_PROT_STATE
);
}
}
void
pdstate_set_state_pdetected
(
struct
pp_instance
*
ppi
)
{
if
(
ppi
->
pdstate
!=
PP_PDSTATE_NONE
)
{
ppi
->
pdstate
=
PP_PDSTATE_PDETECTED
;
pp_timeout_reset
(
ppi
,
PP_TO_PROT_STATE
);
}
}
/* link state functions to manage the extension (Enable/disable) */
void
pdstate_enable_extension
(
struct
pp_instance
*
ppi
)
{
if
(
ppi
->
pdstate
==
PP_PDSTATE_NONE
)
return
;
ppi
->
pdstate
=
PP_PDSTATE_PDETECTED
;
pp_timeout_reset
(
ppi
,
PP_TO_PROT_STATE
);
if
(
ppi
->
extState
!=
PP_EXSTATE_ACTIVE
)
{
ppi
->
extState
=
PP_EXSTATE_ACTIVE
;
if
(
is_ext_hook_available
(
ppi
,
extension_state_changed
)
)
ppi
->
ext_hooks
->
extension_state_changed
(
ppi
);
}
}
include/ppsi/ppsi.h
View file @
8e1f78bf
...
...
@@ -452,45 +452,10 @@ extern int ppsi_drop_rx(void);
extern
int
ppsi_drop_tx
(
void
);
/* link state functions to manage the extension (Enable/disable) */
static
inline
void
pdstate_disable_extension
(
struct
pp_instance
*
ppi
)
{
ppi
->
pdstate
=
PP_PDSTATE_FAILURE
;
if
(
ppi
->
extState
==
PP_EXSTATE_ACTIVE
)
{
if
(
ppi
->
ptp_support
)
ppi
->
extState
=
ppi
->
ptp_support
?
PP_EXSTATE_PTP
:
PP_EXSTATE_DISABLE
;
pp_servo_init
(
ppi
);
// Reinitialize the servo
if
(
is_ext_hook_available
(
ppi
,
extension_state_changed
)
)
ppi
->
ext_hooks
->
extension_state_changed
(
ppi
);
}
}
static
inline
void
pdstate_set_state_pdetection
(
struct
pp_instance
*
ppi
)
{
if
(
ppi
->
pdstate
!=
PP_PDSTATE_NONE
)
{
ppi
->
pdstate
=
PP_PDSTATE_PDETECTION
;
pp_timeout_reset
(
ppi
,
PP_TO_PROT_STATE
);
}
}
static
inline
void
pdstate_set_state_pdetected
(
struct
pp_instance
*
ppi
)
{
if
(
ppi
->
pdstate
!=
PP_PDSTATE_NONE
)
{
ppi
->
pdstate
=
PP_PDSTATE_PDETECTED
;
pp_timeout_reset
(
ppi
,
PP_TO_PROT_STATE
);
}
}
/* link state functions to manage the extension (Enable/disable) */
static
inline
void
pdstate_enable_extension
(
struct
pp_instance
*
ppi
)
{
if
(
ppi
->
pdstate
!=
PP_PDSTATE_NONE
)
{
ppi
->
pdstate
=
PP_PDSTATE_PDETECTED
;
pp_timeout_reset
(
ppi
,
PP_TO_PROT_STATE
);
if
(
ppi
->
extState
!=
PP_EXSTATE_ACTIVE
)
{
ppi
->
extState
=
PP_EXSTATE_ACTIVE
;
if
(
is_ext_hook_available
(
ppi
,
extension_state_changed
)
)
ppi
->
ext_hooks
->
extension_state_changed
(
ppi
);
}
}
}
extern
void
pdstate_disable_extension
(
struct
pp_instance
*
ppi
);
extern
void
pdstate_set_state_pdetection
(
struct
pp_instance
*
ppi
);
extern
void
pdstate_set_state_pdetected
(
struct
pp_instance
*
ppi
);
extern
void
pdstate_enable_extension
(
struct
pp_instance
*
ppi
);
#include <ppsi/faults.h>
#include <ppsi/timeout_prot.h>
...
...
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