/* The map stuff is very simple. You fill in your struct map_info with ahandfulofroutinesforaccessingthedevice,makingsuretheyhandle pagingetc.correctlyifyourdeviceneedsit.Thenyoupassitoff toachipproberoutine--eitherJEDECorCFIprobeorboth--via do_map_probe().Ifachipisrecognised,theprobecodewillinvokethe appropriatechipdriver(ifpresent)andreturnastructmtd_info. Atwhichpoint,youfillinthemtd->modulewithyourownmodule address,andregisteritwiththeMTDcorecode.Oryoucouldpartition itandregisterthepartitionsinstead,orkeepitforyourownprivate use;whatever.
int swap; /* this mapping's byte-swapping requirement */ int bankwidth; /* in octets. This isn't necessarily the width ofactualbuscycles--it'stherepeatinterval inbytes,beforeyouaretalkingtothefirstchipagain.
*/
/* We can perhaps put in 'point' and 'unpoint' methods, if we really
want to enable XIP for non-linear mappings. Not yet though. */ #endif /* It's possible for the map driver to use cached memory in its copy_fromimplementation(and_only_withcopy_from).However, whenthechipdriverknowssomeflashareahaschangedcontents, itwillsignalittothemapdriverthroughthisroutinetolet themapdriverinvalidatethecorrespondingcacheasneeded.
If there is no cache to care about this can be set to NULL. */ void (*inval_cache)(struct map_info *, unsignedlong, ssize_t);
/* This will be called with 1 as parameter when the first map user *needsVPP,andcalledwith0whenthelastuserexits.Themap *coremaintainsareferencecounter,andassumesthatVPPisa *globalresourceapplyingtoallmappedflashchipsonthesystem.
*/ void (*set_vpp)(struct map_info *, int);
#define ENABLE_VPP(map) do { if (map->set_vpp) map->set_vpp(map, 1); } while (0) #define DISABLE_VPP(map) do { if (map->set_vpp) map->set_vpp(map, 0); } while (0)
#define INVALIDATE_CACHED_RANGE(map, from, size) \ do { if (map->inval_cache) map->inval_cache(map, from, size); } while (0)
#define map_word_equal(map, val1, val2) \
({ \ int i, ret = 1; \ for (i = 0; i < map_words(map); i++) \ if ((val1).x[i] != (val2).x[i]) { \
ret = 0; \ break; \
} \
ret; \
})
#define map_word_and(map, val1, val2) \
({ \
map_word r; \ int i; \ for (i = 0; i < map_words(map); i++) \
r.x[i] = (val1).x[i] & (val2).x[i]; \
r; \
})
#define map_word_clr(map, val1, val2) \
({ \
map_word r; \ int i; \ for (i = 0; i < map_words(map); i++) \
r.x[i] = (val1).x[i] & ~(val2).x[i]; \
r; \
})
#define map_word_or(map, val1, val2) \
({ \
map_word r; \ int i; \ for (i = 0; i < map_words(map); i++) \
r.x[i] = (val1).x[i] | (val2).x[i]; \
r; \
})
#define map_word_andequal(map, val1, val2, val3) \
({ \ int i, ret = 1; \ for (i = 0; i < map_words(map); i++) { \ if (((val1).x[i] & (val2).x[i]) != (val3).x[i]) { \
ret = 0; \ break; \
} \
} \
ret; \
})
#define map_word_bitsset(map, val1, val2) \
({ \ int i, ret = 0; \ for (i = 0; i < map_words(map); i++) { \ if ((val1).x[i] & (val2).x[i]) { \
ret = 1; \ break; \
} \
} \
ret; \
})
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.