HFCC-01 Low-Level Software (LLSW) Rel_6802_HFCC-01-RP-CSAR-CB
Loading...
Searching...
No Matches
modPwm.h File Reference
#include "commonDataTypes.h"
#include "modStatus.h"
#include "modConfig.h"
Include dependency graph for modPwm.h:
modPwm.h Node1 modPwm.h Node2 commonDataTypes.h Node1->Node2 Node3 modStatus.h Node1->Node3 Node4 modConfig.h Node1->Node4 Node4->Node3 Node5 INTEGRITY.h Node4->Node5 Node6 modInfo.h Node4->Node6 Node6->Node2 Node6->Node3
This graph shows which files directly or indirectly include this file:
modPwm.h Node1 modPwm.h Node2 deviceLibModule.h Node1->Node2 Node3 modPwm.c Node1->Node3

Go to the source code of this file.

Functions

ModStatus modPwm_enable (const PWMChannelNum pwmChannel)
 modPwm_enable.
ModStatus modPwm_disable (const PWMChannelNum pwmChannel)
 modPwm_disable.
ModStatus modPwm_setFrequencyDutycycle (const PWMChannelNum pwmChannel, const UInt16 frequency, const UInt16 dutyCycle)
 modPwm_setFrequencyDutycycle.

Detailed Description

Function Documentation

◆ modPwm_disable()

ModStatus modPwm_disable ( const PWMChannelNum pwmChannel)

modPwm_disable.

To disable PWM for specific channel.

Parameters
[in]pwmChannelThe PWM channel.
Returns
ModStatus - Module status return code, If no error occurs during the operation of the function, it returns MD_SUCCESS. Otherwise related error message is returned.
Return values
MD_SUCCESS: Success.
MD_INVALID_INIT: Module is not initialized in config .
MD_INVALID_CHANNEL: Channel is not valid.
MD_READ_ERR: Failed to read from the module.
MD_WRITE_ERR: Failed to write to the module.
MD_OP_ALREADY_PERFORMED: The pwm channel is already disabled.

Low-Level Software Requirements (LLR)

Low-Level Requirement Specification: modPwm_disable

Requirement ID Parent HLR ID Detailed Low-Level Requirement Statement (EARS Format) Software Unit Reference Verification Method Status
LLR_PWM_MODPWM_DISABLE_01 HLR_PWM_23291 WHEN pwmChannel is not one of the defined PWM output channel identifiers (PWM_CH1, PWM_CH2, PWM_CH3, PWM_CH4), the modPwm_disable() function SHALL abort processing and return MD_INVALID_CHANNEL. modPwm.c:modPwm_disable() Test Closed
LLR_PWM_MODPWM_DISABLE_02 HLR_PWM_23291 WHEN the module initialization state is not initialized (INIT), the modPwm_disable() function SHALL abort processing and return MD_INVALID_INIT. modPwm.c:modPwm_disable() Test Closed
LLR_PWM_MODPWM_DISABLE_03 HLR_PWM_23291 WHEN a driver operation reports a failure status other than DRV_SUCCESS, the modPwm_disable() function SHALL abort processing and return the module error code produced by errCheck() for the reported driver status. modPwm.c:modPwm_disable() Test Closed
LLR_PWM_MODPWM_DISABLE_04 HLR_PWM_23291 WHEN preconditions are satisfied, the modPwm_disable() function SHALL invoke routine pwm_disable() to execute target subsystem hardware operation. modPwm.c:modPwm_disable() Test Closed
LLR_PWM_MODPWM_DISABLE_05 HLR_PWM_23291 WHEN preconditions are satisfied, the modPwm_disable() function SHALL evaluate the driver return status using errCheck(). modPwm.c:modPwm_disable() Test Closed
LLR_PWM_MODPWM_DISABLE_06 HLR_PWM_23291 WHEN all operational processing completes successfully, the modPwm_disable() function SHALL return MD_SUCCESS. modPwm.c:modPwm_disable() Test Closed

Control Coupling Diagram (CCD)

