Sun Microsystems CP2500 manual Usagestr

Page 21

CODE EXAMPLE 1-1System Watchdog Node Management Code Example (Continued)

#define WATCHDOG_DISARMED

"disarmed"

/*

*data structure that will be passed as argument to

*picl_walk_tree_by_class callback function

*/

typedef struct {

int start_index; int max_index;

char **list;

char *name;

char *action;

char *op; int32_t timeout;

int error_code; } wdadm_args_t;

static

char

 

*prog;

static picl_nodehdl_t

rooth;

static

 

int count = 0;

/*

*Error mesage texts

*/

static char

*err_msg[] = {

 

 

 

/* program usage */

 

 

 

USAGE_STR,

/* 0 */

/* picl call failed messages */

 

 

 

"picl_initialize failed: %s\n",

/*

1

*/

"picl_get_root failed: %s\n",

/*

2

*/

"picl_get_propval_by_name failed: %s\n"

/*

3

*/

};

 

 

 

 

#define NUM_ERROR_CODES 7

/* mapping between picl error codes and errno */ static int error_map[][2] = {

{PICL_SUCCESS, 0}, { PICL_FAILURE, -1}, {PICL_VALUETOOBIG, E2BIG}, {PICL_NODENOTFOUND, ENODEV}, {PICL_PERMDENIED, EPERM}, {PICL_NOSPACE, ENOMEM}, {PICL_INVALIDARG, EINVAL} };

static int picl2errno(int piclerr)

{

int i;

for (i = 0; i < NUM_ERROR_CODES; i++) { if (error_map[i][0] == piclerr)

return (error_map[i][1]);

Chapter 1 Watchdog Timer 7

Image 21
Contents Netra CP2500 Board Programming Guide Page Contents User Flash Figures Vi Netra CP2500 Board Programming Guide March Tables Viii Netra CP2500 Board Programming Guide March Code Samples Netra CP2500 Board Programming Guide March How This Book Is Organized PrefaceTypographic Conventions Using Unix CommandsRelated Documentation Shell PromptsDocumentation, Support, and Training Third-Party Web SitesSun Welcomes Your Comments Overview Watchdog TimerPicl Plug-In Module 2Properties Under watchdog-controllerNode 1Watchdog Plug-In Interfaces for Netra CP2500 Board SoftwareHEALTHY# 3Properties Under watchdog-timerNodeCode Example 1-1System Watchdog Node Management Code Example Watchdog Node Management CodeCode Example 1-1System Watchdog Node Management Code Example Usagestr Code Example 1-1System Watchdog Node Management Code Example Code Example 1-1System Watchdog Node Management Code Example Code Example 1-1System Watchdog Node Management Code Example Code Example 1-1System Watchdog Node Management Code Example Code Example 1-1System Watchdog Node Management Code Example Null Code Example 1-1System Watchdog Node Management Code Example Code Example 1-1System Watchdog Node Management Code Example Code Example 1-1System Watchdog Node Management Code Example Code Example 1-1System Watchdog Node Management Code Example Code Example 1-1System Watchdog Node Management Code Example Notreached Code Example 1-1System Watchdog Node Management Code Example OpenBoot Prom Interface Netra CP2500 Board Programming Guide March Environmental Monitoring Environmental Monitoring Component Compatibility Typical Environmental Monitoring System Application1Compatible Environmental Monitoring Components I2C Environmental Monitoring Protection at the OpenBoot Prom Typical Cycle From Power Up to ShutdownPost Shutdown Recovery 3I2C Components Hardware Environmental Monitoring FunctionsEnvironmental Monitoring CPU Inlet, Exhaust, and CPU Temperature Monitoring Switching Power On and OffNetra CP2500 Board Programming Guide March Critical Temperature Response at OpenBoot Prom OpenBoot Prom Environmental MonitoringEnvironmental Monitoring Application Programming Using the show-sensorsCommand at OpenBoot Prom4PICL Temperature Sensor Class Node Properties Reading Temperature Sensor States UsingSolaris Driver Interface Using a Configuration File for Sensor InformationCode Example 2-1Sample envmond Application Program Sample Application ProgramCode Example 2-1Sample envmond Application Program Code Example 2-1Sample envmond Application Program Code Example 2-1Sample envmond Application Program Prtdiag command example Reading the CPU Temperature Environmental Limits5Description of Values Displayed by Solaris Commands User Flash Usage and Implementation User FlashOpenBoot Prom Device Tree and Properties User Flash Driver1User Flash Node Properties User Flash Device Files Application Programming InterfaceInterface Header File 2System CallsCode Example 3-1PROM Information Structure Structures to Use in Ioctl ArgumentsErrors Example ProgramsCode Example 3-2User Flash Interface Structure Code Example 3-3Read Action on User Flash Device Read Example ProgramCode Example 3-4Write Action on User Flash Device Write Example ProgramCode Example 3-4Write Action on User Flash Device Code Example 3-5Block Erase Action on User Flash Device Block Erase Example ProgramCode Example 3-5Block Erase Action on User Flash Device Code Example 3-6Sample User Flash Application Program Sample User Flash Application ProgramCode Example 3-6Sample User Flash Application Program Code Example 3-6Sample User Flash Application Program Code Example 3-6Sample User Flash Application Program Code Example 3-6Sample User Flash Application Program Code Example 3-6Sample User Flash Application Program Picl IndexWatchdog-controller, 3 Watchdog-timer, 3