HFCC-01 Low-Level Software (LLSW) Rel_6802_HFCC-01-RP-CSAR-CB
Loading...
Searching...
No Matches
discreteIn.c File Reference
#include "discreteIn.h"
#include "utilHelper.h"
#include "interDrv.h"
#include "interStatus.h"
#include "mmapDiscreteIn.h"
#include "memoryOper.h"
Include dependency graph for discreteIn.c:
discreteIn.c Node1 discreteIn.c Node2 discreteIn.h Node1->Node2 Node5 utilHelper.h Node1->Node5 Node7 interDrv.h Node1->Node7 Node8 interStatus.h Node1->Node8 Node9 mmapDiscreteIn.h Node1->Node9 Node10 memoryOper.h Node1->Node10 Node3 commonDataTypes.h Node2->Node3 Node4 driverStatus.h Node2->Node4 Node6 INTEGRITY.h Node5->Node6 Node7->Node3 Node7->Node8

Functions

static DriverStatus readDiscreteInReg (const UInt32 baseAddress, const UInt32 offset, UInt32 *data)
 readDiscreteInReg.
DriverStatus discreteIn_getPbit (const DInDevHandler dInDevHdl, DInPbitStatus *pbitStatus, const UInt8 devNum)
 discreteIn_getPbit.
DriverStatus discreteIn_getCbit (const DInDevHandler dInDevHdl, DInCbitStatus *cbitStatus, const UInt8 devNum)
 discreteIn_getCbit.
DriverStatus discreteIn_getTemp (const DInDevHandler dInDevHdl, Float32 *temp)
 discreteIn_getTemp.
DriverStatus discreteIn_getChSense (const DInDevHandler dInDevHdl, DInDevState *pDevState)
 discreteIn_getChSense.

Detailed Description

Author
Ramza Anuar ramza.nosp@m..anu.nosp@m.ar@tu.nosp@m.sas..nosp@m.my

Discrete Input device driver file

Function Documentation

◆ discreteIn_getCbit()

DriverStatus discreteIn_getCbit ( const DInDevHandler dInDevHdl,
DInCbitStatus * cbitStatus,
const UInt8 devNum )

discreteIn_getCbit.

discreteIn get CBIT status.

Parameters
[in]dInDevHdlThe discrete input device handler.
[out]cbitStatusThe pointer of CBIT status value.
[in]devNumThe discrete input device number.
Returns
DriverStatus - Driver status return code, If no error occurs during the operation of the function, it returns DRV_SUCCESS. Otherwise related error message is returned.
Return values
DRV_SUCCESS: Success.
DRV_READ_FAILED: Failed to read from the device or module.
DRV_INVALID_PARAM: The provided address pointer is invalid.

Low-Level Software Requirements (LLR)

Low-Level Requirement Specification: discreteIn_getCbit

Requirement ID Parent HLR ID Detailed Low-Level Requirement Statement (EARS Format) Software Unit Reference Verification Method Status
LLR_DISCRETEIN_DISCRETEIN_GETCBIT_01 HLR_DIN_23588 WHEN the pointer cbitStatus is NULL (invalid), the discreteIn_getCbit() function SHALL abort processing and return DRV_INVALID_PARAM. discreteIn.c:discreteIn_getCbit() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETCBIT_02 HLR_DIN_23588 WHEN devNum is equal to 0 or 1, the discreteIn_getCbit() function SHALL map the hardware access to device instance 0. discreteIn.c:discreteIn_getCbit() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETCBIT_03 HLR_DIN_23588 WHEN devNum is equal to 2, the discreteIn_getCbit() function SHALL map the hardware access to device instance 1. discreteIn.c:discreteIn_getCbit() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETCBIT_04 HLR_DIN_23588 WHEN the device instance is resolved, the discreteIn_getCbit() function SHALL read the CBIT status register MMAP_DIN_CBIT_STATUS using readDiscreteInReg(). discreteIn.c:discreteIn_getCbit() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETCBIT_05 HLR_DIN_23588 WHEN the CBIT status register is read successfully, the discreteIn_getCbit() function SHALL unpack hardware status bits for power good, over/under temperature, and channel parity into struct cbitStatus. discreteIn.c:discreteIn_getCbit() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETCBIT_06 HLR_DIN_23588 WHEN all operational processing completes successfully, the discreteIn_getCbit() function SHALL return DRV_SUCCESS. discreteIn.c:discreteIn_getCbit() Test Closed

