scsi-disk.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef SCSI_DISK_H
  2. #define SCSI_DISK_H
  3. /* scsi-disk.c */
  4. enum scsi_reason {
  5. SCSI_REASON_DONE, /* Command complete. */
  6. SCSI_REASON_DATA /* Transfer complete, more data required. */
  7. };
  8. typedef struct SCSIDeviceState SCSIDeviceState;
  9. typedef struct SCSIDevice SCSIDevice;
  10. typedef void (*scsi_completionfn)(void *opaque, int reason, uint32_t tag,
  11. uint32_t arg);
  12. struct SCSIDevice
  13. {
  14. SCSIDeviceState *state;
  15. void (*destroy)(SCSIDevice *s);
  16. int32_t (*send_command)(SCSIDevice *s, uint32_t tag, uint8_t *buf,
  17. int lun);
  18. void (*read_data)(SCSIDevice *s, uint32_t tag);
  19. int (*write_data)(SCSIDevice *s, uint32_t tag);
  20. void (*cancel_io)(SCSIDevice *s, uint32_t tag);
  21. uint8_t *(*get_buf)(SCSIDevice *s, uint32_t tag);
  22. };
  23. SCSIDevice *scsi_disk_init(BlockDriverState *bdrv, int tcq,
  24. scsi_completionfn completion, void *opaque);
  25. SCSIDevice *scsi_generic_init(BlockDriverState *bdrv, int tcq,
  26. scsi_completionfn completion, void *opaque);
  27. /* cdrom.c */
  28. int cdrom_read_toc(int nb_sectors, uint8_t *buf, int msf, int start_track);
  29. int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num);
  30. #endif