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

Page 61
Image 61
Sun Microsystems CP2500 manual Example Programs, Errors, Code Example 3-2User Flash Interface Structure