Control Coupling Diagram (CCD)

ControlCouplingStructureChart Caller discreteIn_getCbit() [Low-Level Device Drivers] Target memoryOper_set() [Low-Level Driver Helper] Caller:s->Target:n l_t0->l_b0   dInDevHdl (Flag) l_t1->l_b1   devNum (Flag) r_b0->r_t0   statusCode (DriverStatus)
Control Coupling Structure Chart

Data Coupling Diagram (DCD)

DataCouplingStructureChart Caller discreteIn_getCbit() [Low-Level Device Drivers] Target memoryOper_set() [Low-Level Driver Helper] Caller:s->Target:n l_t0->l_b0   dInDevHdl (Payload) l_t1->l_b1   devNum (Payload) r_b0->r_t0   *cbitStatus (Output Data)
Data Coupling Structure Chart

Control Flow Diagram (CFD)

cfd_discreteIn_getCbit start Entry: discreteIn_getCbit() guard_1 LLR_01: Guard Check Is the pointer `cbitStatus` is NULL (invalid)? start->guard_1 err_exit_1 LLR_01 Error Exit abort processing and return `DRV_INVALID_PARAM` guard_1->err_exit_1 YES (TRUE) guard_2 LLR_02: Guard Check Is `devNum` is equal to `0` or `devNum` is equal to `1`? guard_1->guard_2 err_exit_2 LLR_02 Error Exit execute conditional operational branch guard_2->err_exit_2 YES (TRUE) guard_3 LLR_03: Guard Check Is `devNum` is equal to `2`? guard_2->guard_3 err_exit_3 LLR_03 Error Exit execute conditional operational branch guard_3->err_exit_3 YES (TRUE) guard_4 LLR_04: Guard Check Is a driver operation reports a failure status other than DRV_SUCCESS? guard_3->guard_4 err_exit_4 LLR_04 Error Exit abort processing and return `retStatus` guard_4->err_exit_4 YES (TRUE) act_5 LLR_05: Action Step invoke routine `memoryOper_set()` to execute target subsystem hardware operation guard_4->act_5 NO (FALSE) act_6 LLR_06: Action Step read the Discrete Input CBIT Status Register (CBIT_STATUS) at physical offset `0x0058` (`MMAP_DIN_CBIT_STATUS`) using `readDiscreteInReg()` act_5->act_6 act_7 LLR_07: Action Step invoke bitwise routine `READ_BIT()` to extract target channel status bit from register payload act_6->act_7 success_exit LLR_08: Final Exit return `DRV_SUCCESS` act_7->success_exit
Control Flow Diagram

Data Flow Diagram (DFD)

dfd_discreteIn_getCbit in_store Input Data Sources & Parameters • dInDevHdl (const DInDevHandler) • devNum (const UInt8) proc_1 LLR_01: Data Validation Check • Evaluate Parameter / State: cbitStatus in_store->proc_1 Validated Input Data proc_2 LLR_02: Data Validation Check • Evaluate Parameter / State: devNum proc_1->proc_2 Validated Input Data proc_3 LLR_03: Data Validation Check • Evaluate Parameter / State: devNum proc_2->proc_3 Validated Input Data proc_4 LLR_04: Data Validation Check • Evaluate Parameter / State: retStatus proc_3->proc_4 Validated Input Data proc_5 LLR_05: Data Payload Transformation • Process payload via memoryOper_set() proc_4->proc_5 Data Payload (memoryOper_set) proc_6 LLR_06: Data Payload Transformation • Process payload via readDiscreteInReg() proc_5->proc_6 Data Payload (readDiscreteInReg) proc_7 LLR_07: Data Payload Transformation • Process payload via READ_BIT() proc_6->proc_7 Data Payload (READ_BIT) proc_8 LLR_08: Status Output Packaging • Format Return Payload: DriverStatus proc_7->proc_8 Final Output Data out_sink Output Data Sinks & Status Return • cbitStatus (DInCbitStatus) proc_8->out_sink Output Data & Status Code
Data Flow Diagram
Here is the call graph for this function:
discreteIn_getCbit Node1 discreteIn_getCbit Node1->Node1 Node2 readDiscreteInReg Node1->Node2 Node2->Node2 Node3 interDrv_Read32 Node2->Node3 Node3->Node3 Node4 interDrv_isAddressValid Node3->Node4 Node5 memoryMap_Read32 Node3->Node5 Node4->Node4 Node5->Node5
Here is the caller graph for this function:
discreteIn_getCbit Node1 discreteIn_getCbit Node1->Node1 Node2 modHsb_getDiscreteInCbit Node1->Node2 Node2->Node2

