Re: Implementation of the AGENT_STATE Register

"Hidetoshi Shimokawa" <[email protected]>
Newsgroups gmane.os.freebsd.devel.firewire
Message-ID <[email protected]>
Sorry for the late response.

On Sat, Feb 9, 2008 at 6:06 AM, Sean Bruno <[email protected]> wrote:
> 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));

I don't think you need ntohs() here.

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

I'm not sure whether byteswapping is required here or not.

>         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
>
>



-- 
/\ Hidetoshi Shimokawa
\/ [email protected]
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-firewire
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.