HFCC-01 Low-Level Software (LLSW) Rel_6802_HFCC-01-RP-CSAR-CB
Loading...
Searching...
No Matches
discreteIn.h File Reference
#include "commonDataTypes.h"
#include "driverStatus.h"
Include dependency graph for discreteIn.h:
discreteIn.h Node1 discreteIn.h Node2 commonDataTypes.h Node1->Node2 Node3 driverStatus.h Node1->Node3
This graph shows which files directly or indirectly include this file:
discreteIn.h Node1 discreteIn.h Node2 discreteIn.c Node1->Node2 Node3 modDiscreteIn.c Node1->Node3 Node4 modHsb.c Node1->Node4

Go to the source code of this file.

Data Structures

struct  DInPbitStatus
 Discrete Input Power-On Built-In Test (PBIT) Diagnostic Status Structure. More...
struct  DInCbitStatus
 Discrete Input Continuous Built-In Test (CBIT) Diagnostic Status Structure. More...
struct  DInDevState
 Discrete Input Channel Boolean State Array Structure. More...
struct  DInDevHandler
 Discrete Input Peripheral Hardware Device Handler Structure. More...

Macros

#define DIN_MFB_MAX   (2U)
#define DIN_DEV_MAX   (3U)
#define DIN_CH_MAX   (44U)
#define DIN_DEV_CH_MAX   (32U)
#define DIN_BANK_MASK   (0x03U)
#define DIN_BANK_SHIFT   (6U)
#define DIN_BANK_OFFSET_0   (0U)
#define DIN_BANK_OFFSET_1   (8U)
#define DIN_BANK_OFFSET_2   (16U)
#define DIN_BANK_OFFSET_3   (24U)
#define DIN_TEMP_MASK   (0xFFFFU)

Enumerations

enum  DInDevBank { BANK0 = 0x00U , BANK1 = 0x01U , BANK2 = 0x02U , BANK3 = 0x03U }
 Discrete Input Hardware Channel Register Bank Selection (Bank 0 to Bank 3). More...
enum  DInBITState { DIN_BIT_PASS = 0U , DIN_BIT_FAIL = 1U }
 Discrete Input Built-In Test (BIT) Pass/Fail Evaluation State. More...
enum  DInBitChannel {
  DIN_BIT_SO_CH1 = 0U , DIN_BIT_SO_CH2 , DIN_BIT_SO_CH3 , DIN_BIT_SO_CH4 ,
  DIN_BIT_SO_CH5 , DIN_BIT_SO_CH6 , DIN_BIT_SO_CH7 , DIN_BIT_SO_CH8 ,
  DIN_BIT_SO_CH9 , DIN_BIT_SO_CH10 , DIN_BIT_SO_CH11 , DIN_BIT_SO_CH12 ,
  DIN_BIT_SO_CH13 , DIN_BIT_SO_CH14 , DIN_BIT_SO_CH15 , DIN_BIT_SO_CH16 ,
  DIN_BIT_SG_CH33_1 , DIN_BIT_SG_CH34_1 , DIN_BIT_SG_CH35_1 , DIN_BIT_SG_CH36_1 ,
  DIN_BIT_SG_CH37_1 , DIN_BIT_SG_CH38_1 , DIN_BIT_GO_CH38_2 , DIN_BIT_GO_CH37_2 ,
  DIN_BIT_GO_CH36_2 , DIN_BIT_GO_CH35_2 , DIN_BIT_GO_CH34_2 , DIN_BIT_GO_CH33_2 ,
  DIN_BIT_OG_CH17 , DIN_BIT_OG_CH18 , DIN_BIT_OG_CH19 , DIN_BIT_OG_CH20 ,
  DIN_BIT_OG_CH21 , DIN_BIT_OG_CH22 , DIN_BIT_OG_CH23 , DIN_BIT_OG_CH24 ,
  DIN_BIT_OG_CH25 , DIN_BIT_OG_CH26 , DIN_BIT_OG_CH27 , DIN_BIT_OG_CH28 ,
  DIN_BIT_OG_CH29 , DIN_BIT_OG_CH30 , DIN_BIT_OG_CH31 , DIN_BIT_OG_CH32
}
 Discrete Input Built-In Test (BIT) Hardware Channel Allocation Indices. More...

Functions

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 header file

Macro Definition Documentation

◆ DIN_BANK_MASK

#define DIN_BANK_MASK   (0x03U)

◆ DIN_BANK_OFFSET_0

#define DIN_BANK_OFFSET_0   (0U)

◆ DIN_BANK_OFFSET_1

#define DIN_BANK_OFFSET_1   (8U)

◆ DIN_BANK_OFFSET_2

#define DIN_BANK_OFFSET_2   (16U)

◆ DIN_BANK_OFFSET_3

#define DIN_BANK_OFFSET_3   (24U)

◆ DIN_BANK_SHIFT

#define DIN_BANK_SHIFT   (6U)

◆ DIN_CH_MAX

#define DIN_CH_MAX   (44U)

◆ DIN_DEV_CH_MAX

#define DIN_DEV_CH_MAX   (32U)

◆ DIN_DEV_MAX

#define DIN_DEV_MAX   (3U)

◆ DIN_MFB_MAX

#define DIN_MFB_MAX   (2U)

◆ DIN_TEMP_MASK

#define DIN_TEMP_MASK   (0xFFFFU)

Enumeration Type Documentation

◆ DInBitChannel

