background image

iv

    Netra CP3010 Board Programming Guide

 

• January 

2006

Example Block Erase Program

 

15

Example Flash Application Program

 

17

Index

 

23

Summary of Contents for Netra CP3010

Page 1: ...crosystems Inc www sun com Submit comments about this document at http www sun com hwdocs feedback Netra CP3010 Board Programming Guide For the Netra CT 900 Server Part No 819 1185 10 January 2006 Revision A ...

Page 2: ...2006 Sun Microsystems Inc 4150 Network Circle Santa Clara Californie 95054 Etats Unis Tous droits réservés Sun Microsystems Inc a les droits de propriété intellectuels relatants à la technologie qui est décrit dans ce document En particulier et sans la limitation ces droits de propriété intellectuels peuvent inclure un ou plus des brevets américains énumérés à http www sun com patents et un ou les...

Page 3: ...ware Requirements 6 Storing Data and Applications 6 Switch Settings 6 OpenBoot PROM Device Tree and Properties 7 Flash Device Files 7 Interface Header File 8 Flash Memory 8 Accessing the Flash Device 8 Using Structures in IOCTL Arguments 9 Resolving Structure Errors 10 Developing Programs 11 Example Read Program 11 Example Write Program 13 ...

Page 4: ...iv Netra CP3010 Board Programming Guide January 2006 Example Block Erase Program 15 Example Flash Application Program 17 Index 23 ...

Page 5: ...v Tables TABLE 1 1 Hardware Environmental Monitoring Functions 2 TABLE 2 1 Flash Node Properties 7 TABLE 2 2 System Calls 8 TABLE 2 3 Structure Errors 10 ...

Page 6: ...vi Netra CP3010 Board Programming Guide January 2006 ...

Page 7: ...ucture 9 CODE EXAMPLE 2 2 Flash User Interface Structure 10 CODE EXAMPLE 2 3 Read Action on Flash Device 11 CODE EXAMPLE 2 4 Write Action on Flash Device 13 CODE EXAMPLE 2 5 Block Erase Action on Flash Device 15 CODE EXAMPLE 2 6 Flash Application Program 17 ...

Page 8: ...viii Netra CP3010 Board Programming Guide January 2006 ...

Page 9: ...010 Board Programming Guide is written for program developers and users who want to program this board to design original equipment manufacturer OEM systems supply additional capability to an existing compatible system or work in a laboratory environment for experimental purposes Note You are required to have a basic knowledge of computers and digital logic programming to fully use the information...

Page 10: ...mands This document might not contain information about basic UNIX commands and procedures such as shutting down the system booting the system and configuring devices Refer to the following for this information Software documentation that you received with your system Solaris Operating System documentation which is at http docs sun com Shell Prompts Shell Prompt C shell machine name C shell superu...

Page 11: ...d AaBbCc123 Book titles new words or terms words to be emphasized Replace command line variables with real names or values Read Chapter 6 in the User s Guide These are called class options You must be superuser to do this To delete a file type rm filename Title Part Number Netra CP3010 Board Product Notes 819 1181 xx Netra CP3010 Board Getting Started Guide 819 1182 xx Netra CP3010 Board User s Gu...

Page 12: ...oods or services that are available on or through such sites or resources Documentation Support and Training Sun Welcomes Your Comments Sun is interested in improving its documentation and welcomes your comments and suggestions You can submit your comments by going to http www sun com hwdocs feedback Please include the title and part number of your document with your feedback Netra CP3010 Board Pr...

Page 13: ...hat increases uptime and manageability of the board Through an Intelligent Platform Management Controller IPMC and system management software the Netra CP3010 board monitors voltage temperature and power on sensors This chapter contains the following topics Power Requirements on page 2 Inlet Exhaust and CPU Temperatures on page 2 ...

Page 14: ...at monitor the hardware environment The CPU diode sensor reading might vary from slot to slot and from board to board in a system and is dependent primarily on system cooling As an example a system might have sensor readings for the CPU diode from 35 C to 49 C with an ambient inlet of 21 C across many boards with a variety of configurations and positions within a chassis You must take care when se...

