SIM_INTERFACE(firewire_bus) { int (*connect_device)(conf_object_t *NOTNULL bus, conf_object_t *NOTNULL dev); int (*disconnect_device)(conf_object_t *NOTNULL bus, conf_object_t *NOTNULL dev); void (*set_device_bus_id)(conf_object_t *NOTNULL bus, conf_object_t *NOTNULL dev, uint16 bus_id); void (*set_id_mask)(conf_object_t *NOTNULL bus, conf_object_t *NOTNULL dev, uint16 id_mask); firewire_ack_code_t (*transfer)(conf_object_t *NOTNULL bus, conf_object_t *NOTNULL source, dbuffer_t *packet, int crc_calculated); int (*register_channel)(conf_object_t *NOTNULL bus, conf_object_t *NOTNULL dev, uint32 channel); int (*unregister_channel)(conf_object_t *NOTNULL bus, conf_object_t *NOTNULL dev, uint32 channel); void (*reset)(conf_object_t *NOTNULL bus); }; #define FIREWIRE_BUS_INTERFACE "firewire_bus"
This interface must be implemented by all firewire buses.
connect_device is called when a device wants to connect to the bus. The bus should return 0 upon success.
disconnect_device is called when a device wants to disconnect from the bus. The bus should return 0 upon success.
set_device_bus_id sets the bus id for the device. This needs to be called by a device when its Node_IDS[bus_id] field is updated. The new bus id should be placed in bits 15-6 in the bus_id argument.
set_id_mask can be called by a device to specify a mask that should be applied to the device ID when routing transfers. This can be used to e.g. accept transfers to multiple bus-numbers.
transfer sends a packet. The bus will route the transfer to the correct device(s). The source parameter should be set to the device which sent the transfer. The bus uses this parameter to avoid sending packets to their sender. If the crc_calculated argument is non-zero the packet's crc fields are filled in.The return code is one of:
typedef enum { /* Values defined in the FireWire specification */ Firewire_Ack_Complete = 1, Firewire_Ack_Pending = 2, Firewire_Ack_Busy_X = 4, Firewire_Ack_Busy_A = 5, Firewire_Ack_Busy_B = 6, Firewire_Ack_Tardy = 0xb, Firewire_Ack_Conflict_Error = 0xc, Firewire_Ack_Data_Error = 0xd, Firewire_Ack_Type_Error = 0xe, Firewire_Ack_Address_Error = 0xf, /* Values not defined in FireWire but used in Simics */ Firewire_Ack_No_Destination = 0x10, /* no destination found */ Firewire_Ack_No_Ack = 0x11 /* no ack signal sent for packet */ } firewire_ack_code_t;
register_channel can be called to tell the bus that the device want to receive isochronous transfers to channel channel. channel must be in the range [0, 63). A device can register several channels. It is an error to subscribe a device to a channel it is already subscribed to. Returns 0 on success.
unregister_channel tells the bus the device is no longer interested in transfers to channel channel. channel must be in the range [0, 63). It is an error to unsubscribe a device from a channel if it isn't subscribing to it. Returns 0 on success.
reset can be called to cause a bus reset. After the bus reset, all the devices may have received new IDs.