aboutsummaryrefslogtreecommitdiff
path: root/src/include/ipxe
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2012-08-24 17:25:14 +0100
committerMichael Brown <mcb30@ipxe.org>2012-08-24 17:26:10 +0100
commitd1949f2737e44b1e0cdc6695ab867bc70002fcea (patch)
treeda270a66cf1429e04718f1b1f5aa7ed27395b595 /src/include/ipxe
parent5676abead23d6b6d9fc14084922ec36c5d5c015e (diff)
downloadipxe-d1949f2737e44b1e0cdc6695ab867bc70002fcea.zip
ipxe-d1949f2737e44b1e0cdc6695ab867bc70002fcea.tar.gz
ipxe-d1949f2737e44b1e0cdc6695ab867bc70002fcea.tar.bz2
[bitbash] Add optional open() and close() methods for bit-bashing interfaces
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe')
-rw-r--r--src/include/ipxe/bitbash.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/include/ipxe/bitbash.h b/src/include/ipxe/bitbash.h
index 62b54b1..69d5d9e 100644
--- a/src/include/ipxe/bitbash.h
+++ b/src/include/ipxe/bitbash.h
@@ -14,6 +14,18 @@ struct bit_basher;
/** Bit-bashing operations */
struct bit_basher_operations {
/**
+ * Open bit-bashing interface (optional)
+ *
+ * @v basher Bit-bashing interface
+ */
+ void ( * open ) ( struct bit_basher *basher );
+ /**
+ * Close bit-bashing interface (optional)
+ *
+ * @v basher Bit-bashing interface
+ */
+ void ( * close ) ( struct bit_basher *basher );
+ /**
* Set/clear output bit
*
* @v basher Bit-bashing interface
@@ -45,6 +57,26 @@ struct bit_basher {
struct bit_basher_operations *op;
};
+/**
+ * Open bit-bashing interface
+ *
+ * @v basher Bit-bashing interface
+ */
+static inline void open_bit ( struct bit_basher *basher ) {
+ if ( basher->op->open )
+ basher->op->open ( basher );
+}
+
+/**
+ * Close bit-bashing interface
+ *
+ * @v basher Bit-bashing interface
+ */
+static inline void close_bit ( struct bit_basher *basher ) {
+ if ( basher->op->close )
+ basher->op->close ( basher );
+}
+
extern void write_bit ( struct bit_basher *basher, unsigned int bit_id,
unsigned long data );
extern int read_bit ( struct bit_basher *basher, unsigned int bit_id );