Page 15: ...The inlet sensor measures the local air temperature at the leading edge of the board under the solder side cover This value typically can range from a reading of 0 C to 13 C above inlet system ambient in a chassis You must understand the application and installation of the board to use this temperature sensor A sudden drop of all temperature sensors close to or near room ambient temperature can me...

Page 16: ...4 Netra CP3010 Board Programming Guide January 2006 ...

Page 17: ...s chapter introduces the flash device driver for the onboard flash PROM and describes how to use the device This chapter contains the following topics Software Requirements on page 6 Storing Data and Applications on page 6 Accessing the Flash Device on page 8 Developing Programs on page 11 ...

Page 18: ... writes can be submitted concurrently however they are serialized by the uflash device For example the driver blocks additional reads and writes to the device while a read or write is in progress The driver supports erase and lock features Applications can use them through the IOCTL interface The device is divided into logical blocks Applications that issue these operations supply a block number o...

Page 19: ...uflash0 TABLE 2 1 Flash Node Properties Property Description Value sunw location U55 model SUNW 254 0078 boot banks 00 00 00 00 00 00 00 02 00 00 00 04 00 00 00 06 system banks 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 03 flash banks 00 00 00 00 00 00 00 1f write window 00 08 00 00 00 08 00 00 boot window 00 00 00 00 00 08 00 00 bank size 00080000 version OBP 4 21 0 2005 11 22 16 48 Netra CP301...

Page 20: ...ng operations such as read and write The user flash includes a flash PROM chip that can be programmed The physical address of the user flash is 1ff f000 0000 Accessing the Flash Device You can access the flash device from the Solaris OS through an application or user C program No command line tool is available Access to the driver is carried out through open read write pread pwrite and ioctl syste...

Page 21: ...mand define UIOCIBLK uflashIOC 0 identify define UIOCQBLK uflashIOC 1 query a block define UIOCLBLK uflashIOC 2 lock a block define UIOCCLCK uflashIOC 4 clear all locks define UIOCEBLK uflashIOC 5 erase a block define UIOCMLCK uflashIOC 3 master lock define UIOCEALL uflashIOC 6 erase all unlocked blocks CODE EXAMPLE 2 1 PROM Information Structure PROM info structure typedef struct uint16_t mfr_id ...

Page 22: ...ructure Errors Error Message Description EINVAL An application passed one or more incorrect arguments to the system call EACCESS A 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 wi...

Page 23: ... EXAMPLE 2 3 Read Action on Flash Device uflash_read c An example that shows how to read flash include sys types h include sys stat h include fcntl h include stdio h include stdlib h include string h include errno h include uflash_if h char uflash0 dev uflash0 int ufd0 uflash_if_t ufif0 char buf0 char module static int uflash_init char buf0 malloc ufif0 info blk_size if buf0 printf s cannot alloca...

Page 24: ...nfo dev_id printf number of blocks 0x p ufif0 info blk_num printf block size 0x p ufif0 info blk_size static int uflash_uninit if ufd0 close ufd0 cleanup if buf0 free buf0 static int uflash_read read block 0 of user flash if pread ufd0 buf0 ufif0 info blk_size 0 ufif0 info blk_size perror uflash0 read return 0 main int ret module argv 0 ret uflash_init if ret uflash_read uflash_uninit CODE EXAMPLE...

Page 25: ...ash_if h char uflash0 dev uflash0 int ufd0 uflash_if_t ufif0 char buf0 char module static int uflash_init char buf0 malloc ufif0 info blk_size if buf0 printf s cannot allocate memory n module return 1 open device if ufd0 open uflash0 O_RDWR 1 perror uflash0 exit 1 get uflash sizes if ioctl ufd0 UIOCIBLK ufif0 1 perror ioctl ufd0 UIOCIBLK exit 1 if ufd0 printf s n uflash0 printf manfacturer id 0x p...

Page 26: ...i write some pattern to the buffers for i 0 i ufif0 info blk_size i sizeof int int buf0 i 0xDEADBEEF write block 0 of user flash if pwrite ufd0 buf0 ufif0 info blk_size 0 ufif0 info blk_size perror uflash0 write return 0 main int ret module argv 0 ret uflash_init if ret uflash_write uflash_uninit CODE EXAMPLE 2 4 Write Action on Flash Device Continued ...