Discrete Input Built-In Test (BIT) Hardware Channel Allocation Indices.

Enumerator
DIN_BIT_SO_CH1 

Discrete Input BIT channel 1 (Supply/Open type).

DIN_BIT_SO_CH2 

Discrete Input BIT channel 2 (Supply/Open type).

DIN_BIT_SO_CH3 

Discrete Input BIT channel 3 (Supply/Open type).

DIN_BIT_SO_CH4 

Discrete Input BIT channel 4 (Supply/Open type).

DIN_BIT_SO_CH5 

Discrete Input BIT channel 5 (Supply/Open type).

DIN_BIT_SO_CH6 

Discrete Input BIT channel 6 (Supply/Open type).

DIN_BIT_SO_CH7 

Discrete Input BIT channel 7 (Supply/Open type).

DIN_BIT_SO_CH8 

Discrete Input BIT channel 8 (Supply/Open type).

DIN_BIT_SO_CH9 

Discrete Input BIT channel 9 (Supply/Open type).

DIN_BIT_SO_CH10 

Discrete Input BIT channel 10 (Supply/Open type).

DIN_BIT_SO_CH11 

Discrete Input BIT channel 11 (Supply/Open type).

DIN_BIT_SO_CH12 

Discrete Input BIT channel 12 (Supply/Open type).

DIN_BIT_SO_CH13 

Discrete Input BIT channel 13 (Supply/Open type).

DIN_BIT_SO_CH14 

Discrete Input BIT channel 14 (Supply/Open type).

DIN_BIT_SO_CH15 

Discrete Input BIT channel 15 (Supply/Open type).

DIN_BIT_SO_CH16 

Discrete Input BIT channel 16 (Supply/Open type).

DIN_BIT_SG_CH33_1 

Discrete Input BIT channel 33 (Supply/Ground stage 1).

DIN_BIT_SG_CH34_1 

Discrete Input BIT channel 34 (Supply/Ground stage 1).

DIN_BIT_SG_CH35_1 

Discrete Input BIT channel 35 (Supply/Ground stage 1).

DIN_BIT_SG_CH36_1 

Discrete Input BIT channel 36 (Supply/Ground stage 1).

DIN_BIT_SG_CH37_1 

Discrete Input BIT channel 37 (Supply/Ground stage 1).

DIN_BIT_SG_CH38_1 

Discrete Input BIT channel 38 (Supply/Ground stage 1).

DIN_BIT_GO_CH38_2 

Discrete Input BIT channel 38 (Ground/Open stage 2).

DIN_BIT_GO_CH37_2 

Discrete Input BIT channel 37 (Ground/Open stage 2).

DIN_BIT_GO_CH36_2 

Discrete Input BIT channel 36 (Ground/Open stage 2).

DIN_BIT_GO_CH35_2 

Discrete Input BIT channel 35 (Ground/Open stage 2).

DIN_BIT_GO_CH34_2 

Discrete Input BIT channel 34 (Ground/Open stage 2).

DIN_BIT_GO_CH33_2 

Discrete Input BIT channel 33 (Ground/Open stage 2).

DIN_BIT_OG_CH17 

Discrete Input BIT channel 17 (Open/Ground type).

DIN_BIT_OG_CH18 

Discrete Input BIT channel 18 (Open/Ground type).

DIN_BIT_OG_CH19 

Discrete Input BIT channel 19 (Open/Ground type).

DIN_BIT_OG_CH20 

Discrete Input BIT channel 20 (Open/Ground type).

DIN_BIT_OG_CH21 

Discrete Input BIT channel 21 (Open/Ground type).

DIN_BIT_OG_CH22 

Discrete Input BIT channel 22 (Open/Ground type).

DIN_BIT_OG_CH23 

Discrete Input BIT channel 23 (Open/Ground type).

DIN_BIT_OG_CH24 

Discrete Input BIT channel 24 (Open/Ground type).

DIN_BIT_OG_CH25 

Discrete Input BIT channel 25 (Open/Ground type).

DIN_BIT_OG_CH26 

Discrete Input BIT channel 26 (Open/Ground type).

DIN_BIT_OG_CH27 

Discrete Input BIT channel 27 (Open/Ground type).

DIN_BIT_OG_CH28 

Discrete Input BIT channel 28 (Open/Ground type).

DIN_BIT_OG_CH29 

Discrete Input BIT channel 29 (Open/Ground type).

DIN_BIT_OG_CH30 

Discrete Input BIT channel 30 (Open/Ground type).

DIN_BIT_OG_CH31 

Discrete Input BIT channel 31 (Open/Ground type).

DIN_BIT_OG_CH32 

Discrete Input BIT channel 32 (Open/Ground type).

Discrete Input BIT channel 32 (Open/Ground type).

◆ DInBITState

Discrete Input Built-In Test (BIT) Pass/Fail Evaluation State.

Enumerator
DIN_BIT_PASS 

DIN BIT for NO ERROR condition is 0.

DIN_BIT_FAIL 

DIN BIT for ERROR condition is 1.

DIN BIT for ERROR condition is 1.

◆ DInDevBank

enum DInDevBank

Discrete Input Hardware Channel Register Bank Selection (Bank 0 to Bank 3).

Enumerator
BANK0 

The channel bank for the CH1 to CH6.

BANK1 

The channel bank for the CH7 to CH15.

BANK2 

The channel bank for the CH16 to CH24.

BANK3 

The channel bank for the CH25 to CH26.

The channel bank for the CH25 to CH26

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