◆ discreteIn_getChSense()

DriverStatus discreteIn_getChSense ( const DInDevHandler dInDevHdl,
DInDevState * pDevState )

discreteIn_getChSense.

discreteIn get channel sense logic value.

Parameters
[in]dInDevHdlThe discrete input device handler.
[out]pDevStateThe state of the channel.
Returns
DriverStatus - Driver status return code, If no error occurs during the operation of the function, it returns DRV_SUCCESS. Otherwise related error message is returned.
Return values
DRV_SUCCESS: Success.
DRV_READ_FAILED: Failed to read from the device or module.
DRV_INVALID_PARAM: The provided address pointer is invalid.

Low-Level Software Requirements (LLR)

Low-Level Requirement Specification: discreteIn_getChSense

Requirement ID Parent HLR ID Detailed Low-Level Requirement Statement (EARS Format) Software Unit Reference Verification Method Status
LLR_DISCRETEIN_DISCRETEIN_GETCHSENSE_01 HLR_DIN_23258 WHEN the pointer pDevState is NULL (invalid), the discreteIn_getChSense() function SHALL abort processing and return DRV_INVALID_PARAM. discreteIn.c:discreteIn_getChSense() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETCHSENSE_02 HLR_DIN_23258 WHEN a driver operation reports a failure status other than DRV_SUCCESS, the discreteIn_getChSense() function SHALL abort processing and return that driver failure status. discreteIn.c:discreteIn_getChSense() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETCHSENSE_03 HLR_DIN_23258 WHEN preconditions are satisfied, the discreteIn_getChSense() function SHALL read the Discrete Input Channel Sense Register (READ_INPUT) at physical offset 0x0078 (MMAP_DIN_READ_INPUT) using readDiscreteInReg(). discreteIn.c:discreteIn_getChSense() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETCHSENSE_04 HLR_DIN_23258 WHEN preconditions are satisfied, the discreteIn_getChSense() function SHALL invoke bitwise routine READ_BIT() to extract target channel status bit from register payload. discreteIn.c:discreteIn_getChSense() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETCHSENSE_05 HLR_DIN_23258 WHEN all operational processing completes successfully, the discreteIn_getChSense() function SHALL return DRV_SUCCESS. discreteIn.c:discreteIn_getChSense() Test Closed

Control Coupling Diagram (CCD)

ControlCouplingStructureChart Caller discreteIn_getChSense() [Low-Level Device Drivers] Target readDiscreteInReg() [Low-Level Driver Helper] Caller:s->Target:n l_t0->l_b0   dInDevHdl (Flag) r_b0->r_t0   statusCode (DriverStatus)
Control Coupling Structure Chart

Data Coupling Diagram (DCD)

DataCouplingStructureChart Caller discreteIn_getChSense() [Low-Level Device Drivers] Target readDiscreteInReg() [Low-Level Driver Helper] Caller:s->Target:n l_t0->l_b0   dInDevHdl (Payload) r_b0->r_t0   *pDevState (Output Data)
Data Coupling Structure Chart

Control Flow Diagram (CFD)