Page 27: ...clude string h include errno h include uflash_if h char uflash0 dev uflash0 int ufd0 uflash_if_t ufif0 char module static int uflash_init open device if ufd0 open uflash0 O_RDWR 1 perror uflash0 exit 1 get uflash sizes if ioctl ufd0 UIOCIBLK ufif0 1 perror ioctl ufd0 UIOCIBLK exit 1 if ufd0 printf s n uflash0 printf manfacturer id 0x p n ufif0 info mfr_id printf device id 0x p n ufif0 info dev_id ...

Page 28: ...user flash uf0 blk_num 1 uf0 num_of_blks 2 if ufd0 ioctl ufd0 UIOCEBLK ufif0 1 perror ioctl ufd0 UIOCEBLK return 1 printf nblockerase successful on s n uflash0 return 0 main int ret module argv 0 ret uflash_init if ret uflash_blockerase uflash_uninit CODE EXAMPLE 2 5 Block Erase Action on Flash Device Continued ...

Page 29: ... of ioctl calls such as identify the chip query block lock block unlock block erase block Please note that not all of the above ioctl calls are available for all flash PROMs It is the user s responsibility to find out the features of a given PROM The type block size and number of blocks of the PROM are returned by identify ioctl The pwrite erases the block s and then does the writing Use the follo...

Page 30: ...s 6 erase blocks q quit h display this menu char get_cmd static char get_cmd char buf 10 gets buf return buf 0 Main main int argc char argv int n_byte returned from pread pwrite int size offset pat int fd0 h i int fd prom_id uflash_if_t uflash_if caddr_t r_buf w_buf char devname0 dev uflash0 char c r_buf caddr_t malloc PROM_SIZE w_buf caddr_t malloc PROM_SIZE Open the user flash PROM CODE EXAMPLE ...

Page 31: ...rr d command prom_id switch get_cmd case q goto getout case h case h 0 while help h fprintf stderr s n help h h break case 6 erase flash PROM block fprintf stderr Enter PROM block number 0 56 scanf d uflash_if blk_num fprintf stderr Enter number of block scanf d uflash_if num_of_blks if ioctl fd UIOCEBLK uflash_if 1 goto getout break case 5 clear all locks if ioctl fd UIOCCLCK uflash_if 1 goto get...

Page 32: ...uflash_if blk_num fprintf stderr Enter number of block scanf d uflash_if num_of_blks if ioctl fd UIOCQBLK uflash_if 1 goto getout for i uflash_if blk_num i uflash_if blk_num uflash_if num_of_blks i fprintf stderr block d status x n i uflash_if info blk_status i 0x1 break case 2 identify flash PROM if ioctl fd UIOCIBLK uflash_if 1 goto getout fprintf stderr manufacturer id 0x x device id 0x x n of ...

Page 33: ..._byte pwrite fd w_buf size offset if n_byte size the write failed printf Write process was failed at byte 0x x n n_byte break case 0 read from user flash PROM fprintf stderr Enter PROM offset 0 0xXX XXXX scanf x offset fprintf stderr Enter number of bytes hex scanf x size getchar clean up the char buf n_byte pread fd r_buf size offset if n_byte size the read failed printf Read process was failed a...

Page 34: ...rd Programming Guide January 2006 printf nuser data buffer n for i 0 i size i printf 2x r_buf i 0xff printf n default continue exit getout close fd0 return end of main CODE EXAMPLE 2 6 Flash Application Program Continued ...

Page 35: ... ECANCELLED 10 EFAULT 10 EINVAL 10 ENOMEM 10 environmental monitoring 1 ENXIO 10 erase feature 6 erase programs 11 error messages 10 exhaust sensor 3 F flash chip 8 flash device accessing 8 driver 5 files 7 flash driver software requirements 6 flash header file 8 flash memory 5 flash modules default settings 6 flash node properties 7 flash user interface structure 9 H hardware environment function...

Page 36: ...rogress 6 read programs 11 reboots locks preserved 6 S sensors 1 3 Solaris OS uflash 6 storing data and applications 6 structure errors 10 system calls 8 system interfaces 8 system management software 1 T temperature 1 2 temperature gradual increase 3 temperature sudden drop 3 temperatures alarm and shutdown 2 testing flash device driver 17 U user data storing 8 user flash application program 17 i...

Reviews: