FPGA Bridge¶
API to implement a new FPGA bridge¶
struct
fpga_bridge
— The FPGA Bridge structurestruct
fpga_bridge_ops
— Low level Bridge driver opsdevm_fpga_bridge_create()
— Allocate and init a bridge structfpga_bridge_register()
— Register a bridgefpga_bridge_unregister()
— Unregister a bridge
-
struct
fpga_bridge
¶ FPGA bridge structure
Definition
struct fpga_bridge {
const char *name;
struct device dev;
struct mutex mutex;
const struct fpga_bridge_ops *br_ops;
struct fpga_image_info *info;
struct list_head node;
void *priv;
};
Members
name
name of low level FPGA bridge
dev
FPGA bridge device
mutex
enforces exclusive reference to bridge
br_ops
pointer to struct of FPGA bridge ops
info
fpga image specific information
node
FPGA bridge list node
priv
low level driver private date
-
struct
fpga_bridge_ops
¶ ops for low level FPGA bridge drivers
Definition
struct fpga_bridge_ops {
int (*enable_show)(struct fpga_bridge *bridge);
int (*enable_set)(struct fpga_bridge *bridge, bool enable);
void (*fpga_bridge_remove)(struct fpga_bridge *bridge);
const struct attribute_group **groups;
};
Members
enable_show
returns the FPGA bridge's status
enable_set
set a FPGA bridge as enabled or disabled
fpga_bridge_remove
set FPGA into a specific state during driver remove
groups
optional attribute groups.
-
struct fpga_bridge *
devm_fpga_bridge_create
(struct device * dev, const char * name, const struct fpga_bridge_ops * br_ops, void * priv)¶ create and init a managed struct fpga_bridge
Parameters
struct device * dev
FPGA bridge device from pdev
const char * name
FPGA bridge name
const struct fpga_bridge_ops * br_ops
pointer to structure of fpga bridge ops
void * priv
FPGA bridge private data
Description
This function is intended for use in a FPGA bridge driver's probe function.
After the bridge driver creates the struct with devm_fpga_bridge_create()
, it
should register the bridge with fpga_bridge_register()
. The bridge driver's
remove function should call fpga_bridge_unregister()
. The bridge struct
allocated with this function will be freed automatically on driver detach.
This includes the case of a probe function returning error before calling
fpga_bridge_register()
, the struct will still get cleaned up.
Return
struct fpga_bridge or NULL
-
int
fpga_bridge_register
(struct fpga_bridge * bridge)¶ register a FPGA bridge
Parameters
struct fpga_bridge * bridge
FPGA bridge struct
Return
0 for success, error code otherwise.
-
void
fpga_bridge_unregister
(struct fpga_bridge * bridge)¶ unregister a FPGA bridge
Parameters
struct fpga_bridge * bridge
FPGA bridge struct
Description
This function is intended for use in a FPGA bridge driver's remove function.