1 |
|
/* |
2 |
|
* scsi_amiga.cpp - SCSI Manager, Amiga specific stuff |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2000 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 |
44 |
|
|
45 |
|
static ULONG buffer_size; // Size of data buffer |
46 |
|
static UBYTE *buffer = NULL; // Pointer to data buffer |
47 |
+ |
static ULONG buffer_memf; // Buffer memory flags |
48 |
|
|
49 |
|
static UBYTE cmd_buffer[12]; // Buffer for SCSI command |
50 |
|
|
60 |
|
{ |
61 |
|
int id, lun; |
62 |
|
|
63 |
+ |
int memtype = PrefsFindInt32("scsimemtype"); |
64 |
+ |
switch (memtype) { |
65 |
+ |
case 1: |
66 |
+ |
buffer_memf = MEMF_24BITDMA | MEMF_PUBLIC; |
67 |
+ |
break; |
68 |
+ |
case 2: |
69 |
+ |
buffer_memf = MEMF_ANY | MEMF_PUBLIC; |
70 |
+ |
break; |
71 |
+ |
default: |
72 |
+ |
buffer_memf = MEMF_CHIP | MEMF_PUBLIC; |
73 |
+ |
break; |
74 |
+ |
} |
75 |
+ |
|
76 |
|
// Create port and buffers |
77 |
|
the_port = CreateMsgPort(); |
78 |
< |
buffer = (UBYTE *)AllocMem(buffer_size = 0x10000, MEMF_CHIP | MEMF_PUBLIC); |
78 |
> |
buffer = (UBYTE *)AllocMem(buffer_size = 0x10000, buffer_memf); |
79 |
|
sense_buffer = (UBYTE *)AllocMem(SENSE_LENGTH, MEMF_CHIP | MEMF_PUBLIC); |
80 |
|
if (the_port == NULL || buffer == NULL || sense_buffer == NULL) { |
81 |
|
ErrorAlert(GetString(STR_NO_MEM_ERR)); |
156 |
|
if (size <= buffer_size) |
157 |
|
return true; |
158 |
|
|
159 |
< |
UBYTE *new_buffer = (UBYTE *)AllocMem(size, MEMF_CHIP | MEMF_PUBLIC); |
159 |
> |
UBYTE *new_buffer = (UBYTE *)AllocMem(size, buffer_memf); |
160 |
|
if (new_buffer == NULL) |
161 |
|
return false; |
162 |
|
FreeMem(buffer, buffer_size); |
255 |
|
} |
256 |
|
|
257 |
|
// Process S/G table when reading |
258 |
< |
if (res == 0) { |
258 |
> |
if (reading && res == 0) { |
259 |
|
D(bug(" reading from buffer\n")); |
260 |
|
uint8 *buffer_ptr = buffer; |
261 |
|
for (int i=0; i<sg_size; i++) { |