PS BasicOps
Edit this on GitLab
PS BasicOps
Explanation
About the Sample Code
Introduction This sample application code in C is designed for use with North Atlantic Industries (NAI) Single Slot Kit (SSK) to interact with their embedded function modules, specifically focusing on power supply monitoring and operations. The code demonstrates how to perform basic operations with an NAI Power Supply from either an external system over Ethernet or directly within the SIU Chassis using I2C communication.
Source Code Breakdown
Includes and Definitions
The initial part of the code includes necessary headers and defines various constants:
- Standard libraries: stdio.h
, string.h
, ctype.h
.
- NAI-specific headers: These include functional modules for board access, utilities, and hardware-specific operations (naibrd.h
, nai.h
, etc.).
- Custom utility headers for basic operations.
Global Constants
static const int8_t *SAMPLE_PGM_NAME = (const int8_t *)"PS4_BasicOps";
/*static const int8_t *DEF_CONFIG_FILE = (const int8_t *)"default_PS4_BasicOps.txt";*/
/* Global buffer and count for user input */
static int8_t g_ps_op[80];
static int32_t g_ps_responseCnt = 0;
static int32_t g_ps_cardIndex = 5; /* Logical reference to power supply */
-
SAMPLE_PGM_NAME
: Defines the name of the program. -
Global variables to hold user input, response count, and card index for identifying the power supply unit.
Function Declarations Several functions are declared to handle various tasks, including displaying configurations, reading statuses, and monitoring power supply.
void DisplayI2CDeviceCfg(void);
void PS_BasicOps(void);
nai_status_t ReadAllNonGeneralStatuses(void);
nai_status_t ReadStatusGeneral(void);
nai_status_t ReadAllMonitors(void);
Main Function
The main
function initializes and configures the sample program. Depending on where the application is running (externally via Ethernet or within the chassis using I2C), it establishes the necessary communication and calls PS_BasicOps()
to perform operations.
Steps:
1. Display application description.
2. Query user for communication method (Ethernet or I2C).
3. Depending on the selection, configure the IP address and port for Ethernet or set up I2C.
4. Open the device connection using naibrd_PS_OpenDevice
.
5. If successful, perform basic operations using PS_BasicOps
.
6. Close the connection to the power supply.
DisplayPSApplicationDescription Function
static void DisplayPSApplicationDescription()
{
printf(" Power Supply Application Description\n");
// Description of the application based on running context.
}
This function provides an overview of the program and the required configurations based on running context (externally via Ethernet or within NIU SIU Chassis using I2C).
PS_BasicOps Function Performs basic operations to monitor the power supply metrics: 1. Reads FPGA version numbers. 2. Reads build date and time. 3. Gets the serial number of the power supply. 4. Calls other functions to read general statuses, non-general statuses, and all monitors.
ReadStatusGeneral Function Reads general status, including dynamic and latched general statuses. Displays the read status using print functions.
ReadAllNonGeneralStatuses Function Reads non-general status flags such as under/over voltage, over current, and temperature statuses. Displays these statuses accordingly.
ReadAllMonitors Function Reads all voltage, current, and temperature monitors for various power lines and displays the monitored values.
Functions and Definitions
NAI Library Functions:
- naibrd_PS_GetVersionNum()
: Retrieves version numbers.
- naibrd_PS_GetBuildDate()
: Retrieves build date information.
- naibrd_PS_GetBuildTime()
: Retrieves build time information.
- naibrd_PS_GetSerialNum()
: Retrieves the serial number of the device.
- naibrd_PS_GetStatus()
: Reads various status flags for monitoring.
- naibrd_PS_GetVoltage()
: Retrieves voltage readings.
- naibrd_PS_GetCurrent()
: Retrieves current readings.
- naibrd_PS_GetTemperature()
: Retrieves temperature readings.
- naibrd_SetIPAddress()
: Configures IP address for communication.
- naibrd_PS_OpenDevice()
: Opens the power supply device for communication.
- naibrd_Close()
: Closes the connection to the power supply.
Conclusion This C program demonstrates a basic example of interacting with NAI power supplies. It showcases reading various metrics, statuses and performing basic monitoring operations over both Ethernet and I2C communications. This serves as a foundational example for developers working with NAI embedded modules, providing a template for more complex applications.
#include <ctype.h>
#include <stdio.h> /* for printf(),getchar() */
#include <string.h> /* for void *memcpy(void *dest, const void *src, size_t n); */
/* Common Sample Program include files */
#include "include/naiapp_boardaccess_menu.h"
#include "include/naiapp_boardaccess_query.h"
#include "include/naiapp_boardaccess_access.h"
#include "include/naiapp_boardaccess_display.h"
#include "include/naiapp_boardaccess_utils.h"
/* naibrd include files */
#include "naibrd.h"
#include "nai.h"
#include "powersupply/naibrd_ps.h"
#include "advanced/nai_ether_adv.h"
#include "PS_BasicOps_utils.h"
#include "PS_BasicOps_driven_table.h"
static const int8_t *SAMPLE_PGM_NAME = (const int8_t *)"PS4_BasicOps";
/*static const int8_t *DEF_CONFIG_FILE = (const int8_t *)"default_PS4_BasicOps.txt";*/
/* Global buffer and count for user input */
static int8_t g_ps_op[80];
static int32_t g_ps_responseCnt = 0;
static int32_t g_ps_cardIndex = 5; /* Note, the g_ps_cardIndex is a logical reference to the power supply - can be any value between (0 - NAI_MAX_CARDS-1) */
void DisplayI2CDeviceCfg(void);
void PS_BasicOps(void);
nai_status_t ReadAllNonGeneralStatuses( void );
nai_status_t ReadStatusGeneral( void );
nai_status_t ReadAllMonitors( void );
static void DisplayPSApplicationDescription()
{
printf(" Power Supply Application Description\n");
printf("---------------------------------------------------------------------------------\n");
printf("This application is intended to run with the SIU Chassis that a NAI Power Supply.\n\n");
printf("When this application is running externally from the SIU Chassis,\n");
printf("the NAI Ethernet Listener Server must be running in the main processor\n");
printf("in the NIU SIU Chassis (ex. 75G5, 75INT2, 75PPC1, 75ARM1, etc.),\n");
printf("and the communication method must be Ethernet.\n\n");
printf("When this application is running on the main processor in the NIU SIU Chassis\n");
printf("(ex. 75INT2, 75PPC1, 75ARM1, etc.), the communication method must be I2C.\n\n");
printf("\n");
}
/**************************************************************************************************************/
/**
<summary>
The purpose of the PS_BasicOps is to illustrate the methods to call in the naibrd library to perform basic
monitor operations with the PS4 Power Supply.
</summary>
*/
/**************************************************************************************************************/
#if defined (__VXWORKS__)
int32_t PS_BasicOps_Sample(void)
#else
int32_t main(void)
#endif
{
nai_status_t status = NAI_SUCCESS;
bool_t bQuit = FALSE;
bool_t bEthernet = FALSE;
bool_t maximillionBrd = TRUE;
int32_t Protocol = 0, Port = 0;
int8_t szPort[NAI_MAX_PORT_LEN];
int8_t szIPAddress[NAI_MAX_IP_LEN];
int8_t inputBuffer[80];
int32_t inputResponseCnt;
printf("\n");
printf("NAI Sample Program: %s\n", SAMPLE_PGM_NAME);
printf("=============================================================================\n\n");
DisplayPSApplicationDescription();
/* Check where this application is running */
printf("Is this application running externally and communicating to the SIU\n");
printf("via Ethernet? (default: Y) : ");
bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
if (!bQuit)
{
if ((inputResponseCnt == 0) || (toupper(inputBuffer[0]) == 'Y'))
{
bEthernet = TRUE;
/* Get the IP Address for the NAI board */
bQuit = naiapp_query_EthernetCfg(maximillionBrd, &Protocol, (int8_t *)&Port, &szIPAddress[0]);
if (!bQuit)
{
sprintf((char*)&szPort[0], "%d", Port);
}
}
}
if (!bQuit)
{
if (bEthernet)
{
check_status(naibrd_SetIPAddress(g_ps_cardIndex, (const char *)&szIPAddress[0], (const char *)&szPort[0]));
if (Protocol == NAI_TCP_PROTOCOL)
{
status = check_status(naibrd_PS_OpenDevice(g_ps_cardIndex, NAIBRD_COMM_ETHER_TCP, NAI_DEV_NAME_PS4G1));
}
else
{
status = check_status(naibrd_PS_OpenDevice(g_ps_cardIndex, NAIBRD_COMM_ETHER_UDP, NAI_DEV_NAME_PS4G1));
}
}
else
{
status = check_status(naibrd_PS_OpenDevice(g_ps_cardIndex, NAIBRD_COMM_I2C, NAI_DEV_NAME_PS4G1));
}
if (status == NAI_SUCCESS)
{
PS_BasicOps();
}
else
{
printf("%s returned status %s\n","naibrd_PS_OpenDevice",nai_GetStatusString(status));
printf("Type Enter key to exit program : ");
naiapp_query_ForQuitResponse(sizeof(g_ps_op), NAI_QUIT_CHAR, g_ps_op, &g_ps_responseCnt);
}
/* Close connection to power supply */
naibrd_Close(g_ps_cardIndex);
}
return status;
}
void PS_BasicOps(void)
{
uint32_t serialNum;
uint8_t majorVer, minorVer, revVer;
uint32_t month, day, year;
uint32_t hour, minute, second;
int key_in_value;
do
{
/* Read the FPGA Version Numbers */
if ( check_status( naibrd_PS_GetVersionNum( g_ps_cardIndex, NAI_PS_PROC_MASTER, &majorVer, &minorVer, &revVer ) ) == NAI_SUCCESS )
{
printf(" Master Version: %d.%d.%d ", majorVer, minorVer, revVer);
}
if ( check_status( naibrd_PS_GetVersionNum( g_ps_cardIndex, NAI_PS_PROC_SLAVE, &majorVer, &minorVer, &revVer ) ) == NAI_SUCCESS )
{
printf(" Slave Version: %d.%d.%d ", majorVer, minorVer, revVer);
}
printf("\n");
/* Read Build Date */
if ( check_status( naibrd_PS_GetBuildDate( g_ps_cardIndex, NAI_PS_PROC_MASTER, &month, &day, &year ) )== NAI_SUCCESS )
{
printf( " - Build Date: Master: %02d / %02d /%02d\n",month, day, year );
}
if ( check_status( naibrd_PS_GetBuildDate( g_ps_cardIndex, NAI_PS_PROC_SLAVE, &month, &day, &year ) )== NAI_SUCCESS )
{
printf( " - Build Date: Slave: %02d / %02d /%02d\n",month, day, year );
}
/* Read Build Time */
if ( check_status( naibrd_PS_GetBuildTime( g_ps_cardIndex, NAI_PS_PROC_MASTER, &hour, &minute, &second ) ) == NAI_SUCCESS )
{
printf(" - Build Time: Master: %02u:%02u:%02u\n", hour, minute,second);
}
if ( check_status( naibrd_PS_GetBuildTime( g_ps_cardIndex, NAI_PS_PROC_SLAVE, &hour, &minute, &second ) ) == NAI_SUCCESS )
{
printf(" - Build Time: Slave: %02u:%02u:%02u\n", hour, minute,second);
}
/* Read The Serial Number */
if ( check_status( naibrd_PS_GetSerialNum( g_ps_cardIndex, &serialNum ) ) == NAI_SUCCESS )
{
printf(" - Serial Num: %d\n",serialNum );
}
ReadStatusGeneral();
ReadAllNonGeneralStatuses();
ReadAllMonitors();
printf("press Q/q and \"Enter\" to quit, press \"Enter\" to continue.\n");
key_in_value=getchar();
} while ( key_in_value!='q' && key_in_value!='Q' );
}
nai_status_t ReadStatusGeneral( void )
{
nai_status_t status=NAI_SUCCESS;
uint32_t dynamicGeneralStatus = 0;
uint32_t latchGeneralStatus = 0;
int32_t i;
print_ps_status_general_title();
for ( i=0;i<sizeof(status_general_demo_grps)/sizeof(struct status_general_info);i++ )
{
if (status_general_demo_grps[i].general_mask != PS_STATUS_GENERAL_MASK_NONE )
{
printf("%-36s", status_general_demo_grps[i].grp_name);
status = naibrd_PS_GetStatus( g_ps_cardIndex, PS_STATUS_GENERAL, &dynamicGeneralStatus );
if ( status != NAI_SUCCESS )
{
printf
(
"ERROR: Status %d naibrd_PS_GetStatus(cardIndex=%d,PS_STATUS_GENERAL) **** FAILED ****\n",
status,g_ps_cardIndex);
break;
}
print_ps_status( (dynamicGeneralStatus & status_general_demo_grps[i].general_mask) );
status = naibrd_PS_GetStatus( g_ps_cardIndex, PS_STATUS_GENERAL_LATCHED, &latchGeneralStatus);
if ( status != NAI_SUCCESS )
{
printf
(
"naibrd_PS_GetStatus(cardIndex=%d,PS_STATUS_GENERAL_LATCHED) **** FAILED ****\n",
g_ps_cardIndex);
break;
}
print_ps_status( (latchGeneralStatus & status_general_demo_grps[i].general_mask));
}
else
{
continue;
}
printf("\n");
}
print_ps_short_horizontal_border();
return status;
}
nai_status_t ReadAllNonGeneralStatuses( void )
{
uint32_t underVoltageStatus = 0;
uint32_t overVoltageStatus = 0;
uint32_t overCurrentStatus = 0;
uint32_t overTemperatureStatus = 0;
uint32_t underVoltageLatchStatus = 0;
uint32_t overVoltageLatchStatus = 0;
uint32_t overCurrentLatchStatus = 0;
uint32_t overTemperatureLatchStatus = 0;
nai_status_t status = NAI_SUCCESS;
status = naibrd_PS_GetStatus( g_ps_cardIndex, PS_STATUS_UNDER_VOLTAGE, &underVoltageStatus );
if ( status != NAI_SUCCESS )
{
printf( "naibrd_PS_GetStatus(cardIndex=%d,cmd=PS_STATUS_UNDER_VOLTAGE) **** FAILED ****\n", g_ps_cardIndex);
}
if(status == NAI_SUCCESS)
{
status = naibrd_PS_GetStatus( g_ps_cardIndex, PS_STATUS_OVER_VOLTAGE, &overVoltageStatus );
if ( status != NAI_SUCCESS )
{
printf( "naibrd_PS_GetStatus(cardIndex=%d,cmd=PS_STATUS_OVER_VOLTAGE) **** FAILED ****\n", g_ps_cardIndex);
}
if(status == NAI_SUCCESS)
{
status = naibrd_PS_GetStatus( g_ps_cardIndex, PS_STATUS_OVER_CURRENT, &overCurrentStatus );
if ( status != NAI_SUCCESS )
{
printf( "naibrd_PS_GetStatus(cardIndex=%d,cmd=PS_STATUS_OVER_CURRENT) **** FAILED ****\n", g_ps_cardIndex);
}
if(status == NAI_SUCCESS)
{
status = naibrd_PS_GetStatus( g_ps_cardIndex, PS_STATUS_OVER_TEMPERATURE, &overTemperatureStatus );
if ( status != NAI_SUCCESS )
{
printf( "naibrd_PS_GetStatus(cardIndex=%d,cmd=PS_STATUS_OVER_TEMPERATURE) **** FAILED ****\n", g_ps_cardIndex);
}
if(status == NAI_SUCCESS)
{
status = naibrd_PS_GetStatus( g_ps_cardIndex, PS_STATUS_UNDER_VOLTAGE_LATCHED, &underVoltageLatchStatus );
if ( status != NAI_SUCCESS )
{
printf( "naibrd_PS_GetStatus(cardIndex=%d,cmd=PS_STATUS_UNDER_VOLTAGE_LATCHED) **** FAILED ****\n", g_ps_cardIndex);
}
if(status == NAI_SUCCESS)
{
status = naibrd_PS_GetStatus( g_ps_cardIndex, PS_STATUS_OVER_VOLTAGE_LATCHED, &overVoltageLatchStatus );
if ( status != NAI_SUCCESS )
{
printf( "naibrd_PS_GetStatus(cardIndex=%d,cmd=PS_STATUS_OVER_VOLTAGE_LATCHED) **** FAILED ****\n", g_ps_cardIndex);
}
if(status == NAI_SUCCESS)
{
status = naibrd_PS_GetStatus( g_ps_cardIndex, PS_STATUS_OVER_CURRENT_LATCHED, &overCurrentLatchStatus );
if ( status != NAI_SUCCESS )
{
printf( "naibrd_PS_GetStatus(cardIndex=%d,cmd=PS_STATUS_OVER_CURRENT_LATCHED) **** FAILED ****\n", g_ps_cardIndex);
}
if(status == NAI_SUCCESS)
{
status = naibrd_PS_GetStatus( g_ps_cardIndex, PS_STATUS_OVER_TEMPERATURE_LATCHED, &overTemperatureLatchStatus );
if ( status != NAI_SUCCESS )
{
printf( "naibrd_PS_GetStatus(cardIndex=%d,cmd=PS_STATUS_OVER_TEMPERATURE_LATCHED) **** FAILED ****\n", g_ps_cardIndex);
}
}
}
}
}
}
}
}
if ( status == NAI_SUCCESS )
{
print_ps_status_title();
printf("%-16s", VOLT_3_3_NAME);
print_ps_status(underVoltageStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_3_3V);
print_ps_status(underVoltageLatchStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_3_3V);
print_ps_status(overVoltageStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_3_3V);
print_ps_status(overVoltageLatchStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_3_3V);
print_ps_status(overCurrentStatus & PS_STATUS_MONITOR_MASK_CURRENT_MONITOR_3_3V);
print_ps_status(overCurrentLatchStatus & PS_STATUS_MONITOR_MASK_CURRENT_MONITOR_3_3V);
print_ps_status_na(); /*There is no temp status for 3.3V*/
print_ps_status_na(); /*There is no temp status for 3.3V*/
printf("\n");
printf("%-16s", VOLT_5_NAME);
print_ps_status(underVoltageStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_5V);
print_ps_status(underVoltageLatchStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_5V);
print_ps_status(overVoltageStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_5V);
print_ps_status(overVoltageLatchStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_5V);
print_ps_status(overCurrentStatus & PS_STATUS_MONITOR_MASK_CURRENT_MONITOR_5V);
print_ps_status(overCurrentLatchStatus & PS_STATUS_MONITOR_MASK_CURRENT_MONITOR_5V);
print_ps_status(overTemperatureStatus & PS_STATUS_MONITOR_MASK_TEMP_MONITOR_5V);
print_ps_status(overTemperatureLatchStatus & PS_STATUS_MONITOR_MASK_TEMP_MONITOR_5V);
printf("\n");
printf("%-16s", VOLT_12_NAME);
print_ps_status(underVoltageStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_12V);
print_ps_status(underVoltageLatchStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_12V);
print_ps_status(overVoltageStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_12V);
print_ps_status(overVoltageLatchStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_12V);
print_ps_status(overCurrentStatus & PS_STATUS_MONITOR_MASK_CURRENT_MONITOR_12V);
print_ps_status(overCurrentLatchStatus & PS_STATUS_MONITOR_MASK_CURRENT_MONITOR_12V);
print_ps_status_na(); /*There is no temp status for 12V*/
print_ps_status_na(); /*There is no temp status for 12V*/
printf("\n");
printf("%-16s", VOLT_MINUS_12_NAME);
print_ps_status(underVoltageStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_MINUS_12V);
print_ps_status(underVoltageLatchStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_MINUS_12V);
print_ps_status(overVoltageStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_MINUS_12V);
print_ps_status(overVoltageLatchStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_MINUS_12V);
print_ps_status(overCurrentStatus & PS_STATUS_MONITOR_MASK_CURRENT_MONITOR_MINUS_12V);
print_ps_status(overCurrentLatchStatus & PS_STATUS_MONITOR_MASK_CURRENT_MONITOR_MINUS_12V);
print_ps_status_na(); /*There is no temp status for -12V*/
print_ps_status_na(); /*There is no temp status for -12V*/
printf("\n");
printf("%-16s", VOLT_36_NAME);
print_ps_status(underVoltageStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_36V);
print_ps_status(underVoltageLatchStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_36V);
print_ps_status(overVoltageStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_36V);
print_ps_status(overVoltageLatchStatus & PS_STATUS_MONITOR_MASK_VOLT_MONITOR_36V);
print_ps_status(overCurrentStatus & PS_STATUS_MONITOR_MASK_CURRENT_MONITOR_36V);
print_ps_status(overCurrentLatchStatus & PS_STATUS_MONITOR_MASK_CURRENT_MONITOR_36V);
print_ps_status_na(); /*There is no temp status for 36V*/
print_ps_status_na(); /*There is no temp status for 36V*/
printf("\n");
print_ps_long_horizontal_border();
}
return status;
}
nai_status_t ReadAllMonitors( void )
{
nai_status_t status;
float64_t monitorVoltageArray[4];
float64_t monitorCurrentArray[3];
float64_t monitorTemperatureArray[4];
print_ps_monitor_title();
printf("%-16s", VOLT_INPUT_NAME);
status = naibrd_PS_GetVoltage( g_ps_cardIndex, NAI_PS_VOLT_MONITOR_INPUT, PS_MONITOR_MASK_ALL, 4, monitorVoltageArray );
if( status == NAI_SUCCESS)
{
print_ps_voltage(monitorVoltageArray ,'+');
}
status = naibrd_PS_GetCurrent( g_ps_cardIndex, NAI_PS_CURRENT_MONITOR_INPUT, PS_MONITOR_MASK_CURR_AVG_PEAK, 3, monitorCurrentArray );
if( status == NAI_SUCCESS)
{
print_ps_current(monitorCurrentArray);
}
status = naibrd_PS_GetTemperature( g_ps_cardIndex, NAI_PS_TEMP_MONITOR_INPUT, PS_MONITOR_MASK_ALL, 4, monitorTemperatureArray );
if( status == NAI_SUCCESS)
{
print_ps_temperature(monitorTemperatureArray);
}
printf("\n");
printf("%-16s", VOLT_36_NAME);
status = naibrd_PS_GetVoltage( g_ps_cardIndex, NAI_PS_VOLT_MONITOR_36V, PS_MONITOR_MASK_ALL, 4, monitorVoltageArray );
if( status == NAI_SUCCESS)
{
print_ps_voltage(monitorVoltageArray ,'+');
}
if( status == NAI_SUCCESS)
{
print_ps_current_na();
}
status = naibrd_PS_GetTemperature( g_ps_cardIndex, NAI_PS_TEMP_MONITOR_BUCKBOOST, PS_MONITOR_MASK_ALL, 4, monitorTemperatureArray );
if( status == NAI_SUCCESS)
{
print_ps_temperature(monitorTemperatureArray);
}
printf("\n");
printf("%-16s", VOLT_BATTERY_NAME);
status = naibrd_PS_GetVoltage( g_ps_cardIndex, NAI_PS_VOLT_MONITOR_BATTERY, PS_MONITOR_MASK_ALL, 4, monitorVoltageArray );
if( status == NAI_SUCCESS)
{
print_ps_voltage(monitorVoltageArray ,'+');
}
if( status == NAI_SUCCESS)
{
print_ps_current_na();
}
if( status == NAI_SUCCESS)
{
print_ps_temperature_na();
}
printf("\n");
printf("%-16s", VOLT_3_3_NAME);
status = naibrd_PS_GetVoltage( g_ps_cardIndex, NAI_PS_VOLT_MONITOR_3_3V, PS_MONITOR_MASK_ALL, 4, monitorVoltageArray );
if( status == NAI_SUCCESS)
{
print_ps_voltage(monitorVoltageArray ,'+');
}
status = naibrd_PS_GetCurrent( g_ps_cardIndex, NAI_PS_CURRENT_MONITOR_3_3V, PS_MONITOR_MASK_CURR_AVG_PEAK, 3, monitorCurrentArray );
if( status == NAI_SUCCESS)
{
print_ps_current(monitorCurrentArray);
}
print_ps_temperature_na();
printf("\n");
printf("%-16s", VOLT_5_NAME);
status = naibrd_PS_GetVoltage( g_ps_cardIndex, NAI_PS_VOLT_MONITOR_5V, PS_MONITOR_MASK_ALL, 4, monitorVoltageArray );
if( status == NAI_SUCCESS)
{
print_ps_voltage(monitorVoltageArray ,'+');
}
status = naibrd_PS_GetCurrent( g_ps_cardIndex, NAI_PS_CURRENT_MONITOR_5V, PS_MONITOR_MASK_CURR_AVG_PEAK, 3, monitorCurrentArray );
if( status == NAI_SUCCESS)
{
print_ps_current(monitorCurrentArray);
}
status = naibrd_PS_GetTemperature( g_ps_cardIndex, NAI_PS_TEMP_MONITOR_5V, PS_MONITOR_MASK_ALL, 4, monitorTemperatureArray );
if( status == NAI_SUCCESS)
{
print_ps_temperature(monitorTemperatureArray);
}
printf("\n");
printf("%-16s", VOLT_12_NAME);
status = naibrd_PS_GetVoltage( g_ps_cardIndex, NAI_PS_VOLT_MONITOR_12V, PS_MONITOR_MASK_ALL, 4, monitorVoltageArray );
if( status == NAI_SUCCESS)
{
print_ps_voltage(monitorVoltageArray ,'+');
}
status = naibrd_PS_GetCurrent( g_ps_cardIndex, NAI_PS_CURRENT_MONITOR_12V, PS_MONITOR_MASK_CURR_AVG_PEAK, 3, monitorCurrentArray );
if( status == NAI_SUCCESS)
{
print_ps_current(monitorCurrentArray);
}
print_ps_temperature_na();
printf("\n");
printf("%-16s", VOLT_MINUS_12_NAME);
status = naibrd_PS_GetVoltage( g_ps_cardIndex, NAI_PS_VOLT_MONITOR_MINUS_12V, PS_MONITOR_MASK_ALL, 4, monitorVoltageArray );
if( status == NAI_SUCCESS)
{
print_ps_voltage(monitorVoltageArray ,'-');
}
status = naibrd_PS_GetCurrent( g_ps_cardIndex, NAI_PS_CURRENT_MONITOR_MINUS_12V, PS_MONITOR_MASK_CURR_AVG_PEAK, 3, monitorCurrentArray );
if( status == NAI_SUCCESS)
{
print_ps_current(monitorCurrentArray);
}
print_ps_temperature_na();
printf("\n");
if ( status == NAI_SUCCESS )
{
print_ps_long_horizontal_border();
}
printf("\n");
return status;
}