diff options
Diffstat (limited to 'policy_manager/stm/zipc/StateTransitionor/AccelPedal')
4 files changed, 217 insertions, 0 deletions
diff --git a/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedal.c b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedal.c new file mode 100644 index 0000000..fa692ee --- /dev/null +++ b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedal.c @@ -0,0 +1,117 @@ +/************************************************************/ +/* ZACCEL_AccelPedal.c */ +/* AccelPedal State transition model source file */ +/* ZIPC Designer Version 1.2.0 */ +/************************************************************/ +#include "../ZST_include.h" + +/* State management variable */ +static uint8_t ZACCEL_AccelPedalState[ZACCEL_ACCELPEDALSTATENOMAX]; + +static void ZACCEL_AccelPedals0e1( void ); +static void ZACCEL_AccelPedals1e0( void ); +static void ZACCEL_AccelPedals0Event( void ); +static void ZACCEL_AccelPedals1Event( void ); + +/****************************************/ +/* Action function */ +/* STM : AccelPedal */ +/* State : accel_pedal_off( No 0 ) */ +/* Event : evt_accel_pedal_on( No 1 ) */ +/****************************************/ +static void ZACCEL_AccelPedals0e1( void ) +{ + ZACCEL_AccelPedalState[ZACCEL_ACCELPEDAL] = ( uint8_t )ZACCEL_ACCELPEDALS1; + stm_aps_start_activity_accel_pedal_on(); +} + +/****************************************/ +/* Action function */ +/* STM : AccelPedal */ +/* State : accel_pedal_on( No 1 ) */ +/* Event : evt_accel_pedal_off( No 0 )*/ +/****************************************/ +static void ZACCEL_AccelPedals1e0( void ) +{ + ZACCEL_AccelPedalState[ZACCEL_ACCELPEDAL] = ( uint8_t )ZACCEL_ACCELPEDALS0; + stm_aps_start_activity_accel_pedal_off(); +} + +/****************************************/ +/* Event appraisal function */ +/* STM : AccelPedal */ +/* State : accel_pedal_off( No 0 ) */ +/****************************************/ +static void ZACCEL_AccelPedals0Event( void ) +{ + /*evt_accel_pedal_on*/ + if( g_stm_event == StmEvtNoAccelPedalOn ) + { + ZACCEL_AccelPedals0e1(); + } + else + { + /*Else and default design have not done.*/ + /*Please confirm the STM and design else and default.*/ + } +} + +/****************************************/ +/* Event appraisal function */ +/* STM : AccelPedal */ +/* State : accel_pedal_on( No 1 ) */ +/****************************************/ +static void ZACCEL_AccelPedals1Event( void ) +{ + /*evt_accel_pedal_off*/ + if( g_stm_event == StmEvtNoAccelPedalOff ) + { + ZACCEL_AccelPedals1e0(); + } + else + { + /*Else and default design have not done.*/ + /*Please confirm the STM and design else and default.*/ + } +} + +/****************************************/ +/* Event call function */ +/* STM : AccelPedal */ +/****************************************/ +void stm_aps_event_call( void ) +{ + stm_aps_start_stm(); + switch( ZACCEL_AccelPedalState[ZACCEL_ACCELPEDAL] ) + { + case ZACCEL_ACCELPEDALS0: + ZACCEL_AccelPedals0Event(); + break; + case ZACCEL_ACCELPEDALS1: + ZACCEL_AccelPedals1Event(); + break; + default: + /*Not accessible to this else (default).*/ + break; + } +} + +/****************************************/ +/* Initial function */ +/* STM : AccelPedal */ +/****************************************/ +void stm_aps_initialize( void ) +{ + ZACCEL_AccelPedalState[ZACCEL_ACCELPEDAL] = ( uint8_t )ZACCEL_ACCELPEDALS0; + stm_aps_start_activity_accel_pedal_off(); +} + +/****************************************/ +/* Terminate function */ +/* STM : AccelPedal */ +/****************************************/ +void ZACCEL_AccelPedalTerminate( void ) +{ + ZACCEL_AccelPedalState[ZACCEL_ACCELPEDAL] = ( uint8_t )ZACCEL_ACCELPEDALTERMINATE; +} + diff --git a/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedal.h b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedal.h new file mode 100644 index 0000000..40da956 --- /dev/null +++ b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedal.h @@ -0,0 +1,41 @@ +/************************************************************/ +/* ZACCEL_AccelPedal.h */ +/* AccelPedal State transition model header file */ +/* ZIPC Designer Version 1.2.0 */ +/************************************************************/ +#ifndef ZHEADER_ZACCEL_ACCELPEDAL_H +#define ZHEADER_ZACCEL_ACCELPEDAL_H + +/*State management variable access define*/ +#define ZACCEL_ACCELPEDAL ( 0U ) +#define ZACCEL_ACCELPEDALS0 ( 0U ) +#define ZACCEL_ACCELPEDALS1 ( 1U ) +#define ZACCEL_ACCELPEDALSTATENOMAX ( 1U ) + +/*End state define*/ +#define ZACCEL_ACCELPEDALEND ( 2U ) +/*Terminate state define*/ +#define ZACCEL_ACCELPEDALTERMINATE ( ZACCEL_ACCELPEDALEND + 1U ) + +/*State no define*/ +#define ZACCEL_ACCELPEDALS0STATENO ( 0U ) +#define ZACCEL_ACCELPEDALS1STATENO ( 1U ) + +/*State serial no define*/ +#define ZACCEL_ACCELPEDALS0STATESERIALNO ( 0U ) +#define ZACCEL_ACCELPEDALS1STATESERIALNO ( 1U ) + +/*Event no define*/ +#define ZACCEL_ACCELPEDALE0EVENTNO ( 0U ) +#define ZACCEL_ACCELPEDALE1EVENTNO ( 1U ) + +/*Event serial no define*/ +#define ZACCEL_ACCELPEDALE0EVENTSERIALNO ( 0U ) +#define ZACCEL_ACCELPEDALE1EVENTSERIALNO ( 1U ) + +/*Extern function*/ +extern void stm_aps_event_call( void ); +extern void stm_aps_initialize( void ); +extern void ZACCEL_AccelPedalTerminate( void ); + +#endif diff --git a/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedalState_func.c b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedalState_func.c new file mode 100644 index 0000000..1fd9c2a --- /dev/null +++ b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedalState_func.c @@ -0,0 +1,45 @@ +/************************************************************/ +/* ZACCEL_AccelPedalState_func.c */ +/* Function and variable source file */ +/* ZIPC Designer Version 1.2.0 */ +/************************************************************/ +#include "../ZST_include.h" + +/************************************************************* + Function definition +*************************************************************/ + +/* + * @name stm_aps_start_activity_accel_pedal_off + */ +void stm_aps_start_activity_accel_pedal_off() { + g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state = StmAccelPedalSttNoOff; + g_stm_crr_state.car_element[StmCarElementNoAccelPedal].changed = STM_TRUE; +} + +/* + * @name stm_aps_start_activity_accel_pedal_on + */ +void stm_aps_start_activity_accel_pedal_on() { + g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state = StmAccelPedalSttNoOn; + g_stm_crr_state.car_element[StmCarElementNoAccelPedal].changed = STM_TRUE; +} + +/* + * @name stm_aps_initialize_variable + */ +void stm_aps_initialize_variable() { + g_stm_prv_state.car_element[StmCarElementNoAccelPedal].state = StmAccelPedalSttNoOff; + g_stm_prv_state.car_element[StmCarElementNoAccelPedal].changed = STM_FALSE; + + g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state = StmAccelPedalSttNoOff; + g_stm_crr_state.car_element[StmCarElementNoAccelPedal].changed = STM_FALSE; +} + +/* + * @name stm_aps_start_stm + */ +void stm_aps_start_stm() { + g_stm_prv_state.car_element[StmCarElementNoAccelPedal].state = g_stm_crr_state.car_element[StmCarElementNoAccelPedal].state; + g_stm_crr_state.car_element[StmCarElementNoAccelPedal].changed = STM_FALSE; +} diff --git a/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedalState_func.h b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedalState_func.h new file mode 100644 index 0000000..7d36cd0 --- /dev/null +++ b/policy_manager/stm/zipc/StateTransitionor/AccelPedal/ZACCEL_AccelPedalState_func.h @@ -0,0 +1,14 @@ +/************************************************************/ +/* ZACCEL_AccelPedalState_func.h */ +/* Function and variable header file */ +/* ZIPC Designer Version 1.2.0 */ +/************************************************************/ +#ifndef ZHEADER_ZACCEL_ACCELPEDALSTATE_FUNC_H +#define ZHEADER_ZACCEL_ACCELPEDALSTATE_FUNC_H + +extern void stm_aps_start_activity_accel_pedal_off(); +extern void stm_aps_start_activity_accel_pedal_on(); +extern void stm_aps_initialize_variable(); +extern void stm_aps_start_stm(); + +#endif |