ControlCouplingStructureChart Caller modPwm_disable() [Device Library Modules] Target pwm_disable() [Subordinate Routine] Caller:s->Target:n l_t0->l_b0   pwmChannel (Flag) r_b0->r_t0   statusCode (ModStatus)
Control Coupling Structure Chart

Data Coupling Diagram (DCD)

DataCouplingStructureChart Caller modPwm_disable() [Device Library Modules] Target pwm_disable() [Subordinate Routine] Caller:s->Target:n l_t0->l_b0   pwmChannel (Payload) r_b0->r_t0   stateTelemetry (Internal State)
Data Coupling Structure Chart

Control Flow Diagram (CFD)

cfd_modPwm_disable start Entry: modPwm_disable() guard_1 LLR_01: Guard Check Is the channel validation check returns FALSE (invalid channel)? start->guard_1 err_exit_1 LLR_01 Error Exit abort processing and return `MD_INVALID_CHANNEL` guard_1->err_exit_1 YES (TRUE) guard_2 LLR_02: Guard Check Is the module initialization state is not initialized (INIT)? guard_1->guard_2 err_exit_2 LLR_02 Error Exit abort processing and return `MD_INVALID_INIT` guard_2->err_exit_2 YES (TRUE) guard_3 LLR_03: Guard Check Is a driver operation reports a failure status other than DRV_SUCCESS? guard_2->guard_3 err_exit_3 LLR_03 Error Exit abort processing and return the module error code produced by errCheck(retStatus) guard_3->err_exit_3 YES (TRUE) act_4 LLR_04: Action Step invoke routine `pwm_disable()` to execute target subsystem hardware operation guard_3->act_4 NO (FALSE) act_5 LLR_05: Action Step evaluate the driver return status using `errCheck()` act_4->act_5 success_exit LLR_06: Final Exit return `MD_SUCCESS` act_5->success_exit
Control Flow Diagram

Data Flow Diagram (DFD)

dfd_modPwm_disable in_store Input Data Sources & Parameters • pwmChannel (const PWMChannelNum) proc_1 LLR_01: Data Validation Check • Evaluate Parameter / State: validateChannel in_store->proc_1 Validated Input Data proc_2 LLR_02: Data Validation Check • Evaluate Parameter / State: pwmModHdl proc_1->proc_2 Validated Input Data proc_3 LLR_03: Data Validation Check • Evaluate Parameter / State: retStatus proc_2->proc_3 Validated Input Data proc_4 LLR_04: Data Payload Transformation • Process payload via pwm_disable() proc_3->proc_4 Data Payload (pwm_disable) proc_5 LLR_05: Data Payload Transformation • Process payload via errCheck() proc_4->proc_5 Data Payload (errCheck) proc_6 LLR_06: Status Output Packaging • Format Return Payload: ModStatus proc_5->proc_6 Final Output Data out_sink Output Data Sinks & Status Return • Status Payload (ModStatus) proc_6->out_sink Output Data & Status Code
Data Flow Diagram
Here is the call graph for this function:
modPwm_disable Node1 modPwm_disable Node1->Node1 Node2 errCheck Node1->Node2 Node3 pwm_disable Node1->Node3 Node11 validateChannel Node1->Node11 Node2->Node2 Node3->Node3 Node4 readPwmReg Node3->Node4 Node8 writePwmReg Node3->Node8 Node4->Node4 Node5 interDrv_Read32 Node4->Node5 Node5->Node5 Node6 interDrv_isAddressValid Node5->Node6 Node7 memoryMap_Read32 Node5->Node7 Node6->Node6 Node7->Node7 Node8->Node8 Node9 interDrv_Write32 Node8->Node9 Node9->Node6 Node9->Node9 Node10 memoryMap_Write32 Node9->Node10 Node10->Node10 Node11->Node11
Here is the caller graph for this function:
modPwm_disable Node1 modPwm_disable Node1->Node1 Node2 modPwm_initReset Node1->Node2 Node2->Node2 Node3 modConfig_init Node2->Node3 Node4 modConfig_reset Node2->Node4 Node3->Node3 Node4->Node4 Node5 modConfig_close Node4->Node5 Node5->Node5

