ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/AmigaOS/scsi_amiga.cpp
(Generate patch)

Comparing BasiliskII/src/AmigaOS/scsi_amiga.cpp (file contents):
Revision 1.1.1.1 by cebix, 1999-10-03T14:16:25Z vs.
Revision 1.7 by jlachmann, 2002-06-23T08:27:05Z

# Line 1 | Line 1
1   /*
2   *  scsi_amiga.cpp - SCSI Manager, Amiga specific stuff
3   *
4 < *  Basilisk II (C) 1997-1999 Christian Bauer
4 > *  Basilisk II (C) 1997-2001 Christian Bauer
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 22 | Line 22
22   #include <exec/memory.h>
23   #include <devices/trackdisk.h>
24   #include <devices/scsidisk.h>
25 + #define __USE_SYSBASE
26   #include <proto/exec.h>
27 + #include <inline/exec.h>
28  
29   #include "sysdeps.h"
30   #include "main.h"
# Line 44 | Line 46 | static struct MsgPort *the_port = NULL;
46  
47   static ULONG buffer_size;                               // Size of data buffer
48   static UBYTE *buffer = NULL;                    // Pointer to data buffer
49 + static ULONG buffer_memf;                               // Buffer memory flags
50  
51   static UBYTE cmd_buffer[12];                    // Buffer for SCSI command
52  
# Line 59 | Line 62 | void SCSIInit(void)
62   {
63          int id, lun;
64  
65 +        int memtype = PrefsFindInt32("scsimemtype");
66 +        switch (memtype) {
67 +                case 1:
68 +                        buffer_memf = MEMF_24BITDMA | MEMF_PUBLIC;
69 +                        break;
70 +                case 2:
71 +                        buffer_memf = MEMF_ANY | MEMF_PUBLIC;
72 +                        break;
73 +                default:
74 +                        buffer_memf = MEMF_CHIP | MEMF_PUBLIC;
75 +                        break;
76 +        }
77 +
78          // Create port and buffers
79          the_port = CreateMsgPort();
80 <        buffer = (UBYTE *)AllocMem(buffer_size = 0x10000, MEMF_CHIP | MEMF_PUBLIC);
80 >        buffer = (UBYTE *)AllocMem(buffer_size = 0x10000, buffer_memf);
81          sense_buffer = (UBYTE *)AllocMem(SENSE_LENGTH, MEMF_CHIP | MEMF_PUBLIC);
82          if (the_port == NULL || buffer == NULL || sense_buffer == NULL) {
83 <                ErrorAlert(GetString(STR_NO_MEM_ERR));
83 >                ErrorAlert(STR_NO_MEM_ERR);
84                  QuitEmulator();
85          }
86  
# Line 83 | Line 99 | void SCSIInit(void)
99                                          struct IOStdReq *io = (struct IOStdReq *)CreateIORequest(the_port, sizeof(struct IOStdReq));
100                                          if (io == NULL)
101                                                  continue;
102 <                                        if (OpenDevice((UBYTE *)dev_name, dev_unit + lun * 10, (struct IORequest *)io, 0)) {
102 >                                        if (OpenDevice((UBYTE *) dev_name, dev_unit + lun * 10, (struct IORequest *)io, 0)) {
103                                                  DeleteIORequest(io);
104                                                  continue;
105                                          }
# Line 142 | Line 158 | static bool try_buffer(int size)
158          if (size <= buffer_size)
159                  return true;
160  
161 <        UBYTE *new_buffer = (UBYTE *)AllocMem(size, MEMF_CHIP | MEMF_PUBLIC);
161 >        UBYTE *new_buffer = (UBYTE *)AllocMem(size, buffer_memf);
162          if (new_buffer == NULL)
163                  return false;
164          FreeMem(buffer, buffer_size);
# Line 241 | Line 257 | bool scsi_send_cmd(size_t data_length, b
257          }
258  
259          // Process S/G table when reading
260 <        if (res == 0) {
260 >        if (reading && res == 0) {
261                  D(bug(" reading from buffer\n"));
262                  uint8 *buffer_ptr = buffer;
263                  for (int i=0; i<sg_size; i++) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines