BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / bus_managers / ide / ide_sim.h
blobf353b520b1a83cc0d346f5fc3b9aab3830c9a3f0
1 /*
2 ** Copyright 2002/03, Thomas Kurschel. All rights reserved.
3 ** Distributed under the terms of the OpenBeOS License.
4 */
6 /*
7 Part of Open IDE bus manager
9 Interface between ide and scsi bus manager
13 #ifndef __IDE_SIM_H__
14 #define __IDE_SIM_H__
17 #include <sys/cdefs.h>
19 #include "scsi_cmds.h"
22 extern scsi_for_sim_interface *scsi;
23 extern scsi_sim_interface ide_sim_module;
25 // set sense of current request
26 static inline void
27 set_sense(ide_device_info *device, int sense_key, int sense_asc)
29 device->new_combined_sense = (sense_key << 16) | sense_asc;
32 // retrieve key from combined sense
33 static inline uint8
34 decode_sense_key(uint32 combined_sense)
36 return (combined_sense >> 16) & 0xff;
39 // retrieve asc from combined sense
40 static inline uint8
41 decode_sense_asc(uint32 combined_sense)
43 return (combined_sense >> 8) & 0xff;
46 // retrieve ascq from combined sense
47 static inline uint8
48 decode_sense_ascq(uint32 combined_sense)
50 return combined_sense & 0xff;
53 // retrieve asc and ascq from combined sense
54 static inline uint16
55 decode_sense_asc_ascq(uint32 combined_sense)
57 return combined_sense & 0xffff;
60 void finish_request(ide_qrequest *qrequest, bool resubmit);
61 void finish_reset_queue(ide_qrequest *qrequest);
62 void finish_retry(ide_qrequest *qrequest);
63 void finish_all_requests(ide_device_info *device, ide_qrequest *ignore,
64 int subsys_status, bool resubmit);
65 void finish_checksense(ide_qrequest *qrequest);
68 // start request by resetting sense
69 static inline void
70 start_request(ide_device_info *device, ide_qrequest *qrequest)
72 device->new_combined_sense = 0;
73 device->subsys_status = SCSI_REQ_CMP;
74 qrequest->request->device_status = SCSI_STATUS_GOOD;
78 __BEGIN_DECLS
80 void create_sense(ide_device_info *device, scsi_sense *sense);
82 __END_DECLS
85 #endif