Logo Search packages:      
Sourcecode: cbmlink version File versions  Download package

static int mem_op ( const struct comm comm,
enum opcode  op,
unsigned  bank,
unsigned  start,
unsigned  end 
) [static]

send a memory transfer command and a header

comm the communication primitives
op the operation (REQ_LOAD or REQ_SAVE)
bank memory bank
start start address
end end address
zero on success, nonzero on error

Definition at line 41 of file mem.c.

References comm::comm_read, comm::comm_rs, comm::comm_sr, and comm::comm_write.

Referenced by load(), and save().

  char req[4];
  req[0] = op;
  req[1] = bank;

  if ((*comm->comm_write) (req, 2))
    return 1;
  (*comm->comm_sr) ();
  if ((*comm->comm_read) (req, 1))
    return 2;
  if (*req)
    return 3;

  req[0] = start;
  req[1] = start >> 8;
  req[2] = end;
  req[3] = end >> 8;

  (*comm->comm_rs) ();
  if ((*comm->comm_write) (req, 4))
    return 4;

  return 0;

Generated by  Doxygen 1.6.0   Back to index