12 #include "dev_boost_pconfig.h" 13 #include "dev_boost_typedef.h" 14 #include "dev_boost_substates.h" 15 #include "dev_boost_special_functions.h" 20 volatile uint16_t __attribute__((always_inline)) State_Error(
volatile struct BOOST_CONVERTER_s *boostInstance);
21 volatile uint16_t __attribute__((always_inline)) State_Initialize(
volatile struct BOOST_CONVERTER_s *boostInstance);
22 volatile uint16_t __attribute__((always_inline)) State_Reset(
volatile struct BOOST_CONVERTER_s *boostInstance);
23 volatile uint16_t __attribute__((always_inline)) State_Standby(
volatile struct BOOST_CONVERTER_s *boostInstance);
24 volatile uint16_t __attribute__((always_inline)) State_RampUp(
volatile struct BOOST_CONVERTER_s *boostInstance);
25 volatile uint16_t __attribute__((always_inline)) State_Online(
volatile struct BOOST_CONVERTER_s *boostInstance);
28 volatile uint16_t (*BoostConverterStateMachine[])(
volatile struct BOOST_CONVERTER_s *boostInstance) =
39 volatile uint16_t BoostStateList_size = (
sizeof(BoostConverterStateMachine)/
sizeof(BoostConverterStateMachine[0]));
54 volatile uint16_t State_Initialize(
volatile struct BOOST_CONVERTER_s *boostInstance)
56 volatile uint16_t _i=0;
87 return(BOOST_OPSRET_COMPLETE);
106 volatile uint16_t retval=1;
107 volatile uint16_t _i=0;
110 retval &= boostPWM_Suspend(boostInstance);
141 return(BOOST_OPSRET_COMPLETE);
143 return(BOOST_OPSRET_ERROR);
159 volatile uint16_t State_Standby(
volatile struct BOOST_CONVERTER_s *boostInstance)
161 volatile uint16_t retval=0;
166 { boostInstance->
status.bits.
GO =
true; }
170 retval = drv_BoostConverter_SpecialFunctionExecute(boostInstance, CS_OFSET_CALIBRATION);
174 case BOOST_OPSRET_COMPLETE:
178 case BOOST_OPSRET_REPEAT:
181 return(BOOST_OPSRET_REPEAT);
186 return(BOOST_OPSRET_ERROR);
200 boostInstance->
status.bits.
GO =
false;
201 return(BOOST_OPSRET_COMPLETE);
206 return(BOOST_OPSRET_REPEAT);
227 volatile uint16_t retval=0;
230 if ((uint16_t)(boostInstance->
state_id.
bits.substate_id) >= (uint16_t)(BoostRampUpSubStateList_size))
234 if (BoostConverterRampUpSubStateMachine[boostInstance->
state_id.
bits.substate_id] == NULL)
235 return(BOOST_OPSRET_ERROR);
238 retval = BoostConverterRampUpSubStateMachine[boostInstance->
state_id.
bits.substate_id](boostInstance);
245 case BOOST_OPSRET_REPEAT:
247 retval = BOOST_OPSRET_REPEAT;
254 case BOOST_OPSRET_COMPLETE:
260 if ((uint16_t)(boostInstance->
state_id.
bits.substate_id) < (uint16_t)(BoostRampUpSubStateList_size))
262 retval = BOOST_OPSRET_REPEAT;
264 if (boostInstance->
state_id.
bits.substate_id == BOOST_OPSTATE_I_RAMP_UP)
277 retval = BOOST_OPSRET_COMPLETE;
286 retval = BOOST_OPSRET_ERROR;
348 return(BOOST_OPSRET_REPEAT);
365 volatile uint16_t retval=0;
370 retval = boostPWM_Suspend(boostInstance);
374 retval = BOOST_OPSRET_COMPLETE;
376 retval = BOOST_OPSRET_ERROR;
enum BOOST_CONTROL_MODE_e control_mode
Fundamental control mode.
volatile int16_t MinOutput
Minimum output value used for clamping (R/W)
volatile struct NPNZ_PORTS_s Ports
Controller input and output ports.
volatile struct NPNZ16b_s * controller
pointer to control loop object data structure
volatile struct BOOST_STARTUP_PERIOD_HANDLER_s v_ramp
Voltage Ramp-Up period deinitions.
volatile bool adc_active
Bit #1: indicating that ADC has been started and samples are taken.
volatile bool fault_active
Bit #5: Flag bit indicating system is in enforced shut down mode (usually due to a fault condition)
volatile uint16_t v_ref
User reference setting used to control the power converter controller.
volatile struct NPNZ_PORT_s Target
Primary data output port declaration.
volatile struct BOOST_LOOP_SETTINGS_s v_loop
BOOST voltage control loop object.
volatile struct NPNZ_LIMITS_s Limits
Input and output clamping values.
volatile uint16_t ref_inc_step
Size/value of one reference increment/decrement or this period.
volatile uint16_t no_of_phases
number of converter phases
volatile bool suspend
Bit #6: Control bit to put the converter in suspend mode (turned off while ENABLE bit is still on)
volatile bool enabled
Bit #15: Control bit enabling/disabling the charger port.
volatile struct BOOST_CONVERTER_STARTUP_s startup
BOOST startup timing settings.
void(* ctrl_Reset)(volatile struct NPNZ16b_s *)
Function pointer to RESET routine.
volatile bool busy
Bit #7: Flag bit indicating that the state machine is executing a process (e.g. startup-ramp)
volatile struct BOOST_STARTUP_PERIOD_HANDLER_s power_good_delay
Power-Good Delay period deinitions.
volatile bool ready
Bit #0: status bit, indicating boost converter is initialized and ready to run.
volatile bool pwm_active
Bit #2: indicating that PWM has been started and ADC triggers are generated.
struct BOOST_STATE_ID_s::@372::@373 bits
volatile uint16_t reference
Control loop reference variable.
volatile uint16_t counter
Soft-Start Execution Counter (read only)
volatile struct BOOST_LOOP_SETTINGS_s i_loop[BOOST_MPHASE_COUNT]
BOOST Current control loop objects.
volatile struct NPNZ_STATUS_s status
Control Loop Status and Control flags.
volatile bool cs_calib_complete
Bit #4: indicating that current sensor calibration has completed.
volatile uint16_t * ptrAddress
Pointer to register or variable where the value is read from (e.g. ADCBUFx) or written to (e....
volatile struct BOOST_CONVERTER_STATUS_s status
BOOST operation status bits.
volatile bool GO
Bit #13: When set, the GO-bit fires up the power supply.
volatile bool cs_calib_enable
Bit #8: Flag bit indicating that current sensors need to calibrated.
volatile struct BOOST_STARTUP_PERIOD_HANDLER_s power_on_delay
Power-On Delay period deinitions.
volatile struct BOOST_STATE_ID_s state_id
BOOST state machine operating state ID.
BOOST control & monitoring data structure.
volatile bool autorun
Bit #14: Control bit determining if charger is starting automatically or on command (using the GO bit...
volatile struct BOOST_CONVERTER_SETTINGS_s set_values
Control field for global access to references.
volatile bool enabled
Bit 15: enables/disables control loop execution.