| plan 9 kernel history: overview | file list | diff list |
2000/1111/bitsy/devflash.c (diff list | history)
| 2000/1107/sys/src/9/bitsy/devflash.c:30,42 – 2000/1111/sys/src/9/bitsy/devflash.c:30,35 (short | long | prev | next) | ||
| 2000/1107 | /* * common flash memory interface */ | |
| 2000/1107/sys/src/9/bitsy/devflash.c:70,74 – 2000/1111/sys/src/9/bitsy/devflash.c:63,185 | ||
| 2000/1107 | struct CFIgeom { ulong size; /* 2**n bytes */ | |
| 2000/1111 | ulong dev_code; /* ??? */ ulong max_multi; /* max bytes in a multibyte write */ ulong nregion; /* number of erase regions */ ulong region[1]; /* erase region info */ }; #define mirror(x) (((x)<<16)|(x)) void cfiquery(void) { struct CFIid *id; flash[0x55] = mirror(0x98); id = (struct CFIid*)&flash[0x10]; if(id.q != 'q' || id.r != 'r' || id.y != 'y') print("CFI not supported by flash\n"); flash[0x55] = mirror(0xFF); } void cfigeom(void) { } /* * flash device interface */ enum { Qf0=1, Qf1, Qf2, Qf3, }; Dirtab flashdir[]={ "f0", { Qf0, 0 }, 0, 0664, "f1", { Qf1, 0 }, 0, 0664, "f2", { Qf2, 0 }, 0, 0664, "f3", { Qf3, 0 }, 0, 0664, }; void flashinit(void) { cfiquery(); cfigeom(); } static Chan* flashattach(char* spec) { return devattach('r', spec); } static int flashwalk(Chan* c, char* name) { return devwalk(c, name, flashdir, nelem(flashdir), devgen); } static void flashstat(Chan* c, char* dp) { devstat(c, dp, flashdir, nelem(flashdir), devgen); } static Chan* flashopen(Chan* c, int omode) { omode = openmode(omode); if(strcmp(up->user, eve)!=0) error(Eperm); return devopen(c, omode, flashdir, nelem(flashdir), devgen); } static void flashclose(Chan*) { } static long flashread(Chan* c, void* a, long n, vlong off) { USED(c, a, off); error("UUO"); return n; } static long flashwrite(Chan* c, void* a, long n, vlong) { USED(c, a, off); error("UUO"); return n; } Dev flashdevtab = { 'F', "flash", devreset, flashinit, flashattach, devclone, flashwalk, flashstat, flashopen, devcreate, flashclose, flashread, devbread, flashwrite, devbwrite, devremove, devwstat, | |
| 2000/1107 | }; | |