cfd_discreteIn_getChSense start Entry: discreteIn_getChSense() guard_1 LLR_01: Guard Check Is the pointer `pDevState` is NULL (invalid)? start->guard_1 err_exit_1 LLR_01 Error Exit abort processing and return `DRV_INVALID_PARAM` guard_1->err_exit_1 YES (TRUE) guard_2 LLR_02: Guard Check Is a driver operation reports a failure status other than DRV_SUCCESS? guard_1->guard_2 err_exit_2 LLR_02 Error Exit abort processing and return `retStatus` guard_2->err_exit_2 YES (TRUE) act_3 LLR_03: Action Step read the Discrete Input Channel Sense Register (READ_INPUT) at physical offset `0x0078` (`MMAP_DIN_READ_INPUT`) using `readDiscreteInReg()` guard_2->act_3 NO (FALSE) act_4 LLR_04: Action Step invoke bitwise routine `READ_BIT()` to extract target channel status bit from register payload act_3->act_4 success_exit LLR_05: Final Exit return `DRV_SUCCESS` act_4->success_exit
Control Flow Diagram

Data Flow Diagram (DFD)

dfd_discreteIn_getChSense in_store Input Data Sources & Parameters • dInDevHdl (const DInDevHandler) proc_1 LLR_01: Data Validation Check • Evaluate Parameter / State: pDevState in_store->proc_1 Validated Input Data proc_2 LLR_02: Data Validation Check • Evaluate Parameter / State: retStatus proc_1->proc_2 Validated Input Data proc_3 LLR_03: Data Payload Transformation • Process payload via readDiscreteInReg() proc_2->proc_3 Data Payload (readDiscreteInReg) proc_4 LLR_04: Data Payload Transformation • Process payload via READ_BIT() proc_3->proc_4 Data Payload (READ_BIT) proc_5 LLR_05: Status Output Packaging • Format Return Payload: DriverStatus proc_4->proc_5 Final Output Data out_sink Output Data Sinks & Status Return • pDevState (DInDevState) proc_5->out_sink Output Data & Status Code
Data Flow Diagram
Here is the call graph for this function:
discreteIn_getChSense Node1 discreteIn_getChSense Node1->Node1 Node2 readDiscreteInReg Node1->Node2 Node2->Node2 Node3 interDrv_Read32 Node2->Node3 Node3->Node3 Node4 interDrv_isAddressValid Node3->Node4 Node5 memoryMap_Read32 Node3->Node5 Node4->Node4 Node5->Node5
Here is the caller graph for this function:
discreteIn_getChSense Node1 discreteIn_getChSense Node1->Node1 Node2 modDiscreteIn_read Node1->Node2 Node2->Node2

◆ discreteIn_getPbit()

DriverStatus discreteIn_getPbit ( const DInDevHandler dInDevHdl,
DInPbitStatus * pbitStatus,
const UInt8 devNum )

discreteIn_getPbit.

discreteIn get PBIT status.

Parameters
[in]dInDevHdlThe discrete input device handler.
[in]devNumThe discrete input device number.
[out]pbitStatusThe pointer of PBIT status value.
Returns
DriverStatus - Driver status return code, If no error occurs during the operation of the function, it returns DRV_SUCCESS. Otherwise related error message is returned.
Return values
DRV_SUCCESS: Success.
DRV_READ_FAILED: Failed to read from the device or module.
DRV_INVALID_PARAM: The provided address pointer is invalid.

Low-Level Software Requirements (LLR)

Low-Level Requirement Specification: discreteIn_getPbit

Requirement ID Parent HLR ID Detailed Low-Level Requirement Statement (EARS Format) Software Unit Reference Verification Method Status
LLR_DISCRETEIN_DISCRETEIN_GETPBIT_01 HLR_DIN_319 WHEN the pointer pbitStatus is NULL (invalid), the discreteIn_getPbit() function SHALL abort processing and return DRV_INVALID_PARAM. discreteIn.c:discreteIn_getPbit() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETPBIT_02 HLR_DIN_319 WHEN devNum is equal to 0 or 1, the discreteIn_getPbit() function SHALL map the hardware access to device instance 0. discreteIn.c:discreteIn_getPbit() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETPBIT_03 HLR_DIN_319 WHEN devNum is equal to 2, the discreteIn_getPbit() function SHALL map the hardware access to device instance 1. discreteIn.c:discreteIn_getPbit() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETPBIT_04 HLR_DIN_319 WHEN the device instance is resolved, the discreteIn_getPbit() function SHALL read the PBIT status register MMAP_DIN_PBIT_STATUS using readDiscreteInReg(). discreteIn.c:discreteIn_getPbit() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETPBIT_05 HLR_DIN_319 WHEN the PBIT status register is read successfully, the discreteIn_getPbit() function SHALL unpack hardware status bits for power good, over/under temperature, and logic verification into struct pbitStatus. discreteIn.c:discreteIn_getPbit() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETPBIT_06 HLR_DIN_319 WHEN all operational processing completes successfully, the discreteIn_getPbit() function SHALL return DRV_SUCCESS. discreteIn.c:discreteIn_getPbit() Test Closed