◆ modPwm_enable()

ModStatus modPwm_enable ( const PWMChannelNum pwmChannel)

modPwm_enable.

To enable PWM for specific channel.

Parameters
[in]pwmChannelThe PWM channel.
Returns
ModStatus - Module status return code, If no error occurs during the operation of the function, it returns MD_SUCCESS. Otherwise related error message is returned.
Return values
MD_SUCCESS: Success.
MD_INVALID_INIT: Module is not initialized in config.
MD_INVALID_CHANNEL: Channel is not valid.
MD_INVALID_PARAM: The provided address pointer is invalid.
MD_READ_ERR: Failed to read from the module.
MD_WRITE_ERR: Failed to write to the module.
MD_OP_ALREADY_PERFORMED: The pwm channel is already enabled.

Low-Level Software Requirements (LLR)

Low-Level Requirement Specification: modPwm_enable

Requirement ID Parent HLR ID Detailed Low-Level Requirement Statement (EARS Format) Software Unit Reference Verification Method Status
LLR_PWM_MODPWM_ENABLE_01 HLR_PWM_23291 WHEN pwmChannel is not one of the defined PWM output channel identifiers (PWM_CH1, PWM_CH2, PWM_CH3, PWM_CH4), the modPwm_enable() function SHALL abort processing and return MD_INVALID_CHANNEL. modPwm.c:modPwm_enable() Test Closed
LLR_PWM_MODPWM_ENABLE_02 HLR_PWM_23291 WHEN the module initialization state is not initialized (INIT), the modPwm_enable() function SHALL abort processing and return MD_INVALID_INIT. modPwm.c:modPwm_enable() Test Closed
LLR_PWM_MODPWM_ENABLE_03 HLR_PWM_23291 WHEN a driver operation reports a failure status other than DRV_SUCCESS, the modPwm_enable() function SHALL abort processing and return the module error code produced by errCheck() for the reported driver status. modPwm.c:modPwm_enable() Test Closed
LLR_PWM_MODPWM_ENABLE_04 HLR_PWM_23291 WHEN preconditions are satisfied, the modPwm_enable() function SHALL invoke routine pwm_enable() to execute target subsystem hardware operation. modPwm.c:modPwm_enable() Test Closed
LLR_PWM_MODPWM_ENABLE_05 HLR_PWM_23291 WHEN preconditions are satisfied, the modPwm_enable() function SHALL evaluate the driver return status using errCheck(). modPwm.c:modPwm_enable() Test Closed
LLR_PWM_MODPWM_ENABLE_06 HLR_PWM_23291 WHEN all operational processing completes successfully, the modPwm_enable() function SHALL return MD_SUCCESS. modPwm.c:modPwm_enable() Test Closed

Control Coupling Diagram (CCD)

ControlCouplingStructureChart Caller modPwm_enable() [Device Library Modules] Target pwm_enable() [Subordinate Routine] Caller:s->Target:n l_t0->l_b0   pwmChannel (Flag) r_b0->r_t0   statusCode (ModStatus)
Control Coupling Structure Chart

Data Coupling Diagram (DCD)

DataCouplingStructureChart Caller modPwm_enable() [Device Library Modules] Target pwm_enable() [Subordinate Routine] Caller:s->Target:n l_t0->l_b0   pwmChannel (Payload) r_b0->r_t0   stateTelemetry (Internal State)
Data Coupling Structure Chart

Control Flow Diagram (CFD)

cfd_modPwm_enable start Entry: modPwm_enable() guard_1 LLR_01: Guard Check Is the channel validation check returns FALSE (invalid channel)? start->guard_1 err_exit_1 LLR_01 Error Exit abort processing and return `MD_INVALID_CHANNEL` guard_1->err_exit_1 YES (TRUE) guard_2 LLR_02: Guard Check Is the module initialization state is not initialized (INIT)? guard_1->guard_2 err_exit_2 LLR_02 Error Exit abort processing and return `MD_INVALID_INIT` guard_2->err_exit_2 YES (TRUE) guard_3 LLR_03: Guard Check Is a driver operation reports a failure status other than DRV_SUCCESS? guard_2->guard_3 err_exit_3 LLR_03 Error Exit abort processing and return the module error code produced by errCheck(retStatus) guard_3->err_exit_3 YES (TRUE) act_4 LLR_04: Action Step invoke routine `pwm_enable()` to execute target subsystem hardware operation guard_3->act_4 NO (FALSE) act_5 LLR_05: Action Step evaluate the driver return status using `errCheck()` act_4->act_5 success_exit LLR_06: Final Exit return `MD_SUCCESS` act_5->success_exit
Control Flow Diagram

