- AmigaOS: SCSI buffer memory type can be selected via prefs

This commit is contained in:
cebix 2001-05-24 14:31:07 +00:00
parent d88fac31e1
commit 68310129fe
7 changed files with 99 additions and 36 deletions

View File

@ -15,6 +15,7 @@ V0.9 - <insert date here>
- Unix: ether_linux.cpp moved and renamed to ether_unix.cpp, now
also works with the tap driver under FreeBSD [Michael Alyn Miller]
- BeOS: fixed some bugs in the extfs file types handling
- AmigaOS: SCSI buffer type can be selected
V0.9 (snapshot) - 17.Feb.2001
- adapted for mon V3.0 which is now the required minimum

View File

@ -508,6 +508,19 @@ AmigaOS:
ahi/<hexadecimal mode ID>
scsimemtype <type>
This item controls the type of memory to use for SCSI buffers. Possible
values are:
0 Chip memory
1 24-bit DMA capable memory
2 Any memory
Be warned that many SCSI host adapters will not work with the "Any memory"
setting. Basilisk II has no way of knowing which memory type is supported
by the host adapter and setting an unsupported type will result in data
corruption.
Windows:
noscsi <"true" or "false">

View File

@ -27,6 +27,7 @@
// Platform-specific preferences items
prefs_desc platform_prefs_items[] = {
{"sound", TYPE_STRING, false, "sound output mode description"},
{"scsimemtype", TYPE_INT32, false, "SCSI buffer memory type"},
{NULL, TYPE_END, false, NULL} // End of list
};
@ -84,4 +85,5 @@ void SavePrefs(void)
void AddPlatformPrefsDefaults(void)
{
PrefsReplaceString("extfs", "WORK:");
PrefsAddInt32("scsimemtype", 0);
}

View File

