CODE EXAMPLE 3-6 Sample User Flash Application Program (Continued)
#if 1
#define PROM_SIZE 0x700000 /* 7 MBytes */ #endif
static char *help[14] | = { | |
| "0 | user flash PROM", |
| "1 | user flash PROM", |
| "2 | user flash PROM", |
| "3 | blocks", |
| "4 | blocks", |
| "5 | all locks", |
| "6 | blocks", |
| "q |
|
| "?/h | |
| "" |
|
}; |
|
|
/*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.
*/