mtd/include/linux/mtd map.h,1.39,1.40

David Woodhouse dwmw2 at infradead.org
Sat Jul 10 17:14:20 EDT 2004


Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv11947/include/linux/mtd

Modified Files:
	map.h 
Log Message:
Make Intel command set build again.

Index: map.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/map.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- map.h	9 Jul 2004 16:53:45 -0000	1.39
+++ map.h	10 Jul 2004 21:14:18 -0000	1.40
@@ -199,6 +199,40 @@
 	return 1;
 }
 
+static inline map_word map_word_and(struct map_info *map, map_word val1, map_word val2)
+{
+	map_word r;
+	int i;
+
+	for (i=0; i<map_words(map); i++) {
+		r.x[i] = val1.x[i] & val2.x[i];
+	}
+	return r;
+}
+
+static inline map_word map_word_or(struct map_info *map, map_word val1, map_word val2)
+{
+	map_word r;
+	int i;
+
+	for (i=0; i<map_words(map); i++) {
+		r.x[i] = val1.x[i] | val2.x[i];
+	}
+	return r;
+}
+#define map_word_andequal(m, a, b, z) map_word_equal(m, z, map_word_and(m, a, b))
+
+static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2)
+{
+	int i;
+
+	for (i=0; i<map_words(map); i++) {
+		if (val1.x[i] & val2.x[i])
+			return 1;
+	}
+	return 0;
+}
+
 static inline map_word map_word_load(struct map_info *map, const void *ptr)
 {
 	map_word r;
@@ -219,8 +253,38 @@
 	return r;
 }
 
+static inline map_word map_word_load_partial(struct map_info *map, map_word orig, const char *buf, int start, int len)
+{
+	int i;
+
+	if (map_bankwidth_is_large(map)) {
+		char *dest = (char *)&orig;
+		memcpy(dest+start, buf, len);
+	} else {
+		for (i=start; i < start+len; i++) {
+			int bitpos;
+#ifdef __LITTLE_ENDIAN
+			bitpos = i*8;
+#else /* __BIG_ENDIAN */
+			bitpos = (map_bankwidth(map)-i)*8;
+#endif
+			orig.x[0] &= ~(0xff << bitpos);
+			orig.x[0] |= buf[i] << bitpos;
+		}
+	}
+	return orig;
+}
 
+static inline map_word map_word_ff(struct map_info *map)
+{
+	map_word r;
+	int i;
 
+	for (i=0; i<map_words(map); i++) {
+		r.x[i] = ~0UL;
+	}
+	return r;
+}
 static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
 {
 	map_word r;





More information about the linux-mtd-cvs mailing list