@ -94,6 +94,7 @@ const int GAD_SCSI3_UNIT = 0x0413;
const int GAD_SCSI4_UNIT = 0x0414;
const int GAD_SCSI5_UNIT = 0x0415;
const int GAD_SCSI6_UNIT = 0x0416;
const int GAD_SCSI_MEMTYPE = 0x0420;
const int GAD_VIDEO_TYPE = 0x0500; // "Graphics/Sound" pane
const int GAD_DISPLAY_X = 0x0501;
@ -362,6 +363,10 @@ bool PrefsEditor(void)
}
break;
case GAD_SCSI_MEMTYPE:
PrefsReplaceInt32("scsimemtype", code);
break;
case GAD_VIDEO_TYPE:
ghost_graphics_gadgets(h);
break;
@ -1087,6 +1092,7 @@ static void create_volumes_pane(struct LayoutHandle *h)
static char scsi_dev[6][256];
static LONG scsi_unit[6];
static LONG scsi_memtype;
// Read SCSI preferences
static void parse_scsi_prefs(void)
@ -1101,6 +1107,8 @@ static void parse_scsi_prefs(void)
if (str)
sscanf(str, "%[^/]/%ld", scsi_dev[i], &scsi_unit[i]);
}
scsi_memtype = PrefsFindInt32("scsimemtype");
}
// Read settings from gadgets and set preferences
@ -1125,32 +1133,47 @@ static void create_scsi_pane(struct LayoutHandle *h)
parse_scsi_prefs();
VGROUP;
for (int i=0; i<7; i++) {
HGROUP;
LT_New(h, LA_Type, TEXT_KIND,
LA_LabelID, STR_SCSI_ID_0 + i,
TAG_END
);
LT_New(h, LA_Type, STRING_KIND,
LA_LabelID, STR_DEVICE_CTRL,
LA_ID, GAD_SCSI0_DEVICE + i,
LA_Chars, 20,
LA_STRPTR, (ULONG)scsi_dev[i],
GTST_MaxChars, sizeof(scsi_dev[i]) - 1,
LAST_Picker, TRUE,
TAG_END
);
LT_New(h, LA_Type, INTEGER_KIND,
LA_LabelID, STR_UNIT_CTRL,
LA_ID, GAD_SCSI0_UNIT + i,
LA_Chars, 4,
LA_LONG, (ULONG)&scsi_unit[i],
LAIN_UseIncrementers, TRUE,
GTIN_MaxChars, 8,
TAG_END
);
ENDGROUP;
}
LT_New(h, LA_Type, VERTICAL_KIND,
LA_LabelID, STR_SCSI_DEVICES_CTRL,
TAG_END
);
for (int i=0; i<7; i++) {
HGROUP;
LT_New(h, LA_Type, TEXT_KIND,
LA_LabelID, STR_SCSI_ID_0 + i,
TAG_END
);
LT_New(h, LA_Type, STRING_KIND,
LA_LabelID, STR_DEVICE_CTRL,
LA_ID, GAD_SCSI0_DEVICE + i,
LA_Chars, 20,
LA_STRPTR, (ULONG)scsi_dev[i],
GTST_MaxChars, sizeof(scsi_dev[i]) - 1,
LAST_Picker, TRUE,
TAG_END
);
LT_New(h, LA_Type, INTEGER_KIND,
LA_LabelID, STR_UNIT_CTRL,
LA_ID, GAD_SCSI0_UNIT + i,
LA_Chars, 4,
LA_LONG, (ULONG)&scsi_unit[i],
LAIN_UseIncrementers, TRUE,
GTIN_MaxChars, 8,
TAG_END
);
ENDGROUP;
}
ENDGROUP;
VGROUP;
LT_New(h, LA_Type, CYCLE_KIND,
LA_LabelID, STR_SCSI_MEMTYPE_CTRL,
LA_ID, GAD_SCSI_MEMTYPE,
LACY_FirstLabel, STR_MEMTYPE_CHIP_LAB,
LACY_LastLabel, STR_MEMTYPE_ANY_LAB,
LA_LONG, (ULONG)&scsi_memtype,
TAG_END
);
ENDGROUP;
ENDGROUP;
}
@ -1166,7 +1189,7 @@ enum {
DISPLAY_SCREEN
};
static BYTE display_type;
static LONG display_type;
static LONG dis_width, dis_height;
static ULONG mode_id;
static BYTE frameskip_num;
@ -1210,9 +1233,9 @@ static void parse_graphics_prefs(void)
const char *str = PrefsFindString("screen");
if (str) {
if (sscanf(str, "win/%d/%d", &dis_width, &dis_height) == 2)
if (sscanf(str, "win/%ld/%ld", &dis_width, &dis_height) == 2)
display_type = DISPLAY_WINDOW;
else if (sscanf(str, "pip/%d/%d", &dis_width, &dis_height) == 2)
else if (sscanf(str, "pip/%ld/%ld", &dis_width, &dis_height) == 2)
display_type = DISPLAY_PIP;
else if (sscanf(str, "scr/%08lx", &mode_id) == 1)
display_type = DISPLAY_SCREEN;
@ -1368,7 +1391,7 @@ static void create_graphics_pane(struct LayoutHandle *h)
LA_LabelID, STR_VIDEO_TYPE_CTRL,
LA_ID, GAD_VIDEO_TYPE,
LACY_LabelTable, (ULONG)labels,
LA_BYTE, (ULONG)&display_type,
LA_LONG, (ULONG)&display_type,
TAG_END
);
LT_New(h, LA_Type, INTEGER_KIND,

View File

@ -44,6 +44,7 @@ static struct MsgPort *the_port = NULL; // Message port for device communication
static ULONG buffer_size; // Size of data buffer
static UBYTE *buffer = NULL; // Pointer to data buffer
static ULONG buffer_memf; // Buffer memory flags
static UBYTE cmd_buffer[12]; // Buffer for SCSI command
@ -59,9 +60,22 @@ void SCSIInit(void)
{
int id, lun;
int memtype = PrefsFindInt32("scsimemtype");
switch (memtype) {
case 1:
buffer_memf = MEMF_24BITDMA | MEMF_PUBLIC;
break;
case 2:
buffer_memf = MEMF_ANY | MEMF_PUBLIC;
break;
default:
buffer_memf = MEMF_CHIP | MEMF_PUBLIC;
break;
}
// Create port and buffers
the_port = CreateMsgPort();
buffer = (UBYTE *)AllocMem(buffer_size = 0x10000, MEMF_CHIP | MEMF_PUBLIC);
buffer = (UBYTE *)AllocMem(buffer_size = 0x10000, buffer_memf);
sense_buffer = (UBYTE *)AllocMem(SENSE_LENGTH, MEMF_CHIP | MEMF_PUBLIC);
if (the_port == NULL || buffer == NULL || sense_buffer == NULL) {
ErrorAlert(GetString(STR_NO_MEM_ERR));
@ -142,7 +156,7 @@ static bool try_buffer(int size)
if (size <= buffer_size)
return true;
UBYTE *new_buffer = (UBYTE *)AllocMem(size, MEMF_CHIP | MEMF_PUBLIC);
UBYTE *new_buffer = (UBYTE *)AllocMem(size, buffer_memf);
if (new_buffer == NULL)
return false;
FreeMem(buffer, buffer_size);
@ -241,7 +255,7 @@ bool scsi_send_cmd(size_t data_length, bool reading, int sg_size, uint8 **sg_ptr
}
// Process S/G table when reading
if (res == 0) {
if (reading && res == 0) {
D(bug(" reading from buffer\n"));
uint8 *buffer_ptr = buffer;
for (int i=0; i<sg_size; i++) {

View File

@ -44,10 +44,15 @@ user_string_def platform_strings[] = {
{STR_NO_GTLAYOUT_LIB_WARN, "Cannot open gtlayout.library V39. The preferences editor GUI will not be available."},
{STR_NO_AHI_WARN, "Cannot open ahi.device V2. Audio output will be disabled."},
{STR_NO_AHI_CTRL_WARN, "Cannot open AHI control structure. Audio output will be disabled."},
{STR_AHI_MODE_CTRL, "AHI Mode"},
{STR_NOT_ENOUGH_MEM_WARN, "Could not get %lu MBytes of memory.\nShould I use the largest Block (%lu MBytes) instead ?"},
{STR_AHI_MODE_CTRL, "AHI Mode"},
{STR_SCSI_MEMTYPE_CTRL, "Buffer Memory Type"},
{STR_MEMTYPE_CHIP_LAB, "Chip"},
{STR_MEMTYPE_24BITDMA_LAB, "24-Bit DMA"},
{STR_MEMTYPE_ANY_LAB, "Any"},
{STR_SCSI_DEVICES_CTRL, "Virtual SCSI Devices"},
{-1, NULL} // End marker
};

View File

@ -36,9 +36,14 @@ enum {
STR_NO_GTLAYOUT_LIB_WARN,
STR_NO_AHI_WARN,
STR_NO_AHI_CTRL_WARN,
STR_NOT_ENOUGH_MEM_WARN,
STR_AHI_MODE_CTRL,
STR_NOT_ENOUGH_MEM_WARN,
STR_SCSI_MEMTYPE_CTRL,
STR_MEMTYPE_CHIP_LAB,
STR_MEMTYPE_24BITDMA_LAB,
STR_MEMTYPE_ANY_LAB,
STR_SCSI_DEVICES_CTRL
};
#endif