PERFORCE change 54449 for review
Juli Mallett
jmallett at FreeBSD.org
Wed Jun 9 06:13:42 GMT 2004
http://perforce.freebsd.org/chv.cgi?CH=54449
Change 54449 by jmallett at jmallett_oingo on 2004/06/09 06:13:31
Stab stab stab, I think I'll do bus stuff this way.
Affected files ...
.. //depot/projects/mips/sys/mips/include/bus.h#3 edit
Differences ...
==== //depot/projects/mips/sys/mips/include/bus.h#3 (text+ko) ====
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2002 Juli Mallett. All rights reserved.
+ * Copyright (c) 2002-2004 Juli Mallett. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,8 +30,50 @@
typedef unsigned long bus_addr_t;
typedef unsigned long bus_size_t;
-typedef int bus_type_t;
typedef unsigned long bus_space_handle_t;
-typedef unsigned long bus_space_tag_t;
+typedef unsigned long bus_space_word_t;
+
+struct bus_space_tag {
+ const char *bst_name;
+ bus_space_word_t (*bst_read)(char, bus_space_handle_t, bus_size_t);
+ void (*bst_write)(char, bus_space_handle_t, bus_size_t, bus_space_word_t);
+};
+
+typedef struct bus_space_tag *bus_space_tag_t;
+
+#define BUSSPACE_READ(size, type) \
+static __inline type \
+bus_space_read_ ## size(bus_space_tag_t t, \
+ bus_space_handle_t h, \
+ bus_size_t o) \
+{ \
+ return ((type)((*(t)->bst_read)((size), h, o))); \
+} \
+struct __hack
+
+#define BUSSPACE_WRITE(size, type) \
+static __inline void \
+bus_space_write_ ## size(bus_space_tag_t t, \
+ bus_space_handle_t h, \
+ bus_size_t o, \
+ type v) \
+{ \
+ ((*(t)->bst_write)((size), h, o, v)); \
+} \
+struct __hack
+
+#define BUSSPACE_WRAPPER(size, type) \
+BUSSPACE_READ(size, type); \
+BUSSPACE_WRITE(size, type); \
+struct __hack
+
+BUSSPACE_WRAPPER(1, uint8_t);
+BUSSPACE_WRAPPER(2, uint16_t);
+BUSSPACE_WRAPPER(4, uint32_t);
+BUSSPACE_WRAPPER(8, uint64_t);
+
+#undef BUSSPACE_READ
+#undef BUSSPACE_WRITE
+#undef BUSSPACE_WRAPPER
#endif /* !_MACHINE_BUS_H_ */
More information about the p4-projects
mailing list