changer.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #include <u.h>
  2. #include <libc.h>
  3. #include "scsireq.h"
  4. long
  5. SReinitialise(ScsiReq *rp)
  6. {
  7. uchar cmd[6];
  8. memset(cmd, 0, sizeof(cmd));
  9. cmd[0] = ScmdEInitialise;
  10. rp->cmd.p = cmd;
  11. rp->cmd.count = sizeof(cmd);
  12. rp->data.p = cmd;
  13. rp->data.count = 0;
  14. rp->data.write = 1;
  15. return SRrequest(rp);
  16. }
  17. long
  18. SRmmove(ScsiReq *rp, int transport, int source, int destination, int invert)
  19. {
  20. uchar cmd[12];
  21. memset(cmd, 0, sizeof(cmd));
  22. cmd[0] = ScmdMMove;
  23. cmd[2] = transport>>8;
  24. cmd[3] = transport;
  25. cmd[4] = source>>8;
  26. cmd[5] = source;
  27. cmd[6] = destination>>8;
  28. cmd[7] = destination;
  29. cmd[10] = invert & 0x01;
  30. rp->cmd.p = cmd;
  31. rp->cmd.count = sizeof(cmd);
  32. rp->data.p = cmd;
  33. rp->data.count = 0;
  34. rp->data.write = 1;
  35. return SRrequest(rp);
  36. }
  37. long
  38. SRestatus(ScsiReq *rp, uchar type, uchar *list, int nbytes)
  39. {
  40. uchar cmd[12];
  41. memset(cmd, 0, sizeof(cmd));
  42. cmd[0] = ScmdEStatus;
  43. cmd[1] = type & 0x07;
  44. cmd[4] = 0xFF;
  45. cmd[5] = 0xFF;
  46. cmd[7] = nbytes>>16;
  47. cmd[8] = nbytes>>8;
  48. cmd[9] = nbytes;
  49. rp->cmd.p = cmd;
  50. rp->cmd.count = sizeof(cmd);
  51. rp->data.p = list;
  52. rp->data.count = nbytes;
  53. rp->data.write = 0;
  54. return SRrequest(rp);
  55. }