Data Flow Diagram (DFD)

dfd_modPwm_enable in_store Input Data Sources & Parameters • pwmChannel (const PWMChannelNum) proc_1 LLR_01: Data Validation Check • Evaluate Parameter / State: validateChannel in_store->proc_1 Validated Input Data proc_2 LLR_02: Data Validation Check • Evaluate Parameter / State: pwmModHdl proc_1->proc_2 Validated Input Data proc_3 LLR_03: Data Validation Check • Evaluate Parameter / State: retStatus proc_2->proc_3 Validated Input Data proc_4 LLR_04: Data Payload Transformation • Process payload via pwm_enable() proc_3->proc_4 Data Payload (pwm_enable) proc_5 LLR_05: Data Payload Transformation • Process payload via errCheck() proc_4->proc_5 Data Payload (errCheck) proc_6 LLR_06: Status Output Packaging • Format Return Payload: ModStatus proc_5->proc_6 Final Output Data out_sink Output Data Sinks & Status Return • Status Payload (ModStatus) proc_6->out_sink Output Data & Status Code
Data Flow Diagram
Here is the call graph for this function:
modPwm_enable Node1 modPwm_enable Node1->Node1 Node2 errCheck Node1->Node2 Node3 pwm_enable Node1->Node3 Node11 validateChannel Node1->Node11 Node2->Node2 Node3->Node3 Node4 readPwmReg Node3->Node4 Node8 writePwmReg Node3->Node8 Node4->Node4 Node5 interDrv_Read32 Node4->Node5 Node5->Node5 Node6 interDrv_isAddressValid Node5->Node6 Node7 memoryMap_Read32 Node5->Node7 Node6->Node6 Node7->Node7 Node8->Node8 Node9 interDrv_Write32 Node8->Node9 Node9->Node6 Node9->Node9 Node10 memoryMap_Write32 Node9->Node10 Node10->Node10 Node11->Node11
Here is the caller graph for this function:
modPwm_enable Node1 modPwm_enable Node1->Node1

◆ modPwm_setFrequencyDutycycle()

ModStatus modPwm_setFrequencyDutycycle ( const PWMChannelNum pwmChannel,
const UInt16 frequency,
const UInt16 dutyCycle )

modPwm_setFrequencyDutycycle.

To set frequency duty cycle for PWM module.

Parameters
[in]pwmChannelPWM channel number to access.
[in]frequencyPWM frequency in Hz (Max is 20000 Hz) [Hz].
[in]dutyCyclePWM duty cycle in percentage, Value 0 - 100 % [%].
Returns
ModStatus - Module status return code, If no error occurs during the operation of the function, it returns MD_SUCCESS. Otherwise related error message is returned.
Return values
MD_SUCCESS: Success.
MD_INVALID_INIT: Module is not initialized in config.
MD_INVALID_CHANNEL: Channel is not valid.
MD_INVALID_VALUE: Frequency or duty cycle value exceed limit.
MD_READ_ERR: Failed to read from the module.
MD_WRITE_ERR: Failed to write to the module.

Low-Level Software Requirements (LLR)

Low-Level Requirement Specification: modPwm_setFrequencyDutycycle

