Sun Microsystems CP2500 Example Programs, Errors, Code Example 3-2User Flash Interface Structure

Page 61

User Flash User Interface Structure

The user flash user interface structure holds user parameters to commands such as erase.

CODE EXAMPLE 3-2User Flash Interface Structure

/*

*uflash user interface structure.

*/

typedef struct {

 

 

int

blk_num;

 

int

num_of_blks;

 

uflash_info_t

info;

/* to be filled by the

driver */

 

 

} uflash_if_t;

 

 

Errors

EINVAL

Application passed one or more incorrect arguments to the system

 

call.

EACCESS

Write or Erase operation was attempted on a locked block.

ECANCELLED

A hardware malfunction has been detected. Normally, retrying the

 

command should fix this problem. If the problem persists, power

 

cycling the system might be necessary.

ENXIO

This error indicates problems with the driver state. Power cycle of

 

the system or reinstallation of driver may be necessary.

EFAULT

An error was encountered when copying arguments between the

 

application and driver (kernel) space.

ENOMEM

System was low on memory when the driver attempted to acquire it.

EBUSY

A write operation is already in progress when more than one

 

write requests are made.

 

 

Example Programs

Example programs are provided in this section for the following actions on user flash device:

Read

Chapter 3 User Flash 47

Image 61
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 PromptsThird-Party Web Sites Documentation, Support, and TrainingSun 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 Typical Environmental Monitoring System Application Environmental Monitoring Component Compatibility1Compatible 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 FlashUser Flash Driver OpenBoot Prom Device Tree and Properties1User Flash Node Properties User Flash Device Files Application Programming InterfaceInterface Header File 2System CallsCode Example 3-1PROM Information Structure Structures to Use in Ioctl ArgumentsExample Programs ErrorsCode 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