Control Coupling Diagram (CCD)

ControlCouplingStructureChart Caller discreteIn_getPbit() [Low-Level Device Drivers] Target memoryOper_set() [Low-Level Driver Helper] Caller:s->Target:n l_t0->l_b0   dInDevHdl (Flag) l_t1->l_b1   devNum (Flag) r_b0->r_t0   statusCode (DriverStatus)
Control Coupling Structure Chart

Data Coupling Diagram (DCD)

DataCouplingStructureChart Caller discreteIn_getPbit() [Low-Level Device Drivers] Target memoryOper_set() [Low-Level Driver Helper] Caller:s->Target:n l_t0->l_b0   dInDevHdl (Payload) l_t1->l_b1   devNum (Payload) r_b0->r_t0   *pbitStatus (Output Data)
Data Coupling Structure Chart

Control Flow Diagram (CFD)

cfd_discreteIn_getPbit start Entry: discreteIn_getPbit() guard_1 LLR_01: Guard Check Is the pointer `pbitStatus` is NULL (invalid)? start->guard_1 err_exit_1 LLR_01 Error Exit abort processing and return `DRV_INVALID_PARAM` guard_1->err_exit_1 YES (TRUE) guard_2 LLR_02: Guard Check Is `devNum` is equal to `0` or `devNum` is equal to `1`? guard_1->guard_2 err_exit_2 LLR_02 Error Exit execute conditional operational branch guard_2->err_exit_2 YES (TRUE) guard_3 LLR_03: Guard Check Is `devNum` is equal to `2`? guard_2->guard_3 err_exit_3 LLR_03 Error Exit execute conditional operational branch guard_3->err_exit_3 YES (TRUE) guard_4 LLR_04: Guard Check Is a driver operation reports a failure status other than DRV_SUCCESS? guard_3->guard_4 err_exit_4 LLR_04 Error Exit abort processing and return `retStatus` guard_4->err_exit_4 YES (TRUE) act_5 LLR_05: Action Step invoke routine `memoryOper_set()` to execute target subsystem hardware operation guard_4->act_5 NO (FALSE) act_6 LLR_06: Action Step read the Discrete Input PBIT Status Register (PBIT_STATUS) at physical offset `0x0050` (`MMAP_DIN_PBIT_STATUS`) using `readDiscreteInReg()` act_5->act_6 act_7 LLR_07: Action Step invoke bitwise routine `READ_BIT()` to extract target channel status bit from register payload act_6->act_7 success_exit LLR_08: Final Exit return `DRV_SUCCESS` act_7->success_exit
Control Flow Diagram

Data Flow Diagram (DFD)