Requirement ID Parent HLR ID Detailed Low-Level Requirement Statement (EARS Format) Software Unit Reference Verification Method Status
LLR_PWM_MODPWM_SETFREQUENCYDUTYCYCLE_01 HLR_PWM_23289 WHEN pwmChannel is not one of the defined PWM output channel identifiers (PWM_CH1, PWM_CH2, PWM_CH3, PWM_CH4), the modPwm_setFrequencyDutycycle() function SHALL abort processing and return MD_INVALID_CHANNEL. modPwm.c:modPwm_setFrequencyDutycycle() Test Closed
LLR_PWM_MODPWM_SETFREQUENCYDUTYCYCLE_02 HLR_PWM_23289 WHEN the module initialization state is not initialized (INIT), the modPwm_setFrequencyDutycycle() function SHALL abort processing and return MD_INVALID_INIT. modPwm.c:modPwm_setFrequencyDutycycle() Test Closed
LLR_PWM_MODPWM_SETFREQUENCYDUTYCYCLE_03 HLR_PWM_23289 WHEN frequency is greater than MOD_PWM_MAX_FREQ, the modPwm_setFrequencyDutycycle() function SHALL abort processing and return MD_INVALID_VALUE. modPwm.c:modPwm_setFrequencyDutycycle() Test Closed
LLR_PWM_MODPWM_SETFREQUENCYDUTYCYCLE_04 HLR_PWM_23289 WHEN dutyCycle is greater than PWM_DUTY_CYCLE_MAX, the modPwm_setFrequencyDutycycle() function SHALL abort processing and return MD_INVALID_VALUE. modPwm.c:modPwm_setFrequencyDutycycle() Test Closed
LLR_PWM_MODPWM_SETFREQUENCYDUTYCYCLE_05 HLR_PWM_23289 WHEN a driver operation reports a failure status other than DRV_SUCCESS, the modPwm_setFrequencyDutycycle() function SHALL abort processing and return the module error code produced by errCheck() for the reported driver status. modPwm.c:modPwm_setFrequencyDutycycle() Test Closed
LLR_PWM_MODPWM_SETFREQUENCYDUTYCYCLE_06 HLR_PWM_23289 WHEN preconditions are satisfied, the modPwm_setFrequencyDutycycle() function SHALL invoke routine pwm_setFrequencyDutycycle() to execute target subsystem hardware operation. modPwm.c:modPwm_setFrequencyDutycycle() Test Closed
LLR_PWM_MODPWM_SETFREQUENCYDUTYCYCLE_07 HLR_PWM_23289 WHEN preconditions are satisfied, the modPwm_setFrequencyDutycycle() function SHALL evaluate the driver return status using errCheck(). modPwm.c:modPwm_setFrequencyDutycycle() Test Closed
LLR_PWM_MODPWM_SETFREQUENCYDUTYCYCLE_08 HLR_PWM_23289 WHEN all operational processing completes successfully, the modPwm_setFrequencyDutycycle() function SHALL return MD_SUCCESS. modPwm.c:modPwm_setFrequencyDutycycle() Test Closed

Control Coupling Diagram (CCD)

ControlCouplingStructureChart Caller modPwm_setFrequencyDutycycle() [Device Library Modules] Target pwm_setFrequencyDutycycle() [Subordinate Routine] Caller:s->Target:n l_t0->l_b0   pwmChannel (Flag) l_t1->l_b1   frequency (Flag) l_t2->l_b2   dutyCycle (Flag) r_b0->r_t0   statusCode (ModStatus)
Control Coupling Structure Chart

Data Coupling Diagram (DCD)

DataCouplingStructureChart Caller modPwm_setFrequencyDutycycle() [Device Library Modules] Target pwm_setFrequencyDutycycle() [Subordinate Routine] Caller:s->Target:n l_t0->l_b0   pwmChannel (Payload) l_t1->l_b1   frequency (Payload) l_t2->l_b2   dutyCycle (Payload) r_b0->r_t0   stateTelemetry (Internal State)
Data Coupling Structure Chart

Control Flow Diagram (CFD)

