|
HFCC-01 Low-Level Software (LLSW) Rel_6802_HFCC-01-RP-CSAR-CB
|
#include "analogIn.h"#include "utilHelper.h"#include "interDrv.h"#include "interStatus.h"#include "mmapAnalogIn.h"Macros | |
| #define | AIN_VOLTAGE_LSB (0.003F) |
| #define | AIN_CH_ENABLE_STATE (1U) |
Functions | |
| static DriverStatus | readAnInReg (const UInt32 baseAddress, const UInt32 offset, UInt32 *data) |
| readAnInReg - analogIn PCIe read function. | |
| static DriverStatus | writeAnInReg (const UInt32 baseAddress, const UInt32 offset, const UInt32 data) |
| writeAnInReg - analogIn PCIe write function. | |
| DriverStatus | analogIn_getPbit (const AnalogInDevHandler analogInDevHdl, AnalogInPbitStatus *pbitStatus) |
| analogIn_getPbit. | |
| DriverStatus | analogIn_getCbit (const AnalogInDevHandler analogInDevHdl, AnalogInCbitStatus *cbitStatus) |
| analogIn_getCbit. | |
| DriverStatus | analogIn_getTemp (const AnalogInDevHandler analogInDevHdl, Float32 *temp5v, Float32 *temp10v) |
| analogIn_getTemp. | |
| DriverStatus | analogIn_enableDisableCh (const AnalogInDevHandler analogInDevHdl, const UInt8 chNum, const Bool flag) |
| analogIn_enableDisableCh. | |
| DriverStatus | analogIn_getInputRange (const AnalogInDevHandler analogInDevHdl, const UInt8 bank, UInt32 *range) |
| analogIn_getInputRange. | |
| DriverStatus | analogIn_getAdcReading (const AnalogInDevHandler analogInDevHdl, const UInt8 chNum, Float32 *adcValue) |
| analogIn_getAdcReading. | |
| DriverStatus | analogIn_getChannelStatus (const AnalogInDevHandler analogInDevHdl, const UInt8 chNum, Bool *status) |
| analogIn_getChannelStatus. | |
Analog Input device driver file
| #define AIN_CH_ENABLE_STATE (1U) |
| #define AIN_VOLTAGE_LSB (0.003F) |
| DriverStatus analogIn_enableDisableCh | ( | const AnalogInDevHandler | analogInDevHdl, |
| const UInt8 | chNum, | ||
| const Bool | flag ) |
analogIn_enableDisableCh.
| [in] | analogInDevHdl | The device handler. |
| [in] | chNum | The device channel number. |
| [out] | flag | The flag to enable or disable channel. |
| 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_ANALOGIN_ANALOGIN_ENABLEDISABLECH_01 | HLR_AIN_30827 | WHEN invoked, the analogIn_enableDisableCh() function SHALL read the current ADC channel enable status from register MMAP_ADC_CH_STATE using readAnInReg(). | analogIn.c:analogIn_enableDisableCh() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_ENABLEDISABLECH_02 | HLR_AIN_30827 | WHEN the register read operation fails (status not equal to DRV_SUCCESS), the analogIn_enableDisableCh() function SHALL abort processing and return that failure status. | analogIn.c:analogIn_enableDisableCh() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_ENABLEDISABLECH_03 | HLR_AIN_30827 | WHEN flag is TRUE, the analogIn_enableDisableCh() function SHALL enable channel chNum by setting bit chNum in the ADC channel state register value. | analogIn.c:analogIn_enableDisableCh() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_ENABLEDISABLECH_04 | HLR_AIN_30827 | WHEN flag is FALSE, the analogIn_enableDisableCh() function SHALL disable channel chNum by clearing bit chNum in the ADC channel state register value. | analogIn.c:analogIn_enableDisableCh() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_ENABLEDISABLECH_05 | HLR_AIN_30827 | WHEN the ADC channel enable bitmask is updated, the analogIn_enableDisableCh() function SHALL write the new mask to register MMAP_ADC_CH_ENABLE using writeAnInReg(). | analogIn.c:analogIn_enableDisableCh() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_ENABLEDISABLECH_06 | HLR_AIN_30827 | WHEN all operational processing completes successfully, the analogIn_enableDisableCh() function SHALL return DRV_SUCCESS. | analogIn.c:analogIn_enableDisableCh() | Test | Closed |
| DriverStatus analogIn_getAdcReading | ( | const AnalogInDevHandler | analogInDevHdl, |
| const UInt8 | chNum, | ||
| Float32 * | adcValue ) |
analogIn_getAdcReading.
| [in] | analogInDevHdl | The analog input device handler. |
| [in] | chNum | The device channel number. |
| [out] | adcValue | The adc reading value. |
| 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_ANALOGIN_ANALOGIN_GETADCREADING_01 | HLR_AIN_21627 | WHEN the pointer adcValue is NULL (invalid), the analogIn_getAdcReading() function SHALL abort processing and return DRV_INVALID_PARAM. | analogIn.c:analogIn_getAdcReading() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETADCREADING_02 | HLR_AIN_21627 | WHEN a driver operation reports a failure status other than DRV_SUCCESS, the analogIn_getAdcReading() function SHALL abort processing and return that driver failure status. | analogIn.c:analogIn_getAdcReading() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETADCREADING_03 | HLR_AIN_21627 | WHEN preconditions are satisfied, the analogIn_getAdcReading() function SHALL read the memory map offset list (ADC_RD_BASE_ADDR) at physical offset (0x0200 + (chNum * MMAP_ADC_CH_OFFSET_GAP)) (MMAP_ADC_RD_BASE_ADDR) using readAnInReg(). | analogIn.c:analogIn_getAdcReading() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETADCREADING_04 | HLR_AIN_21627 | WHEN all operational processing completes successfully, the analogIn_getAdcReading() function SHALL return DRV_SUCCESS. | analogIn.c:analogIn_getAdcReading() | Test | Closed |
| DriverStatus analogIn_getCbit | ( | const AnalogInDevHandler | analogInDevHdl, |
| AnalogInCbitStatus * | cbitStatus ) |
analogIn_getCbit.
analogIn get CBIT status.
| [in] | analogInDevHdl | The analog input device handler. |
| [out] | cbitStatus | The pointer of CBIT status value. |
| 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_ANALOGIN_ANALOGIN_GETCBIT_01 | HLR_AIN_23596 | WHEN the pointer cbitStatus is NULL (invalid), the analogIn_getCbit() function SHALL abort processing and return DRV_INVALID_PARAM. | analogIn.c:analogIn_getCbit() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETCBIT_02 | HLR_AIN_23596 | WHEN a driver operation reports a failure status other than DRV_SUCCESS, the analogIn_getCbit() function SHALL abort processing and return that driver failure status. | analogIn.c:analogIn_getCbit() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETCBIT_03 | HLR_AIN_23596 | WHEN preconditions are satisfied, the analogIn_getCbit() function SHALL read the memory map offset list (ADC_CBIT_GEN_STATUS) at physical offset 0x0110 (MMAP_ADC_CBIT_GEN_STATUS) using readAnInReg(). | analogIn.c:analogIn_getCbit() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETCBIT_04 | HLR_AIN_23596 | WHEN preconditions are satisfied, the analogIn_getCbit() function SHALL invoke bitwise routine READ_BIT() to extract target channel status bit from register payload. | analogIn.c:analogIn_getCbit() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETCBIT_05 | HLR_AIN_23596 | WHEN all operational processing completes successfully, the analogIn_getCbit() function SHALL return DRV_SUCCESS. | analogIn.c:analogIn_getCbit() | Test | Closed |
| DriverStatus analogIn_getChannelStatus | ( | const AnalogInDevHandler | analogInDevHdl, |
| const UInt8 | chNum, | ||
| Bool * | status ) |
analogIn_getChannelStatus.
| [in] | analogInDevHdl | The analog input device handler. |
| [in] | chNum | The device channel number. |
| [out] | status | The status of the channel. |
| 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_ANALOGIN_ANALOGIN_GETCHANNELSTATUS_01 | HLR_AIN_30827 | WHEN the pointer status is NULL (invalid), the analogIn_getChannelStatus() function SHALL abort processing and return DRV_INVALID_PARAM. | analogIn.c:analogIn_getChannelStatus() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETCHANNELSTATUS_02 | HLR_AIN_30827 | WHEN the pointer status is valid, the analogIn_getChannelStatus() function SHALL read the ADC channel state register MMAP_ADC_CH_STATE using readAnInReg(). | analogIn.c:analogIn_getChannelStatus() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETCHANNELSTATUS_03 | HLR_AIN_30827 | WHEN the register read operation fails (status not equal to DRV_SUCCESS), the analogIn_getChannelStatus() function SHALL abort processing and return that failure status. | analogIn.c:analogIn_getChannelStatus() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETCHANNELSTATUS_04 | HLR_AIN_30827 | WHEN bit chNum in register MMAP_ADC_CH_STATE is equal to AIN_CH_ENABLE_STATE, the analogIn_getChannelStatus() function SHALL set *status to TRUE (enabled). | analogIn.c:analogIn_getChannelStatus() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETCHANNELSTATUS_05 | HLR_AIN_30827 | WHEN bit chNum in register MMAP_ADC_CH_STATE is not equal to AIN_CH_ENABLE_STATE, the analogIn_getChannelStatus() function SHALL set *status to FALSE (disabled). | analogIn.c:analogIn_getChannelStatus() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETCHANNELSTATUS_06 | HLR_AIN_30827 | WHEN all operational processing completes successfully, the analogIn_getChannelStatus() function SHALL return DRV_SUCCESS. | analogIn.c:analogIn_getChannelStatus() | Test | Closed |
| DriverStatus analogIn_getInputRange | ( | const AnalogInDevHandler | analogInDevHdl, |
| const UInt8 | bank, | ||
| UInt32 * | range ) |
analogIn_getInputRange.
| [in] | analogInDevHdl | The analog input device handler. |
| [in] | bank | The device bank. |
| [out] | range | The range data value. |
| 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_ANALOGIN_ANALOGIN_GETINPUTRANGE_01 | HLR_AIN_21627 | WHEN the pointer range is NULL (invalid), the analogIn_getInputRange() function SHALL abort processing and return DRV_INVALID_PARAM. | analogIn.c:analogIn_getInputRange() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETINPUTRANGE_02 | HLR_AIN_21627 | WHEN a driver operation reports a failure status other than DRV_SUCCESS, the analogIn_getInputRange() function SHALL abort processing and return that driver failure status. | analogIn.c:analogIn_getInputRange() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETINPUTRANGE_03 | HLR_AIN_21627 | WHEN preconditions are satisfied, the analogIn_getInputRange() function SHALL read the memory map offset list (ADC_IN_RG_BANK_BASE) at physical offset (0x0000 + (bank * MMAP_ADC_CH_OFFSET_GAP)) (MMAP_ADC_IN_RG_BANK_BASE) using readAnInReg(). | analogIn.c:analogIn_getInputRange() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETINPUTRANGE_04 | HLR_AIN_21627 | WHEN all operational processing completes successfully, the analogIn_getInputRange() function SHALL return DRV_SUCCESS. | analogIn.c:analogIn_getInputRange() | Test | Closed |
| DriverStatus analogIn_getPbit | ( | const AnalogInDevHandler | analogInDevHdl, |
| AnalogInPbitStatus * | pbitStatus ) |
analogIn_getPbit.
analogIn get PBIT status.
| [in] | analogInDevHdl | The analog input device handler. |
| [out] | pbitStatus | The pointer of PBIT status value. |
| 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_ANALOGIN_ANALOGIN_GETPBIT_01 | HLR_AIN_322 | WHEN the pointer pbitStatus is NULL (invalid), the analogIn_getPbit() function SHALL abort processing and return DRV_INVALID_PARAM. | analogIn.c:analogIn_getPbit() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETPBIT_02 | HLR_AIN_322 | WHEN a driver operation reports a failure status other than DRV_SUCCESS, the analogIn_getPbit() function SHALL abort processing and return that driver failure status. | analogIn.c:analogIn_getPbit() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETPBIT_03 | HLR_AIN_322 | WHEN preconditions are satisfied, the analogIn_getPbit() function SHALL read the memory map offset list (ADC_PBIT_GEN_STATUS) at physical offset 0x0104 (MMAP_ADC_PBIT_GEN_STATUS) using readAnInReg(). | analogIn.c:analogIn_getPbit() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETPBIT_04 | HLR_AIN_322 | WHEN preconditions are satisfied, the analogIn_getPbit() function SHALL invoke bitwise routine READ_BIT() to extract target channel status bit from register payload. | analogIn.c:analogIn_getPbit() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETPBIT_05 | HLR_AIN_322 | WHEN all operational processing completes successfully, the analogIn_getPbit() function SHALL return DRV_SUCCESS. | analogIn.c:analogIn_getPbit() | Test | Closed |
| DriverStatus analogIn_getTemp | ( | const AnalogInDevHandler | analogInDevHdl, |
| Float32 * | temp5v, | ||
| Float32 * | temp10v ) |
analogIn_getTemp.
analogIn get temperature value in degree celsius (C).
| [in] | analogInDevHdl | The analog input device handler. |
| [out] | temp5v | The pointer of 5v bank temperature value in degree celsius (C). |
| [out] | temp10v | The pointer of 10v bank 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_ANALOGIN_ANALOGIN_GETTEMP_01 | HLR_AIN_31357 | WHEN the pointer temp5v is NULL (invalid) or the pointer temp10v is NULL (invalid), the analogIn_getTemp() function SHALL abort processing and return DRV_INVALID_PARAM. | analogIn.c:analogIn_getTemp() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETTEMP_02 | HLR_AIN_31357 | WHEN a driver operation reports a failure status other than DRV_SUCCESS, the analogIn_getTemp() function SHALL abort processing and return that driver failure status. | analogIn.c:analogIn_getTemp() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETTEMP_03 | HLR_AIN_31357 | WHEN preconditions are satisfied, the analogIn_getTemp() function SHALL read the memory map offset list (ADC_TEMP_5V) at physical offset 0x011C (MMAP_ADC_TEMP_5V) using readAnInReg(). | analogIn.c:analogIn_getTemp() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETTEMP_04 | HLR_AIN_31357 | WHEN preconditions are satisfied, the analogIn_getTemp() function SHALL invoke routine 005() to execute target subsystem hardware operation. | analogIn.c:analogIn_getTemp() | Test | Closed |
| LLR_ANALOGIN_ANALOGIN_GETTEMP_05 | HLR_AIN_31357 | WHEN all operational processing completes successfully, the analogIn_getTemp() function SHALL return DRV_SUCCESS. | analogIn.c:analogIn_getTemp() | Test | Closed |
|
static |
readAnInReg - analogIn 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_ANALOGIN_READANINREG_01 | HLR_AIN_21627 | WHEN the pointer data is NULL (invalid), the readAnInReg() function SHALL abort processing and return DRV_INVALID_PARAM. | analogIn.c:readAnInReg() | Test | Closed |
| LLR_ANALOGIN_READANINREG_02 | HLR_AIN_21627 | WHEN the pointer data is valid, the readAnInReg() function SHALL read a 32-bit register value from physical memory address (baseAddress + addrOffset) into *data using PCIe primitive interDrv_Read32(). | analogIn.c:readAnInReg() | Test | Closed |
| LLR_ANALOGIN_READANINREG_03 | HLR_AIN_21627 | WHEN memory access via interDrv_Read32() fails (status not equal to INTF_SUCCESS), the readAnInReg() function SHALL abort processing and return DRV_READ_FAILED. | analogIn.c:readAnInReg() | Test | Closed |
| LLR_ANALOGIN_READANINREG_04 | HLR_AIN_21627 | WHEN all operational processing completes successfully, the readAnInReg() function SHALL return DRV_SUCCESS. | analogIn.c:readAnInReg() | Test | Closed |
|
static |
writeAnInReg - analogIn 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_ANALOGIN_WRITEANINREG_01 | HLR_AIN_21627 | WHEN invoked, the writeAnInReg() function SHALL write the 32-bit word data to physical memory address (baseAddress + addrOffset) using PCIe primitive interDrv_Write32(). | analogIn.c:writeAnInReg() | Test | Closed |
| LLR_ANALOGIN_WRITEANINREG_02 | HLR_AIN_21627 | WHEN memory access via interDrv_Write32() fails (status not equal to INTF_SUCCESS), the writeAnInReg() function SHALL abort processing and return DRV_WRITE_FAILED. | analogIn.c:writeAnInReg() | Test | Closed |
| LLR_ANALOGIN_WRITEANINREG_03 | HLR_AIN_21627 | WHEN all operational processing completes successfully, the writeAnInReg() function SHALL return DRV_SUCCESS. | analogIn.c:writeAnInReg() | Test | Closed |