dfd_discreteIn_getPbit in_store Input Data Sources & Parameters • dInDevHdl (const DInDevHandler) • devNum (const UInt8) proc_1 LLR_01: Data Validation Check • Evaluate Parameter / State: pbitStatus in_store->proc_1 Validated Input Data proc_2 LLR_02: Data Validation Check • Evaluate Parameter / State: devNum proc_1->proc_2 Validated Input Data proc_3 LLR_03: Data Validation Check • Evaluate Parameter / State: devNum proc_2->proc_3 Validated Input Data proc_4 LLR_04: Data Validation Check • Evaluate Parameter / State: retStatus proc_3->proc_4 Validated Input Data proc_5 LLR_05: Data Payload Transformation • Process payload via memoryOper_set() proc_4->proc_5 Data Payload (memoryOper_set) proc_6 LLR_06: Data Payload Transformation • Process payload via readDiscreteInReg() proc_5->proc_6 Data Payload (readDiscreteInReg) proc_7 LLR_07: Data Payload Transformation • Process payload via READ_BIT() proc_6->proc_7 Data Payload (READ_BIT) proc_8 LLR_08: Status Output Packaging • Format Return Payload: DriverStatus proc_7->proc_8 Final Output Data out_sink Output Data Sinks & Status Return • pbitStatus (DInPbitStatus) proc_8->out_sink Output Data & Status Code
Data Flow Diagram
Here is the call graph for this function:
discreteIn_getPbit Node1 discreteIn_getPbit Node1->Node1 Node2 readDiscreteInReg Node1->Node2 Node2->Node2 Node3 interDrv_Read32 Node2->Node3 Node3->Node3 Node4 interDrv_isAddressValid Node3->Node4 Node5 memoryMap_Read32 Node3->Node5 Node4->Node4 Node5->Node5
Here is the caller graph for this function:
discreteIn_getPbit Node1 discreteIn_getPbit Node1->Node1 Node2 modHsb_getDiscreteInPbit Node1->Node2 Node2->Node2

◆ discreteIn_getTemp()

DriverStatus discreteIn_getTemp ( const DInDevHandler dInDevHdl,
Float32 * temp )

discreteIn_getTemp.

discreteIn get temperature value in degree Celsius (C).

Parameters
[in]dInDevHdlThe discrete input device handler.
[out]tempThe pointer of temperature value in degree Celsius (C).
Returns
DriverStatus - Driver status return code, If no error occurs during the operation of the function, it returns DRV_SUCCESS. Otherwise related error message is returned.
Return values
DRV_SUCCESS: Success.
DRV_READ_FAILED: Failed to read from the device or module.
DRV_INVALID_PARAM: The provided address pointer is invalid.

Low-Level Software Requirements (LLR)

Low-Level Requirement Specification: discreteIn_getTemp

Requirement ID Parent HLR ID Detailed Low-Level Requirement Statement (EARS Format) Software Unit Reference Verification Method Status
LLR_DISCRETEIN_DISCRETEIN_GETTEMP_01 HLR_DIN_30815 WHEN the pointer temp is NULL (invalid), the discreteIn_getTemp() function SHALL abort processing and return DRV_INVALID_PARAM. discreteIn.c:discreteIn_getTemp() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETTEMP_02 HLR_DIN_30815 WHEN a driver operation reports a failure status other than DRV_SUCCESS, the discreteIn_getTemp() function SHALL abort processing and return that driver failure status. discreteIn.c:discreteIn_getTemp() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETTEMP_03 HLR_DIN_30815 WHEN preconditions are satisfied, the discreteIn_getTemp() function SHALL read the Raw Temperature Sensor Register (TEMP_RAW) at physical offset 0x0068 (MMAP_DIN_TEMP_RAW) using readDiscreteInReg(). discreteIn.c:discreteIn_getTemp() Test Closed
LLR_DISCRETEIN_DISCRETEIN_GETTEMP_04 HLR_DIN_30815 WHEN all operational processing completes successfully, the discreteIn_getTemp() function SHALL return DRV_SUCCESS. discreteIn.c:discreteIn_getTemp() Test Closed

Control Coupling Diagram (CCD)

ControlCouplingStructureChart Caller discreteIn_getTemp() [Low-Level Device Drivers] Target readDiscreteInReg() [Low-Level Driver Helper] Caller:s->Target:n l_t0->l_b0   dInDevHdl (Flag) r_b0->r_t0   statusCode (DriverStatus)
Control Coupling Structure Chart

Data Coupling Diagram (DCD)

DataCouplingStructureChart Caller discreteIn_getTemp() [Low-Level Device Drivers] Target readDiscreteInReg() [Low-Level Driver Helper] Caller:s->Target:n l_t0->l_b0   dInDevHdl (Payload) r_b0->r_t0   *temp (Output Data)
Data Coupling Structure Chart

