Implementation of the AGENT_STATE Register

Sean Bruno sbruno at miralink.com
Fri Feb 8 13:06:21 PST 2008


Hidetoshi:

Can you review this and correct it where needed?  I am sure that it is 
wrong, but I haven't tested it yet.

struct agent_state {
        uint32_t fetch_agent_state;
#define AGENT_STATE_RESET 0
#define AGENT_STATE_ACTIVE 1
#define AGENT_STATE_SUSPENDED 2
#define AGENT_STATE_DEAD 3
        uint32_t bus_reset_command_reset_init_vals;
        uint32_t read_vals;
        uint32_t write_effects;
};

static void
sbp_targ_send_agent_state(struct fw_xfer *xfer)
{
        struct agent_state *current_state;
        struct fw_pkt *rfp; /* response to request --> from target */

        xfer->send.payload = malloc(sizeof(struct agent_state), 
M_SBP_TARG, M_NOWAIT | M_ZERO);
        xfer->send.pay_len = ntohs(sizeof(struct agent_state));
        xfer->send.spd = FWSPD_S400;

        current_state = (struct agent_state *)xfer->send.payload;
        current_state->fetch_agent_state = AGENT_STATE_ACTIVE;

        rfp = &xfer->recv.hdr;
        rfp->mode.rresb.tcode = FWTCODE_RRESB;
        rfp->mode.rresb.rtcode = 0;
        rfp->mode.rresb.extcode = 0;
        xfer->send.hdr.mode.hdr.dst = ntohs(rfp->mode.hdr.src);
        xfer->hand = fw_xfer_free_buf;
        rfp->mode.hdr.pri = 0;
        fw_asyreq(xfer->fc, -1, xfer);

}


Sean


More information about the freebsd-firewire mailing list