cfd_modPwm_setFrequencyDutycycle start Entry: modPwm_setFrequencyDutycycle() guard_1 LLR_01: Guard Check Is the channel validation check returns FALSE (invalid channel)? start->guard_1 err_exit_1 LLR_01 Error Exit abort processing and return `MD_INVALID_CHANNEL` guard_1->err_exit_1 YES (TRUE) guard_2 LLR_02: Guard Check Is the module initialization state is not initialized (INIT)? guard_1->guard_2 err_exit_2 LLR_02 Error Exit abort processing and return `MD_INVALID_INIT` guard_2->err_exit_2 YES (TRUE) guard_3 LLR_03: Guard Check Is `frequency` is greater than `MOD_PWM_MAX_FREQ`? guard_2->guard_3 err_exit_3 LLR_03 Error Exit abort processing and return `MD_INVALID_VALUE` guard_3->err_exit_3 YES (TRUE) guard_4 LLR_04: Guard Check Is `dutyCycle` is greater than `PWM_DUTY_CYCLE_MAX`? guard_3->guard_4 err_exit_4 LLR_04 Error Exit abort processing and return `MD_INVALID_VALUE` guard_4->err_exit_4 YES (TRUE) guard_5 LLR_05: Guard Check Is a driver operation reports a failure status other than DRV_SUCCESS? guard_4->guard_5 err_exit_5 LLR_05 Error Exit abort processing and return the module error code produced by errCheck(retStatus) guard_5->err_exit_5 YES (TRUE) act_6 LLR_06: Action Step invoke routine `pwm_setFrequencyDutycycle()` to execute target subsystem hardware operation guard_5->act_6 NO (FALSE) act_7 LLR_07: Action Step evaluate the driver return status using `errCheck()` act_6->act_7 success_exit LLR_08: Final Exit return `MD_SUCCESS` act_7->success_exit
Control Flow Diagram

Data Flow Diagram (DFD)

dfd_modPwm_setFrequencyDutycycle in_store Input Data Sources & Parameters • pwmChannel (const PWMChannelNum) • frequency (const UInt16) • dutyCycle (const UInt16) proc_1 LLR_01: Data Validation Check • Evaluate Parameter / State: validateChannel in_store->proc_1 Validated Input Data proc_2 LLR_02: Data Validation Check • Evaluate Parameter / State: pwmModHdl proc_1->proc_2 Validated Input Data proc_3 LLR_03: Data Validation Check • Evaluate Parameter / State: frequency proc_2->proc_3 Validated Input Data proc_4 LLR_04: Data Validation Check • Evaluate Parameter / State: dutyCycle proc_3->proc_4 Validated Input Data proc_5 LLR_05: Data Validation Check • Evaluate Parameter / State: retStatus proc_4->proc_5 Validated Input Data proc_6 LLR_06: Data Payload Transformation • Process payload via pwm_setFrequencyDutycycle() proc_5->proc_6 Data Payload (pwm_setFrequencyDutycycle) proc_7 LLR_07: Data Payload Transformation • Process payload via errCheck() proc_6->proc_7 Data Payload (errCheck) proc_8 LLR_08: Status Output Packaging • Format Return Payload: ModStatus proc_7->proc_8 Final Output Data out_sink Output Data Sinks & Status Return • Status Payload (ModStatus) proc_8->out_sink Output Data & Status Code
Data Flow Diagram
Here is the call graph for this function:
modPwm_setFrequencyDutycycle Node1 modPwm_setFrequencyDutycycle Node1->Node1 Node2 errCheck Node1->Node2 Node3 pwm_setFrequencyDutycycle Node1->Node3 Node11 validateChannel Node1->Node11 Node2->Node2 Node3->Node3 Node4 readPwmReg Node3->Node4 Node8 writePwmReg Node3->Node8 Node4->Node4 Node5 interDrv_Read32 Node4->Node5 Node5->Node5 Node6 interDrv_isAddressValid Node5->Node6 Node7 memoryMap_Read32 Node5->Node7 Node6->Node6 Node7->Node7 Node8->Node8 Node9 interDrv_Write32 Node8->Node9 Node9->Node6 Node9->Node9 Node10 memoryMap_Write32 Node9->Node10 Node10->Node10 Node11->Node11
Here is the caller graph for this function:
modPwm_setFrequencyDutycycle Node1 modPwm_setFrequencyDutycycle Node1->Node1