Control Flow Diagram (CFD)

cfd_discreteIn_getTemp start Entry: discreteIn_getTemp() guard_1 LLR_01: Guard Check Is the pointer `temp` is NULL (invalid)? start->guard_1 err_exit_1 LLR_01 Error Exit abort processing and return `DRV_INVALID_PARAM` guard_1->err_exit_1 YES (TRUE) guard_2 LLR_02: Guard Check Is a driver operation reports a failure status other than DRV_SUCCESS? guard_1->guard_2 err_exit_2 LLR_02 Error Exit abort processing and return `retStatus` guard_2->err_exit_2 YES (TRUE) act_3 LLR_03: Action Step read the Raw Temperature Sensor Register (TEMP_RAW) at physical offset `0x0068` (`MMAP_DIN_TEMP_RAW`) using `readDiscreteInReg()` guard_2->act_3 NO (FALSE) success_exit LLR_04: Final Exit return `DRV_SUCCESS` act_3->success_exit
Control Flow Diagram

Data Flow Diagram (DFD)

dfd_discreteIn_getTemp in_store Input Data Sources & Parameters • dInDevHdl (const DInDevHandler) proc_1 LLR_01: Data Validation Check • Evaluate Parameter / State: temp in_store->proc_1 Validated Input Data proc_2 LLR_02: Data Validation Check • Evaluate Parameter / State: retStatus proc_1->proc_2 Validated Input Data proc_3 LLR_03: Data Payload Transformation • Process payload via readDiscreteInReg() proc_2->proc_3 Data Payload (readDiscreteInReg) proc_4 LLR_04: Status Output Packaging • Format Return Payload: DriverStatus proc_3->proc_4 Final Output Data out_sink Output Data Sinks & Status Return • temp (Float32) proc_4->out_sink Output Data & Status Code
Data Flow Diagram
Here is the call graph for this function:
discreteIn_getTemp Node1 discreteIn_getTemp Node1->Node1 Node2 readDiscreteInReg Node1->Node2 Node2->Node2 Node3 interDrv_Read32 Node2->Node3 Node3->Node3 Node4 interDrv_isAddressValid Node3->Node4 Node5 memoryMap_Read32 Node3->Node5 Node4->Node4 Node5->Node5
Here is the caller graph for this function:
discreteIn_getTemp Node1 discreteIn_getTemp Node1->Node1 Node2 modHsb_getDiscreteInCbit Node1->Node2 Node2->Node2

◆ readDiscreteInReg()

DriverStatus readDiscreteInReg ( const UInt32 baseAddress,
const UInt32 offset,
UInt32 * data )
static

readDiscreteInReg.

To read function for PCIe Discrete Input.

Parameters
[in]baseAddressThe base address of the module and device.
[in]offsetThe offset address from module base address.
[out]data32bit data to read from PCIe.
Returns
DriverStatus - Driver status return code, If no error occurs during the operation of the function, it returns DRV_SUCCESS. Otherwise related error message is returned.
Return values
DRV_SUCCESS: Success.
DRV_READ_FAILED: PCIe failed to read value.
DRV_INVALID_PARAM: The provided address pointer is invalid.

Low-Level Software Requirements (LLR)

Low-Level Requirement Specification: readDiscreteInReg

Requirement ID Parent HLR ID Detailed Low-Level Requirement Statement (EARS Format) Software Unit Reference Verification Method Status
LLR_DISCRETEIN_READDISCRETEINREG_01 HLR_DIN_23588 WHEN the pointer data is NULL (invalid), the readDiscreteInReg() function SHALL abort processing and return DRV_INVALID_PARAM. discreteIn.c:readDiscreteInReg() Test Closed
LLR_DISCRETEIN_READDISCRETEINREG_02 HLR_DIN_23588 WHEN the pointer data is valid, the readDiscreteInReg() function SHALL read a 32-bit register value from physical memory address (baseAddress + addrOffset) into *data using PCIe primitive interDrv_Read32(). discreteIn.c:readDiscreteInReg() Test Closed
LLR_DISCRETEIN_READDISCRETEINREG_03 HLR_DIN_23588 WHEN memory access via interDrv_Read32() fails (status not equal to INTF_SUCCESS), the readDiscreteInReg() function SHALL abort processing and return DRV_READ_FAILED. discreteIn.c:readDiscreteInReg() Test Closed
LLR_DISCRETEIN_READDISCRETEINREG_04 HLR_DIN_23588 WHEN all operational processing completes successfully, the readDiscreteInReg() function SHALL return DRV_SUCCESS. discreteIn.c:readDiscreteInReg() Test Closed

