mirror of
https://github.com/ipxe/ipxe
synced 2025-12-26 01:22:37 +03:00
[bitbash] Add optional open() and close() methods for bit-bashing interfaces
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -13,6 +13,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
|
||||
*
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user