|
HFCC-01 Low-Level Software (LLSW) Rel_6802_HFCC-01-RP-CSAR-CB
|
#include "discreteOut.h"#include "interDrv.h"#include "interStatus.h"#include "utilHelper.h"#include "mmapDiscreteOut.h"#include "timeOper.h"#include "memoryOper.h"Macros | |
| #define | DOUT_CHANNEL_MAX (6U) |
| #define | DOUT_CHANNEL_OK (3U) |
| #define | DOUT_CHANNEL_UNDERLOAD (2U) |
| #define | DOUT_BANK_STATUS_NORMAL (1U) |
| #define | DOUT_BANK_STATUS_MASK (0x00000003U) |
| #define | DOUT_ULD_STATUS (0x02U) |
| #define | DOUT_PWM_CARD (0U) |
| #define | DOUT_PWM1_DEVICE (0U) |
| #define | DOUT_PWM2_DEVICE (1U) |
| #define | DOUT_PWM3_DEVICE (2U) |
| #define | DOUT_PWM4_DEVICE (3U) |
| #define | DOUT_PWM1_CHANNEL (2U) |
| #define | DOUT_PWM2_CHANNEL (2U) |
| #define | DOUT_PWM3_CHANNEL (2U) |
| #define | DOUT_PWM4_CHANNEL (2U) |
| #define | GET_HB_FIELD(data, pos) |
| #define | IS_CHANNEL_ENABLED(state, pos) |
| #define | IS_HB_OK(hb) |
Functions | |
| static DriverStatus | readDiscreteOutReg (const UInt32 baseAddress, const UInt32 offset, UInt32 *data) |
| readDiscreteOutReg. | |
| static DriverStatus | writeDiscreteOutReg (const UInt32 baseAddress, const UInt32 offset, const UInt32 data) |
| writeDiscreteOutReg. | |
| DriverStatus | discreteOut_reset (const DOutDevHandler dOutDevHdl) |
| discreteOut_reset. | |
| DriverStatus | discreteOut_getPbit (const DOutDevHandler dOutDevHdl, DOutPbitStatus *pbitStatus, const UInt8 devNum) |
| discreteOut_getPbit. | |
| DriverStatus | discreteOut_getCbit (const DOutDevHandler dOutDevHdl, DOutCbitStatus *cbitStatus, const UInt8 devNum) |
| discreteOut_getCbit. | |
| DriverStatus | discreteOut_getTemp (const DOutDevHandler dOutDevHdl, Float32 *temp) |
| discreteOut_getTemp. | |
| DriverStatus | discreteOut_devicesConfig (const DOutDevHandler dOutDevHdl, const DOutBankCfg bankConfig) |
| discreteOut_devicesConfig. | |
| DriverStatus | discreteOut_writeChState (const DOutDevHandler dOutDevHdl, const UInt8 channelNum, const Bool dOutLogic) |
| discreteOut_writeChState. | |
Discrete Output device driver file
| #define DOUT_BANK_STATUS_MASK (0x00000003U) |
| #define DOUT_BANK_STATUS_NORMAL (1U) |
| #define DOUT_CHANNEL_MAX (6U) |
| #define DOUT_CHANNEL_OK (3U) |
| #define DOUT_CHANNEL_UNDERLOAD (2U) |
| #define DOUT_PWM1_CHANNEL (2U) |
| #define DOUT_PWM1_DEVICE (0U) |
| #define DOUT_PWM2_CHANNEL (2U) |
| #define DOUT_PWM2_DEVICE (1U) |
| #define DOUT_PWM3_CHANNEL (2U) |
| #define DOUT_PWM3_DEVICE (2U) |
| #define DOUT_PWM4_CHANNEL (2U) |
| #define DOUT_PWM4_DEVICE (3U) |
| #define DOUT_PWM_CARD (0U) |
| #define DOUT_ULD_STATUS (0x02U) |
| #define GET_HB_FIELD | ( | data, | |
| pos ) |
| #define IS_CHANNEL_ENABLED | ( | state, | |
| pos ) |
| #define IS_HB_OK | ( | hb | ) |
| DriverStatus discreteOut_devicesConfig | ( | const DOutDevHandler | dOutDevHdl, |
| const DOutBankCfg | bankConfig ) |
discreteOut_devicesConfig.
discreteOut set device configuration.
| [in] | dOutDevHdl | The discrete output device handler. |
| [in] | bankConfig | The bank configuration value. |
| DRV_SUCCESS | : Success. |
| DRV_WRITE_FAILED | : Failed to write to the device or module. |
| DRV_READ_FAILED | : Failed to read from the device or module. |
| Requirement ID | Parent HLR ID | Detailed Low-Level Requirement Statement (EARS Format) | Software Unit Reference | Verification Method | Status |
|---|---|---|---|---|---|
| LLR_DISCRETEOUT_DISCRETEOUT_DEVICESCONFIG_01 | HLR_DOUT_39816 | WHEN invoked, the discreteOut_devicesConfig() function SHALL read the current bank configuration register MMAP_DOUT_BANK_CFG_DEV using readDiscreteOutReg(). | discreteOut.c:discreteOut_devicesConfig() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_DEVICESCONFIG_02 | HLR_DOUT_39816 | WHEN the register read operation fails (status not equal to DRV_SUCCESS), the discreteOut_devicesConfig() function SHALL abort processing and return that failure status. | discreteOut.c:discreteOut_devicesConfig() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_DEVICESCONFIG_03 | HLR_DOUT_39816 | WHEN bank configuration overvoltage is enabled (bankConfig.overVoltage is TRUE), the discreteOut_devicesConfig() function SHALL set bit 0 in the configuration word. | discreteOut.c:discreteOut_devicesConfig() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_DEVICESCONFIG_04 | HLR_DOUT_39816 | WHEN bank configuration overvoltage is disabled (bankConfig.overVoltage is FALSE), the discreteOut_devicesConfig() function SHALL clear bit 0 in the configuration word. | discreteOut.c:discreteOut_devicesConfig() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_DEVICESCONFIG_05 | HLR_DOUT_39816 | WHEN bank configuration underload is enabled (bankConfig.underLoad is TRUE), the discreteOut_devicesConfig() function SHALL set bit 1 in the configuration word. | discreteOut.c:discreteOut_devicesConfig() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_DEVICESCONFIG_06 | HLR_DOUT_39816 | WHEN bank configuration underload is disabled (bankConfig.underLoad is FALSE), the discreteOut_devicesConfig() function SHALL clear bit 1 in the configuration word. | discreteOut.c:discreteOut_devicesConfig() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_DEVICESCONFIG_07 | HLR_DOUT_39816 | WHEN bank configuration bits are updated, the discreteOut_devicesConfig() function SHALL write the configured word to register MMAP_DOUT_BANK_CFG_DEV using writeDiscreteOutReg(). | discreteOut.c:discreteOut_devicesConfig() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_DEVICESCONFIG_08 | HLR_DOUT_39816 | WHEN all operational processing completes successfully, the discreteOut_devicesConfig() function SHALL return DRV_SUCCESS. | discreteOut.c:discreteOut_devicesConfig() | Test | Closed |
| DriverStatus discreteOut_getCbit | ( | const DOutDevHandler | dOutDevHdl, |
| DOutCbitStatus * | cbitStatus, | ||
| const UInt8 | devNum ) |
discreteOut_getCbit.
discreteOut get CBIT status.
| [in] | dOutDevHdl | The discrete output device handler. |
| [out] | cbitStatus | The pointer of CBIT status value. |
| [in] | devNum | The discrete output device number. |
| DRV_SUCCESS | : Success. |
| DRV_READ_FAILED | : Failed to read from the device or module. |
| DRV_INVALID_PARAM | : The provided address pointer is invalid. |
| Requirement ID | Parent HLR ID | Detailed Low-Level Requirement Statement (EARS Format) | Software Unit Reference | Verification Method | Status |
|---|---|---|---|---|---|
| LLR_DISCRETEOUT_DISCRETEOUT_GETCBIT_01 | HLR_DOUT_23590 | WHEN the pointer cbitStatus is NULL (invalid), the discreteOut_getCbit() function SHALL abort processing and return DRV_INVALID_PARAM. | discreteOut.c:discreteOut_getCbit() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_GETCBIT_02 | HLR_DOUT_23590 | WHEN devNum is between 0 and 7, the discreteOut_getCbit() function SHALL select device bank index 0. | discreteOut.c:discreteOut_getCbit() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_GETCBIT_03 | HLR_DOUT_23590 | WHEN devNum is between 8 and 10, the discreteOut_getCbit() function SHALL select device bank index 1. | discreteOut.c:discreteOut_getCbit() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_GETCBIT_04 | HLR_DOUT_23590 | WHEN the device bank index is resolved, the discreteOut_getCbit() function SHALL read the CBIT status register MMAP_DOUT_CBIT_STATUS using readDiscreteOutReg(). | discreteOut.c:discreteOut_getCbit() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_GETCBIT_05 | HLR_DOUT_23590 | WHEN the CBIT status register is read successfully, the discreteOut_getCbit() function SHALL unpack hardware telemetry bits for power good, over/under temperature, overvoltage lockout, and underload shutdown for the specified device into cbitStatus. | discreteOut.c:discreteOut_getCbit() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_GETCBIT_06 | HLR_DOUT_23590 | WHEN all operational processing completes successfully, the discreteOut_getCbit() function SHALL return DRV_SUCCESS. | discreteOut.c:discreteOut_getCbit() | Test | Closed |
| DriverStatus discreteOut_getPbit | ( | const DOutDevHandler | dOutDevHdl, |
| DOutPbitStatus * | pbitStatus, | ||
| const UInt8 | devNum ) |
discreteOut_getPbit.
discreteOut get PBIT status.
| [in] | dOutDevHdl | The discrete output device handler. |
| [out] | pbitStatus | The pointer of PBIT status value. |
| [in] | devNum | The discrete output device number. |
| DRV_SUCCESS | : Success. |
| DRV_READ_FAILED | : Failed to read from the device or module. |
| DRV_INVALID_PARAM | : The provided address pointer is invalid. |
| Requirement ID | Parent HLR ID | Detailed Low-Level Requirement Statement (EARS Format) | Software Unit Reference | Verification Method | Status |
|---|---|---|---|---|---|
| LLR_DISCRETEOUT_DISCRETEOUT_GETPBIT_01 | HLR_DOUT_321 | WHEN the pointer pbitStatus is NULL (invalid), the discreteOut_getPbit() function SHALL abort processing and return DRV_INVALID_PARAM. | discreteOut.c:discreteOut_getPbit() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_GETPBIT_02 | HLR_DOUT_321 | WHEN devNum is between 0 and 7, the discreteOut_getPbit() function SHALL select device bank index 0. | discreteOut.c:discreteOut_getPbit() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_GETPBIT_03 | HLR_DOUT_321 | WHEN devNum is between 8 and 10, the discreteOut_getPbit() function SHALL select device bank index 1. | discreteOut.c:discreteOut_getPbit() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_GETPBIT_04 | HLR_DOUT_321 | WHEN the device bank index is resolved, the discreteOut_getPbit() function SHALL read the PBIT status register MMAP_DOUT_PBIT_STATUS using readDiscreteOutReg(). | discreteOut.c:discreteOut_getPbit() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_GETPBIT_05 | HLR_DOUT_321 | WHEN the PBIT status register is read successfully, the discreteOut_getPbit() function SHALL unpack hardware telemetry bits for power good, over/under temperature, and built-in test pattern results into pbitStatus. | discreteOut.c:discreteOut_getPbit() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_GETPBIT_06 | HLR_DOUT_321 | WHEN all operational processing completes successfully, the discreteOut_getPbit() function SHALL return DRV_SUCCESS. | discreteOut.c:discreteOut_getPbit() | Test | Closed |
| DriverStatus discreteOut_getTemp | ( | const DOutDevHandler | dOutDevHdl, |
| Float32 * | temp ) |
discreteOut_getTemp.
discreteOut get temperature value in degree celsius (C).
| [in] | dOutDevHdl | The discrete output device handler. |
| [out] | temp | The pointer of temperature value in degree celsius (C). |
| DRV_SUCCESS | : Success. |
| DRV_READ_FAILED | : Failed to read from the device or module. |
| DRV_INVALID_PARAM | : The provided address pointer is invalid. |
| Requirement ID | Parent HLR ID | Detailed Low-Level Requirement Statement (EARS Format) | Software Unit Reference | Verification Method | Status |
|---|---|---|---|---|---|
| LLR_DISCRETEOUT_DISCRETEOUT_GETTEMP_01 | HLR_DOUT_30818 | WHEN the pointer temp is NULL (invalid), the discreteOut_getTemp() function SHALL abort processing and return DRV_INVALID_PARAM. | discreteOut.c:discreteOut_getTemp() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_GETTEMP_02 | HLR_DOUT_30818 | WHEN a driver operation reports a failure status other than DRV_SUCCESS, the discreteOut_getTemp() function SHALL abort processing and return that driver failure status. | discreteOut.c:discreteOut_getTemp() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_GETTEMP_03 | HLR_DOUT_30818 | WHEN preconditions are satisfied, the discreteOut_getTemp() function SHALL read the Discrete Output Temperature Register (TEMP_RAW) at physical offset 0x0060 (MMAP_DOUT_TEMP_RAW) using readDiscreteOutReg(). | discreteOut.c:discreteOut_getTemp() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_GETTEMP_04 | HLR_DOUT_30818 | WHEN all operational processing completes successfully, the discreteOut_getTemp() function SHALL return DRV_SUCCESS. | discreteOut.c:discreteOut_getTemp() | Test | Closed |
| DriverStatus discreteOut_reset | ( | const DOutDevHandler | dOutDevHdl | ) |
discreteOut_reset.
Reset the discrete output module. The reset operation is performed by setting the reset bit of the discrete output module to 1 and then setting it back to 0.
| [in] | dOutDevHdl | The discrete output device handler. |
| DRV_SUCCESS | : Success. |
| DRV_WRITE_FAILED | : Failed to write to the device or module. |
| Requirement ID | Parent HLR ID | Detailed Low-Level Requirement Statement (EARS Format) | Software Unit Reference | Verification Method | Status |
|---|---|---|---|---|---|
| LLR_DISCRETEOUT_DISCRETEOUT_RESET_01 | HLR_DOUT_30817 | WHEN a driver operation reports a failure status other than DRV_SUCCESS, the discreteOut_reset() function SHALL abort processing and return that driver failure status. | discreteOut.c:discreteOut_reset() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_RESET_02 | HLR_DOUT_30817 | WHEN preconditions are satisfied, the discreteOut_reset() function SHALL write the device block members memory offset (DOUT_RESET_MODULE) at physical offset 0x0028 (MMAP_DOUT_RESET_MODULE) using writeDiscreteOutReg(). | discreteOut.c:discreteOut_reset() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_RESET_03 | HLR_DOUT_30817 | WHEN the reset register is asserted, the discreteOut_reset() function SHALL wait for a minimum hardware reset pulse width delay of 100 microseconds before deasserting. | discreteOut.c:discreteOut_reset() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_RESET_04 | HLR_DOUT_30817 | WHEN all operational processing completes successfully, the discreteOut_reset() function SHALL return DRV_SUCCESS. | discreteOut.c:discreteOut_reset() | Test | Closed |
| DriverStatus discreteOut_writeChState | ( | const DOutDevHandler | dOutDevHdl, |
| const UInt8 | channelNum, | ||
| const Bool | dOutLogic ) |
discreteOut_writeChState.
Write the discrete output state.
| [in] | dOutDevHdl | The discrete output device handler. |
| [in] | channelNum | The channel number. |
| [in] | dOutLogic | The logic state to set. |
| DRV_SUCCESS | : Success. |
| DRV_WRITE_FAILED | : Failed to write to the device or module. |
| DRV_READ_FAILED | : Failed to read from the device or module. |
| DRV_INVALID_CHANNEL | : The channel number is invalid. |
| Requirement ID | Parent HLR ID | Detailed Low-Level Requirement Statement (EARS Format) | Software Unit Reference | Verification Method | Status |
|---|---|---|---|---|---|
| LLR_DISCRETEOUT_DISCRETEOUT_WRITECHSTATE_01 | HLR_DOUT_234 | WHEN channel number channelNum exceeds DOUT_CHANNEL_MAX, the discreteOut_writeChState() function SHALL abort processing and return DRV_INVALID_CHANNEL. | discreteOut.c:discreteOut_writeChState() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_WRITECHSTATE_02 | HLR_DOUT_234 | WHEN channel validation passes, the discreteOut_writeChState() function SHALL read the current channel state register MMAP_DOUT_BANK_CH_STATE using readDiscreteOutReg(). | discreteOut.c:discreteOut_writeChState() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_WRITECHSTATE_03 | HLR_DOUT_234 | WHEN dOutLogic is TRUE, the discreteOut_writeChState() function SHALL set bit channelNum in the channel state register value. | discreteOut.c:discreteOut_writeChState() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_WRITECHSTATE_04 | HLR_DOUT_234 | WHEN dOutLogic is FALSE, the discreteOut_writeChState() function SHALL clear bit channelNum in the channel state register value. | discreteOut.c:discreteOut_writeChState() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_WRITECHSTATE_05 | HLR_DOUT_234 | WHEN the channel bit is updated, the discreteOut_writeChState() function SHALL write the modified register value to MMAP_DOUT_BANK_CH_STATE using writeDiscreteOutReg(). | discreteOut.c:discreteOut_writeChState() | Test | Closed |
| LLR_DISCRETEOUT_DISCRETEOUT_WRITECHSTATE_06 | HLR_DOUT_234 | WHEN all operational processing completes successfully, the discreteOut_writeChState() function SHALL return DRV_SUCCESS. | discreteOut.c:discreteOut_writeChState() | Test | Closed |
|
static |
readDiscreteOutReg.
discreteOut PCIe read function.
| [in] | baseAddress | The base address of the module and device. |
| [in] | offset | The offset address from module base address. |
| [out] | data | 32bit data to read from PCIe. |
| DRV_SUCCESS | : Success. |
| DRV_READ_FAILED | : PCIe failed to read value. |
| DRV_INVALID_PARAM | : The provided address pointer is invalid. |
| Requirement ID | Parent HLR ID | Detailed Low-Level Requirement Statement (EARS Format) | Software Unit Reference | Verification Method | Status |
|---|---|---|---|---|---|
| LLR_DISCRETEOUT_READDISCRETEOUTREG_01 | HLR_DOUT_23590 | WHEN the pointer data is NULL (invalid), the readDiscreteOutReg() function SHALL abort processing and return DRV_INVALID_PARAM. | discreteOut.c:readDiscreteOutReg() | Test | Closed |
| LLR_DISCRETEOUT_READDISCRETEOUTREG_02 | HLR_DOUT_23590 | WHEN the pointer data is valid, the readDiscreteOutReg() function SHALL read a 32-bit register value from physical memory address (baseAddress + addrOffset) into *data using PCIe primitive interDrv_Read32(). | discreteOut.c:readDiscreteOutReg() | Test | Closed |
| LLR_DISCRETEOUT_READDISCRETEOUTREG_03 | HLR_DOUT_23590 | WHEN memory access via interDrv_Read32() fails (status not equal to INTF_SUCCESS), the readDiscreteOutReg() function SHALL abort processing and return DRV_READ_FAILED. | discreteOut.c:readDiscreteOutReg() | Test | Closed |
| LLR_DISCRETEOUT_READDISCRETEOUTREG_04 | HLR_DOUT_23590 | WHEN all operational processing completes successfully, the readDiscreteOutReg() function SHALL return DRV_SUCCESS. | discreteOut.c:readDiscreteOutReg() | Test | Closed |
|
static |
writeDiscreteOutReg.
discreteOut PCIe write function.
| [in] | baseAddress | The base address of the module and device. |
| [in] | offset | The offset address from module base address. |
| [in] | data | 32bit data to write to PCIe. |
| DRV_SUCCESS | : Success. |
| DRV_WRITE_FAILED | : PCIe failed to write value. |
| Requirement ID | Parent HLR ID | Detailed Low-Level Requirement Statement (EARS Format) | Software Unit Reference | Verification Method | Status |
|---|---|---|---|---|---|
| LLR_DISCRETEOUT_WRITEDISCRETEOUTREG_01 | HLR_DOUT_23590 | WHEN invoked, the writeDiscreteOutReg() function SHALL write the 32-bit word data to physical memory address (baseAddress + addrOffset) using PCIe primitive interDrv_Write32(). | discreteOut.c:writeDiscreteOutReg() | Test | Closed |
| LLR_DISCRETEOUT_WRITEDISCRETEOUTREG_02 | HLR_DOUT_23590 | WHEN memory access via interDrv_Write32() fails (status not equal to INTF_SUCCESS), the writeDiscreteOutReg() function SHALL abort processing and return DRV_WRITE_FAILED. | discreteOut.c:writeDiscreteOutReg() | Test | Closed |
| LLR_DISCRETEOUT_WRITEDISCRETEOUTREG_03 | HLR_DOUT_23590 | WHEN all operational processing completes successfully, the writeDiscreteOutReg() function SHALL return DRV_SUCCESS. | discreteOut.c:writeDiscreteOutReg() | Test | Closed |