Control Coupling Diagram (CCD)

ControlCouplingStructureChart Caller readDiscreteInReg() [Low-Level Device Drivers] Target interDrv_Read32() [Low-Level Driver Helper] Caller:s->Target:n l_t0->l_b0   baseAddress (Flag) l_t1->l_b1   offset (Flag) r_b0->r_t0   statusCode (DriverStatus)
Control Coupling Structure Chart

Data Coupling Diagram (DCD)

DataCouplingStructureChart Caller readDiscreteInReg() [Low-Level Device Drivers] Target interDrv_Read32() [Low-Level Driver Helper] Caller:s->Target:n l_t0->l_b0   baseAddress (Payload) l_t1->l_b1   offset (Payload) r_b0->r_t0   *data (Output Data)
Data Coupling Structure Chart

Control Flow Diagram (CFD)

cfd_readDiscreteInReg start Entry: readDiscreteInReg() guard_1 LLR_01: Guard Check Is the pointer `data` is NULL (invalid)? start->guard_1 err_exit_1 LLR_01 Error Exit abort processing and return `DRV_INVALID_PARAM` guard_1->err_exit_1 YES (TRUE) guard_2 LLR_02: Guard Check Is `intStatus` is not equal to `INTF_SUCCESS`? guard_1->guard_2 err_exit_2 LLR_02 Error Exit abort processing and return `DRV_READ_FAILED` guard_2->err_exit_2 YES (TRUE) act_3 LLR_03: Action Step invoke PCIe primitive `interDrv_Read32()` to read 32-bit word from physical memory address `baseAddress + addrOffset` into `*data` guard_2->act_3 NO (FALSE) success_exit LLR_04: Final Exit return `DRV_SUCCESS` act_3->success_exit
Control Flow Diagram

Data Flow Diagram (DFD)

dfd_readDiscreteInReg in_store Input Data Sources & Parameters • baseAddress (const UInt32) • offset (const UInt32) proc_1 LLR_01: Data Validation Check • Evaluate Parameter / State: data in_store->proc_1 Validated Input Data proc_2 LLR_02: Data Validation Check • Evaluate Parameter / State: intStatus proc_1->proc_2 Validated Input Data proc_3 LLR_03: Data Payload Transformation • Process payload via interDrv_Read32() proc_2->proc_3 Data Payload (interDrv_Read32) proc_4 LLR_04: Status Output Packaging • Format Return Payload: DriverStatus proc_3->proc_4 Final Output Data out_sink Output Data Sinks & Status Return • data (UInt32) proc_4->out_sink Output Data & Status Code
Data Flow Diagram
Here is the call graph for this function:
readDiscreteInReg Node1 readDiscreteInReg Node1->Node1 Node2 interDrv_Read32 Node1->Node2 Node2->Node2 Node3 interDrv_isAddressValid Node2->Node3 Node4 memoryMap_Read32 Node2->Node4 Node3->Node3 Node4->Node4
Here is the caller graph for this function:
readDiscreteInReg Node1 readDiscreteInReg Node1->Node1 Node2 discreteIn_getCbit Node1->Node2 Node4 discreteIn_getChSense Node1->Node4 Node6 discreteIn_getPbit Node1->Node6 Node8 discreteIn_getTemp Node1->Node8 Node2->Node2 Node3 modHsb_getDiscreteInCbit Node2->Node3 Node3->Node3 Node4->Node4 Node5 modDiscreteIn_read Node4->Node5 Node5->Node5 Node6->Node6 Node7 modHsb_getDiscreteInPbit Node6->Node7 Node7->Node7 Node8->Node3 Node8->Node8