diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..ffef9a2f --- /dev/null +++ b/LICENSE @@ -0,0 +1,31 @@ +BSD 3-Clause License + +Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) +Copyright (C) 2014-2020 GIMONS +Copyright (c) 2020, akuker +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/raspberrypi/cfilesystem.cpp b/src/raspberrypi/cfilesystem.cpp index 76ee30db..074caa66 100644 --- a/src/raspberrypi/cfilesystem.cpp +++ b/src/raspberrypi/cfilesystem.cpp @@ -9,7 +9,12 @@ // Imported NetBSD support and some optimisation patch by Rin Okuyama. // Imported sava's bugfix patch(in RASDRV DOS edition). // -// [ ホストファイルシステム ] +// [ Host File System for the X68000 ] +// +// Note: This functionality is specific to the X68000 +// operating system. +// It is highly unlikely that this will work for other +// platforms. // //--------------------------------------------------------------------------- diff --git a/src/raspberrypi/cfilesystem.h b/src/raspberrypi/cfilesystem.h index 6332a2a5..42cfa146 100644 --- a/src/raspberrypi/cfilesystem.h +++ b/src/raspberrypi/cfilesystem.h @@ -5,8 +5,10 @@ // // Powered by XM6 TypeG Technology. // Copyright (C) 2016-2020 GIMONS -// [ ホストファイルシステム ] +// [ Host File System for the X68000 ] // +// Note: This functionality is specific to the X68000 operating system. +// It is highly unlikely that this will work for other platforms. //--------------------------------------------------------------------------- #ifndef cfilesystem_h diff --git a/src/raspberrypi/ctapdriver.cpp b/src/raspberrypi/ctapdriver.cpp index 4adabab9..47536574 100644 --- a/src/raspberrypi/ctapdriver.cpp +++ b/src/raspberrypi/ctapdriver.cpp @@ -8,7 +8,7 @@ // // Imported NetBSD support and some optimisation patch by Rin Okuyama. // -// [ TAPドライバ ] +// [ TAP Driver ] // //--------------------------------------------------------------------------- @@ -206,4 +206,4 @@ int FASTCALL CTapDriver::Tx(BYTE *buf, int len) // 送信開始 return write(m_hTAP, buf, len); -} \ No newline at end of file +} diff --git a/src/raspberrypi/ctapdriver.h b/src/raspberrypi/ctapdriver.h index 97ba4e1e..c4735c77 100644 --- a/src/raspberrypi/ctapdriver.h +++ b/src/raspberrypi/ctapdriver.h @@ -8,7 +8,7 @@ // // Imported NetBSD support and some optimisation patch by Rin Okuyama. // -// [ TAPドライバ ] +// [ TAP Driver ] // //--------------------------------------------------------------------------- diff --git a/src/raspberrypi/disk.cpp b/src/raspberrypi/disk.cpp index af11ecf1..dbe3d34a 100644 --- a/src/raspberrypi/disk.cpp +++ b/src/raspberrypi/disk.cpp @@ -11,8 +11,9 @@ // // Imported sava's Anex86/T98Next image and MO format support patch. // Imported NetBSD support and some optimisation patch by Rin Okuyama. +// Comments translated to english by akuker. // -// [ ディスク ] +// [ Disk ] // //--------------------------------------------------------------------------- @@ -38,7 +39,7 @@ //=========================================================================== // -// ディスク +// Disk // //=========================================================================== //#define DISK_LOG @@ -51,18 +52,18 @@ //=========================================================================== // -// ディスクトラック +// Disk Track // //=========================================================================== //--------------------------------------------------------------------------- // -// コンストラクタ +// Constructor // //--------------------------------------------------------------------------- DiskTrack::DiskTrack() { - // 内部情報の初期化 + // Initialization of internal information dt.track = 0; dt.size = 0; dt.sectors = 0; @@ -78,12 +79,12 @@ DiskTrack::DiskTrack() //--------------------------------------------------------------------------- // -// デストラクタ +// Destructor // //--------------------------------------------------------------------------- DiskTrack::~DiskTrack() { - // メモリ解放は行うが、自動セーブはしない + // Release memory, but do not save automatically if (dt.buffer) { free(dt.buffer); dt.buffer = NULL; @@ -96,7 +97,7 @@ DiskTrack::~DiskTrack() //--------------------------------------------------------------------------- // -// 初期化 +// Initialization // //--------------------------------------------------------------------------- void FASTCALL DiskTrack::Init( @@ -107,25 +108,25 @@ void FASTCALL DiskTrack::Init( ASSERT((sectors > 0) && (sectors <= 0x100)); ASSERT(imgoff >= 0); - // パラメータを設定 + // Set Parameters dt.track = track; dt.size = size; dt.sectors = sectors; dt.raw = raw; - // 初期化されていない(ロードする必要あり) + // Not initialized (needs to be loaded) dt.init = FALSE; - // 変更されていない + // Not Changed dt.changed = FALSE; - // 実データまでのオフセット + // Offset to actual data dt.imgoffset = imgoff; } //--------------------------------------------------------------------------- // -// ロード +// Load // //--------------------------------------------------------------------------- BOOL FASTCALL DiskTrack::Load(const Filepath& path) @@ -137,14 +138,15 @@ BOOL FASTCALL DiskTrack::Load(const Filepath& path) ASSERT(this); - // 既にロードされていれば不要 + // Not needed if already loaded if (dt.init) { ASSERT(dt.buffer); ASSERT(dt.changemap); return TRUE; } - // オフセットを計算(これ以前のトラックは256セクタ保持とみなす) + // Calculate offset (previous tracks are considered to + // hold 256 sectors) offset = ((off64_t)dt.track << 8); if (dt.raw) { ASSERT(dt.size == 11); @@ -154,13 +156,13 @@ BOOL FASTCALL DiskTrack::Load(const Filepath& path) offset <<= dt.size; } - // 実イメージまでのオフセットを追加 + // Add offset to real image offset += dt.imgoffset; - // レングスを計算(このトラックのデータサイズ) + // Calculate length (data size of this track) length = dt.sectors << dt.size; - // バッファのメモリを確保 + // Allocate buffer memory ASSERT((dt.size >= 8) && (dt.size <= 11)); ASSERT((dt.sectors > 0) && (dt.sectors <= 0x100)); @@ -177,7 +179,7 @@ BOOL FASTCALL DiskTrack::Load(const Filepath& path) return FALSE; } - // バッファ長が異なるなら再確保 + // Reallocate if the buffer length is different if (dt.length != (DWORD)length) { free(dt.buffer); #if defined(RASCSI) && !defined(BAREMETAL) @@ -188,7 +190,7 @@ BOOL FASTCALL DiskTrack::Load(const Filepath& path) dt.length = length; } - // 変更マップのメモリを確保 + // Reserve change map memory if (dt.changemap == NULL) { dt.changemap = (BOOL *)malloc(dt.sectors * sizeof(BOOL)); dt.maplen = dt.sectors; @@ -198,17 +200,17 @@ BOOL FASTCALL DiskTrack::Load(const Filepath& path) return FALSE; } - // バッファ長が異なるなら再確保 + // Reallocate if the buffer length is different if (dt.maplen != (DWORD)dt.sectors) { free(dt.changemap); dt.changemap = (BOOL *)malloc(dt.sectors * sizeof(BOOL)); dt.maplen = dt.sectors; } - // 変更マップクリア + // Clear changemap memset(dt.changemap, 0x00, dt.sectors * sizeof(BOOL)); - // ファイルから読み込む + // Read from File #if defined(RASCSI) && !defined(BAREMETAL) if (!fio.OpenDIO(path, Fileio::ReadOnly)) { #else @@ -217,25 +219,25 @@ BOOL FASTCALL DiskTrack::Load(const Filepath& path) return FALSE; } if (dt.raw) { - // 分割読み + // Split Reading for (i = 0; i < dt.sectors; i++) { - // シーク + // Seek if (!fio.Seek(offset)) { fio.Close(); return FALSE; } - // 読み込み + // Read if (!fio.Read(&dt.buffer[i << dt.size], 1 << dt.size)) { fio.Close(); return FALSE; } - // 次のオフセット + // Next offset offset += 0x930; } } else { - // 連続読み + // Continuous reading if (!fio.Seek(offset)) { fio.Close(); return FALSE; @@ -247,7 +249,7 @@ BOOL FASTCALL DiskTrack::Load(const Filepath& path) } fio.Close(); - // フラグを立て、正常終了 + // Set a flag and end normally dt.init = TRUE; dt.changed = FALSE; return TRUE; @@ -255,7 +257,7 @@ BOOL FASTCALL DiskTrack::Load(const Filepath& path) //--------------------------------------------------------------------------- // -// セーブ +// Save // //--------------------------------------------------------------------------- BOOL FASTCALL DiskTrack::Save(const Filepath& path) @@ -269,82 +271,82 @@ BOOL FASTCALL DiskTrack::Save(const Filepath& path) ASSERT(this); - // 初期化されていなければ不要 + // Not needed if not initialized if (!dt.init) { return TRUE; } - // 変更されていなければ不要 + // Not needed unless changed if (!dt.changed) { return TRUE; } - // 書き込む必要がある + // Need to write ASSERT(dt.buffer); ASSERT(dt.changemap); ASSERT((dt.size >= 8) && (dt.size <= 11)); ASSERT((dt.sectors > 0) && (dt.sectors <= 0x100)); - // RAWモードでは書き込みはありえない + // Writing in RAW mode is not allowed ASSERT(!dt.raw); - // オフセットを計算(これ以前のトラックは256セクタ保持とみなす) + // Calculate offset (previous tracks are considered to hold 256 offset = ((off64_t)dt.track << 8); offset <<= dt.size; - // 実イメージまでのオフセットを追加 + // Add offset to real image offset += dt.imgoffset; - // セクタあたりのレングスを計算 + // Calculate length per sector length = 1 << dt.size; - // ファイルオープン + // Open file if (!fio.Open(path, Fileio::ReadWrite)) { return FALSE; } - // 部分書き込みループ + // Partial write loop for (i = 0; i < dt.sectors;) { - // 変更されていれば + // If changed if (dt.changemap[i]) { - // 書き込みサイズ初期化 + // Initialize write size total = 0; - // シーク + // Seek if (!fio.Seek(offset + ((off64_t)i << dt.size))) { fio.Close(); return FALSE; } - // 連続するセクタ長 + // Consectutive sector length for (j = i; j < dt.sectors; j++) { - // 途切れたら終了 + // end when interrupted if (!dt.changemap[j]) { break; } - // 1セクタ分加算 + // Add one sector total += length; } - // 書き込み + // Write if (!fio.Write(&dt.buffer[i << dt.size], total)) { fio.Close(); return FALSE; } - // 未変更のセクタへ + // To unmodified sector i = j; } else { - // 次のセクタ + // Next Sector i++; } } - // クローズ + // Close fio.Close(); - // 変更フラグを落とし、終了 + // Drop the change flag and exit memset(dt.changemap, 0x00, dt.sectors * sizeof(BOOL)); dt.changed = FALSE; return TRUE; @@ -352,7 +354,7 @@ BOOL FASTCALL DiskTrack::Save(const Filepath& path) //--------------------------------------------------------------------------- // -// リードセクタ +// Read Sector // //--------------------------------------------------------------------------- BOOL FASTCALL DiskTrack::Read(BYTE *buf, int sec) const @@ -361,29 +363,29 @@ BOOL FASTCALL DiskTrack::Read(BYTE *buf, int sec) const ASSERT(buf); ASSERT((sec >= 0) & (sec < 0x100)); - // 初期化されていなければエラー + // Error if not initialized if (!dt.init) { return FALSE; } - // セクタが有効数を超えていればエラー + // // Error if the number of sectors exceeds the valid number if (sec >= dt.sectors) { return FALSE; } - // コピー + // Copy ASSERT(dt.buffer); ASSERT((dt.size >= 8) && (dt.size <= 11)); ASSERT((dt.sectors > 0) && (dt.sectors <= 0x100)); memcpy(buf, &dt.buffer[(off64_t)sec << dt.size], (off64_t)1 << dt.size); - // 成功 + // Success return TRUE; } //--------------------------------------------------------------------------- // -// ライトセクタ +// Write Sector // //--------------------------------------------------------------------------- BOOL FASTCALL DiskTrack::Write(const BYTE *buf, int sec) @@ -396,21 +398,21 @@ BOOL FASTCALL DiskTrack::Write(const BYTE *buf, int sec) ASSERT((sec >= 0) & (sec < 0x100)); ASSERT(!dt.raw); - // 初期化されていなければエラー + // Error if not initialized if (!dt.init) { return FALSE; } - // セクタが有効数を超えていればエラー + // // Error if the number of sectors exceeds the valid number if (sec >= dt.sectors) { return FALSE; } - // オフセット、レングスを計算 + // Calculate offset and length offset = sec << dt.size; length = 1 << dt.size; - // 比較 + // Compare ASSERT(dt.buffer); ASSERT((dt.size >= 8) && (dt.size <= 11)); ASSERT((dt.sectors > 0) && (dt.sectors <= 0x100)); @@ -419,24 +421,24 @@ BOOL FASTCALL DiskTrack::Write(const BYTE *buf, int sec) return TRUE; } - // コピー、変更あり + // Copy, change memcpy(&dt.buffer[offset], buf, length); dt.changemap[sec] = TRUE; dt.changed = TRUE; - // 成功 + // Success return TRUE; } //=========================================================================== // -// ディスクキャッシュ +// Disk Cache // //=========================================================================== //--------------------------------------------------------------------------- // -// コンストラクタ +// Constructor // //--------------------------------------------------------------------------- DiskCache::DiskCache( @@ -448,13 +450,13 @@ DiskCache::DiskCache( ASSERT(blocks > 0); ASSERT(imgoff >= 0); - // キャッシュワーク + // Cache work for (i = 0; i < CacheMax; i++) { cache[i].disktrk = NULL; cache[i].serial = 0; } - // その他 + // Other serial = 0; sec_path = path; sec_size = size; @@ -465,18 +467,18 @@ DiskCache::DiskCache( //--------------------------------------------------------------------------- // -// デストラクタ +// Destructor // //--------------------------------------------------------------------------- DiskCache::~DiskCache() { - // トラックをクリア + // Clear the track Clear(); } //--------------------------------------------------------------------------- // -// RAWモード設定 +// RAW Mode Setting // //--------------------------------------------------------------------------- void FASTCALL DiskCache::SetRawMode(BOOL raw) @@ -484,13 +486,13 @@ void FASTCALL DiskCache::SetRawMode(BOOL raw) ASSERT(this); ASSERT(sec_size == 11); - // 設定 + // Configuration cd_raw = raw; } //--------------------------------------------------------------------------- // -// セーブ +// Save // //--------------------------------------------------------------------------- BOOL FASTCALL DiskCache::Save() @@ -499,11 +501,11 @@ BOOL FASTCALL DiskCache::Save() ASSERT(this); - // トラックを保存 + // Save track for (i = 0; i < CacheMax; i++) { - // 有効なトラックか + // Is it a valid track? if (cache[i].disktrk) { - // 保存 + // Save if (!cache[i].disktrk->Save(sec_path)) { return FALSE; } @@ -515,7 +517,7 @@ BOOL FASTCALL DiskCache::Save() //--------------------------------------------------------------------------- // -// ディスクキャッシュ情報取得 +// Get disk cache information // //--------------------------------------------------------------------------- BOOL FASTCALL DiskCache::GetCache(int index, int& track, DWORD& aserial) const @@ -523,12 +525,12 @@ BOOL FASTCALL DiskCache::GetCache(int index, int& track, DWORD& aserial) const ASSERT(this); ASSERT((index >= 0) && (index < CacheMax)); - // 未使用ならFALSE + // FALSE if unused if (!cache[index].disktrk) { return FALSE; } - // トラックとシリアルを設定 + // Set track and serial track = cache[index].disktrk->GetTrack(); aserial = cache[index].serial; @@ -537,7 +539,7 @@ BOOL FASTCALL DiskCache::GetCache(int index, int& track, DWORD& aserial) const //--------------------------------------------------------------------------- // -// クリア +// Clear // //--------------------------------------------------------------------------- void FASTCALL DiskCache::Clear() @@ -546,7 +548,7 @@ void FASTCALL DiskCache::Clear() ASSERT(this); - // キャッシュワークを解放 + // Free the cache for (i = 0; i < CacheMax; i++) { if (cache[i].disktrk) { delete cache[i].disktrk; @@ -557,7 +559,7 @@ void FASTCALL DiskCache::Clear() //--------------------------------------------------------------------------- // -// セクタリード +// Sector Read // //--------------------------------------------------------------------------- BOOL FASTCALL DiskCache::Read(BYTE *buf, int block) @@ -568,25 +570,25 @@ BOOL FASTCALL DiskCache::Read(BYTE *buf, int block) ASSERT(this); ASSERT(sec_size != 0); - // 先に更新 + // Update first Update(); - // トラックを算出(256セクタ/トラックに固定) + // Calculate track (fixed to 256 sectors/track) track = block >> 8; - // そのトラックデータを得る + // Get the track data disktrk = Assign(track); if (!disktrk) { return FALSE; } - // トラックに任せる + // Read the track data to the cache return disktrk->Read(buf, (BYTE)block); } //--------------------------------------------------------------------------- // -// セクタライト +// Sector write // //--------------------------------------------------------------------------- BOOL FASTCALL DiskCache::Write(const BYTE *buf, int block) @@ -597,25 +599,25 @@ BOOL FASTCALL DiskCache::Write(const BYTE *buf, int block) ASSERT(this); ASSERT(sec_size != 0); - // 先に更新 + // Update first Update(); - // トラックを算出(256セクタ/トラックに固定) + // Calculate track (fixed to 256 sectors/track) track = block >> 8; - // そのトラックデータを得る + // Get that track data disktrk = Assign(track); if (!disktrk) { return FALSE; } - // トラックに任せる + // Write the data to the cache return disktrk->Write(buf, (BYTE)block); } //--------------------------------------------------------------------------- // -// トラックの割り当て +// Track Assignment // //--------------------------------------------------------------------------- DiskTrack* FASTCALL DiskCache::Assign(int track) @@ -629,72 +631,72 @@ DiskTrack* FASTCALL DiskCache::Assign(int track) ASSERT(sec_size != 0); ASSERT(track >= 0); - // まず、既に割り当てされていないか調べる + // First, check if it is already assigned for (i = 0; i < CacheMax; i++) { if (cache[i].disktrk) { if (cache[i].disktrk->GetTrack() == track) { - // トラックが一致 + // Track match cache[i].serial = serial; return cache[i].disktrk; } } } - // 次に、空いているものがないか調べる + // Next, check for empty for (i = 0; i < CacheMax; i++) { if (!cache[i].disktrk) { - // ロードを試みる + // Try loading if (Load(i, track)) { - // ロード成功 + // Success loading cache[i].serial = serial; return cache[i].disktrk; } - // ロード失敗 + // Load failed return NULL; } } - // 最後に、シリアル番号の一番若いものを探し、削除する + // Finally, find the youngest serial number and delete it - // インデックス0を候補cとする + // Set index 0 as candidate c s = cache[0].serial; c = 0; - // 候補とシリアルを比較し、より小さいものへ更新する + // Compare candidate with serial and update to smaller one for (i = 0; i < CacheMax; i++) { ASSERT(cache[i].disktrk); - // 既に存在するシリアルと比較、更新 + // Compare and update the existing serial if (cache[i].serial < s) { s = cache[i].serial; c = i; } } - // このトラックを保存 + // Save this track if (!cache[c].disktrk->Save(sec_path)) { return NULL; } - // このトラックを削除 + // Delete this track disktrk = cache[c].disktrk; cache[c].disktrk = NULL; - // ロード + // Load if (Load(c, track, disktrk)) { - // ロード成功 + // Successful loading cache[c].serial = serial; return cache[c].disktrk; } - // ロード失敗 + // Load failed return NULL; } //--------------------------------------------------------------------------- // -// トラックのロード +// Load cache // //--------------------------------------------------------------------------- BOOL FASTCALL DiskCache::Load(int index, int track, DiskTrack *disktrk) @@ -706,29 +708,29 @@ BOOL FASTCALL DiskCache::Load(int index, int track, DiskTrack *disktrk) ASSERT(track >= 0); ASSERT(!cache[index].disktrk); - // このトラックのセクタ数を取得 + // Get the number of sectors on this track sectors = sec_blocks - (track << 8); ASSERT(sectors > 0); if (sectors > 0x100) { sectors = 0x100; } - // ディスクトラックを作成 + // Create a disk track if (disktrk == NULL) { disktrk = new DiskTrack(); } - // ディスクトラックを初期化 + // Initialize disk track disktrk->Init(track, sec_size, sectors, cd_raw, imgoffset); - // ロードを試みる + // Try loading if (!disktrk->Load(sec_path)) { // 失敗 delete disktrk; return FALSE; } - // 割り当て成功、ワークを設定 + // Allocation successful, work set cache[index].disktrk = disktrk; return TRUE; @@ -736,7 +738,7 @@ BOOL FASTCALL DiskCache::Load(int index, int track, DiskTrack *disktrk) //--------------------------------------------------------------------------- // -// シリアル番号の更新 +// Update serial number // //--------------------------------------------------------------------------- void FASTCALL DiskCache::Update() @@ -745,13 +747,13 @@ void FASTCALL DiskCache::Update() ASSERT(this); - // 更新して、0以外は何もしない + // Update and do nothing except 0 serial++; if (serial != 0) { return; } - // 全キャッシュのシリアルをクリア(32bitループしている) + // Clear serial of all caches (loop in 32bit) for (i = 0; i < CacheMax; i++) { cache[i].serial = 0; } @@ -760,18 +762,18 @@ void FASTCALL DiskCache::Update() //=========================================================================== // -// ディスク +// Disk // //=========================================================================== //--------------------------------------------------------------------------- // -// コンストラクタ +// Constructor // //--------------------------------------------------------------------------- Disk::Disk() { - // ワーク初期化 + // Work initialization disk.id = MAKEID('N', 'U', 'L', 'L'); disk.ready = FALSE; disk.writep = FALSE; @@ -787,26 +789,26 @@ Disk::Disk() disk.dcache = NULL; disk.imgoffset = 0; - // その他 + // Other cache_wb = TRUE; } //--------------------------------------------------------------------------- // -// デストラクタ +// Destructor // //--------------------------------------------------------------------------- Disk::~Disk() { - // ディスクキャッシュの保存 + // Save disk cache if (disk.ready) { - // レディの場合のみ + // Only if ready... if (disk.dcache) { disk.dcache->Save(); } } - // ディスクキャッシュの削除 + // Clear disk cache if (disk.dcache) { delete disk.dcache; disk.dcache = NULL; @@ -815,14 +817,14 @@ Disk::~Disk() //--------------------------------------------------------------------------- // -// リセット +// Reset // //--------------------------------------------------------------------------- void FASTCALL Disk::Reset() { ASSERT(this); - // ロックなし、アテンションなし、リセットあり + // no lock, no attention, reset disk.lock = FALSE; disk.attn = FALSE; disk.reset = TRUE; @@ -831,7 +833,7 @@ void FASTCALL Disk::Reset() #ifndef RASCSI //--------------------------------------------------------------------------- // -// セーブ +// Save // //--------------------------------------------------------------------------- BOOL FASTCALL Disk::Save(Fileio *fio, int ver) @@ -842,13 +844,13 @@ BOOL FASTCALL Disk::Save(Fileio *fio, int ver) ASSERT(this); ASSERT(fio); - // サイズをセーブ + // Save size sz = 52; if (!fio->Write(&sz, sizeof(sz))) { return FALSE; } - // 実体をセーブ + // Save entity PROP_EXPORT(fio, disk.id); PROP_EXPORT(fio, disk.ready); PROP_EXPORT(fio, disk.writep); @@ -863,7 +865,7 @@ BOOL FASTCALL Disk::Save(Fileio *fio, int ver) PROP_EXPORT(fio, disk.code); PROP_EXPORT(fio, padding); - // パスをセーブ + // Save the path if (!diskpath.Save(fio, ver)) { return FALSE; } @@ -873,7 +875,7 @@ BOOL FASTCALL Disk::Save(Fileio *fio, int ver) //--------------------------------------------------------------------------- // -// ロード +// Load // //--------------------------------------------------------------------------- BOOL FASTCALL Disk::Load(Fileio *fio, int ver) @@ -886,19 +888,19 @@ BOOL FASTCALL Disk::Load(Fileio *fio, int ver) ASSERT(this); ASSERT(fio); - // version2.03より前は、ディスクはセーブしていない + // Prior to version 2.03, the disk was not saved if (ver <= 0x0202) { return TRUE; } - // 現在のディスクキャッシュを削除 + // Delete the current disk cache if (disk.dcache) { disk.dcache->Save(); delete disk.dcache; disk.dcache = NULL; } - // サイズをロード、照合 + // Load size if (!fio->Read(&sz, sizeof(sz))) { return FALSE; } @@ -906,7 +908,7 @@ BOOL FASTCALL Disk::Load(Fileio *fio, int ver) return FALSE; } - // バッファへロード + // Load into buffer PROP_IMPORT(fio, buf.id); PROP_IMPORT(fio, buf.ready); PROP_IMPORT(fio, buf.writep); @@ -921,23 +923,23 @@ BOOL FASTCALL Disk::Load(Fileio *fio, int ver) PROP_IMPORT(fio, buf.code); PROP_IMPORT(fio, padding); - // パスをロード + // Load path if (!path.Load(fio, ver)) { return FALSE; } - // IDが一致した場合のみ、移動 + // Move only if IDs match if (disk.id == buf.id) { - // NULLなら何もしない + // Do nothing if null if (IsNULL()) { return TRUE; } - // セーブした時と同じ種類のデバイス + // Same type of device as when saving disk.ready = FALSE; if (Open(path)) { - // Open内でディスクキャッシュは作成されている - // プロパティのみ移動 + // Disk cache is created in Open + // move only properties if (!disk.readonly) { disk.writep = buf.writep; } @@ -947,12 +949,12 @@ BOOL FASTCALL Disk::Load(Fileio *fio, int ver) disk.lun = buf.lun; disk.code = buf.code; - // 正常にロードできた + // Loaded successfully return TRUE; } } - // ディスクキャッシュ再作成 + // Disk cache rebuild if (!IsReady()) { disk.dcache = NULL; } else { @@ -965,7 +967,7 @@ BOOL FASTCALL Disk::Load(Fileio *fio, int ver) //--------------------------------------------------------------------------- // -// NULLチェック +// NULL Check // //--------------------------------------------------------------------------- BOOL FASTCALL Disk::IsNULL() const @@ -980,7 +982,7 @@ BOOL FASTCALL Disk::IsNULL() const //--------------------------------------------------------------------------- // -// SASIチェック +// SASI Check // //--------------------------------------------------------------------------- BOOL FASTCALL Disk::IsSASI() const @@ -995,8 +997,8 @@ BOOL FASTCALL Disk::IsSASI() const //--------------------------------------------------------------------------- // -// オープン -// ※派生クラスで、オープン成功後の後処理として呼び出すこと +// Open +// * Call as a post-process after successful opening in a derived class // //--------------------------------------------------------------------------- BOOL FASTCALL Disk::Open(const Filepath& path, BOOL /*attn*/) @@ -1007,68 +1009,68 @@ BOOL FASTCALL Disk::Open(const Filepath& path, BOOL /*attn*/) ASSERT((disk.size >= 8) && (disk.size <= 11)); ASSERT(disk.blocks > 0); - // レディ + // Ready disk.ready = TRUE; - // キャッシュ初期化 + // Cache initialization ASSERT(!disk.dcache); disk.dcache = new DiskCache(path, disk.size, disk.blocks, disk.imgoffset); - // 読み書きオープン可能か + // Can read/write open if (fio.Open(path, Fileio::ReadWrite)) { - // 書き込み許可、リードオンリーでない + // Write permission, not read only disk.writep = FALSE; disk.readonly = FALSE; fio.Close(); } else { - // 書き込み禁止、リードオンリー + // Write protected, read only disk.writep = TRUE; disk.readonly = TRUE; } - // ロックされていない + // Not locked disk.lock = FALSE; - // パス保存 + // Save path diskpath = path; - // 成功 + // Success return TRUE; } //--------------------------------------------------------------------------- // -// イジェクト +// Eject // //--------------------------------------------------------------------------- void FASTCALL Disk::Eject(BOOL force) { ASSERT(this); - // リムーバブルでなければイジェクトできない + // Can only be ejected if it is removable if (!disk.removable) { return; } - // レディでなければイジェクト必要ない + // If you're not ready, you don't need to eject if (!disk.ready) { return; } - // 強制フラグがない場合、ロックされていないことが必要 + // Must be unlocked if there is no force flag if (!force) { if (disk.lock) { return; } } - // ディスクキャッシュを削除 + // Remove disk cache disk.dcache->Save(); delete disk.dcache; disk.dcache = NULL; - // ノットレディ、アテンションなし + // Not ready, no attention disk.ready = FALSE; disk.writep = FALSE; disk.readonly = FALSE; @@ -1077,31 +1079,31 @@ void FASTCALL Disk::Eject(BOOL force) //--------------------------------------------------------------------------- // -// 書き込み禁止 +// Write Protected // //--------------------------------------------------------------------------- void FASTCALL Disk::WriteP(BOOL writep) { ASSERT(this); - // レディであること + // be ready if (!disk.ready) { return; } - // Read Onlyの場合は、プロテクト状態のみ + // Read Only, protect only if (disk.readonly) { ASSERT(disk.writep); return; } - // フラグ設定 + // Write protect flag setting disk.writep = writep; } //--------------------------------------------------------------------------- // -// 内部ワーク取得 +// Get Disk // //--------------------------------------------------------------------------- void FASTCALL Disk::GetDisk(disk_t *buffer) const @@ -1109,13 +1111,13 @@ void FASTCALL Disk::GetDisk(disk_t *buffer) const ASSERT(this); ASSERT(buffer); - // 内部ワークをコピー + // Assign internal buffer *buffer = disk; } //--------------------------------------------------------------------------- // -// パス取得 +// Get Path // //--------------------------------------------------------------------------- void FASTCALL Disk::GetPath(Filepath& path) const @@ -1125,52 +1127,52 @@ void FASTCALL Disk::GetPath(Filepath& path) const //--------------------------------------------------------------------------- // -// フラッシュ +// Flush // //--------------------------------------------------------------------------- BOOL FASTCALL Disk::Flush() { ASSERT(this); - // キャッシュがなければ何もしない + // Do nothing if there's nothing cached if (!disk.dcache) { return TRUE; } - // キャッシュを保存 + // Save cache return disk.dcache->Save(); } //--------------------------------------------------------------------------- // -// レディチェック +// Check Ready // //--------------------------------------------------------------------------- BOOL FASTCALL Disk::CheckReady() { ASSERT(this); - // リセットなら、ステータスを返す + // Not ready if reset if (disk.reset) { disk.code = DISK_DEVRESET; disk.reset = FALSE; return FALSE; } - // アテンションなら、ステータスを返す + // Not ready if it needs attention if (disk.attn) { disk.code = DISK_ATTENTION; disk.attn = FALSE; return FALSE; } - // ノットレディなら、ステータスを返す + // Return status if not ready if (!disk.ready) { disk.code = DISK_NOTREADY; return FALSE; } - // エラーなしに初期化 + // Initialization with no error disk.code = DISK_NOERROR; return TRUE; } @@ -1178,7 +1180,7 @@ BOOL FASTCALL Disk::CheckReady() //--------------------------------------------------------------------------- // // INQUIRY -// ※常時成功する必要がある +// *You need to be successful at all times // //--------------------------------------------------------------------------- int FASTCALL Disk::Inquiry( @@ -1186,7 +1188,7 @@ int FASTCALL Disk::Inquiry( { ASSERT(this); - // デフォルトはINQUIRY失敗 + // default is INQUIRY failure disk.code = DISK_INVALIDCMD; return 0; } @@ -1194,7 +1196,7 @@ int FASTCALL Disk::Inquiry( //--------------------------------------------------------------------------- // // REQUEST SENSE -// ※SASIは別処理 +// *SASI is a separate process // //--------------------------------------------------------------------------- int FASTCALL Disk::RequestSense(const DWORD *cdb, BYTE *buf) @@ -1205,33 +1207,34 @@ int FASTCALL Disk::RequestSense(const DWORD *cdb, BYTE *buf) ASSERT(cdb); ASSERT(buf); - // エラーがない場合に限り、ノットレディをチェック + // Return not ready only if there are no errors if (disk.code == DISK_NOERROR) { if (!disk.ready) { disk.code = DISK_NOTREADY; } } - // サイズ決定(アロケーションレングスに従う) + // Size determination (according to allocation length) size = (int)cdb[4]; ASSERT((size >= 0) && (size < 0x100)); - // SCSI-1では、サイズ0のときに4バイト転送する(SCSI-2ではこの仕様は削除) + // For SCSI-1, transfer 4 bytes when the size is 0 + // (Deleted this specification for SCSI-2) if (size == 0) { size = 4; } - // バッファをクリア + // Clear the buffer memset(buf, 0, size); - // 拡張センスデータを含めた、18バイトを設定 + // Set 18 bytes including extended sense data buf[0] = 0x70; buf[2] = (BYTE)(disk.code >> 16); buf[7] = 10; buf[12] = (BYTE)(disk.code >> 8); buf[13] = (BYTE)disk.code; - // コードをクリア + // Clear the code disk.code = 0x00; return size; @@ -1239,8 +1242,8 @@ int FASTCALL Disk::RequestSense(const DWORD *cdb, BYTE *buf) //--------------------------------------------------------------------------- // -// MODE SELECTチェック -// ※disk.codeの影響を受けない +// MODE SELECT check +// *Not affected by disk.code // //--------------------------------------------------------------------------- int FASTCALL Disk::SelectCheck(const DWORD *cdb) @@ -1250,16 +1253,16 @@ int FASTCALL Disk::SelectCheck(const DWORD *cdb) ASSERT(this); ASSERT(cdb); - // SCSIHDでなくセーブパラメータが設定されていればエラー + // Error if save parameters are set instead of SCSIHD if (disk.id != MAKEID('S', 'C', 'H', 'D')) { - // セーブパラメータが設定されていればエラー + // Error if save parameters are set if (cdb[1] & 0x01) { disk.code = DISK_INVALIDCDB; return 0; } } - // パラメータレングスで指定されたデータを受け取る + // Receive the data specified by the parameter length length = (int)cdb[4]; return length; } @@ -1267,8 +1270,8 @@ int FASTCALL Disk::SelectCheck(const DWORD *cdb) //--------------------------------------------------------------------------- // -// MODE SELECT(10)チェック -// ※disk.codeの影響を受けない +// MODE SELECT(10) check +// * Not affected by disk.code // //--------------------------------------------------------------------------- int FASTCALL Disk::SelectCheck10(const DWORD *cdb) @@ -1278,7 +1281,7 @@ int FASTCALL Disk::SelectCheck10(const DWORD *cdb) ASSERT(this); ASSERT(cdb); - // SCSIHDでなくセーブパラメータが設定されていればエラー + // Error if save parameters are set instead of SCSIHD if (disk.id != MAKEID('S', 'C', 'H', 'D')) { if (cdb[1] & 0x01) { disk.code = DISK_INVALIDCDB; @@ -1286,7 +1289,7 @@ int FASTCALL Disk::SelectCheck10(const DWORD *cdb) } } - // パラメータレングスで指定されたデータを受け取る + // Receive the data specified by the parameter length length = cdb[7]; length <<= 8; length |= cdb[8]; @@ -1300,7 +1303,7 @@ int FASTCALL Disk::SelectCheck10(const DWORD *cdb) //--------------------------------------------------------------------------- // // MODE SELECT -// ※disk.codeの影響を受けない +// * Not affected by disk.code // //--------------------------------------------------------------------------- BOOL FASTCALL Disk::ModeSelect( @@ -1310,7 +1313,7 @@ BOOL FASTCALL Disk::ModeSelect( ASSERT(buf); ASSERT(length >= 0); - // 設定できない + // cannot be set disk.code = DISK_INVALIDPRM; return FALSE; @@ -1319,7 +1322,7 @@ BOOL FASTCALL Disk::ModeSelect( //--------------------------------------------------------------------------- // // MODE SENSE -// ※disk.codeの影響を受けない +// *Not affected by disk.code // //--------------------------------------------------------------------------- int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf) @@ -1336,19 +1339,19 @@ int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf) ASSERT(buf); ASSERT(cdb[0] == 0x1a); - // レングス取得、バッファクリア + // Get length, clear buffer length = (int)cdb[4]; ASSERT((length >= 0) && (length < 0x100)); memset(buf, 0, length); - // 変更可能フラグ取得 + // Get changeable flag if ((cdb[2] & 0xc0) == 0x40) { change = TRUE; } else { change = FALSE; } - // ページコード取得(0x00は最初からvalid) + // Get page code (0x00 is valid from the beginning) page = cdb[2] & 0x3f; if (page == 0x00) { valid = TRUE; @@ -1356,7 +1359,7 @@ int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf) valid = FALSE; } - // 基本情報 + // Basic information size = 4; // MEDIUM TYPE @@ -1369,48 +1372,48 @@ int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf) buf[2] = 0x80; } - // DBDが0なら、ブロックディスクリプタを追加 + // add block descriptor if DBD is 0 if ((cdb[1] & 0x08) == 0) { - // モードパラメータヘッダ + // Mode parameter header buf[3] = 0x08; - // レディの場合に限り + // Only if ready if (disk.ready) { - // ブロックディスクリプタ(ブロック数) + // Block descriptor (number of blocks) buf[5] = (BYTE)(disk.blocks >> 16); buf[6] = (BYTE)(disk.blocks >> 8); buf[7] = (BYTE)disk.blocks; - // ブロックディスクリプタ(ブロックレングス) + // Block descriptor (block length) size = 1 << disk.size; buf[9] = (BYTE)(size >> 16); buf[10] = (BYTE)(size >> 8); buf[11] = (BYTE)size; } - // サイズ再設定 + // size size = 12; } - // ページコード1(read-write error recovery) + // Page code 1(read-write error recovery) if ((page == 0x01) || (page == 0x3f)) { size += AddError(change, &buf[size]); valid = TRUE; } - // ページコード3(format device) + // Page code 3(format device) if ((page == 0x03) || (page == 0x3f)) { size += AddFormat(change, &buf[size]); valid = TRUE; } - // ページコード4(drive parameter) + // Page code 4(drive parameter) if ((page == 0x04) || (page == 0x3f)) { size += AddDrive(change, &buf[size]); valid = TRUE; } - // ページコード6(optical) + // Page code 6(optical) if (disk.id == MAKEID('S', 'C', 'M', 'O')) { if ((page == 0x06) || (page == 0x3f)) { size += AddOpt(change, &buf[size]); @@ -1418,13 +1421,13 @@ int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf) } } - // ページコード8(caching) + // Page code 8(caching) if ((page == 0x08) || (page == 0x3f)) { size += AddCache(change, &buf[size]); valid = TRUE; } - // ページコード13(CD-ROM) + // Page code 13(CD-ROM) if (disk.id == MAKEID('S', 'C', 'C', 'D')) { if ((page == 0x0d) || (page == 0x3f)) { size += AddCDROM(change, &buf[size]); @@ -1432,7 +1435,7 @@ int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf) } } - // ページコード14(CD-DA) + // Page code 14(CD-DA) if (disk.id == MAKEID('S', 'C', 'C', 'D')) { if ((page == 0x0e) || (page == 0x3f)) { size += AddCDDA(change, &buf[size]); @@ -1440,23 +1443,23 @@ int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf) } } - // ページ(ベンダ特殊) + // Page (vendor special) ret = AddVendor(page, change, &buf[size]); if (ret > 0) { size += ret; valid = TRUE; } - // モードデータレングスを最終設定 + // final setting of mode data length buf[0] = (BYTE)(size - 1); - // サポートしていないページか + // Unsupported page if (!valid) { disk.code = DISK_INVALIDCDB; return 0; } - // MODE SENSE成功 + // MODE SENSE success disk.code = DISK_NOERROR; return length; } @@ -1464,7 +1467,7 @@ int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf) //--------------------------------------------------------------------------- // // MODE SENSE(10) -// ※disk.codeの影響を受けない +// *Not affected by disk.code // //--------------------------------------------------------------------------- int FASTCALL Disk::ModeSense10(const DWORD *cdb, BYTE *buf) @@ -1481,7 +1484,7 @@ int FASTCALL Disk::ModeSense10(const DWORD *cdb, BYTE *buf) ASSERT(buf); ASSERT(cdb[0] == 0x5a); - // レングス取得、バッファクリア + // Get length, clear buffer length = cdb[7]; length <<= 8; length |= cdb[8]; @@ -1491,14 +1494,14 @@ int FASTCALL Disk::ModeSense10(const DWORD *cdb, BYTE *buf) ASSERT((length >= 0) && (length < 0x800)); memset(buf, 0, length); - // 変更可能フラグ取得 + // Get changeable flag if ((cdb[2] & 0xc0) == 0x40) { change = TRUE; } else { change = FALSE; } - // ページコード取得(0x00は最初からvalid) + // Get page code (0x00 is valid from the beginning) page = cdb[2] & 0x3f; if (page == 0x00) { valid = TRUE; @@ -1506,54 +1509,54 @@ int FASTCALL Disk::ModeSense10(const DWORD *cdb, BYTE *buf) valid = FALSE; } - // 基本情報 + // Basic Information size = 4; if (disk.writep) { buf[2] = 0x80; } - // DBDが0なら、ブロックディスクリプタを追加 + // add block descriptor if DBD is 0 if ((cdb[1] & 0x08) == 0) { - // モードパラメータヘッダ + // Mode parameter header buf[3] = 0x08; - // レディの場合に限り + // Only if ready if (disk.ready) { - // ブロックディスクリプタ(ブロック数) + // Block descriptor (number of blocks) buf[5] = (BYTE)(disk.blocks >> 16); buf[6] = (BYTE)(disk.blocks >> 8); buf[7] = (BYTE)disk.blocks; - // ブロックディスクリプタ(ブロックレングス) + // Block descriptor (block length) size = 1 << disk.size; buf[9] = (BYTE)(size >> 16); buf[10] = (BYTE)(size >> 8); buf[11] = (BYTE)size; } - // サイズ再設定 + // Size size = 12; } - // ページコード1(read-write error recovery) + // Page code 1(read-write error recovery) if ((page == 0x01) || (page == 0x3f)) { size += AddError(change, &buf[size]); valid = TRUE; } - // ページコード3(format device) + // Page code 3(format device) if ((page == 0x03) || (page == 0x3f)) { size += AddFormat(change, &buf[size]); valid = TRUE; } - // ページコード4(drive parameter) + // Page code 4(drive parameter) if ((page == 0x04) || (page == 0x3f)) { size += AddDrive(change, &buf[size]); valid = TRUE; } - // ページコード6(optical) + // ペPage code 6(optical) if (disk.id == MAKEID('S', 'C', 'M', 'O')) { if ((page == 0x06) || (page == 0x3f)) { size += AddOpt(change, &buf[size]); @@ -1561,13 +1564,13 @@ int FASTCALL Disk::ModeSense10(const DWORD *cdb, BYTE *buf) } } - // ページコード8(caching) + // Page code 8(caching) if ((page == 0x08) || (page == 0x3f)) { size += AddCache(change, &buf[size]); valid = TRUE; } - // ページコード13(CD-ROM) + // Page code 13(CD-ROM) if (disk.id == MAKEID('S', 'C', 'C', 'D')) { if ((page == 0x0d) || (page == 0x3f)) { size += AddCDROM(change, &buf[size]); @@ -1575,7 +1578,7 @@ int FASTCALL Disk::ModeSense10(const DWORD *cdb, BYTE *buf) } } - // ページコード14(CD-DA) + // Page code 14(CD-DA) if (disk.id == MAKEID('S', 'C', 'C', 'D')) { if ((page == 0x0e) || (page == 0x3f)) { size += AddCDDA(change, &buf[size]); @@ -1583,30 +1586,30 @@ int FASTCALL Disk::ModeSense10(const DWORD *cdb, BYTE *buf) } } - // ページ(ベンダ特殊) + // Page (vendor special) ret = AddVendor(page, change, &buf[size]); if (ret > 0) { size += ret; valid = TRUE; } - // モードデータレングスを最終設定 + // final setting of mode data length buf[0] = (BYTE)(size - 1); - // サポートしていないページか + // Unsupported page if (!valid) { disk.code = DISK_INVALIDCDB; return 0; } - // MODE SENSE成功 + // MODE SENSE success disk.code = DISK_NOERROR; return length; } //--------------------------------------------------------------------------- // -// エラーページ追加 +// Add error page // //--------------------------------------------------------------------------- int FASTCALL Disk::AddError(BOOL change, BYTE *buf) @@ -1614,22 +1617,22 @@ int FASTCALL Disk::AddError(BOOL change, BYTE *buf) ASSERT(this); ASSERT(buf); - // コード・レングスを設定 + // Set the message length buf[0] = 0x01; buf[1] = 0x0a; - // 変更可能領域はない + // No changeable area if (change) { return 12; } - // リトライカウントは0、リミットタイムは装置内部のデフォルト値を使用 + // Retry count is 0, limit time uses internal default value return 12; } //--------------------------------------------------------------------------- // -// フォーマットページ追加 +// Add format page // //--------------------------------------------------------------------------- int FASTCALL Disk::AddFormat(BOOL change, BYTE *buf) @@ -1639,11 +1642,12 @@ int FASTCALL Disk::AddFormat(BOOL change, BYTE *buf) ASSERT(this); ASSERT(buf); - // コード・レングスを設定 + // Set the message length buf[0] = 0x80 | 0x03; buf[1] = 0x16; - // 物理セクタのバイト数は変更可能に見せる(実際には変更できないが) + // Show the number of bytes in the physical sector as changeable \ + // (though it cannot be changed in practice) if (change) { buf[0xc] = 0xff; buf[0xd] = 0xff; @@ -1651,20 +1655,20 @@ int FASTCALL Disk::AddFormat(BOOL change, BYTE *buf) } if (disk.ready) { - // 1ゾーンのトラック数を8に設定(TODO) + // Set the number of tracks in one zone to 8 (TODO) buf[0x3] = 0x08; - // セクタ/トラックを25に設定(TODO) + // Set sector/track to 25 (TODO) buf[0xa] = 0x00; buf[0xb] = 0x19; - // 物理セクタのバイト数を設定 + // Set the number of bytes in the physical sector size = 1 << disk.size; buf[0xc] = (BYTE)(size >> 8); buf[0xd] = (BYTE)size; } - // リムーバブル属性を設定 + // Set removable attribute if (disk.removable) { buf[20] = 0x20; } @@ -1674,7 +1678,7 @@ int FASTCALL Disk::AddFormat(BOOL change, BYTE *buf) //--------------------------------------------------------------------------- // -// ドライブページ追加 +// Add drive page // //--------------------------------------------------------------------------- int FASTCALL Disk::AddDrive(BOOL change, BYTE *buf) @@ -1684,17 +1688,18 @@ int FASTCALL Disk::AddDrive(BOOL change, BYTE *buf) ASSERT(this); ASSERT(buf); - // コード・レングスを設定 + // Set the message length buf[0] = 0x04; buf[1] = 0x16; - // 変更可能領域はない + // No changeable area if (change) { return 24; } if (disk.ready) { - // シリンダ数を設定(総ブロック数を25セクタ/トラックと8ヘッドで除算) + // Set the number of cylinders (total number of blocks + // divided by 25 sectors/track and 8 heads) cylinder = disk.blocks; cylinder >>= 3; cylinder /= 25; @@ -1702,7 +1707,7 @@ int FASTCALL Disk::AddDrive(BOOL change, BYTE *buf) buf[0x3] = (BYTE)(cylinder >> 8); buf[0x4] = (BYTE)cylinder; - // ヘッドを8で固定 + // Fix the head at 8 buf[0x5] = 0x8; } @@ -1711,7 +1716,7 @@ int FASTCALL Disk::AddDrive(BOOL change, BYTE *buf) //--------------------------------------------------------------------------- // -// オプティカルページ追加 +// Add option // //--------------------------------------------------------------------------- int FASTCALL Disk::AddOpt(BOOL change, BYTE *buf) @@ -1719,22 +1724,22 @@ int FASTCALL Disk::AddOpt(BOOL change, BYTE *buf) ASSERT(this); ASSERT(buf); - // コード・レングスを設定 + // Set the message length buf[0] = 0x06; buf[1] = 0x02; - // 変更可能領域はない + // No changeable area if (change) { return 4; } - // 更新ブロックのレポートは行わない + // Do not report update blocks return 4; } //--------------------------------------------------------------------------- // -// キャッシュページ追加 +// Add Cache Page // //--------------------------------------------------------------------------- int FASTCALL Disk::AddCache(BOOL change, BYTE *buf) @@ -1742,22 +1747,22 @@ int FASTCALL Disk::AddCache(BOOL change, BYTE *buf) ASSERT(this); ASSERT(buf); - // コード・レングスを設定 + // Set the message length buf[0] = 0x08; buf[1] = 0x0a; - // 変更可能領域はない + // No changeable area if (change) { return 12; } - // 読み込みキャッシュのみ有効、プリフェッチは行わない + // Only read cache is valid, no prefetch return 12; } //--------------------------------------------------------------------------- // -// CD-ROMページ追加 +// Add CDROM Page // //--------------------------------------------------------------------------- int FASTCALL Disk::AddCDROM(BOOL change, BYTE *buf) @@ -1765,19 +1770,19 @@ int FASTCALL Disk::AddCDROM(BOOL change, BYTE *buf) ASSERT(this); ASSERT(buf); - // コード・レングスを設定 + // Set the message length buf[0] = 0x0d; buf[1] = 0x06; - // 変更可能領域はない + // No changeable area if (change) { return 8; } - // インアクティブタイマは2sec + // 2 seconds for inactive timer buf[3] = 0x05; - // MSF倍数はそれぞれ60, 75 + // MSF multiples are 60 and 75 respectively buf[5] = 60; buf[7] = 75; @@ -1794,22 +1799,23 @@ int FASTCALL Disk::AddCDDA(BOOL change, BYTE *buf) ASSERT(this); ASSERT(buf); - // コード・レングスを設定 + // Set the message length buf[0] = 0x0e; buf[1] = 0x0e; - // 変更可能領域はない + // No changeable area if (change) { return 16; } - // オーディオは操作完了を待ち、 複数トラックにまたがるPLAYを許可する + // Audio waits for operation completion and allows + // PLAY across multiple tracks return 16; } //--------------------------------------------------------------------------- // -// Vendor特殊ページ追加 +// Add special vendor page // //--------------------------------------------------------------------------- int FASTCALL Disk::AddVendor(int /*page*/, BOOL /*change*/, BYTE *buf) @@ -1823,7 +1829,7 @@ int FASTCALL Disk::AddVendor(int /*page*/, BOOL /*change*/, BYTE *buf) //--------------------------------------------------------------------------- // // READ DEFECT DATA(10) -// ※disk.codeの影響を受けない +// *Not affected by disk.code // //--------------------------------------------------------------------------- int FASTCALL Disk::ReadDefectData10(const DWORD *cdb, BYTE *buf) @@ -1835,7 +1841,7 @@ int FASTCALL Disk::ReadDefectData10(const DWORD *cdb, BYTE *buf) ASSERT(buf); ASSERT(cdb[0] == 0x37); - // レングス取得、バッファクリア + // Get length, clear buffer length = cdb[7]; length <<= 8; length |= cdb[8]; @@ -1859,14 +1865,14 @@ int FASTCALL Disk::ReadDefectData10(const DWORD *cdb, BYTE *buf) buf[10] = 0xff; buf[11] = 0xff; - // リスト無し + // no list disk.code = DISK_NODEFECT; return 4; } //--------------------------------------------------------------------------- // -// コマンド +// Command // //--------------------------------------------------------------------------- @@ -1879,12 +1885,12 @@ BOOL FASTCALL Disk::TestUnitReady(const DWORD* /*cdb*/) { ASSERT(this); - // 状態チェック + // Status check if (!CheckReady()) { return FALSE; } - // TEST UNIT READY成功 + // TEST UNIT READY Success return TRUE; } @@ -1897,37 +1903,37 @@ BOOL FASTCALL Disk::Rezero(const DWORD* /*cdb*/) { ASSERT(this); - // 状態チェック + // Status check if (!CheckReady()) { return FALSE; } - // REZERO成功 + // REZERO Success return TRUE; } //--------------------------------------------------------------------------- // // FORMAT UNIT -// ※SASIはオペコード$06、SCSIはオペコード$04 +// *Opcode $06 for SASI, Opcode $04 for SCSI // //--------------------------------------------------------------------------- BOOL FASTCALL Disk::Format(const DWORD *cdb) { ASSERT(this); - // 状態チェック + // Status check if (!CheckReady()) { return FALSE; } - // FMTDATA=1はサポートしない(但しDEFECT LISTが無いならOK) + // FMTDATA=1 is not supported (but OK if there is no DEFECT LIST) if ((cdb[1] & 0x10) != 0 && cdb[4] != 0) { disk.code = DISK_INVALIDCDB; return FALSE; } - // FORMAT成功 + // FORMAT Success return TRUE; } @@ -1940,12 +1946,12 @@ BOOL FASTCALL Disk::Reassign(const DWORD* /*cdb*/) { ASSERT(this); - // 状態チェック + // Status check if (!CheckReady()) { return FALSE; } - // REASSIGN BLOCKS成功 + // REASSIGN BLOCKS Success return TRUE; } @@ -1959,53 +1965,53 @@ int FASTCALL Disk::Read(BYTE *buf, DWORD block) ASSERT(this); ASSERT(buf); - // 状態チェック + // Status check if (!CheckReady()) { return 0; } - // トータルブロック数を超えていればエラー + // Error if the total number of blocks is exceeded if (block >= disk.blocks) { disk.code = DISK_INVALIDLBA; return 0; } - // キャッシュに任せる + // leave it to the cache if (!disk.dcache->Read(buf, block)) { disk.code = DISK_READFAULT; return 0; } - // 成功 + // Success return (1 << disk.size); } //--------------------------------------------------------------------------- // -// WRITEチェック +// WRITE check // //--------------------------------------------------------------------------- int FASTCALL Disk::WriteCheck(DWORD block) { ASSERT(this); - // 状態チェック + // Status check if (!CheckReady()) { return 0; } - // トータルブロック数を超えていればエラー + // Error if the total number of blocks is exceeded if (block >= disk.blocks) { return 0; } - // 書き込み禁止ならエラー + // Error if write protected if (disk.writep) { disk.code = DISK_WRITEPROTECT; return 0; } - // 成功 + // Success return (1 << disk.size); } @@ -2019,31 +2025,31 @@ BOOL FASTCALL Disk::Write(const BYTE *buf, DWORD block) ASSERT(this); ASSERT(buf); - // レディでなければエラー + // Error if not ready if (!disk.ready) { disk.code = DISK_NOTREADY; return FALSE; } - // トータルブロック数を超えていればエラー + // Error if the total number of blocks is exceeded if (block >= disk.blocks) { disk.code = DISK_INVALIDLBA; return FALSE; } - // 書き込み禁止ならエラー + // Error if write protected if (disk.writep) { disk.code = DISK_WRITEPROTECT; return FALSE; } - // キャッシュに任せる + // Leave it to the cache if (!disk.dcache->Write(buf, block)) { disk.code = DISK_WRITEFAULT; return FALSE; } - // 成功 + // Success disk.code = DISK_NOERROR; return TRUE; } @@ -2051,19 +2057,19 @@ BOOL FASTCALL Disk::Write(const BYTE *buf, DWORD block) //--------------------------------------------------------------------------- // // SEEK -// ※LBAのチェックは行わない(SASI IOCS) +// *Does not check LBA (SASI IOCS) // //--------------------------------------------------------------------------- BOOL FASTCALL Disk::Seek(const DWORD* /*cdb*/) { ASSERT(this); - // 状態チェック + // Status check if (!CheckReady()) { return FALSE; } - // SEEK成功 + // SEEK Success return TRUE; } @@ -2076,12 +2082,12 @@ BOOL FASTCALL Disk::Assign(const DWORD* /*cdb*/) { ASSERT(this); - // 状態チェック + // Status check if (!CheckReady()) { return FALSE; } - // 成功 + // Success return TRUE; } @@ -2094,12 +2100,12 @@ BOOL FASTCALL Disk::Specify(const DWORD* /*cdb*/) { ASSERT(this); - // 状態チェック + // Status check if (!CheckReady()) { return FALSE; } - // 成功 + // Success return TRUE; } @@ -2114,15 +2120,15 @@ BOOL FASTCALL Disk::StartStop(const DWORD *cdb) ASSERT(cdb); ASSERT(cdb[0] == 0x1b); - // イジェクトビットを見て、必要ならイジェクト + // Look at the eject bit and eject if necessary if (cdb[4] & 0x02) { if (disk.lock) { - // ロックされているので、イジェクトできない + // Cannot be ejected because it is locked disk.code = DISK_PREVENT; return FALSE; } - // イジェクト + // Eject Eject(FALSE); } @@ -2142,19 +2148,19 @@ BOOL FASTCALL Disk::SendDiag(const DWORD *cdb) ASSERT(cdb); ASSERT(cdb[0] == 0x1d); - // PFビットはサポートしない + // Do not support PF bit if (cdb[1] & 0x10) { disk.code = DISK_INVALIDCDB; return FALSE; } - // パラメータリストはサポートしない + // Do not support parameter list if ((cdb[3] != 0) || (cdb[4] != 0)) { disk.code = DISK_INVALIDCDB; return FALSE; } - // 常に成功 + // Always successful disk.code = DISK_NOERROR; return TRUE; } @@ -2170,19 +2176,19 @@ BOOL FASTCALL Disk::Removal(const DWORD *cdb) ASSERT(cdb); ASSERT(cdb[0] == 0x1e); - // 状態チェック + // Status check if (!CheckReady()) { return FALSE; } - // ロックフラグを設定 + // Set Lock flag if (cdb[4] & 0x01) { disk.lock = TRUE; } else { disk.lock = FALSE; } - // REMOVAL成功 + // REMOVAL Success return TRUE; } @@ -2199,15 +2205,15 @@ int FASTCALL Disk::ReadCapacity(const DWORD* /*cdb*/, BYTE *buf) ASSERT(this); ASSERT(buf); - // バッファクリア + // Buffer clear memset(buf, 0, 8); - // 状態チェック + // Status check if (!CheckReady()) { return 0; } - // 論理ブロックアドレスの終端(disk.blocks - 1)を作成 + // Create end of logical block address (disk.blocks-1) ASSERT(disk.blocks > 0); blocks = disk.blocks - 1; buf[0] = (BYTE)(blocks >> 24); @@ -2215,14 +2221,14 @@ int FASTCALL Disk::ReadCapacity(const DWORD* /*cdb*/, BYTE *buf) buf[2] = (BYTE)(blocks >> 8); buf[3] = (BYTE)blocks; - // ブロックレングス(1 << disk.size)を作成 + // Create block length (1 << disk.size) length = 1 << disk.size; buf[4] = (BYTE)(length >> 24); buf[5] = (BYTE)(length >> 16); buf[6] = (BYTE)(length >> 8); buf[7] = (BYTE)length; - // 返送サイズを返す + // return the size return 8; } @@ -2240,7 +2246,7 @@ BOOL FASTCALL Disk::Verify(const DWORD *cdb) ASSERT(cdb); ASSERT(cdb[0] == 0x2f); - // パラメータ取得 + // Get parameters record = cdb[2]; record <<= 8; record |= cdb[3]; @@ -2252,18 +2258,18 @@ BOOL FASTCALL Disk::Verify(const DWORD *cdb) blocks <<= 8; blocks |= cdb[8]; - // 状態チェック + // Status check if (!CheckReady()) { return 0; } - // パラメータチェック + // Parameter check if (disk.blocks < (record + blocks)) { disk.code = DISK_INVALIDLBA; return FALSE; } - // 成功 + // Success return TRUE; } @@ -2279,7 +2285,7 @@ int FASTCALL Disk::ReadToc(const DWORD *cdb, BYTE *buf) ASSERT(cdb[0] == 0x43); ASSERT(buf); - // このコマンドはサポートしない + // This command is not supported disk.code = DISK_INVALIDCMD; return FALSE; } @@ -2295,7 +2301,7 @@ BOOL FASTCALL Disk::PlayAudio(const DWORD *cdb) ASSERT(cdb); ASSERT(cdb[0] == 0x45); - // このコマンドはサポートしない + // This command is not supported disk.code = DISK_INVALIDCMD; return FALSE; } @@ -2311,7 +2317,7 @@ BOOL FASTCALL Disk::PlayAudioMSF(const DWORD *cdb) ASSERT(cdb); ASSERT(cdb[0] == 0x47); - // このコマンドはサポートしない + // This command is not supported disk.code = DISK_INVALIDCMD; return FALSE; } @@ -2327,20 +2333,20 @@ BOOL FASTCALL Disk::PlayAudioTrack(const DWORD *cdb) ASSERT(cdb); ASSERT(cdb[0] == 0x48); - // このコマンドはサポートしない + // This command is not supported disk.code = DISK_INVALIDCMD; return FALSE; } //=========================================================================== // -// SASI ハードディスク +// SASI Hard Disk // //=========================================================================== //--------------------------------------------------------------------------- // -// コンストラクタ +// Constructor // //--------------------------------------------------------------------------- SASIHD::SASIHD() : Disk() @@ -2360,7 +2366,7 @@ void FASTCALL SASIHD::Reset() disk.lock = FALSE; disk.attn = FALSE; - // リセットなし、コードをクリア + // Resetなし、コードをクリア disk.reset = FALSE; disk.code = 0x00; } @@ -2378,12 +2384,12 @@ BOOL FASTCALL SASIHD::Open(const Filepath& path, BOOL /*attn*/) ASSERT(this); ASSERT(!disk.ready); - // 読み込みオープンが必要 + // Open as read-only if (!fio.Open(path, Fileio::ReadOnly)) { return FALSE; } - // ファイルサイズの取得 + // Get file size size = fio.GetFileSize(); fio.Close(); @@ -2395,7 +2401,7 @@ BOOL FASTCALL SASIHD::Open(const Filepath& path, BOOL /*attn*/) disk.size = 10; disk.blocks = (DWORD)(size >> 10); - // 基本クラス + // Call the base class return Disk::Open(path); } #endif // USE_MZ1F23_1024_SUPPORT @@ -2430,7 +2436,7 @@ BOOL FASTCALL SASIHD::Open(const Filepath& path, BOOL /*attn*/) case 0x2793000: break; - // その他(サポートしない) + // Other(サポートしない) default: return FALSE; } @@ -2440,7 +2446,7 @@ BOOL FASTCALL SASIHD::Open(const Filepath& path, BOOL /*attn*/) disk.size = 8; disk.blocks = (DWORD)(size >> 8); - // 基本クラス + // Call the base class return Disk::Open(path); } @@ -2485,34 +2491,34 @@ int FASTCALL SASIHD::RequestSense(const DWORD *cdb, BYTE *buf) //--------------------------------------------------------------------------- // -// コンストラクタ +// Constructor // //--------------------------------------------------------------------------- SCSIHD::SCSIHD() : Disk() { - // SCSI ハードディスク + // SCSI Hard Disk disk.id = MAKEID('S', 'C', 'H', 'D'); } //--------------------------------------------------------------------------- // -// リセット +// Reset // //--------------------------------------------------------------------------- void FASTCALL SCSIHD::Reset() { - // ロック状態解除、アテンション解除 + // Unlock and release attention disk.lock = FALSE; disk.attn = FALSE; - // リセットなし、コードをクリア + // No reset, clear code disk.reset = FALSE; disk.code = 0x00; } //--------------------------------------------------------------------------- // -// オープン +// Open // //--------------------------------------------------------------------------- BOOL FASTCALL SCSIHD::Open(const Filepath& path, BOOL /*attn*/) @@ -2523,35 +2529,35 @@ BOOL FASTCALL SCSIHD::Open(const Filepath& path, BOOL /*attn*/) ASSERT(this); ASSERT(!disk.ready); - // 読み込みオープンが必要 + // read open required if (!fio.Open(path, Fileio::ReadOnly)) { return FALSE; } - // ファイルサイズの取得 + // Get file size size = fio.GetFileSize(); fio.Close(); - // 512バイト単位であること + // Must be 512 bytes if (size & 0x1ff) { return FALSE; } - // 10MB以上 + // 10MB or more if (size < 0x9f5400) { return FALSE; } - // xm6iに準じて2TB - // よく似たものが wxw/wxw_cfg.cpp にもある + // 2TB according to xm6i + // There is a similar one in wxw/wxw_cfg.cpp if (size > 2LL * 1024 * 1024 * 1024 * 1024) { return FALSE; } - // セクタサイズとブロック数 + // sector size and number of blocks disk.size = 9; disk.blocks = (DWORD)(size >> 9); - // 基本クラス + // Call base class return Disk::Open(path); } @@ -2573,38 +2579,38 @@ int FASTCALL SCSIHD::Inquiry( ASSERT(buf); ASSERT(cdb[0] == 0x12); - // EVPDチェック + // EVPD check if (cdb[1] & 0x01) { disk.code = DISK_INVALIDCDB; return 0; } - // レディチェック(イメージファイルがない場合、エラーとする) + // Ready check (Error if no image file) if (!disk.ready) { disk.code = DISK_NOTREADY; return 0; } - // 基本データ + // Basic data // buf[0] ... Direct Access Device - // buf[2] ... SCSI-2準拠のコマンド体系 - // buf[3] ... SCSI-2準拠のInquiryレスポンス - // buf[4] ... Inquiry追加データ + // buf[2] ... SCSI-2 compliant command system + // buf[3] ... SCSI-2 compliant Inquiry response + // buf[4] ... Inquiry additional data memset(buf, 0, 8); - // SCSI-2 本の p.104 4.4.3 不当なロジカルユニットの処理 + // SCSI-2 p.104 4.4.3 Incorrect logical unit handling if (((cdb[1] >> 5) & 0x07) != disk.lun) { buf[0] = 0x7f; } buf[2] = 0x02; buf[3] = 0x02; - buf[4] = 122 + 3; // 実HDDに近い値 + buf[4] = 122 + 3; // Value close to real HDD - // 空白で埋める + // Fill with blanks memset(&buf[8], 0x20, buf[4] - 3); - // ベンダ名/製品名を決定 + // Determine vendor name/product name sprintf(vendor, BENDER_SIGNATURE); size = disk.blocks >> 11; if (size < 300) @@ -2620,26 +2626,26 @@ int FASTCALL SCSIHD::Inquiry( else sprintf(product, "FBSE%d.%dS", size / 1000, (size % 1000) / 100); - // ベンダ名 + // Vendor name memcpy(&buf[8], vendor, strlen(vendor)); - // 製品名 + // Product name memcpy(&buf[16], product, strlen(product)); - // リビジョン + // Revision sprintf(rev, "0%01d%01d%01d", (int)major, (int)(minor >> 4), (int)(minor & 0x0f)); memcpy(&buf[32], rev, 4); - // 返却できるデータのサイズ + // Size of data that can be returned size = (buf[4] + 5); - // 相手のバッファが少なければ制限する + // Limit if the other buffer is small if (size > (int)cdb[4]) { size = (int)cdb[4]; } - // 成功 + // Success disk.code = DISK_NOERROR; return size; } @@ -2647,7 +2653,7 @@ int FASTCALL SCSIHD::Inquiry( //--------------------------------------------------------------------------- // // MODE SELECT -// ※disk.codeの影響を受けない +// *Not affected by disk.code // //--------------------------------------------------------------------------- BOOL FASTCALL SCSIHD::ModeSelect(const DWORD *cdb, const BYTE *buf, int length) @@ -2663,12 +2669,12 @@ BOOL FASTCALL SCSIHD::ModeSelect(const DWORD *cdb, const BYTE *buf, int length) if (cdb[1] & 0x10) { // Mode Parameter header if (length >= 12) { - // ブロックレングスのバイト数をチェック + // Check the block length bytes size = 1 << disk.size; if (buf[9] != (BYTE)(size >> 16) || buf[10] != (BYTE)(size >> 8) || buf[11] != (BYTE)size) { - // 今のところセクタ長の変更は許さない + // currently does not allow changing sector length disk.code = DISK_INVALIDPRM; return FALSE; } @@ -2676,37 +2682,37 @@ BOOL FASTCALL SCSIHD::ModeSelect(const DWORD *cdb, const BYTE *buf, int length) length -= 12; } - // ページの解析 + // Parsing the page while (length > 0) { - // ページの取得 + // Get page page = buf[0]; switch (page) { // format device case 0x03: - // 物理セクタのバイト数をチェック + // check the number of bytes in the physical sector size = 1 << disk.size; if (buf[0xc] != (BYTE)(size >> 8) || buf[0xd] != (BYTE)size) { - // 今のところセクタ長の変更は許さない + // currently does not allow changing sector length disk.code = DISK_INVALIDPRM; return FALSE; } break; - // その他ページ + // Other page default: break; } - // 次のページへ + // Advance to the next page size = buf[1] + 2; length -= size; buf += size; } } - // とりあえずエラーは発生させない(MINIX) + // Do not generate an error for the time being (MINIX) disk.code = DISK_NOERROR; return TRUE; @@ -2714,13 +2720,13 @@ BOOL FASTCALL SCSIHD::ModeSelect(const DWORD *cdb, const BYTE *buf, int length) //=========================================================================== // -// SCSI ハードディスク(PC-9801-55 NEC純正/Anex86/T98Next) +// SCSI hard disk (PC-9801-55 NEC genuine /Anex86/T98Next) // //=========================================================================== //--------------------------------------------------------------------------- // -// コンストラクタ +// Constructor // //--------------------------------------------------------------------------- SCSIHD_NEC::SCSIHD_NEC() : SCSIHD() @@ -2770,12 +2776,12 @@ BOOL FASTCALL SCSIHD_NEC::Open(const Filepath& path, BOOL /*attn*/) ASSERT(this); ASSERT(!disk.ready); - // 読み込みオープンが必要 + // Open as read-only if (!fio.Open(path, Fileio::ReadOnly)) { return FALSE; } - // ファイルサイズの取得 + // Get file size size = fio.GetFileSize(); // ヘッダー読み込み @@ -2854,7 +2860,7 @@ BOOL FASTCALL SCSIHD_NEC::Open(const Filepath& path, BOOL /*attn*/) disk.blocks = (DWORD)(imgsize >> disk.size); disk.imgoffset = imgoffset; - // 基本クラス + // Call the base class return Disk::Open(path); } @@ -2880,7 +2886,7 @@ int FASTCALL SCSIHD_NEC::Inquiry( buf[2] = 0x01; buf[3] = 0x01; - // ベンダー名差し替え + // Replace Vendor name buf[8] = 'N'; buf[9] = 'E'; buf[10] = 'C'; @@ -2898,11 +2904,11 @@ int FASTCALL SCSIHD_NEC::AddError(BOOL change, BYTE *buf) ASSERT(this); ASSERT(buf); - // コード・レングスを設定 + // Set the message length buf[0] = 0x01; buf[1] = 0x06; - // 変更可能領域はない + // No changeable area if (change) { return 8; } @@ -2923,7 +2929,7 @@ int FASTCALL SCSIHD_NEC::AddFormat(BOOL change, BYTE *buf) ASSERT(this); ASSERT(buf); - // コード・レングスを設定 + // Set the message length buf[0] = 0x80 | 0x03; buf[1] = 0x16; @@ -2967,11 +2973,11 @@ int FASTCALL SCSIHD_NEC::AddDrive(BOOL change, BYTE *buf) ASSERT(this); ASSERT(buf); - // コード・レングスを設定 + // Set the message length buf[0] = 0x04; buf[1] = 0x12; - // 変更可能領域はない + // No changeable area if (change) { return 20; } @@ -2991,13 +2997,13 @@ int FASTCALL SCSIHD_NEC::AddDrive(BOOL change, BYTE *buf) //=========================================================================== // -// SCSI ハードディスク(Macintosh Apple純正) +// SCSI hard disk (Macintosh Apple genuine) // //=========================================================================== //--------------------------------------------------------------------------- // -// コンストラクタ +// Constructor // //--------------------------------------------------------------------------- SCSIHD_APPLE::SCSIHD_APPLE() : SCSIHD() @@ -3016,19 +3022,19 @@ int FASTCALL SCSIHD_APPLE::Inquiry( char vendor[32]; char product[32]; - // 基底クラス + // Call the base class size = SCSIHD::Inquiry(cdb, buf, major, minor); - // 基底クラスでエラーなら終了 + // End if there is an error in the base class if (size == 0) { return 0; } - // ベンダ名 + // Vendor name sprintf(vendor, " SEAGATE"); memcpy(&buf[8], vendor, strlen(vendor)); - // 製品名 + // Product name sprintf(product, " ST225N"); memcpy(&buf[16], product, strlen(product)); @@ -3037,7 +3043,7 @@ int FASTCALL SCSIHD_APPLE::Inquiry( //--------------------------------------------------------------------------- // -// Vendor特殊ページ追加 +// Add Vendor special page // //--------------------------------------------------------------------------- int FASTCALL SCSIHD_APPLE::AddVendor(int page, BOOL change, BYTE *buf) @@ -3045,16 +3051,16 @@ int FASTCALL SCSIHD_APPLE::AddVendor(int page, BOOL change, BYTE *buf) ASSERT(this); ASSERT(buf); - // ページコード48 + // Page code 48 if ((page != 0x30) && (page != 0x3f)) { return 0; } - // コード・レングスを設定 + // Set the message length buf[0] = 0x30; buf[1] = 0x1c; - // 変更可能領域はない + // No changeable area if (change) { return 30; } @@ -3067,27 +3073,27 @@ int FASTCALL SCSIHD_APPLE::AddVendor(int page, BOOL change, BYTE *buf) //=========================================================================== // -// SCSI 光磁気ディスク +// SCSI magneto-optical disk // //=========================================================================== //--------------------------------------------------------------------------- // -// コンストラクタ +// Constructor // //--------------------------------------------------------------------------- SCSIMO::SCSIMO() : Disk() { - // SCSI 光磁気ディスク + // SCSI magneto-optical disk disk.id = MAKEID('S', 'C', 'M', 'O'); - // リムーバブル + // Set as removable disk.removable = TRUE; } //--------------------------------------------------------------------------- // -// オープン +// Open // //--------------------------------------------------------------------------- BOOL FASTCALL SCSIMO::Open(const Filepath& path, BOOL attn) @@ -3098,12 +3104,12 @@ BOOL FASTCALL SCSIMO::Open(const Filepath& path, BOOL attn) ASSERT(this); ASSERT(!disk.ready); - // 読み込みオープンが必要 + // Open as read-only if (!fio.Open(path, Fileio::ReadOnly)) { return FALSE; } - // ファイルサイズの取得 + // Get file size size = fio.GetFileSize(); fio.Close(); @@ -3132,15 +3138,15 @@ BOOL FASTCALL SCSIMO::Open(const Filepath& path, BOOL attn) disk.blocks = 310352; break; - // その他(エラー) + // Other (this is an error) default: return FALSE; } - // 基本クラス + // Call the base class Disk::Open(path); - // レディならアテンション + // Attention if ready if (disk.ready && attn) { disk.attn = TRUE; } @@ -3151,7 +3157,7 @@ BOOL FASTCALL SCSIMO::Open(const Filepath& path, BOOL attn) #ifndef RASCSI //--------------------------------------------------------------------------- // -// ロード +// Load // //--------------------------------------------------------------------------- BOOL FASTCALL SCSIMO::Load(Fileio *fio, int ver) @@ -3165,12 +3171,12 @@ BOOL FASTCALL SCSIMO::Load(Fileio *fio, int ver) ASSERT(fio); ASSERT(ver >= 0x0200); - // version2.03より前は、ディスクはセーブしていない + // Prior to version 2.03, the disk was not saved if (ver <= 0x0202) { return TRUE; } - // サイズをロード、照合 + // load size, match if (!fio->Read(&sz, sizeof(sz))) { return FALSE; } @@ -3178,7 +3184,7 @@ BOOL FASTCALL SCSIMO::Load(Fileio *fio, int ver) return FALSE; } - // バッファへロード + // load into buffer PROP_IMPORT(fio, buf.id); PROP_IMPORT(fio, buf.ready); PROP_IMPORT(fio, buf.writep); @@ -3193,27 +3199,27 @@ BOOL FASTCALL SCSIMO::Load(Fileio *fio, int ver) PROP_IMPORT(fio, buf.code); PROP_IMPORT(fio, padding); - // パスをロード + // Load path if (!path.Load(fio, ver)) { return FALSE; } - // 必ずイジェクト + // Always eject Eject(TRUE); - // IDが一致した場合のみ、移動 + // Move only if IDs match if (disk.id != buf.id) { - // セーブ時にMOでなかった。イジェクト状態を維持 + // Not MO at the time of save. Maintain eject status return TRUE; } - // 再オープンを試みる + // Re-try opening if (!Open(path, FALSE)) { - // 再オープンできない。イジェクト状態を維持 + // Cannot reopen. Maintain eject status return TRUE; } - // Open内でディスクキャッシュは作成されている。プロパティのみ移動 + // Disk cache is created in Open. Move property only if (!disk.readonly) { disk.writep = buf.writep; } @@ -3223,7 +3229,7 @@ BOOL FASTCALL SCSIMO::Load(Fileio *fio, int ver) disk.lun = buf.lun; disk.code = buf.code; - // 正常にロードできた + // loaded successfully return TRUE; } #endif // RASCSI @@ -3244,7 +3250,7 @@ int FASTCALL SCSIMO::Inquiry( ASSERT(buf); ASSERT(cdb[0] == 0x12); - // EVPDチェック + // EVPD check if (cdb[1] & 0x01) { disk.code = DISK_INVALIDCDB; return FALSE; @@ -3252,14 +3258,14 @@ int FASTCALL SCSIMO::Inquiry( // 基本データ // buf[0] ... Optical Memory Device - // buf[1] ... リムーバブル - // buf[2] ... SCSI-2準拠のコマンド体系 - // buf[3] ... SCSI-2準拠のInquiryレスポンス - // buf[4] ... Inquiry追加データ + // buf[1] ... Removable + // buf[2] ... SCSI-2 compliant command system + // buf[3] ... SCSI-2 compliant Inquiry response + // buf[4] ... Inquiry additional data memset(buf, 0, 8); buf[0] = 0x07; - // SCSI-2 本の p.104 4.4.3 不当なロジカルユニットの処理 + // SCSI-2 p.104 4.4.3 Incorrect logical unit handling if (((cdb[1] >> 5) & 0x07) != disk.lun) { buf[0] = 0x7f; } @@ -3267,31 +3273,31 @@ int FASTCALL SCSIMO::Inquiry( buf[1] = 0x80; buf[2] = 0x02; buf[3] = 0x02; - buf[4] = 36 - 5; // 必須 + buf[4] = 36 - 5; // required - // 空白で埋める + // Fill with blanks memset(&buf[8], 0x20, buf[4] - 3); - // ベンダ + // Vendor name memcpy(&buf[8], BENDER_SIGNATURE, strlen(BENDER_SIGNATURE)); - // 製品名 + // Product name memcpy(&buf[16], "M2513A", 6); - // リビジョン(XM6のバージョンNo) + // Revision (XM6 version number) sprintf(rev, "0%01d%01d%01d", (int)major, (int)(minor >> 4), (int)(minor & 0x0f)); memcpy(&buf[32], rev, 4); - // 返却できるデータのサイズ + // Size return data size = (buf[4] + 5); - // 相手のバッファが少なければ制限する + // Limit the size if the buffer is too small if (size > (int)cdb[4]) { size = (int)cdb[4]; } - // 成功 + // Success disk.code = DISK_NOERROR; return size; } @@ -3299,7 +3305,7 @@ int FASTCALL SCSIMO::Inquiry( //--------------------------------------------------------------------------- // // MODE SELECT -// ※disk.codeの影響を受けない +// *Not affected by disk.code // //--------------------------------------------------------------------------- BOOL FASTCALL SCSIMO::ModeSelect(const DWORD *cdb, const BYTE *buf, int length) @@ -3315,11 +3321,11 @@ BOOL FASTCALL SCSIMO::ModeSelect(const DWORD *cdb, const BYTE *buf, int length) if (cdb[1] & 0x10) { // Mode Parameter header if (length >= 12) { - // ブロックレングスのバイト数をチェック + // Check the block length (in bytes) size = 1 << disk.size; if (buf[9] != (BYTE)(size >> 16) || buf[10] != (BYTE)(size >> 8) || buf[11] != (BYTE)size) { - // 今のところセクタ長の変更は許さない + // Currently does not allow changing sector length disk.code = DISK_INVALIDPRM; return FALSE; } @@ -3327,19 +3333,19 @@ BOOL FASTCALL SCSIMO::ModeSelect(const DWORD *cdb, const BYTE *buf, int length) length -= 12; } - // ページの解析 + // Parsing the page while (length > 0) { - // ページの取得 + // Get the page page = buf[0]; switch (page) { // format device case 0x03: - // 物理セクタのバイト数をチェック + // Check the number of bytes in the physical sector size = 1 << disk.size; if (buf[0xc] != (BYTE)(size >> 8) || buf[0xd] != (BYTE)size) { - // 今のところセクタ長の変更は許さない + // Currently does not allow changing sector length disk.code = DISK_INVALIDPRM; return FALSE; } @@ -3349,19 +3355,19 @@ BOOL FASTCALL SCSIMO::ModeSelect(const DWORD *cdb, const BYTE *buf, int length) // just ignore, for now break; - // その他ページ + // Other page default: break; } - // 次のページへ + // Advance to the next page size = buf[1] + 2; length -= size; buf += size; } } - // とりあえずエラーは発生させない(MINIX) + // Do not generate an error for the time being (MINIX) disk.code = DISK_NOERROR; return TRUE; @@ -3377,16 +3383,16 @@ int FASTCALL SCSIMO::AddVendor(int page, BOOL change, BYTE *buf) ASSERT(this); ASSERT(buf); - // ページコード20h + // Page code 20h if ((page != 0x20) && (page != 0x3f)) { return 0; } - // コード・レングスを設定 + // Set the message length buf[0] = 0x20; buf[1] = 0x0a; - // 変更可能領域はない + // No changeable area if (change) { return 12; } @@ -3469,26 +3475,26 @@ int FASTCALL SCSIMO::AddVendor(int page, BOOL change, BYTE *buf) //=========================================================================== // -// CDトラック +// CD Track // //=========================================================================== //--------------------------------------------------------------------------- // -// コンストラクタ +// Constructor // //--------------------------------------------------------------------------- CDTrack::CDTrack(SCSICD *scsicd) { ASSERT(scsicd); - // 親となるCD-ROMデバイスを設定 + // Set parent CD-ROM device cdrom = scsicd; - // トラック無効 + // Track defaults to disabled valid = FALSE; - // その他のデータを初期化 + // Initialize other data track_no = -1; first_lba = 0; last_lba = 0; @@ -3498,7 +3504,7 @@ CDTrack::CDTrack(SCSICD *scsicd) //--------------------------------------------------------------------------- // -// デストラクタ +// Destructor // //--------------------------------------------------------------------------- CDTrack::~CDTrack() @@ -3507,7 +3513,7 @@ CDTrack::~CDTrack() //--------------------------------------------------------------------------- // -// 初期化 +// Init // //--------------------------------------------------------------------------- BOOL FASTCALL CDTrack::Init(int track, DWORD first, DWORD last) @@ -3517,11 +3523,11 @@ BOOL FASTCALL CDTrack::Init(int track, DWORD first, DWORD last) ASSERT(track >= 1); ASSERT(first < last); - // トラック番号を設定、有効化 + // Set and enable track number track_no = track; valid = TRUE; - // LBAを記憶 + // Remember LBA first_lba = first; last_lba = last; @@ -3530,7 +3536,7 @@ BOOL FASTCALL CDTrack::Init(int track, DWORD first, DWORD last) //--------------------------------------------------------------------------- // -// パス設定 +// Set Path // //--------------------------------------------------------------------------- void FASTCALL CDTrack::SetPath(BOOL cdda, const Filepath& path) @@ -3538,16 +3544,16 @@ void FASTCALL CDTrack::SetPath(BOOL cdda, const Filepath& path) ASSERT(this); ASSERT(valid); - // CD-DAか、データか + // CD-DA or data audio = cdda; - // パス記憶 + // Remember the path imgpath = path; } //--------------------------------------------------------------------------- // -// パス取得 +// Get Path // //--------------------------------------------------------------------------- void FASTCALL CDTrack::GetPath(Filepath& path) const @@ -3555,13 +3561,13 @@ void FASTCALL CDTrack::GetPath(Filepath& path) const ASSERT(this); ASSERT(valid); - // パスを返す + // Return the path (by reference) path = imgpath; } //--------------------------------------------------------------------------- // -// インデックス追加 +// Add Index // //--------------------------------------------------------------------------- void FASTCALL CDTrack::AddIndex(int index, DWORD lba) @@ -3572,13 +3578,13 @@ void FASTCALL CDTrack::AddIndex(int index, DWORD lba) ASSERT(first_lba <= lba); ASSERT(lba <= last_lba); - // 現在はインデックスはサポートしない + // Currently does not support indexes ASSERT(FALSE); } //--------------------------------------------------------------------------- // -// 開始LBA取得 +// Gets the start of LBA // //--------------------------------------------------------------------------- DWORD FASTCALL CDTrack::GetFirst() const @@ -3592,7 +3598,7 @@ DWORD FASTCALL CDTrack::GetFirst() const //--------------------------------------------------------------------------- // -// 終端LBA取得 +// Get the end of LBA // //--------------------------------------------------------------------------- DWORD FASTCALL CDTrack::GetLast() const @@ -3606,7 +3612,7 @@ DWORD FASTCALL CDTrack::GetLast() const //--------------------------------------------------------------------------- // -// ブロック数取得 +// Get the number of blocks // //--------------------------------------------------------------------------- DWORD FASTCALL CDTrack::GetBlocks() const @@ -3615,13 +3621,13 @@ DWORD FASTCALL CDTrack::GetBlocks() const ASSERT(valid); ASSERT(first_lba < last_lba); - // 開始LBAと最終LBAから算出 + // Calculate from start LBA and end LBA return (DWORD)(last_lba - first_lba + 1); } //--------------------------------------------------------------------------- // -// トラック番号取得 +// Get track number // //--------------------------------------------------------------------------- int FASTCALL CDTrack::GetTrackNo() const @@ -3635,35 +3641,35 @@ int FASTCALL CDTrack::GetTrackNo() const //--------------------------------------------------------------------------- // -// 有効なブロックか +// Is valid block // //--------------------------------------------------------------------------- BOOL FASTCALL CDTrack::IsValid(DWORD lba) const { ASSERT(this); - // トラック自体が無効なら、FALSE + // FALSE if the track itself is invalid if (!valid) { return FALSE; } - // firstより前なら、FALSE + // If the block is BEFORE the first block if (lba < first_lba) { return FALSE; } - // lastより後なら、FALSE + // If the block is AFTER the last block if (last_lba < lba) { return FALSE; } - // このトラック + // This track is valid return TRUE; } //--------------------------------------------------------------------------- // -// オーディオトラックか +// Is audio track // //--------------------------------------------------------------------------- BOOL FASTCALL CDTrack::IsAudio() const @@ -3676,13 +3682,13 @@ BOOL FASTCALL CDTrack::IsAudio() const //=========================================================================== // -// CD-DAバッファ +// CD-DA Buffer // //=========================================================================== //--------------------------------------------------------------------------- // -// コンストラクタ +// Constructor // //--------------------------------------------------------------------------- CDDABuf::CDDABuf() @@ -3691,7 +3697,7 @@ CDDABuf::CDDABuf() //--------------------------------------------------------------------------- // -// デストラクタ +// Destructor // //--------------------------------------------------------------------------- CDDABuf::~CDDABuf() @@ -3706,7 +3712,7 @@ CDDABuf::~CDDABuf() //--------------------------------------------------------------------------- // -// コンストラクタ +// Constructor // //--------------------------------------------------------------------------- SCSICD::SCSICD() : Disk() @@ -3716,17 +3722,17 @@ SCSICD::SCSICD() : Disk() // SCSI CD-ROM disk.id = MAKEID('S', 'C', 'C', 'D'); - // リムーバブル、書込み禁止 + // removable, write protected disk.removable = TRUE; disk.writep = TRUE; - // RAW形式でない + // NOT in raw format rawfile = FALSE; - // フレーム初期化 + // Frame initialization frame = 0; - // トラック初期化 + // Track initialization for (i = 0; i < TrackMax; i++) { track[i] = NULL; } @@ -3737,19 +3743,19 @@ SCSICD::SCSICD() : Disk() //--------------------------------------------------------------------------- // -// デストラクタ +// Destructor // //--------------------------------------------------------------------------- SCSICD::~SCSICD() { - // トラッククリア + // Clear track ClearTrack(); } #ifndef RASCSI //--------------------------------------------------------------------------- // -// ロード +// Load // //--------------------------------------------------------------------------- BOOL FASTCALL SCSICD::Load(Fileio *fio, int ver) @@ -3763,12 +3769,12 @@ BOOL FASTCALL SCSICD::Load(Fileio *fio, int ver) ASSERT(fio); ASSERT(ver >= 0x0200); - // version2.03より前は、ディスクはセーブしていない + // Prior to version 2.03, the disk was not saved if (ver <= 0x0202) { return TRUE; } - // サイズをロード、照合 + // load size, match if (!fio->Read(&sz, sizeof(sz))) { return FALSE; } @@ -3776,7 +3782,7 @@ BOOL FASTCALL SCSICD::Load(Fileio *fio, int ver) return FALSE; } - // バッファへロード + // load into buffer PROP_IMPORT(fio, buf.id); PROP_IMPORT(fio, buf.ready); PROP_IMPORT(fio, buf.writep); @@ -3791,27 +3797,27 @@ BOOL FASTCALL SCSICD::Load(Fileio *fio, int ver) PROP_IMPORT(fio, buf.code); PROP_IMPORT(fio, padding); - // パスをロード + // Load path if (!path.Load(fio, ver)) { return FALSE; } - // 必ずイジェクト + // Always eject Eject(TRUE); - // IDが一致した場合のみ、移動 + // move only if IDs match if (disk.id != buf.id) { - // セーブ時にCD-ROMでなかった。イジェクト状態を維持 + // It was not a CD-ROM when saving. Maintain eject status return TRUE; } - // 再オープンを試みる + // Try to reopen if (!Open(path, FALSE)) { - // 再オープンできない。イジェクト状態を維持 + // Cannot reopen. Maintain eject status return TRUE; } - // Open内でディスクキャッシュは作成されている。プロパティのみ移動 + // Disk cache is created in Open. Move property only if (!disk.readonly) { disk.writep = buf.writep; } @@ -3821,22 +3827,22 @@ BOOL FASTCALL SCSICD::Load(Fileio *fio, int ver) disk.lun = buf.lun; disk.code = buf.code; - // 再度、ディスクキャッシュを破棄 + // Discard the disk cache again if (disk.dcache) { delete disk.dcache; disk.dcache = NULL; } disk.dcache = NULL; - // 暫定 + // Tentative disk.blocks = track[0]->GetBlocks(); if (disk.blocks > 0) { - // ディスクキャッシュを作り直す + // Recreate the disk cache track[0]->GetPath(path); disk.dcache = new DiskCache(path, disk.size, disk.blocks); disk.dcache->SetRawMode(rawfile); - // データインデックスを再設定 + // Reset data index dataindex = 0; } @@ -3846,7 +3852,7 @@ BOOL FASTCALL SCSICD::Load(Fileio *fio, int ver) //--------------------------------------------------------------------------- // -// オープン +// Open // //--------------------------------------------------------------------------- BOOL FASTCALL SCSICD::Open(const Filepath& path, BOOL attn) @@ -3858,67 +3864,67 @@ BOOL FASTCALL SCSICD::Open(const Filepath& path, BOOL attn) ASSERT(this); ASSERT(!disk.ready); - // 初期化、トラッククリア + // Initialization, track clear disk.blocks = 0; rawfile = FALSE; ClearTrack(); - // 読み込みオープンが必要 + // Open as read-only if (!fio.Open(path, Fileio::ReadOnly)) { return FALSE; } - // 物理CDアクセスならクローズして委譲する + // Close and transfer for physical CD access if (path.GetPath()[0] == _T('\\')) { - // クローズ + // Close fio.Close(); - // 物理CDオープン + // Open physical CD if (!OpenPhysical(path)) { return FALSE; } } else { - // サイズ取得 - size = fio.GetFileSize(); + // Get file size + size = fio.GetFileSize(); if (size <= 4) { fio.Close(); return FALSE; } - // CUEシートか、ISOファイルかの判定を行う + // Judge whether it is a CUE sheet or an ISO file fio.Read(file, 4); file[4] = '\0'; fio.Close(); - // FILEで始まっていれば、CUEシートとみなす + // If it starts with FILE, consider it as a CUE sheet if (xstrncasecmp(file, _T("FILE"), 4) == 0) { - // CUEとしてオープン + // Open as CUE if (!OpenCue(path)) { return FALSE; } } else { - // ISOとしてオープン + // Open as ISO if (!OpenIso(path)) { return FALSE; } } } - // オープン成功 + // Successful opening ASSERT(disk.blocks > 0); disk.size = 11; - // 基本クラス + // Call the base class Disk::Open(path); - // RAWフラグを設定 + // Set RAW flag ASSERT(disk.dcache); disk.dcache->SetRawMode(rawfile); - // ROMメディアなので、書き込みはできない + // Since it is a ROM media, writing is not possible disk.writep = TRUE; - // レディならアテンション + // Attention if ready if (disk.ready && attn) { disk.attn = TRUE; } @@ -3928,14 +3934,14 @@ BOOL FASTCALL SCSICD::Open(const Filepath& path, BOOL attn) //--------------------------------------------------------------------------- // -// オープン(CUE) +// Open (CUE) // //--------------------------------------------------------------------------- BOOL FASTCALL SCSICD::OpenCue(const Filepath& /*path*/) { ASSERT(this); - // 常に失敗 + // Always fail return FALSE; } @@ -3953,50 +3959,50 @@ BOOL FASTCALL SCSICD::OpenIso(const Filepath& path) ASSERT(this); - // 読み込みオープンが必要 + // Open as read-only if (!fio.Open(path, Fileio::ReadOnly)) { return FALSE; } - // サイズ取得 + // Get file size size = fio.GetFileSize(); if (size < 0x800) { fio.Close(); return FALSE; } - // 最初の12バイトを読み取って、クローズ + // Read the first 12 bytes and close if (!fio.Read(header, sizeof(header))) { fio.Close(); return FALSE; } - // RAW形式かチェック + // Check if it is RAW format memset(sync, 0xff, sizeof(sync)); sync[0] = 0x00; sync[11] = 0x00; rawfile = FALSE; if (memcmp(header, sync, sizeof(sync)) == 0) { - // 00,FFx10,00なので、RAW形式と推定される + // 00,FFx10,00, so it is presumed to be RAW format if (!fio.Read(header, 4)) { fio.Close(); return FALSE; } - // MODE1/2048またはMODE1/2352のみサポート + // Supports MODE1/2048 or MODE1/2352 only if (header[3] != 0x01) { - // モードが違う + // Different mode fio.Close(); return FALSE; } - // RAWファイルに設定 + // Set to RAW file rawfile = TRUE; } fio.Close(); if (rawfile) { - // サイズが2536の倍数で、700MB以下であること + // Size must be a multiple of 2536 and less than 700MB if (size % 0x930) { return FALSE; } @@ -4004,10 +4010,10 @@ BOOL FASTCALL SCSICD::OpenIso(const Filepath& path) return FALSE; } - // ブロック数を設定 + // Set the number of blocks disk.blocks = (DWORD)(size / 0x930); } else { - // サイズが2048の倍数で、700MB以下であること + // Size must be a multiple of 2048 and less than 700MB if (size & 0x7ff) { return FALSE; } @@ -4015,11 +4021,11 @@ BOOL FASTCALL SCSICD::OpenIso(const Filepath& path) return FALSE; } - // ブロック数を設定 + // Set the number of blocks disk.blocks = (DWORD)(size >> 11); } - // データトラック1つのみ作成 + // Create only one data track ASSERT(!track[0]); track[0] = new CDTrack(this); track[0]->Init(1, 0, disk.blocks - 1); @@ -4027,13 +4033,13 @@ BOOL FASTCALL SCSICD::OpenIso(const Filepath& path) tracks = 1; dataindex = 0; - // オープン成功 + // Successful opening return TRUE; } //--------------------------------------------------------------------------- // -// オープン(Physical) +// Open (Physical) // //--------------------------------------------------------------------------- BOOL FASTCALL SCSICD::OpenPhysical(const Filepath& path) @@ -4043,22 +4049,22 @@ BOOL FASTCALL SCSICD::OpenPhysical(const Filepath& path) ASSERT(this); - // 読み込みオープンが必要 + // Open as read-only if (!fio.Open(path, Fileio::ReadOnly)) { return FALSE; } - // サイズ取得 + // Get size size = fio.GetFileSize(); if (size < 0x800) { fio.Close(); return FALSE; } - // クローズ + // Close fio.Close(); - // サイズが2048の倍数で、700MB以下であること + // Size must be a multiple of 2048 and less than 700MB if (size & 0x7ff) { return FALSE; } @@ -4066,10 +4072,10 @@ BOOL FASTCALL SCSICD::OpenPhysical(const Filepath& path) return FALSE; } - // ブロック数を設定 + // Set the number of blocks disk.blocks = (DWORD)(size >> 11); - // データトラック1つのみ作成 + // Create only one data track ASSERT(!track[0]); track[0] = new CDTrack(this); track[0]->Init(1, 0, disk.blocks - 1); @@ -4077,7 +4083,7 @@ BOOL FASTCALL SCSICD::OpenPhysical(const Filepath& path) tracks = 1; dataindex = 0; - // オープン成功 + // Successful opening return TRUE; } @@ -4097,22 +4103,22 @@ int FASTCALL SCSICD::Inquiry( ASSERT(buf); ASSERT(cdb[0] == 0x12); - // EVPDチェック + // EVPD check if (cdb[1] & 0x01) { disk.code = DISK_INVALIDCDB; return FALSE; } - // 基本データ + // Basic data // buf[0] ... CD-ROM Device - // buf[1] ... リムーバブル - // buf[2] ... SCSI-2準拠のコマンド体系 - // buf[3] ... SCSI-2準拠のInquiryレスポンス - // buf[4] ... Inquiry追加データ + // buf[1] ... Removable + // buf[2] ... SCSI-2 compliant command system + // buf[3] ... SCSI-2 compliant Inquiry response + // buf[4] ... Inquiry additional data memset(buf, 0, 8); buf[0] = 0x05; - // SCSI-2 本の p.104 4.4.3 不当なロジカルユニットの処理 + // SCSI-2 p.104 4.4.3 Incorrect logical unit handling if (((cdb[1] >> 5) & 0x07) != disk.lun) { buf[0] = 0x7f; } @@ -4122,29 +4128,29 @@ int FASTCALL SCSICD::Inquiry( buf[3] = 0x02; buf[4] = 36 - 5; // 必須 - // 空白で埋める + // Fill with blanks memset(&buf[8], 0x20, buf[4] - 3); - // ベンダ + // Vendor name memcpy(&buf[8], BENDER_SIGNATURE, strlen(BENDER_SIGNATURE)); - // 製品名 + // Product name memcpy(&buf[16], "CD-ROM CDU-55S", 14); - // リビジョン(XM6のバージョンNo) + // Revision (XM6 version number) sprintf(rev, "0%01d%01d%01d", (int)major, (int)(minor >> 4), (int)(minor & 0x0f)); memcpy(&buf[32], rev, 4); - // 返却できるデータのサイズ + // Size of data that can be returned size = (buf[4] + 5); - // 相手のバッファが少なければ制限する + // Limit if the other buffer is small if (size > (int)cdb[4]) { size = (int)cdb[4]; } - // 成功 + // Success disk.code = DISK_NOERROR; return size; } @@ -4162,41 +4168,41 @@ int FASTCALL SCSICD::Read(BYTE *buf, DWORD block) ASSERT(this); ASSERT(buf); - // 状態チェック + // Status check if (!CheckReady()) { return 0; } - // トラック検索 + // Search for the track index = SearchTrack(block); - // 無効なら、範囲外 + // if invalid, out of range if (index < 0) { disk.code = DISK_INVALIDLBA; return 0; } ASSERT(track[index]); - // 現在のデータトラックと異なっていれば + // If different from the current data track if (dataindex != index) { - // 現在のディスクキャッシュを削除(Saveの必要はない) + // Delete current disk cache (no need to save) delete disk.dcache; disk.dcache = NULL; - // ブロック数を再設定 + // Reset the number of blocks disk.blocks = track[index]->GetBlocks(); ASSERT(disk.blocks > 0); - // ディスクキャッシュを作り直す + // Recreate the disk cache track[index]->GetPath(path); disk.dcache = new DiskCache(path, disk.size, disk.blocks); disk.dcache->SetRawMode(rawfile); - // データインデックスを再設定 + // Reset data index dataindex = index; } - // 基本クラス + // Base class ASSERT(dataindex >= 0); return Disk::Read(buf, block); } @@ -4221,41 +4227,41 @@ int FASTCALL SCSICD::ReadToc(const DWORD *cdb, BYTE *buf) ASSERT(cdb[0] == 0x43); ASSERT(buf); - // レディチェック + // Check if ready if (!CheckReady()) { return 0; } - // レディであるなら、トラックが最低1つ以上存在する + // If ready, there is at least one track ASSERT(tracks > 0); ASSERT(track[0]); - // アロケーションレングス取得、バッファクリア + // Get allocation length, clear buffer length = cdb[7] << 8; length |= cdb[8]; memset(buf, 0, length); - // MSFフラグ取得 + // Get MSF Flag if (cdb[1] & 0x02) { msf = TRUE; } else { msf = FALSE; } - // 最終トラック番号を取得、チェック + // Get and check the last track number last = track[tracks - 1]->GetTrackNo(); if ((int)cdb[6] > last) { - // ただしAAは除外 + // Except for AA if (cdb[6] != 0xaa) { disk.code = DISK_INVALIDCDB; return 0; } } - // 開始インデックスをチェック + // Check start index index = 0; if (cdb[6] != 0x00) { - // トラック番号が一致するまで、トラックを進める + // Advance the track until the track numbers match while (track[index]) { if ((int)cdb[6] == track[index]->GetTrackNo()) { break; @@ -4263,10 +4269,10 @@ int FASTCALL SCSICD::ReadToc(const DWORD *cdb, BYTE *buf) index++; } - // 見つからなければAAか、内部エラー + // AA if not found or internal error if (!track[index]) { if (cdb[6] == 0xaa) { - // AAなので、最終LBA+1を返す + // Returns the final LBA+1 because it is AA buf[0] = 0x00; buf[1] = 0x0a; buf[2] = (BYTE)track[0]->GetTrackNo(); @@ -4282,38 +4288,38 @@ int FASTCALL SCSICD::ReadToc(const DWORD *cdb, BYTE *buf) return length; } - // それ以外はエラー + // Otherwise, error disk.code = DISK_INVALIDCDB; return 0; } } - // 今回返すトラックディスクリプタの個数(ループ数) + // Number of track descriptors returned this time (number of loops) loop = last - track[index]->GetTrackNo() + 1; ASSERT(loop >= 1); - // ヘッダ作成 + // Create header buf[0] = (BYTE)(((loop << 3) + 2) >> 8); buf[1] = (BYTE)((loop << 3) + 2); buf[2] = (BYTE)track[0]->GetTrackNo(); buf[3] = (BYTE)last; buf += 4; - // ループ + // Loop.... for (i = 0; i < loop; i++) { - // ADRとControl + // ADR and Control if (track[index]->IsAudio()) { - // オーディオトラック + // audio track buf[1] = 0x10; } else { - // データトラック + // data track buf[1] = 0x14; } - // トラック番号 + // track number buf[2] = (BYTE)track[index]->GetTrackNo(); - // トラックアドレス + // track address if (msf) { LBAtoMSF(track[index]->GetFirst(), &buf[4]); } else { @@ -4321,12 +4327,12 @@ int FASTCALL SCSICD::ReadToc(const DWORD *cdb, BYTE *buf) buf[7] = (BYTE)(track[index]->GetFirst()); } - // バッファとインデックスを進める + // Advance buffer pointer and index buf += 8; index++; } - // アロケーションレングスだけ必ず返す + // Always return only the allocation length return length; } @@ -4371,7 +4377,7 @@ BOOL FASTCALL SCSICD::PlayAudioTrack(const DWORD* /*cdb*/) //--------------------------------------------------------------------------- // -// LBA→MSF変換 +// LBA→MSF Conversion // //--------------------------------------------------------------------------- void FASTCALL SCSICD::LBAtoMSF(DWORD lba, BYTE *msf) const @@ -4382,20 +4388,20 @@ void FASTCALL SCSICD::LBAtoMSF(DWORD lba, BYTE *msf) const ASSERT(this); - // 75、75*60でそれぞれ余りを出す + // 75 and 75*60 get the remainder m = lba / (75 * 60); s = lba % (75 * 60); f = s % 75; s /= 75; - // 基点はM=0,S=2,F=0 + // The base point is M=0, S=2, F=0 s += 2; if (s >= 60) { s -= 60; m++; } - // 格納 + // Store ASSERT(m < 0x100); ASSERT(s < 60); ASSERT(f < 75); @@ -4407,7 +4413,7 @@ void FASTCALL SCSICD::LBAtoMSF(DWORD lba, BYTE *msf) const //--------------------------------------------------------------------------- // -// MSF→LBA変換 +// MSF→LBA Conversion // //--------------------------------------------------------------------------- DWORD FASTCALL SCSICD::MSFtoLBA(const BYTE *msf) const @@ -4418,14 +4424,14 @@ DWORD FASTCALL SCSICD::MSFtoLBA(const BYTE *msf) const ASSERT(msf[2] < 60); ASSERT(msf[3] < 75); - // 1, 75, 75*60の倍数で合算 + // 1, 75, add up in multiples of 75*60 lba = msf[1]; lba *= 60; lba += msf[2]; lba *= 75; lba += msf[3]; - // 基点はM=0,S=2,F=0なので、150を引く + // Since the base point is M=0, S=2, F=0, subtract 150 lba -= 150; return lba; @@ -4433,7 +4439,7 @@ DWORD FASTCALL SCSICD::MSFtoLBA(const BYTE *msf) const //--------------------------------------------------------------------------- // -// トラッククリア +// Clear Track // //--------------------------------------------------------------------------- void FASTCALL SCSICD::ClearTrack() @@ -4442,7 +4448,7 @@ void FASTCALL SCSICD::ClearTrack() ASSERT(this); - // トラックオブジェクトを削除 + // delete the track object for (i = 0; i < TrackMax; i++) { if (track[i]) { delete track[i]; @@ -4450,18 +4456,18 @@ void FASTCALL SCSICD::ClearTrack() } } - // トラック数0 + // Number of tracks is 0 tracks = 0; - // データ、オーディオとも設定なし + // No settings for data and audio dataindex = -1; audioindex = -1; } //--------------------------------------------------------------------------- // -// トラック検索 -// ※見つからなければ-1を返す +// Track Search +// * Returns -1 if not found // //--------------------------------------------------------------------------- int FASTCALL SCSICD::SearchTrack(DWORD lba) const @@ -4470,22 +4476,22 @@ int FASTCALL SCSICD::SearchTrack(DWORD lba) const ASSERT(this); - // トラックループ + // Track loop for (i = 0; i < tracks; i++) { - // トラックに聞く + // Listen to the track ASSERT(track[i]); if (track[i]->IsValid(lba)) { return i; } } - // 見つからなかった + // Track wasn't found return -1; } //--------------------------------------------------------------------------- // -// フレーム通知 +// Next Frame // //--------------------------------------------------------------------------- BOOL FASTCALL SCSICD::NextFrame() @@ -4493,10 +4499,10 @@ BOOL FASTCALL SCSICD::NextFrame() ASSERT(this); ASSERT((frame >= 0) && (frame < 75)); - // フレームを0~74の範囲で設定 + // set the frame in the range 0-74 frame = (frame + 1) % 75; - // 1周したらFALSE + // FALSE after one lap if (frame != 0) { return TRUE; } else { @@ -4506,7 +4512,7 @@ BOOL FASTCALL SCSICD::NextFrame() //--------------------------------------------------------------------------- // -// CD-DAバッファ取得 +// Get CD-DA buffer // //--------------------------------------------------------------------------- void FASTCALL SCSICD::GetBuf( @@ -4517,57 +4523,57 @@ void FASTCALL SCSICD::GetBuf( //=========================================================================== // -// SCSI ホストブリッジ +// SCSI Host Bridge // //=========================================================================== //--------------------------------------------------------------------------- // -// コンストラクタ +// Constructor // //--------------------------------------------------------------------------- SCSIBR::SCSIBR() : Disk() { - // ホストブリッジ + // Host Bridge disk.id = MAKEID('S', 'C', 'B', 'R'); #if defined(RASCSI) && !defined(BAREMETAL) - // TAPドライバ生成 + // TAP Driver Generation tap = new CTapDriver(); m_bTapEnable = tap->Init(); - // MACアドレスを生成 + // Generate MAC Address memset(mac_addr, 0x00, 6); if (m_bTapEnable) { tap->GetMacAddr(mac_addr); mac_addr[5]++; } - // パケット受信フラグオフ + // Packet reception flag OFF packet_enable = FALSE; #endif // RASCSI && !BAREMETAL - // ホストファイルシステム生成 + // Create host file system fs = new CFileSys(); fs->Reset(); } //--------------------------------------------------------------------------- // -// デストラクタ +// Destructor // //--------------------------------------------------------------------------- SCSIBR::~SCSIBR() { #if defined(RASCSI) && !defined(BAREMETAL) - // TAPドライバ解放 + // TAP driver release if (tap) { tap->Cleanup(); delete tap; } #endif // RASCSI && !BAREMETAL - // ホストファイルシステム解放 + // Release host file system if (fs) { fs->Reset(); delete fs; @@ -4590,65 +4596,65 @@ int FASTCALL SCSIBR::Inquiry( ASSERT(buf); ASSERT(cdb[0] == 0x12); - // EVPDチェック + // EVPD check if (cdb[1] & 0x01) { disk.code = DISK_INVALIDCDB; return FALSE; } - // 基本データ + // Basic data // buf[0] ... Communication Device - // buf[2] ... SCSI-2準拠のコマンド体系 - // buf[3] ... SCSI-2準拠のInquiryレスポンス - // buf[4] ... Inquiry追加データ + // buf[2] ... SCSI-2 compliant command system + // buf[3] ... SCSI-2 compliant Inquiry response + // buf[4] ... Inquiry additional data memset(buf, 0, 8); buf[0] = 0x09; - // SCSI-2 本の p.104 4.4.3 不当なロジカルユニットの処理 + // SCSI-2 p.104 4.4.3 Incorrect logical unit handling if (((cdb[1] >> 5) & 0x07) != disk.lun) { buf[0] = 0x7f; } buf[2] = 0x02; buf[3] = 0x02; - buf[4] = 36 - 5 + 8; // 必須 + 8バイト拡張 + buf[4] = 36 - 5 + 8; // required + 8 byte extension - // 空白で埋める + // Fill with blanks memset(&buf[8], 0x20, buf[4] - 3); - // ベンダ + // Vendor name memcpy(&buf[8], BENDER_SIGNATURE, strlen(BENDER_SIGNATURE)); - // 製品名 + // Product name memcpy(&buf[16], "RASCSI BRIDGE", 13); - // リビジョン(XM6のバージョンNo) + // Revision (XM6 version number) sprintf(rev, "0%01d%01d%01d", (int)major, (int)(minor >> 4), (int)(minor & 0x0f)); memcpy(&buf[32], rev, 4); - // オプション機能有効フラグ + // Optional function valid flag buf[36] = '0'; #if defined(RASCSI) && !defined(BAREMETAL) - // TAP有効 + // TAP Enable if (m_bTapEnable) { buf[37] = '1'; } #endif // RASCSI && !BAREMETAL - // CFileSys有効 + // CFileSys Enable buf[38] = '1'; - // 返却できるデータのサイズ + // Size of data that can be returned size = (buf[4] + 5); - // 相手のバッファが少なければ制限する + // Limit if the other buffer is small if (size > (int)cdb[4]) { size = (int)cdb[4]; } - // 成功 + // Success disk.code = DISK_NOERROR; return size; } @@ -4662,7 +4668,7 @@ BOOL FASTCALL SCSIBR::TestUnitReady(const DWORD* /*cdb*/) { ASSERT(this); - // TEST UNIT READY成功 + // TEST UNIT READY Success disk.code = DISK_NOERROR; return TRUE; } @@ -4684,52 +4690,52 @@ int FASTCALL SCSIBR::GetMessage10(const DWORD *cdb, BYTE *buf) ASSERT(this); - // タイプ + // Type type = cdb[2]; #if defined(RASCSI) && !defined(BAREMETAL) - // 機能番号 + // Function number func = cdb[3]; #endif // RASCSI && !BAREMETAL - // フェーズ + // Phase phase = cdb[9]; switch (type) { #if defined(RASCSI) && !defined(BAREMETAL) - case 1: // イーサネット - // TAP無効なら処理しない + case 1: // Ethernet + // Do not process if TAP is invalid if (!m_bTapEnable) { return 0; } switch (func) { - case 0: // MACアドレス取得 + case 0: // Get MAC address return GetMacAddr(buf); - case 1: // 受信パケット取得(サイズ/バッファ別) + case 1: // Received packet acquisition (size/buffer) if (phase == 0) { - // パケットサイズ取得 + // Get packet size ReceivePacket(); buf[0] = (BYTE)(packet_len >> 8); buf[1] = (BYTE)packet_len; return 2; } else { - // パケットデータ取得 + // Get package data GetPacketBuf(buf); return packet_len; } - case 2: // 受信パケット取得(サイズ+バッファ同時) + case 2: // Received packet acquisition (size + buffer simultaneously) ReceivePacket(); buf[0] = (BYTE)(packet_len >> 8); buf[1] = (BYTE)packet_len; GetPacketBuf(&buf[2]); return packet_len + 2; - case 3: // 複数パケット同時取得(サイズ+バッファ同時) - // パケット数の上限は現状10個に決め打ち - // これ以上増やしてもあまり速くならない? + case 3: // Simultaneous acquisition of multiple packets (size + buffer simultaneously) + // Currently the maximum number of packets is 10 + // Isn't it too fast if I increase more? total_len = 0; for (i = 0; i < 10; i++) { ReceivePacket(); @@ -4747,21 +4753,21 @@ int FASTCALL SCSIBR::GetMessage10(const DWORD *cdb, BYTE *buf) break; #endif // RASCSI && !BAREMETAL - case 2: // ホストドライブ + case 2: // Host Drive switch (phase) { - case 0: // 結果コード取得 + case 0: // Get result code return ReadFsResult(buf); - case 1: // 返却データ取得 + case 1: // Return data acquisition return ReadFsOut(buf); - case 2: // 返却追加データ取得 + case 2: // Return additional data acquisition return ReadFsOpt(buf); } break; } - // エラー + // Error ASSERT(FALSE); return 0; } @@ -4782,16 +4788,16 @@ BOOL FASTCALL SCSIBR::SendMessage10(const DWORD *cdb, BYTE *buf) ASSERT(cdb); ASSERT(buf); - // タイプ + // Type type = cdb[2]; - // 機能番号 + // Function number func = cdb[3]; - // フェーズ + // Phase phase = cdb[9]; - // ライト数を取得 + // Get the number of lights len = cdb[6]; len <<= 8; len |= cdb[7]; @@ -4800,38 +4806,38 @@ BOOL FASTCALL SCSIBR::SendMessage10(const DWORD *cdb, BYTE *buf) switch (type) { #if defined(RASCSI) && !defined(BAREMETAL) - case 1: // イーサネット - // TAP無効なら処理しない + case 1: // Ethernet + // Do not process if TAP is invalid if (!m_bTapEnable) { return FALSE; } switch (func) { - case 0: // MACアドレス設定 + case 0: // MAC address setting SetMacAddr(buf); return TRUE; - case 1: // パケット送信 + case 1: // Send packet SendPacket(buf, len); return TRUE; } break; #endif // RASCSI && !BAREMETAL - case 2: // ホストドライブ + case 2: // Host drive switch (phase) { - case 0: // コマンド発行 + case 0: // issue command WriteFs(func, buf); return TRUE; - case 1: // 追加データ書き込み + case 1: // additional data writing WriteFsOpt(buf, len); return TRUE; } break; } - // エラー + // Error ASSERT(FALSE); return FALSE; } @@ -4839,7 +4845,7 @@ BOOL FASTCALL SCSIBR::SendMessage10(const DWORD *cdb, BYTE *buf) #if defined(RASCSI) && !defined(BAREMETAL) //--------------------------------------------------------------------------- // -// MACアドレス取得 +// Get MAC Address // //--------------------------------------------------------------------------- int FASTCALL SCSIBR::GetMacAddr(BYTE *mac) @@ -4853,7 +4859,7 @@ int FASTCALL SCSIBR::GetMacAddr(BYTE *mac) //--------------------------------------------------------------------------- // -// MACアドレス設定 +// Set MAC Address // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::SetMacAddr(BYTE *mac) @@ -4866,7 +4872,7 @@ void FASTCALL SCSIBR::SetMacAddr(BYTE *mac) //--------------------------------------------------------------------------- // -// パケット受信 +// Receive Packet // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::ReceivePacket() @@ -4876,15 +4882,15 @@ void FASTCALL SCSIBR::ReceivePacket() ASSERT(this); ASSERT(tap); - // 前のパケットが受信されていない + // previous packet has not been received if (packet_enable) { return; } - // パケット受信 + // Receive packet packet_len = tap->Rx(packet_buf); - // 受信パケットか検査 + // Check if received packet if (memcmp(packet_buf, mac_addr, 6) != 0) { if (memcmp(packet_buf, bcast_addr, 6) != 0) { packet_len = 0; @@ -4892,13 +4898,13 @@ void FASTCALL SCSIBR::ReceivePacket() } } - // バッファサイズを越えたら捨てる + // Discard if it exceeds the buffer size if (packet_len > 2048) { packet_len = 0; return; } - // 受信バッファに格納 + // Store in receive buffer if (packet_len > 0) { packet_enable = TRUE; } @@ -4906,7 +4912,7 @@ void FASTCALL SCSIBR::ReceivePacket() //--------------------------------------------------------------------------- // -// パケット取得 +// Get Packet // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::GetPacketBuf(BYTE *buf) @@ -4917,22 +4923,22 @@ void FASTCALL SCSIBR::GetPacketBuf(BYTE *buf) ASSERT(tap); ASSERT(buf); - // サイズ制限 + // Size limit len = packet_len; if (len > 2048) { len = 2048; } - // コピー + // Copy memcpy(buf, packet_buf, len); - // 受信済み + // Received packet_enable = FALSE; } //--------------------------------------------------------------------------- // -// パケット送信 +// Send Packet // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::SendPacket(BYTE *buf, int len) @@ -4947,7 +4953,7 @@ void FASTCALL SCSIBR::SendPacket(BYTE *buf, int len) //--------------------------------------------------------------------------- // -// $40 - デバイス起動 +// $40 - Device Boot // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_InitDevice(BYTE *buf) @@ -4962,7 +4968,7 @@ void FASTCALL SCSIBR::FS_InitDevice(BYTE *buf) //--------------------------------------------------------------------------- // -// $41 - ディレクトリチェック +// $41 - Directory Check // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_CheckDir(BYTE *buf) @@ -4989,7 +4995,7 @@ void FASTCALL SCSIBR::FS_CheckDir(BYTE *buf) //--------------------------------------------------------------------------- // -// $42 - ディレクトリ作成 +// $42 - Create Directory // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_MakeDir(BYTE *buf) @@ -5016,7 +5022,7 @@ void FASTCALL SCSIBR::FS_MakeDir(BYTE *buf) //--------------------------------------------------------------------------- // -// $43 - ディレクトリ削除 +// $43 - Remove Directory // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_RemoveDir(BYTE *buf) @@ -5043,7 +5049,7 @@ void FASTCALL SCSIBR::FS_RemoveDir(BYTE *buf) //--------------------------------------------------------------------------- // -// $44 - ファイル名変更 +// $44 - Rename // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_Rename(BYTE *buf) @@ -5074,7 +5080,7 @@ void FASTCALL SCSIBR::FS_Rename(BYTE *buf) //--------------------------------------------------------------------------- // -// $45 - ファイル削除 +// $45 - Delete File // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_Delete(BYTE *buf) @@ -5101,7 +5107,7 @@ void FASTCALL SCSIBR::FS_Delete(BYTE *buf) //--------------------------------------------------------------------------- // -// $46 - ファイル属性取得/設定 +// $46 - Get / Set file attributes // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_Attribute(BYTE *buf) @@ -5133,7 +5139,7 @@ void FASTCALL SCSIBR::FS_Attribute(BYTE *buf) //--------------------------------------------------------------------------- // -// $47 - ファイル検索 +// $47 - File Search // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_Files(BYTE *buf) @@ -5187,7 +5193,7 @@ void FASTCALL SCSIBR::FS_Files(BYTE *buf) //--------------------------------------------------------------------------- // -// $48 - ファイル次検索 +// $48 - File next search // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_NFiles(BYTE *buf) @@ -5237,7 +5243,7 @@ void FASTCALL SCSIBR::FS_NFiles(BYTE *buf) //--------------------------------------------------------------------------- // -// $49 - ファイル作成 +// $49 - File Creation // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_Create(BYTE *buf) @@ -5302,7 +5308,7 @@ void FASTCALL SCSIBR::FS_Create(BYTE *buf) //--------------------------------------------------------------------------- // -// $4A - ファイルオープン +// $4A - Open File // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_Open(BYTE *buf) @@ -5356,7 +5362,7 @@ void FASTCALL SCSIBR::FS_Open(BYTE *buf) //--------------------------------------------------------------------------- // -// $4B - ファイルクローズ +// $4B - Close File // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_Close(BYTE *buf) @@ -5406,7 +5412,7 @@ void FASTCALL SCSIBR::FS_Close(BYTE *buf) //--------------------------------------------------------------------------- // -// $4C - ファイル読み込み +// $4C - Read File // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_Read(BYTE *buf) @@ -5458,7 +5464,7 @@ void FASTCALL SCSIBR::FS_Read(BYTE *buf) //--------------------------------------------------------------------------- // -// $4D - ファイル書き込み +// $4D - Write file // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_Write(BYTE *buf) @@ -5508,7 +5514,7 @@ void FASTCALL SCSIBR::FS_Write(BYTE *buf) //--------------------------------------------------------------------------- // -// $4E - ファイルシーク +// $4E - Seek file // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_Seek(BYTE *buf) @@ -5564,7 +5570,7 @@ void FASTCALL SCSIBR::FS_Seek(BYTE *buf) //--------------------------------------------------------------------------- // -// $4F - ファイル時刻取得/設定 +// $4F - File Timestamp Get / Set // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_TimeStamp(BYTE *buf) @@ -5619,7 +5625,7 @@ void FASTCALL SCSIBR::FS_TimeStamp(BYTE *buf) //--------------------------------------------------------------------------- // -// $50 - 容量取得 +// $50 - Get Capacity // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_GetCapacity(BYTE *buf) @@ -5651,7 +5657,7 @@ void FASTCALL SCSIBR::FS_GetCapacity(BYTE *buf) //--------------------------------------------------------------------------- // -// $51 - ドライブ状態検査/制御 +// $51 - Drive status inspection/control // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_CtrlDrive(BYTE *buf) @@ -5681,7 +5687,7 @@ void FASTCALL SCSIBR::FS_CtrlDrive(BYTE *buf) //--------------------------------------------------------------------------- // -// $52 - DPB取得 +// $52 - Get DPB // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_GetDPB(BYTE *buf) @@ -5715,7 +5721,7 @@ void FASTCALL SCSIBR::FS_GetDPB(BYTE *buf) //--------------------------------------------------------------------------- // -// $53 - セクタ読み込み +// $53 - Read Sector // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_DiskRead(BYTE *buf) @@ -5749,7 +5755,7 @@ void FASTCALL SCSIBR::FS_DiskRead(BYTE *buf) //--------------------------------------------------------------------------- // -// $54 - セクタ書き込み +// $54 - Write Sector // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_DiskWrite(BYTE *buf) @@ -5826,7 +5832,7 @@ void FASTCALL SCSIBR::FS_Ioctrl(BYTE *buf) //--------------------------------------------------------------------------- // -// $56 - フラッシュ +// $56 - Flush // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_Flush(BYTE *buf) @@ -5849,7 +5855,7 @@ void FASTCALL SCSIBR::FS_Flush(BYTE *buf) //--------------------------------------------------------------------------- // -// $57 - メディア交換チェック +// $57 - Check Media // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_CheckMedia(BYTE *buf) @@ -5872,7 +5878,7 @@ void FASTCALL SCSIBR::FS_CheckMedia(BYTE *buf) //--------------------------------------------------------------------------- // -// $58 - 排他制御 +// $58 - Lock // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::FS_Lock(BYTE *buf) @@ -5895,7 +5901,7 @@ void FASTCALL SCSIBR::FS_Lock(BYTE *buf) //--------------------------------------------------------------------------- // -// ファイルシステム読み込み(結果コード) +// Read Filesystem (result code) // //--------------------------------------------------------------------------- int FASTCALL SCSIBR::ReadFsResult(BYTE *buf) @@ -5912,7 +5918,7 @@ int FASTCALL SCSIBR::ReadFsResult(BYTE *buf) //--------------------------------------------------------------------------- // -// ファイルシステム読み込み(返却データ) +// Read Filesystem (return data) // //--------------------------------------------------------------------------- int FASTCALL SCSIBR::ReadFsOut(BYTE *buf) @@ -5926,7 +5932,7 @@ int FASTCALL SCSIBR::ReadFsOut(BYTE *buf) //--------------------------------------------------------------------------- // -// ファイルシステム読み込み(返却オプションデータ) +// Read file system (return option data) // //--------------------------------------------------------------------------- int FASTCALL SCSIBR::ReadFsOpt(BYTE *buf) @@ -5940,7 +5946,7 @@ int FASTCALL SCSIBR::ReadFsOpt(BYTE *buf) //--------------------------------------------------------------------------- // -// ファイルシステム書き込み +// Write Filesystem // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::WriteFs(int func, BYTE *buf) @@ -5955,37 +5961,37 @@ void FASTCALL SCSIBR::WriteFs(int func, BYTE *buf) // コマンド分岐 func &= 0x1f; switch (func) { - case 0x00: return FS_InitDevice(buf); // $40 - デバイス起動 - case 0x01: return FS_CheckDir(buf); // $41 - ディレクトリチェック - case 0x02: return FS_MakeDir(buf); // $42 - ディレクトリ作成 - case 0x03: return FS_RemoveDir(buf); // $43 - ディレクトリ削除 - case 0x04: return FS_Rename(buf); // $44 - ファイル名変更 - case 0x05: return FS_Delete(buf); // $45 - ファイル削除 - case 0x06: return FS_Attribute(buf); // $46 - ファイル属性取得/設定 - case 0x07: return FS_Files(buf); // $47 - ファイル検索 - case 0x08: return FS_NFiles(buf); // $48 - ファイル次検索 - case 0x09: return FS_Create(buf); // $49 - ファイル作成 - case 0x0A: return FS_Open(buf); // $4A - ファイルオープン - case 0x0B: return FS_Close(buf); // $4B - ファイルクローズ - case 0x0C: return FS_Read(buf); // $4C - ファイル読み込み - case 0x0D: return FS_Write(buf); // $4D - ファイル書き込み - case 0x0E: return FS_Seek(buf); // $4E - ファイルシーク - case 0x0F: return FS_TimeStamp(buf); // $4F - ファイル更新時刻の取得/設定 - case 0x10: return FS_GetCapacity(buf); // $50 - 容量取得 - case 0x11: return FS_CtrlDrive(buf); // $51 - ドライブ制御/状態検査 - case 0x12: return FS_GetDPB(buf); // $52 - DPB取得 - case 0x13: return FS_DiskRead(buf); // $53 - セクタ読み込み - case 0x14: return FS_DiskWrite(buf); // $54 - セクタ書き込み + case 0x00: return FS_InitDevice(buf); // $40 - start device + case 0x01: return FS_CheckDir(buf); // $41 - directory check + case 0x02: return FS_MakeDir(buf); // $42 - create directory + case 0x03: return FS_RemoveDir(buf); // $43 - remove directory + case 0x04: return FS_Rename(buf); // $44 - change file name + case 0x05: return FS_Delete(buf); // $45 - delete file + case 0x06: return FS_Attribute(buf); // $46 - Get/set file attribute + case 0x07: return FS_Files(buf); // $47 - file search + case 0x08: return FS_NFiles(buf); // $48 - next file search + case 0x09: return FS_Create(buf); // $49 - create file + case 0x0A: return FS_Open(buf); // $4A - File open + case 0x0B: return FS_Close(buf); // $4B - File close + case 0x0C: return FS_Read(buf); // $4C - read file + case 0x0D: return FS_Write(buf); // $4D - write file + case 0x0E: return FS_Seek(buf); // $4E - File seek + case 0x0F: return FS_TimeStamp(buf); // $4F - Get/set file modification time + case 0x10: return FS_GetCapacity(buf); // $50 - get capacity + case 0x11: return FS_CtrlDrive(buf); // $51 - Drive control/state check + case 0x12: return FS_GetDPB(buf); // $52 - Get DPB + case 0x13: return FS_DiskRead(buf); // $53 - read sector + case 0x14: return FS_DiskWrite(buf); // $54 - write sector case 0x15: return FS_Ioctrl(buf); // $55 - IOCTRL - case 0x16: return FS_Flush(buf); // $56 - フラッシュ - case 0x17: return FS_CheckMedia(buf); // $57 - メディア交換チェック - case 0x18: return FS_Lock(buf); // $58 - 排他制御 + case 0x16: return FS_Flush(buf); // $56 - flush + case 0x17: return FS_CheckMedia(buf); // $57 - check media exchange + case 0x18: return FS_Lock(buf); // $58 - exclusive control } } //--------------------------------------------------------------------------- // -// ファイルシステム書き込み(入力オプションデータ) +// File system write (input option data) // //--------------------------------------------------------------------------- void FASTCALL SCSIBR::WriteFsOpt(BYTE *buf, int num) @@ -5997,13 +6003,13 @@ void FASTCALL SCSIBR::WriteFsOpt(BYTE *buf, int num) //=========================================================================== // -// SASI デバイス +// SASI Device // //=========================================================================== //--------------------------------------------------------------------------- // -// コンストラクタ +// Constructor // //--------------------------------------------------------------------------- #ifdef RASCSI @@ -6045,7 +6051,7 @@ SASIDEV::SASIDEV(Device *dev) //--------------------------------------------------------------------------- // -// デストラクタ +// Destructor // //--------------------------------------------------------------------------- SASIDEV::~SASIDEV() @@ -6253,7 +6259,7 @@ Disk* FASTCALL SASIDEV::GetBusyUnit() ASSERT(this); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; return ctrl.unit[lun]; } @@ -6272,19 +6278,19 @@ BUS::phase_t FASTCALL SASIDEV::Process() return ctrl.phase; } - // バス情報の取り込み + // Get bus information ctrl.bus->Aquire(); - // リセット + // Reset if (ctrl.bus->GetRST()) { #if defined(DISK_LOG) Log(Log::Normal, "RESET信号受信"); #endif // DISK_LOG - // コントローラをリセット + // Reset the controller Reset(); - // バスもリセット + // Reset the bus ctrl.bus->Reset(); return ctrl.phase; } @@ -6326,7 +6332,7 @@ BUS::phase_t FASTCALL SASIDEV::Process() MsgIn(); break; - // その他 + // Other default: ASSERT(FALSE); break; @@ -6337,21 +6343,21 @@ BUS::phase_t FASTCALL SASIDEV::Process() //--------------------------------------------------------------------------- // -// バスフリーフェーズ +// Bus free phase // //--------------------------------------------------------------------------- void FASTCALL SASIDEV::BusFree() { ASSERT(this); - // フェーズチェンジ + // Phase change if (ctrl.phase != BUS::busfree) { #if defined(DISK_LOG) - Log(Log::Normal, "バスフリーフェーズ"); + Log(Log::Normal, "Bus free phase"); #endif // DISK_LOG - // フェーズ設定 + // Phase Setting ctrl.phase = BUS::busfree; // 信号線 @@ -6384,7 +6390,7 @@ void FASTCALL SASIDEV::Selection() ASSERT(this); - // フェーズチェンジ + // Phase change if (ctrl.phase != BUS::selection) { // IDが一致していなければ無効 id = 1 << ctrl.id; @@ -6402,7 +6408,7 @@ void FASTCALL SASIDEV::Selection() "セレクションフェーズ ID=%d (デバイスあり)", ctrl.id); #endif // DISK_LOG - // フェーズチェンジ + // Phase change ctrl.phase = BUS::selection; // BSYを上げて応答 @@ -6430,17 +6436,17 @@ void FASTCALL SASIDEV::Command() ASSERT(this); - // フェーズチェンジ + // Phase change if (ctrl.phase != BUS::command) { #if defined(DISK_LOG) Log(Log::Normal, "コマンドフェーズ"); #endif // DISK_LOG - // フェーズ設定 + // Phase Setting ctrl.phase = BUS::command; - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetMSG(FALSE); ctrl.bus->SetCD(TRUE); ctrl.bus->SetIO(FALSE); @@ -6471,7 +6477,7 @@ void FASTCALL SASIDEV::Command() return; } - // コマンドデータ転送 + // Command data transfer for (i = 0; i < (int)ctrl.length; i++) { ctrl.cmd[i] = (DWORD)ctrl.buffer[i]; } @@ -6480,7 +6486,7 @@ void FASTCALL SASIDEV::Command() ctrl.length = 0; ctrl.blocks = 0; - // 実行フェーズ + // Execution Phase Execute(); #else // コマンドを要求 @@ -6489,14 +6495,14 @@ void FASTCALL SASIDEV::Command() #endif // RASCSI } #ifndef RASCSI - // リクエスト中 + // Requesting if (ctrl.bus->GetREQ()) { - // イニシエータが送信した + // Sent by the initiator if (ctrl.bus->GetACK()) { Receive(); } } else { - // イニシエータに次を要求 + // Request the initator to if (!ctrl.bus->GetACK()) { ReceiveNext(); } @@ -6506,7 +6512,7 @@ void FASTCALL SASIDEV::Command() //--------------------------------------------------------------------------- // -// 実行フェーズ +// Execution Phase // //--------------------------------------------------------------------------- void FASTCALL SASIDEV::Execute() @@ -6514,10 +6520,10 @@ void FASTCALL SASIDEV::Execute() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "実行フェーズ コマンド$%02X", ctrl.cmd[0]); + Log(Log::Normal, "Execution Phase コマンド$%02X", ctrl.cmd[0]); #endif // DISK_LOG - // フェーズ設定 + // Phase Setting ctrl.phase = BUS::execute; // データ転送のための初期化 @@ -6527,7 +6533,7 @@ void FASTCALL SASIDEV::Execute() ctrl.execstart = SysTimer::GetTimerLow(); #endif // RASCSI - // コマンド別処理 + // Process by command switch (ctrl.cmd[0]) { // TEST UNIT READY case 0x00: @@ -6592,7 +6598,7 @@ void FASTCALL SASIDEV::Execute() //--------------------------------------------------------------------------- // -// ステータスフェーズ +// Status phase // //--------------------------------------------------------------------------- void FASTCALL SASIDEV::Status() @@ -6604,7 +6610,7 @@ void FASTCALL SASIDEV::Status() ASSERT(this); - // フェーズチェンジ + // Phase change if (ctrl.phase != BUS::status) { #ifdef RASCSI @@ -6625,15 +6631,15 @@ void FASTCALL SASIDEV::Status() Log(Log::Normal, "ステータスフェーズ"); #endif // DISK_LOG - // フェーズ設定 + // Phase Setting ctrl.phase = BUS::status; - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetMSG(FALSE); ctrl.bus->SetCD(TRUE); ctrl.bus->SetIO(TRUE); - // データ転送は1バイトx1ブロック + // Data transfer is 1 byte x 1 block ctrl.offset = 0; ctrl.length = 1; ctrl.blocks = 1; @@ -6655,7 +6661,7 @@ void FASTCALL SASIDEV::Status() // 送信 Send(); #else - // リクエスト中 + // Requesting if (ctrl.bus->GetREQ()) { // イニシエータが受信した if (ctrl.bus->GetACK()) { @@ -6672,24 +6678,24 @@ void FASTCALL SASIDEV::Status() //--------------------------------------------------------------------------- // -// メッセージインフェーズ +// Message in phase // //--------------------------------------------------------------------------- void FASTCALL SASIDEV::MsgIn() { ASSERT(this); - // フェーズチェンジ + // Phase change if (ctrl.phase != BUS::msgin) { #if defined(DISK_LOG) - Log(Log::Normal, "メッセージインフェーズ"); + Log(Log::Normal, "Message in phase"); #endif // DISK_LOG - // フェーズ設定 + // Phase Setting ctrl.phase = BUS::msgin; - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetMSG(TRUE); ctrl.bus->SetCD(TRUE); ctrl.bus->SetIO(TRUE); @@ -6700,12 +6706,12 @@ void FASTCALL SASIDEV::MsgIn() ctrl.offset = 0; #ifndef RASCSI - // メッセージを要求 + // Request message ctrl.bus->SetDAT(ctrl.buffer[ctrl.offset]); ctrl.bus->SetREQ(TRUE); #if defined(DISK_LOG) - Log(Log::Normal, "メッセージインフェーズ $%02X", ctrl.buffer[ctrl.offset]); + Log(Log::Normal, "Message in phase $%02X", ctrl.buffer[ctrl.offset]); #endif // DISK_LOG #endif // RASCSI return; @@ -6715,7 +6721,7 @@ void FASTCALL SASIDEV::MsgIn() // 送信 Send(); #else - // リクエスト中 + // Requesting if (ctrl.bus->GetREQ()) { // イニシエータが受信した if (ctrl.bus->GetACK()) { @@ -6732,7 +6738,7 @@ void FASTCALL SASIDEV::MsgIn() //--------------------------------------------------------------------------- // -// データインフェーズ +// Data-in Phase // //--------------------------------------------------------------------------- void FASTCALL SASIDEV::DataIn() @@ -6745,7 +6751,7 @@ void FASTCALL SASIDEV::DataIn() ASSERT(this); ASSERT(ctrl.length >= 0); - // フェーズチェンジ + // Phase change if (ctrl.phase != BUS::datain) { #ifdef RASCSI @@ -6767,13 +6773,13 @@ void FASTCALL SASIDEV::DataIn() } #if defined(DISK_LOG) - Log(Log::Normal, "データインフェーズ"); + Log(Log::Normal, "Data-in Phase"); #endif // DISK_LOG - // フェーズ設定 + // Phase Setting ctrl.phase = BUS::datain; - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetMSG(FALSE); ctrl.bus->SetCD(FALSE); ctrl.bus->SetIO(TRUE); @@ -6797,7 +6803,7 @@ void FASTCALL SASIDEV::DataIn() // 送信 Send(); #else - // リクエスト中 + // Requesting if (ctrl.bus->GetREQ()) { // イニシエータが受信した if (ctrl.bus->GetACK()) { @@ -6827,7 +6833,7 @@ void FASTCALL SASIDEV::DataOut() ASSERT(this); ASSERT(ctrl.length >= 0); - // フェーズチェンジ + // Phase change if (ctrl.phase != BUS::dataout) { #ifdef RASCSI @@ -6852,10 +6858,10 @@ void FASTCALL SASIDEV::DataOut() Log(Log::Normal, "データアウトフェーズ"); #endif // DISK_LOG - // フェーズ設定 + // Phase Setting ctrl.phase = BUS::dataout; - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetMSG(FALSE); ctrl.bus->SetCD(FALSE); ctrl.bus->SetIO(FALSE); @@ -6876,14 +6882,14 @@ void FASTCALL SASIDEV::DataOut() // 受信 Receive(); #else - // リクエスト中 + // Requesting if (ctrl.bus->GetREQ()) { - // イニシエータが送信した + // Sent by the initiator if (ctrl.bus->GetACK()) { Receive(); } } else { - // イニシエータに次を要求 + // Request the initator to if (!ctrl.bus->GetACK()) { ReceiveNext(); } @@ -6902,15 +6908,15 @@ void FASTCALL SASIDEV::Error() ASSERT(this); - // バス情報の取り込み + // Get bus information ctrl.bus->Aquire(); - // リセットチェック + // Reset check if (ctrl.bus->GetRST()) { - // コントローラをリセット + // Reset the controller Reset(); - // バスもリセット + // Reset the bus ctrl.bus->Reset(); return; } @@ -6925,13 +6931,13 @@ void FASTCALL SASIDEV::Error() Log(Log::Warning, "エラー(ステータスフェーズへ)"); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; - // ステータスとメッセージを設定(CHECK CONDITION) + // Set status and message(CHECK CONDITION) ctrl.status = (lun << 5) | 0x02; - // ステータスフェーズ + // status phase Status(); } @@ -6948,25 +6954,25 @@ void FASTCALL SASIDEV::CmdTestUnitReady() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "TEST UNIT READYコマンド"); + Log(Log::Normal, "TEST UNIT READY Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive status = ctrl.unit[lun]->TestUnitReady(ctrl.cmd); if (!status) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // ステータスフェーズ + // status phase Status(); } @@ -6983,25 +6989,25 @@ void FASTCALL SASIDEV::CmdRezero() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "REZERO UNITコマンド"); + Log(Log::Normal, "REZERO UNIT Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive status = ctrl.unit[lun]->Rezero(ctrl.cmd); if (!status) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // ステータスフェーズ + // status phase Status(); } @@ -7017,17 +7023,17 @@ void FASTCALL SASIDEV::CmdRequestSense() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "REQUEST SENSEコマンド"); + Log(Log::Normal, "REQUEST SENSE Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive ctrl.length = ctrl.unit[lun]->RequestSense(ctrl.cmd, ctrl.buffer); ASSERT(ctrl.length > 0); @@ -7052,25 +7058,25 @@ void FASTCALL SASIDEV::CmdFormat() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "FORMAT UNITコマンド"); + Log(Log::Normal, "FORMAT UNIT Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive status = ctrl.unit[lun]->Format(ctrl.cmd); if (!status) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // ステータスフェーズ + // status phase Status(); } @@ -7087,25 +7093,25 @@ void FASTCALL SASIDEV::CmdReassign() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "REASSIGN BLOCKSコマンド"); + Log(Log::Normal, "REASSIGN BLOCKS Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive status = ctrl.unit[lun]->Reassign(ctrl.cmd); if (!status) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // ステータスフェーズ + // status phase Status(); } @@ -7121,14 +7127,14 @@ void FASTCALL SASIDEV::CmdRead6() ASSERT(this); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // レコード番号とブロック数を取得 + // Get record number and block number record = ctrl.cmd[1] & 0x1f; record <<= 8; record |= ctrl.cmd[2]; @@ -7144,15 +7150,15 @@ void FASTCALL SASIDEV::CmdRead6() "READ(6)コマンド レコード=%06X ブロック=%d", record, ctrl.blocks); #endif // DISK_LOG - // ドライブでコマンド処理 + // Command processing on drive ctrl.length = ctrl.unit[lun]->Read(ctrl.buffer, record); if (ctrl.length <= 0) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // 次のブロックを設定 + // Set next block ctrl.next = record + 1; // リードフェーズ @@ -7171,14 +7177,14 @@ void FASTCALL SASIDEV::CmdWrite6() ASSERT(this); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // レコード番号とブロック数を取得 + // Get record number and block number record = ctrl.cmd[1] & 0x1f; record <<= 8; record |= ctrl.cmd[2]; @@ -7194,15 +7200,15 @@ void FASTCALL SASIDEV::CmdWrite6() "WRITE(6)コマンド レコード=%06X ブロック=%d", record, ctrl.blocks); #endif // DISK_LOG - // ドライブでコマンド処理 + // Command processing on drive ctrl.length = ctrl.unit[lun]->WriteCheck(record); if (ctrl.length <= 0) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // 次のブロックを設定 + // Set next block ctrl.next = record + 1; // ライトフェーズ @@ -7222,25 +7228,25 @@ void FASTCALL SASIDEV::CmdSeek6() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "SEEK(6)コマンド"); + Log(Log::Normal, "SEEK(6) Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive status = ctrl.unit[lun]->Seek(ctrl.cmd); if (!status) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // ステータスフェーズ + // status phase Status(); } @@ -7257,20 +7263,20 @@ void FASTCALL SASIDEV::CmdAssign() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "ASSIGNコマンド"); + Log(Log::Normal, "ASSIGN Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive status = ctrl.unit[lun]->Assign(ctrl.cmd); if (!status) { - // 失敗(エラー) + // Failure (Error) Error(); return; } @@ -7295,20 +7301,20 @@ void FASTCALL SASIDEV::CmdSpecify() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "SPECIFYコマンド"); + Log(Log::Normal, "SPECIFY Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive status = ctrl.unit[lun]->Assign(ctrl.cmd); if (!status) { - // 失敗(エラー) + // Failure (Error) Error(); return; } @@ -7332,23 +7338,23 @@ void FASTCALL SASIDEV::CmdInvalid() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "サポートしていないコマンド"); + Log(Log::Normal, "サポートしていない Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (ctrl.unit[lun]) { - // ドライブでコマンド処理 + // Command processing on drive ctrl.unit[lun]->InvalidCmd(); } - // 失敗(エラー) + // Failure (Error) Error(); } //=========================================================================== // -// データ転送 +// Data transfer // //=========================================================================== @@ -7380,20 +7386,20 @@ void FASTCALL SASIDEV::Send() return; } - // オフセットとレングス + // Offset and Length ctrl.offset += ctrl.length; ctrl.length = 0; return; } #else - // オフセットとレングス + // Offset and Length ASSERT(ctrl.length >= 1); ctrl.offset++; ctrl.length--; // ACKアサート直後にSendNextでデータ設定済みならリクエストを上げる if (ctrl.length != 0) { - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetREQ(TRUE); return; } @@ -7425,7 +7431,7 @@ void FASTCALL SASIDEV::Send() ASSERT(ctrl.length > 0); ASSERT(ctrl.offset == 0); #ifndef RASCSI - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetREQ(TRUE); #endif // RASCSI return; @@ -7433,28 +7439,28 @@ void FASTCALL SASIDEV::Send() // 次フェーズに移動 switch (ctrl.phase) { - // メッセージインフェーズ + // Message in phase case BUS::msgin: - // バスフリーフェーズ + // Bus free phase BusFree(); break; - // データインフェーズ + // Data-in Phase case BUS::datain: - // ステータスフェーズ + // status phase Status(); break; // ステータスフェーズ case BUS::status: - // メッセージインフェーズ + // Message in phase ctrl.length = 1; ctrl.blocks = 1; ctrl.buffer[0] = (BYTE)ctrl.message; MsgIn(); break; - // その他(ありえない) + // Other (impossible) default: ASSERT(FALSE); break; @@ -7471,11 +7477,11 @@ void FASTCALL SASIDEV::SendNext() { ASSERT(this); - // REQが上がっている + // Req is up ASSERT(ctrl.bus->GetREQ()); ASSERT(ctrl.bus->GetIO()); - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetREQ(FALSE); // バッファにデータがあれば先に設定する @@ -7497,25 +7503,25 @@ void FASTCALL SASIDEV::Receive() ASSERT(this); - // REQが上がっている + // Req is up ASSERT(ctrl.bus->GetREQ()); ASSERT(!ctrl.bus->GetIO()); - // データ取得 + // Get data data = (DWORD)ctrl.bus->GetDAT(); - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetREQ(FALSE); switch (ctrl.phase) { - // コマンドフェーズ + // Command phase case BUS::command: ctrl.cmd[ctrl.offset] = data; #if defined(DISK_LOG) Log(Log::Normal, "コマンドフェーズ $%02X", data); #endif // DISK_LOG - // 最初のデータ(オフセット0)によりレングスを再設定 + // Set the length again with the first data (offset 0) if (ctrl.offset == 0) { if (ctrl.cmd[0] >= 0x20 && ctrl.cmd[0] <= 0x7D) { // 10バイトCDB @@ -7524,12 +7530,12 @@ void FASTCALL SASIDEV::Receive() } break; - // データアウトフェーズ + // Data out phase case BUS::dataout: ctrl.buffer[ctrl.offset] = (BYTE)data; break; - // その他(ありえない) + // Other (impossible) default: ASSERT(FALSE); break; @@ -7560,7 +7566,7 @@ void FASTCALL SASIDEV::ReceiveNext() ASSERT(this); - // REQが下がっていること + // REQ is low ASSERT(!ctrl.bus->GetREQ()); ASSERT(!ctrl.bus->GetIO()); @@ -7577,20 +7583,20 @@ void FASTCALL SASIDEV::ReceiveNext() return; } - // オフセットとレングス + // Offset and Length ctrl.offset += ctrl.length; ctrl.length = 0; return; } #else - // オフセットとレングス + // Offset and Length ASSERT(ctrl.length >= 1); ctrl.offset++; ctrl.length--; // レングス!=0なら、再びreqをセット if (ctrl.length != 0) { - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetREQ(TRUE); return; } @@ -7603,10 +7609,10 @@ void FASTCALL SASIDEV::ReceiveNext() // データアウトフェーズの処理 if (ctrl.phase == BUS::dataout) { if (ctrl.blocks == 0) { - // このバッファで終了 + // End with this buffer result = XferOut(FALSE); } else { - // 次のバッファに続く(offset, lengthをセットすること) + // Continue to next buffer (set offset, length) result = XferOut(TRUE); } } @@ -7622,7 +7628,7 @@ void FASTCALL SASIDEV::ReceiveNext() ASSERT(ctrl.length > 0); ASSERT(ctrl.offset == 0); #ifndef RASCSI - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetREQ(TRUE); #endif // RASCSI return; @@ -7631,23 +7637,23 @@ void FASTCALL SASIDEV::ReceiveNext() // 次フェーズに移動 switch (ctrl.phase) { #ifndef RASCSI - // コマンドフェーズ + // Command phase case BUS::command: - // 実行フェーズ + // Execution Phase Execute(); break; #endif // RASCSI - // データアウトフェーズ + // Data out phase case BUS::dataout: // フラッシュ FlushUnit(); - // ステータスフェーズ + // status phase Status(); break; - // その他(ありえない) + // Other (impossible) default: ASSERT(FALSE); break; @@ -7667,7 +7673,7 @@ BOOL FASTCALL SASIDEV::XferIn(BYTE *buf) ASSERT(this); ASSERT(ctrl.phase == BUS::datain); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { return FALSE; @@ -7693,7 +7699,7 @@ BOOL FASTCALL SASIDEV::XferIn(BYTE *buf) ctrl.offset = 0; break; - // その他(ありえない) + // Other (impossible) default: ASSERT(FALSE); return FALSE; @@ -7717,7 +7723,7 @@ BOOL FASTCALL SASIDEV::XferOut(BOOL cont) ASSERT(this); ASSERT(ctrl.phase == BUS::dataout); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { return FALSE; @@ -7803,7 +7809,7 @@ void FASTCALL SASIDEV::FlushUnit() ASSERT(this); ASSERT(ctrl.phase == BUS::dataout); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { return; @@ -7865,13 +7871,13 @@ void FASTCALL SASIDEV::Log(Log::loglevel level, const char *format, ...) //=========================================================================== // -// SCSI デバイス +// SCSI Device // //=========================================================================== //--------------------------------------------------------------------------- // -// コンストラクタ +// Constructor // //--------------------------------------------------------------------------- #ifdef RASCSI @@ -7880,7 +7886,7 @@ SCSIDEV::SCSIDEV() : SASIDEV() SCSIDEV::SCSIDEV(Device *dev) : SASIDEV(dev) #endif { - // 同期転送ワーク初期化 + // Synchronous transfer work initialization scsi.syncenable = FALSE; scsi.syncperiod = 50; scsi.syncoffset = 0; @@ -7891,96 +7897,96 @@ SCSIDEV::SCSIDEV(Device *dev) : SASIDEV(dev) //--------------------------------------------------------------------------- // -// デバイスリセット +// Device reset // //--------------------------------------------------------------------------- void FASTCALL SCSIDEV::Reset() { ASSERT(this); - // ワーク初期化 + // Work initialization scsi.atnmsg = FALSE; scsi.msc = 0; memset(scsi.msb, 0x00, sizeof(scsi.msb)); - // 基底クラス + // Base class SASIDEV::Reset(); } //--------------------------------------------------------------------------- // -// 実行 +// Process // //--------------------------------------------------------------------------- BUS::phase_t FASTCALL SCSIDEV::Process() { ASSERT(this); - // 未接続なら何もしない + // Do nothing if not connected if (ctrl.id < 0 || ctrl.bus == NULL) { return ctrl.phase; } - // バス情報の取り込み + // Get bus information ctrl.bus->Aquire(); - // リセット + // Reset if (ctrl.bus->GetRST()) { #if defined(DISK_LOG) Log(Log::Normal, "RESET信号受信"); #endif // DISK_LOG - // コントローラをリセット + // Reset the controller Reset(); - // バスもリセット + // Reset the bus ctrl.bus->Reset(); return ctrl.phase; } - // フェーズ処理 + // Phase processing switch (ctrl.phase) { - // バスフリー + // Bus free phase case BUS::busfree: BusFree(); break; - // セレクションフェーズ + // Selection phase case BUS::selection: Selection(); break; - // データアウト(MCI=000) + // Data out (MCI=000) case BUS::dataout: DataOut(); break; - // データイン(MCI=001) + // Data in (MCI=001) case BUS::datain: DataIn(); break; - // コマンド(MCI=010) + // Command (MCI=010) case BUS::command: Command(); break; - // ステータス(MCI=011) + // Status (MCI=011) case BUS::status: Status(); break; - // メッセージアウト(MCI=110) + // Message out (MCI=110) case BUS::msgout: MsgOut(); break; - // メッセージイン(MCI=111) + // Message in (MCI=111) case BUS::msgin: MsgIn(); break; - // その他 + // Other default: ASSERT(FALSE); break; @@ -7991,46 +7997,46 @@ BUS::phase_t FASTCALL SCSIDEV::Process() //--------------------------------------------------------------------------- // -// フェーズ +// Phaes // //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // -// バスフリーフェーズ +// Bus free phase // //--------------------------------------------------------------------------- void FASTCALL SCSIDEV::BusFree() { ASSERT(this); - // フェーズチェンジ + // Phase change if (ctrl.phase != BUS::busfree) { #if defined(DISK_LOG) - Log(Log::Normal, "バスフリーフェーズ"); + Log(Log::Normal, "Bus free phase"); #endif // DISK_LOG - // フェーズ設定 + // Phase setting ctrl.phase = BUS::busfree; - // 信号線 + // Signal line ctrl.bus->SetREQ(FALSE); ctrl.bus->SetMSG(FALSE); ctrl.bus->SetCD(FALSE); ctrl.bus->SetIO(FALSE); ctrl.bus->SetBSY(FALSE); - // ステータスとメッセージを初期化 + // Initialize status and message ctrl.status = 0x00; ctrl.message = 0x00; - // ATNメッセージ受信スタータス初期化 + // Initialize ATN message reception status scsi.atnmsg = FALSE; return; } - // セレクションフェーズに移行 + // Move to selection phase if (ctrl.bus->GetSEL() && !ctrl.bus->GetBSY()) { Selection(); } @@ -8038,7 +8044,7 @@ void FASTCALL SCSIDEV::BusFree() //--------------------------------------------------------------------------- // -// セレクションフェーズ +// Selection Phase // //--------------------------------------------------------------------------- void FASTCALL SCSIDEV::Selection() @@ -8047,35 +8053,35 @@ void FASTCALL SCSIDEV::Selection() ASSERT(this); - // フェーズチェンジ + // Phase change if (ctrl.phase != BUS::selection) { - // IDが一致していなければ無効 + // invalid if IDs do not match id = 1 << ctrl.id; if ((ctrl.bus->GetDAT() & id) == 0) { return; } - // 有効なユニットが無ければ終了 + // End if there is no valid unit if (!HasUnit()) { return; } #if defined(DISK_LOG) Log(Log::Normal, - "セレクションフェーズ ID=%d (デバイスあり)", ctrl.id); + "Selection Phase ID=%d (with device)", ctrl.id); #endif // DISK_LOG - // フェーズ設定 + // Phase setting ctrl.phase = BUS::selection; - // BSYを上げて応答 + // Raise BSY and respond ctrl.bus->SetBSY(TRUE); return; } - // セレクション完了 + // Selection completed if (!ctrl.bus->GetSEL() && ctrl.bus->GetBSY()) { - // ATN=1ならメッセージアウトフェーズ、そうでなければコマンドフェーズ + // Message out phase if ATN=1, otherwise command phase if (ctrl.bus->GetATN()) { MsgOut(); } else { @@ -8086,7 +8092,7 @@ void FASTCALL SCSIDEV::Selection() //--------------------------------------------------------------------------- // -// 実行フェーズ +// Execution Phase // //--------------------------------------------------------------------------- void FASTCALL SCSIDEV::Execute() @@ -8094,20 +8100,20 @@ void FASTCALL SCSIDEV::Execute() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "実行フェーズ コマンド$%02X", ctrl.cmd[0]); + Log(Log::Normal, "Execution phase command $%02X", ctrl.cmd[0]); #endif // DISK_LOG - // フェーズ設定 + // Phase Setting ctrl.phase = BUS::execute; - // データ転送のための初期化 + // Initialization for data transfer ctrl.offset = 0; ctrl.blocks = 1; #ifdef RASCSI ctrl.execstart = SysTimer::GetTimerLow(); #endif // RASCSI - // コマンド別処理 + // Process by command switch (ctrl.cmd[0]) { // TEST UNIT READY case 0x00: @@ -8249,73 +8255,73 @@ void FASTCALL SCSIDEV::Execute() CmdModeSense10(); return; - // SPECIFY(SASIのみ/SxSI利用時の警告抑制) + // SPECIFY (SASI only/Suppress warning when using SxSI) case 0xc2: CmdInvalid(); return; } - // それ以外は対応していない + // No other support Log(Log::Normal, "未対応コマンド $%02X", ctrl.cmd[0]); CmdInvalid(); } //--------------------------------------------------------------------------- // -// メッセージアウトフェーズ +// Message out phase // //--------------------------------------------------------------------------- void FASTCALL SCSIDEV::MsgOut() { ASSERT(this); - // フェーズチェンジ + // Phase change if (ctrl.phase != BUS::msgout) { #if defined(DISK_LOG) - Log(Log::Normal, "メッセージアウトフェーズ"); + Log(Log::Normal, "Message Out Phase"); #endif // DISK_LOG - // セレクション後のメッセージアウトフェーズは - // IDENTIFYメッセージの処理 + // Message out phase after selection + // process the IDENTIFY message if (ctrl.phase == BUS::selection) { scsi.atnmsg = TRUE; scsi.msc = 0; memset(scsi.msb, 0x00, sizeof(scsi.msb)); } - // フェーズ設定 + // Phase Setting ctrl.phase = BUS::msgout; - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetMSG(TRUE); ctrl.bus->SetCD(TRUE); ctrl.bus->SetIO(FALSE); - // データ転送は1バイトx1ブロック + // Data transfer is 1 byte x 1 block ctrl.offset = 0; ctrl.length = 1; ctrl.blocks = 1; #ifndef RASCSI - // メッセージを要求 + // Request message ctrl.bus->SetREQ(TRUE); #endif // RASCSI return; } #ifdef RASCSI - // 受信 + // Receive Receive(); #else - // リクエスト中 + // Requesting if (ctrl.bus->GetREQ()) { - // イニシエータが送信した + // Sent by the initiator if (ctrl.bus->GetACK()) { Receive(); } } else { - // イニシエータに次を要求 + // Request the initator to if (!ctrl.bus->GetACK()) { ReceiveNext(); } @@ -8325,47 +8331,47 @@ void FASTCALL SCSIDEV::MsgOut() //--------------------------------------------------------------------------- // -// 共通エラー処理 +// Common Error Handling // //--------------------------------------------------------------------------- void FASTCALL SCSIDEV::Error() { ASSERT(this); - // バス情報の取り込み + // Get bus information ctrl.bus->Aquire(); - // リセットチェック + // Reset check if (ctrl.bus->GetRST()) { - // コントローラをリセット + // Reset the controller Reset(); - // バスもリセット + // Reset the bus ctrl.bus->Reset(); return; } - // ステータスフェーズ、メッセージインフェーズはバスフリー + // Bus free for status phase and message in phase if (ctrl.phase == BUS::status || ctrl.phase == BUS::msgin) { BusFree(); return; } #if defined(DISK_LOG) - Log(Log::Normal, "エラー(ステータスフェーズへ)"); + Log(Log::Normal, "Error (to status phase)"); #endif // DISK_LOG - // ステータスとメッセージを設定(CHECK CONDITION) + // Set status and message(CHECK CONDITION) ctrl.status = 0x02; ctrl.message = 0x00; - // ステータスフェーズ + // status phase Status(); } //--------------------------------------------------------------------------- // -// コマンド +// Command // //--------------------------------------------------------------------------- @@ -8384,10 +8390,10 @@ void FASTCALL SCSIDEV::CmdInquiry() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "INQUIRYコマンド"); + Log(Log::Normal, "INQUIRY Command"); #endif // DISK_LOG - // 有効なユニットを探す + // Find a valid unit disk = NULL; for (lun = 0; lun < UnitMax; lun++) { if (ctrl.unit[lun]) { @@ -8396,7 +8402,7 @@ void FASTCALL SCSIDEV::CmdInquiry() } } - // ディスク側で処理(本来はコントローラで処理される) + // Processed on the disk side (it is originally processed by the controller) if (disk) { #ifdef RASCSI major = (DWORD)(RASCSI >> 8); @@ -8411,17 +8417,17 @@ void FASTCALL SCSIDEV::CmdInquiry() } if (ctrl.length <= 0) { - // 失敗(エラー) + // failure (error) Error(); return; } - // 同期転送サポート情報の追加 + // Add synchronous transfer support information if (scsi.syncenable) { ctrl.buffer[7] |= (1 << 4); } - // データインフェーズ + // Data-in Phase DataIn(); } @@ -8437,25 +8443,25 @@ void FASTCALL SCSIDEV::CmdModeSelect() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "MODE SELECTコマンド"); + Log(Log::Normal, "MODE SELECT Command"); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive ctrl.length = ctrl.unit[lun]->SelectCheck(ctrl.cmd); if (ctrl.length <= 0) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // データアウトフェーズ + // Data out phase DataOut(); } @@ -8471,29 +8477,29 @@ void FASTCALL SCSIDEV::CmdModeSense() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "MODE SENSEコマンド"); + Log(Log::Normal, "MODE SENSE Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive ctrl.length = ctrl.unit[lun]->ModeSense(ctrl.cmd, ctrl.buffer); ASSERT(ctrl.length >= 0); if (ctrl.length == 0) { Log(Log::Warning, - "サポートしていないMODE SENSEページ $%02X", ctrl.cmd[2]); + "Not supported MODE SENSE page $%02X", ctrl.cmd[2]); - // 失敗(エラー) + // Failure (Error) Error(); return; } - // データインフェーズ + // Data-in Phase DataIn(); } @@ -8510,25 +8516,25 @@ void FASTCALL SCSIDEV::CmdStartStop() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "START STOP UNITコマンド"); + Log(Log::Normal, "START STOP UNIT Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive status = ctrl.unit[lun]->StartStop(ctrl.cmd); if (!status) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // ステータスフェーズ + // status phase Status(); } @@ -8545,25 +8551,25 @@ void FASTCALL SCSIDEV::CmdSendDiag() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "SEND DIAGNOSTICコマンド"); + Log(Log::Normal, "SEND DIAGNOSTIC Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive status = ctrl.unit[lun]->SendDiag(ctrl.cmd); if (!status) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // ステータスフェーズ + // status phase Status(); } @@ -8580,25 +8586,25 @@ void FASTCALL SCSIDEV::CmdRemoval() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "PREVENT/ALLOW MEDIUM REMOVALコマンド"); + Log(Log::Normal, "PREVENT/ALLOW MEDIUM REMOVAL Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive status = ctrl.unit[lun]->Removal(ctrl.cmd); if (!status) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // ステータスフェーズ + // status phase Status(); } @@ -8615,17 +8621,17 @@ void FASTCALL SCSIDEV::CmdReadCapacity() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "READ CAPACITYコマンド"); + Log(Log::Normal, "READ CAPACITY Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive length = ctrl.unit[lun]->ReadCapacity(ctrl.cmd, ctrl.buffer); ASSERT(length >= 0); if (length <= 0) { @@ -8633,10 +8639,10 @@ void FASTCALL SCSIDEV::CmdReadCapacity() return; } - // レングス設定 + // Length setting ctrl.length = length; - // データインフェーズ + // Data-in Phase DataIn(); } @@ -8652,20 +8658,20 @@ void FASTCALL SCSIDEV::CmdRead10() ASSERT(this); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ホストブリッジならメッセージ受信 + // Receive message if host bridge if (ctrl.unit[lun]->GetID() == MAKEID('S', 'C', 'B', 'R')) { CmdGetMessage10(); return; } - // レコード番号とブロック数を取得 + // Get record number and block number record = ctrl.cmd[2]; record <<= 8; record |= ctrl.cmd[3]; @@ -8678,27 +8684,27 @@ void FASTCALL SCSIDEV::CmdRead10() ctrl.blocks |= ctrl.cmd[8]; #if defined(DISK_LOG) - Log(Log::Normal, "READ(10)コマンド レコード=%08X ブロック=%d", record, ctrl.blocks); + Log(Log::Normal, "READ(10) command record=%08X block=%d", record, ctrl.blocks); #endif // DISK_LOG - // ブロック数0は処理しない + // Do not process 0 blocks if (ctrl.blocks == 0) { Status(); return; } - // ドライブでコマンド処理 + // Command processing on drive ctrl.length = ctrl.unit[lun]->Read(ctrl.buffer, record); if (ctrl.length <= 0) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // 次のブロックを設定 + // Set next block ctrl.next = record + 1; - // データインフェーズ + // Data-in Phase DataIn(); } @@ -8714,20 +8720,20 @@ void FASTCALL SCSIDEV::CmdWrite10() ASSERT(this); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ホストブリッジならメッセージ受信 + // Receive message with host bridge if (ctrl.unit[lun]->GetID() == MAKEID('S', 'C', 'B', 'R')) { CmdSendMessage10(); return; } - // レコード番号とブロック数を取得 + // Get record number and block number record = ctrl.cmd[2]; record <<= 8; record |= ctrl.cmd[3]; @@ -8741,27 +8747,27 @@ void FASTCALL SCSIDEV::CmdWrite10() #if defined(DISK_LOG) Log(Log::Normal, - "WRTIE(10)コマンド レコード=%08X ブロック=%d", record, ctrl.blocks); + "WRTIE(10) command record=%08X blocks=%d", record, ctrl.blocks); #endif // DISK_LOG - // ブロック数0は処理しない + // Do not process 0 blocks if (ctrl.blocks == 0) { Status(); return; } - // ドライブでコマンド処理 + // Command processing on drive ctrl.length = ctrl.unit[lun]->WriteCheck(record); if (ctrl.length <= 0) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // 次のブロックを設定 + // Set next block ctrl.next = record + 1; - // データアウトフェーズ + // Data out phase DataOut(); } @@ -8778,25 +8784,25 @@ void FASTCALL SCSIDEV::CmdSeek10() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "SEEK(10)コマンド"); + Log(Log::Normal, "SEEK(10) Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive status = ctrl.unit[lun]->Seek(ctrl.cmd); if (!status) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // ステータスフェーズ + // status phase Status(); } @@ -8813,14 +8819,14 @@ void FASTCALL SCSIDEV::CmdVerify() ASSERT(this); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // レコード番号とブロック数を取得 + // Get record number and block number record = ctrl.cmd[2]; record <<= 8; record |= ctrl.cmd[3]; @@ -8834,42 +8840,42 @@ void FASTCALL SCSIDEV::CmdVerify() #if defined(DISK_LOG) Log(Log::Normal, - "VERIFYコマンド レコード=%08X ブロック=%d", record, ctrl.blocks); + "VERIFY command record=%08X blocks=%d", record, ctrl.blocks); #endif // DISK_LOG - // ブロック数0は処理しない + // Do not process 0 blocks if (ctrl.blocks == 0) { Status(); return; } - // BytChk=0なら + // if BytChk=0 if ((ctrl.cmd[1] & 0x02) == 0) { - // ドライブでコマンド処理 + // Command processing on drive status = ctrl.unit[lun]->Seek(ctrl.cmd); if (!status) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // ステータスフェーズ + // status phase Status(); return; } - // テスト読み込み + // Test loading ctrl.length = ctrl.unit[lun]->Read(ctrl.buffer, record); if (ctrl.length <= 0) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // 次のブロックを設定 + // Set next block ctrl.next = record + 1; - // データアウトフェーズ + // Data out phase DataOut(); } @@ -8884,16 +8890,16 @@ void FASTCALL SCSIDEV::CmdSynchronizeCache() ASSERT(this); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // 成功したことにする(未実装) + // Make it do something (not implemented)... - // ステータスフェーズ + // status phase Status(); } @@ -8909,17 +8915,17 @@ void FASTCALL SCSIDEV::CmdReadDefectData10() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "READ DEFECT DATA(10)コマンド"); + Log(Log::Normal, "READ DEFECT DATA(10) Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive ctrl.length = ctrl.unit[lun]->ReadDefectData10(ctrl.cmd, ctrl.buffer); ASSERT(ctrl.length >= 0); @@ -8928,7 +8934,7 @@ void FASTCALL SCSIDEV::CmdReadDefectData10() return; } - // データインフェーズ + // Data-in Phase DataIn(); } @@ -8943,22 +8949,22 @@ void FASTCALL SCSIDEV::CmdReadToc() ASSERT(this); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive ctrl.length = ctrl.unit[lun]->ReadToc(ctrl.cmd, ctrl.buffer); if (ctrl.length <= 0) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // データインフェーズ + // Data-in Phase DataIn(); } @@ -8974,22 +8980,22 @@ void FASTCALL SCSIDEV::CmdPlayAudio10() ASSERT(this); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive status = ctrl.unit[lun]->PlayAudio(ctrl.cmd); if (!status) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // ステータスフェーズ + // status phase Status(); } @@ -9005,22 +9011,22 @@ void FASTCALL SCSIDEV::CmdPlayAudioMSF() ASSERT(this); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive status = ctrl.unit[lun]->PlayAudioMSF(ctrl.cmd); if (!status) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // ステータスフェーズ + // status phase Status(); } @@ -9036,22 +9042,22 @@ void FASTCALL SCSIDEV::CmdPlayAudioTrack() ASSERT(this); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive status = ctrl.unit[lun]->PlayAudioTrack(ctrl.cmd); if (!status) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // ステータスフェーズ + // status phase Status(); } @@ -9067,25 +9073,25 @@ void FASTCALL SCSIDEV::CmdModeSelect10() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "MODE SELECT10コマンド"); + Log(Log::Normal, "MODE SELECT10 Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive ctrl.length = ctrl.unit[lun]->SelectCheck10(ctrl.cmd); if (ctrl.length <= 0) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // データアウトフェーズ + // Data out phase DataOut(); } @@ -9101,29 +9107,29 @@ void FASTCALL SCSIDEV::CmdModeSense10() ASSERT(this); #if defined(DISK_LOG) - Log(Log::Normal, "MODE SENSE(10)コマンド"); + Log(Log::Normal, "MODE SENSE(10) Command "); #endif // DISK_LOG - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ドライブでコマンド処理 + // Command processing on drive ctrl.length = ctrl.unit[lun]->ModeSense10(ctrl.cmd, ctrl.buffer); ASSERT(ctrl.length >= 0); if (ctrl.length == 0) { Log(Log::Warning, - "サポートしていないMODE SENSE(10)ページ $%02X", ctrl.cmd[2]); + "Not supported MODE SENSE(10) page $%02X", ctrl.cmd[2]); - // 失敗(エラー) + // Failure (Error) Error(); return; } - // データインフェーズ + // Data-in Phase DataIn(); } @@ -9139,41 +9145,41 @@ void FASTCALL SCSIDEV::CmdGetMessage10() ASSERT(this); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ホストブリッジでないならエラー + // Error if not a host bridge if (ctrl.unit[lun]->GetID() != MAKEID('S', 'C', 'B', 'R')) { Error(); return; } - // バッファの再確保(ブロック毎の転送ではないため) + // Reallocate buffer (because it is not transfer for each block) if (ctrl.bufsize < 0x1000000) { free(ctrl.buffer); ctrl.bufsize = 0x1000000; ctrl.buffer = (BYTE *)malloc(ctrl.bufsize); } - // ドライブで処理する + // Process with drive bridge = (SCSIBR*)ctrl.unit[lun]; ctrl.length = bridge->GetMessage10(ctrl.cmd, ctrl.buffer); if (ctrl.length <= 0) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // 次のブロックを設定 + // Set next block ctrl.blocks = 1; ctrl.next = 1; - // リードフェーズ + // Data in phase DataIn(); } @@ -9188,27 +9194,27 @@ void FASTCALL SCSIDEV::CmdSendMessage10() ASSERT(this); - // 論理ユニット + // Logical Unit lun = (ctrl.cmd[1] >> 5) & 0x07; if (!ctrl.unit[lun]) { Error(); return; } - // ホストブリッジでないならエラー + // Error if not a host bridge if (ctrl.unit[lun]->GetID() != MAKEID('S', 'C', 'B', 'R')) { Error(); return; } - // バッファの再確保(ブロック毎の転送ではないため) + // Reallocate buffer (because it is not transfer for each block) if (ctrl.bufsize < 0x1000000) { free(ctrl.buffer); ctrl.bufsize = 0x1000000; ctrl.buffer = (BYTE *)malloc(ctrl.bufsize); } - // 転送量を設定 + // Set transfer amount ctrl.length = ctrl.cmd[6]; ctrl.length <<= 8; ctrl.length |= ctrl.cmd[7]; @@ -9216,28 +9222,28 @@ void FASTCALL SCSIDEV::CmdSendMessage10() ctrl.length |= ctrl.cmd[8]; if (ctrl.length <= 0) { - // 失敗(エラー) + // Failure (Error) Error(); return; } - // 次のブロックを設定 + // Set next block ctrl.blocks = 1; ctrl.next = 1; - // ライトフェーズ + // Light phase DataOut(); } //=========================================================================== // -// データ転送 +// Data Transfer // //=========================================================================== //--------------------------------------------------------------------------- // -// データ送信 +// Send data // //--------------------------------------------------------------------------- void FASTCALL SCSIDEV::Send() @@ -9252,44 +9258,45 @@ void FASTCALL SCSIDEV::Send() ASSERT(ctrl.bus->GetIO()); #ifdef RASCSI - // レングス!=0なら送信 + //if Length! = 0, send if (ctrl.length != 0) { len = ctrl.bus->SendHandShake( &ctrl.buffer[ctrl.offset], ctrl.length); - // 全て送信できなければステータスフェーズへ移行 + // If you cannot send all, move to status phase if (len != (int)ctrl.length) { Error(); return; } - // オフセットとレングス + // offset and length ctrl.offset += ctrl.length; ctrl.length = 0; return; } #else - // オフセットとレングス + // offset and length ASSERT(ctrl.length >= 1); ctrl.offset++; ctrl.length--; - // ACKアサート直後にSendNextでデータ設定済みならリクエストを上げる + // Immediately after ACK is asserted, if the data has been + // set by SendNext, raise the request if (ctrl.length != 0) { - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetREQ(TRUE); return; } #endif // RASCSI - // ブロック減算、リザルト初期化 + // Block subtraction, result initialization ctrl.blocks--; result = TRUE; - // データ引き取り後の処理(リード/データインのみ) + // Processing after data collection (read/data-in only) if (ctrl.phase == BUS::datain) { if (ctrl.blocks != 0) { - // 次のバッファを設定(offset, lengthをセットすること) + // // set next buffer (set offset, length) result = XferIn(ctrl.buffer); #ifndef RASCSI ctrl.bus->SetDAT(ctrl.buffer[ctrl.offset]); @@ -9297,56 +9304,56 @@ void FASTCALL SCSIDEV::Send() } } - // リザルトFALSEなら、ステータスフェーズへ移行 + // If result FALSE, move to status phase if (!result) { Error(); return; } - // ブロック!=0なら送信継続 + // Continue sending if block !=0 if (ctrl.blocks != 0){ ASSERT(ctrl.length > 0); ASSERT(ctrl.offset == 0); #ifndef RASCSI - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetREQ(TRUE); #endif // RASCSI return; } - // 次フェーズに移動 + // Move to next phase switch (ctrl.phase) { - // メッセージインフェーズ + // Message in phase case BUS::msgin: - // IDENTIFYメッセージの拡張メッセージに対する応答送信完了 + // Completed sending response to extended message of IDENTIFY message if (scsi.atnmsg) { - // フラグオフ + // flag off scsi.atnmsg = FALSE; - // コマンドフェーズ + // command phase Command(); } else { - // バスフリーフェーズ + // Bus free phase BusFree(); } break; - // データインフェーズ + // Data-in Phase case BUS::datain: - // ステータスフェーズ + // status phase Status(); break; - // ステータスフェーズ + // status phase case BUS::status: - // メッセージインフェーズ + // Message in phase ctrl.length = 1; ctrl.blocks = 1; ctrl.buffer[0] = (BYTE)ctrl.message; MsgIn(); break; - // その他(ありえない) + // Other (impossible) default: ASSERT(FALSE); break; @@ -9356,21 +9363,21 @@ void FASTCALL SCSIDEV::Send() #ifndef RASCSI //--------------------------------------------------------------------------- // -// データ送信継続 +// Continue data transmission..... // //--------------------------------------------------------------------------- void FASTCALL SCSIDEV::SendNext() { ASSERT(this); - // REQが上がっている + // REQ is up ASSERT(ctrl.bus->GetREQ()); ASSERT(ctrl.bus->GetIO()); - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetREQ(FALSE); - // バッファにデータがあれば先に設定する + // If there is data in the buffer, set it first if (ctrl.length > 1) { ctrl.bus->SetDAT(ctrl.buffer[ctrl.offset + 1]); } @@ -9380,7 +9387,7 @@ void FASTCALL SCSIDEV::SendNext() #ifndef RASCSI //--------------------------------------------------------------------------- // -// データ受信 +// Receive data // //--------------------------------------------------------------------------- void FASTCALL SCSIDEV::Receive() @@ -9389,25 +9396,25 @@ void FASTCALL SCSIDEV::Receive() ASSERT(this); - // REQが上がっている + // Req is up ASSERT(ctrl.bus->GetREQ()); ASSERT(!ctrl.bus->GetIO()); - // データ取得 + // Get data data = (DWORD)ctrl.bus->GetDAT(); - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetREQ(FALSE); switch (ctrl.phase) { - // コマンドフェーズ + // Command phase case BUS::command: ctrl.cmd[ctrl.offset] = data; #if defined(DISK_LOG) - Log(Log::Normal, "コマンドフェーズ $%02X", data); + Log(Log::Normal, "Command phase $%02X", data); #endif // DISK_LOG - // 最初のデータ(オフセット0)によりレングスを再設定 + // Set the length again with the first data (offset 0) if (ctrl.offset == 0) { if (ctrl.cmd[0] >= 0x20) { // 10バイトCDB @@ -9416,20 +9423,20 @@ void FASTCALL SCSIDEV::Receive() } break; - // メッセージアウトフェーズ + // Message out phase case BUS::msgout: ctrl.message = data; #if defined(DISK_LOG) - Log(Log::Normal, "メッセージアウトフェーズ $%02X", data); + Log(Log::Normal, "Message out phase $%02X", data); #endif // DISK_LOG break; - // データアウトフェーズ + // Data out phase case BUS::dataout: ctrl.buffer[ctrl.offset] = (BYTE)data; break; - // その他(ありえない) + // Other (impossible) default: ASSERT(FALSE); break; @@ -9440,14 +9447,14 @@ void FASTCALL SCSIDEV::Receive() #ifdef RASCSI //--------------------------------------------------------------------------- // -// データ受信 +// Receive Data // //--------------------------------------------------------------------------- void FASTCALL SCSIDEV::Receive() #else //--------------------------------------------------------------------------- // -// データ受信継続 +// Continue receiving data // //--------------------------------------------------------------------------- void FASTCALL SCSIDEV::ReceiveNext() @@ -9462,70 +9469,70 @@ void FASTCALL SCSIDEV::ReceiveNext() ASSERT(this); - // REQが下がっていること + // REQ is low ASSERT(!ctrl.bus->GetREQ()); ASSERT(!ctrl.bus->GetIO()); #ifdef RASCSI - // レングス!=0なら受信 + // Length != 0 if received if (ctrl.length != 0) { - // 受信 + // Receive len = ctrl.bus->ReceiveHandShake( &ctrl.buffer[ctrl.offset], ctrl.length); - // 全て受信できなければステータスフェーズへ移行 + // If not able to receive all, move to status phase if (len != (int)ctrl.length) { Error(); return; } - // オフセットとレングス + // Offset and Length ctrl.offset += ctrl.length; ctrl.length = 0;; return; } #else - // オフセットとレングス + // Offset and Length ASSERT(ctrl.length >= 1); ctrl.offset++; ctrl.length--; - // レングス!=0なら、再びreqをセット + // If length!=0, set req again if (ctrl.length != 0) { - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetREQ(TRUE); return; } #endif // RASCSI - // ブロック減算、リザルト初期化 + // Block subtraction, result initialization ctrl.blocks--; result = TRUE; - // データ受理後の処理(フェーズ別) + // Processing after receiving data (by phase) switch (ctrl.phase) { - // データアウトフェーズ + // Data out phase case BUS::dataout: if (ctrl.blocks == 0) { - // このバッファで終了 + // End with this buffer result = XferOut(FALSE); } else { - // 次のバッファに続く(offset, lengthをセットすること) + // Continue to next buffer (set offset, length) result = XferOut(TRUE); } break; - // メッセージアウトフェーズ + // Message out phase case BUS::msgout: ctrl.message = ctrl.buffer[0]; if (!XferMsg(ctrl.message)) { - // メッセージアウトに失敗したら、即座にバスフリー + // Immediately free the bus if message output fails BusFree(); return; } - // メッセージインに備え、メッセージデータをクリアしておく + // Clear message data in preparation for message-in ctrl.message = 0x00; break; @@ -9533,73 +9540,73 @@ void FASTCALL SCSIDEV::ReceiveNext() break; } - // リザルトFALSEなら、ステータスフェーズへ移行 + // If result FALSE, move to status phase if (!result) { Error(); return; } - // ブロック!=0なら受信継続 + // Continue to receive if block !=0 if (ctrl.blocks != 0){ ASSERT(ctrl.length > 0); ASSERT(ctrl.offset == 0); #ifndef RASCSI - // ターゲットが操作する信号線 + // Signal line operated by the target ctrl.bus->SetREQ(TRUE); #endif // RASCSI return; } - // 次フェーズに移動 + // Move to next phase switch (ctrl.phase) { - // コマンドフェーズ + // Command phase case BUS::command: #ifdef RASCSI - // コマンドデータ転送 + // Command data transfer len = 6; if (ctrl.buffer[0] >= 0x20 && ctrl.buffer[0] <= 0x7D) { - // 10バイトCDB + // 10 byte CDB len = 10; } for (i = 0; i < len; i++) { ctrl.cmd[i] = (DWORD)ctrl.buffer[i]; #if defined(DISK_LOG) - Log(Log::Normal, "コマンド $%02X", ctrl.cmd[i]); + Log(Log::Normal, "Command $%02X", ctrl.cmd[i]); #endif // DISK_LOG } #endif // RASCSI - // 実行フェーズ + // Execution Phase Execute(); break; - // メッセージアウトフェーズ + // Message out phase case BUS::msgout: - // ATNがアサートし続ける限りメッセージアウトフェーズを継続 + // Continue message out phase as long as ATN keeps asserting if (ctrl.bus->GetATN()) { - // データ転送は1バイトx1ブロック + // Data transfer is 1 byte x 1 block ctrl.offset = 0; ctrl.length = 1; ctrl.blocks = 1; #ifndef RASCSI - // メッセージを要求 + // Request message ctrl.bus->SetREQ(TRUE); #endif // RASCSI return; } - // ATNで送信されたメッセージの解析 + // Parsing messages sent by ATN if (scsi.atnmsg) { i = 0; while (i < scsi.msc) { - // メッセージの種類 + // Message type data = scsi.msb[i]; // ABORT if (data == 0x06) { #if defined(DISK_LOG) Log(Log::Normal, - "メッセージコード ABORT $%02X", data); + "Message code ABORT $%02X", data); #endif // DISK_LOG BusFree(); return; @@ -9609,7 +9616,7 @@ void FASTCALL SCSIDEV::ReceiveNext() if (data == 0x0C) { #if defined(DISK_LOG) Log(Log::Normal, - "メッセージコード BUS DEVICE RESET $%02X", data); + "Message code BUS DEVICE RESET $%02X", data); #endif // DISK_LOG scsi.syncoffset = 0; BusFree(); @@ -9620,18 +9627,18 @@ void FASTCALL SCSIDEV::ReceiveNext() if (data >= 0x80) { #if defined(DISK_LOG) Log(Log::Normal, - "メッセージコード IDENTIFY $%02X", data); + "Message code IDENTIFY $%02X", data); #endif // DISK_LOG } - // 拡張メッセージ + // Extended Message if (data == 0x01) { #if defined(DISK_LOG) Log(Log::Normal, - "メッセージコード EXTENDED MESSAGE $%02X", data); + "Message code EXTENDED MESSAGE $%02X", data); #endif // DISK_LOG - // 同期転送が可能な時だけチェック + // Check only when synchronous transfer is possible if (!scsi.syncenable || scsi.msb[i + 2] != 0x01) { ctrl.length = 1; ctrl.blocks = 1; @@ -9640,19 +9647,19 @@ void FASTCALL SCSIDEV::ReceiveNext() return; } - // Transfer period factor(50 x 4 = 200nsに制限) + // Transfer period factor (limited to 50 x 4 = 200ns) scsi.syncperiod = scsi.msb[i + 3]; if (scsi.syncperiod > 50) { scsi.syncoffset = 50; } - // REQ/ACK offset(16に制限) + // REQ/ACK offset(limited to 16) scsi.syncoffset = scsi.msb[i + 4]; if (scsi.syncoffset > 16) { scsi.syncoffset = 16; } - // STDR応答メッセージ生成 + // STDR response message generation ctrl.length = 5; ctrl.blocks = 1; ctrl.buffer[0] = 0x01; @@ -9664,28 +9671,28 @@ void FASTCALL SCSIDEV::ReceiveNext() return; } - // 次へ + // next i++; } } - // ATNメッセージ受信スタータス初期化 + // Initialize ATN message reception status scsi.atnmsg = FALSE; - // コマンドフェーズ + // Command phase Command(); break; - // データアウトフェーズ + // Data out phase case BUS::dataout: - // フラッシュ + // Flush unit FlushUnit(); - // ステータスフェーズ + // status phase Status(); break; - // その他(ありえない) + // Other (impossible) default: ASSERT(FALSE); break; @@ -9694,7 +9701,7 @@ void FASTCALL SCSIDEV::ReceiveNext() //--------------------------------------------------------------------------- // -// データ転送MSG +// Transfer MSG // //--------------------------------------------------------------------------- BOOL FASTCALL SCSIDEV::XferMsg(DWORD msg) @@ -9702,7 +9709,7 @@ BOOL FASTCALL SCSIDEV::XferMsg(DWORD msg) ASSERT(this); ASSERT(ctrl.phase == BUS::msgout); - // メッセージアウトデータの保存 + // Save message out data if (scsi.atnmsg) { scsi.msb[scsi.msc] = (BYTE)msg; scsi.msc++; diff --git a/src/raspberrypi/disk.h b/src/raspberrypi/disk.h index a539c905..40cb35e0 100644 --- a/src/raspberrypi/disk.h +++ b/src/raspberrypi/disk.h @@ -9,8 +9,9 @@ // Copyright (C) 2010-2015 isaki@NetBSD.org // // Imported sava's Anex86/T98Next image and MO format support patch. +// Comments translated to english by akuker. // -// [ ディスク ] +// [ Disk ] // //--------------------------------------------------------------------------- @@ -22,12 +23,12 @@ //--------------------------------------------------------------------------- // -// エラー定義(REQUEST SENSEで返されるセンスコード) +// Error definition (sense code returned by REQUEST SENSE) // -// MSB 予約(0x00) -// センスキー -// 拡張センスコード(ASC) -// LSB 拡張センスコードクォリファイア(ASCQ) +// MSB Reserved (0x00) +// Sense Key +// Additional Sense Code (ASC) +// LSB Additional Sense Code Qualifier(ASCQ) // //--------------------------------------------------------------------------- #define DISK_NOERROR 0x00000000 // NO ADDITIONAL SENSE INFO. @@ -60,549 +61,549 @@ //=========================================================================== // -// ディスクトラック +// Disk Track // //=========================================================================== class DiskTrack { public: - // 内部データ定義 + // Internal data definition typedef struct { - int track; // トラックナンバー - int size; // セクタサイズ(8 or 9) - int sectors; // セクタ数(<=0x100) - DWORD length; // データバッファ長 - BYTE *buffer; // データバッファ - BOOL init; // ロード済みか - BOOL changed; // 変更済みフラグ - DWORD maplen; // 変更済みマップ長 - BOOL *changemap; // 変更済みマップ - BOOL raw; // RAWモード - off64_t imgoffset; // 実データまでのオフセット + int track; // Track Number + int size; // Sector Size(8 or 9) + int sectors; // Number of sectors(<=0x100) + DWORD length; // Data buffer length + BYTE *buffer; // Data buffer + BOOL init; // Is it initilized? + BOOL changed; // Changed flag + DWORD maplen; // Changed map length + BOOL *changemap; // Changed map + BOOL raw; // RAW mode flag + off64_t imgoffset; // Offset to actual data } disktrk_t; public: - // 基本ファンクション + // Basic Functions DiskTrack(); - // コンストラクタ + // Constructor virtual ~DiskTrack(); - // デストラクタ + // Destructor void FASTCALL Init(int track, int size, int sectors, BOOL raw = FALSE, off64_t imgoff = 0); - // 初期化 + // Initialization BOOL FASTCALL Load(const Filepath& path); - // ロード + // Load BOOL FASTCALL Save(const Filepath& path); - // セーブ + // Save - // リード・ライト + // Read / Write BOOL FASTCALL Read(BYTE *buf, int sec) const; - // セクタリード + // Sector Read BOOL FASTCALL Write(const BYTE *buf, int sec); - // セクタライト + // Sector Write - // その他 + // Other int FASTCALL GetTrack() const { return dt.track; } - // トラック取得 + // Get track BOOL FASTCALL IsChanged() const { return dt.changed; } - // 変更フラグチェック + // Changed flag check private: - // 内部データ + // Internal data disktrk_t dt; - // 内部データ + // Internal data }; //=========================================================================== // -// ディスクキャッシュ +// Disk Cache // //=========================================================================== class DiskCache { public: - // 内部データ定義 + // Internal data definition typedef struct { - DiskTrack *disktrk; // 割り当てトラック - DWORD serial; // 最終シリアル + DiskTrack *disktrk; // Disk Track + DWORD serial; // Serial } cache_t; - // キャッシュ数 + // Number of caches enum { - CacheMax = 16 // キャッシュするトラック数 + CacheMax = 16 // Number of tracks to cache }; public: - // 基本ファンクション + // Basic Functions DiskCache(const Filepath& path, int size, int blocks, off64_t imgoff = 0); - // コンストラクタ + // Constructor virtual ~DiskCache(); - // デストラクタ + // Destructor void FASTCALL SetRawMode(BOOL raw); - // CD-ROM rawモード設定 + // CD-ROM raw mode setting - // アクセス + // Access BOOL FASTCALL Save(); - // 全セーブ&解放 + // Save and release all BOOL FASTCALL Read(BYTE *buf, int block); - // セクタリード + // Sector Read BOOL FASTCALL Write(const BYTE *buf, int block); - // セクタライト + // Sector Write BOOL FASTCALL GetCache(int index, int& track, DWORD& serial) const; - // キャッシュ情報取得 + // Get cache information private: - // 内部管理 + // Internal Management void FASTCALL Clear(); - // トラックをすべてクリア + // Clear all tracks DiskTrack* FASTCALL Assign(int track); - // トラックのロード + // Load track BOOL FASTCALL Load(int index, int track, DiskTrack *disktrk = NULL); - // トラックのロード + // Load track void FASTCALL Update(); - // シリアル番号更新 + // Update serial number - // 内部データ + // Internal data cache_t cache[CacheMax]; - // キャッシュ管理 + // Cache management DWORD serial; - // 最終アクセスシリアルナンバ + // Last serial number Filepath sec_path; - // パス + // Path int sec_size; - // セクタサイズ(8 or 9 or 11) + // Sector size (8 or 9 or 11) int sec_blocks; - // セクタブロック数 + // Blocks per sector BOOL cd_raw; - // CD-ROM RAWモード + // CD-ROM RAW mode off64_t imgoffset; - // 実データまでのオフセット + // Offset to actual data }; //=========================================================================== // -// ディスク +// Disk // //=========================================================================== class Disk { public: - // 内部ワーク + // Internal data structure typedef struct { - DWORD id; // メディアID - BOOL ready; // 有効なディスク - BOOL writep; // 書き込み禁止 - BOOL readonly; // 読み込み専用 - BOOL removable; // 取り外し - BOOL lock; // ロック - BOOL attn; // アテンション - BOOL reset; // リセット - int size; // セクタサイズ - DWORD blocks; // 総セクタ数 + DWORD id; // Media ID + BOOL ready; // Valid Disk + BOOL writep; // Write protected + BOOL readonly; // Read only + BOOL removable; // Removable + BOOL lock; // Locked + BOOL attn; // Attention + BOOL reset; // Reset + int size; // Sector Size + DWORD blocks; // Total number of sectors DWORD lun; // LUN - DWORD code; // ステータスコード - DiskCache *dcache; // ディスクキャッシュ - off64_t imgoffset; // 実データまでのオフセット + DWORD code; // Status code + DiskCache *dcache; // Disk cache + off64_t imgoffset; // Offset to actual data } disk_t; public: - // 基本ファンクション + // Basic Functions Disk(); - // コンストラクタ + // Constructor virtual ~Disk(); - // デストラクタ + // Destructor virtual void FASTCALL Reset(); - // デバイスリセット + // Device Reset #ifndef RASCSI virtual BOOL FASTCALL Save(Fileio *fio, int ver); - // セーブ + // Save virtual BOOL FASTCALL Load(Fileio *fio, int ver); - // ロード + // Load #endif // RASCSI // ID DWORD FASTCALL GetID() const { return disk.id; } - // メディアID取得 + // Get media ID BOOL FASTCALL IsNULL() const; - // NULLチェック + // NULL check BOOL FASTCALL IsSASI() const; - // SASIチェック + // SASI Check - // メディア操作 + // Media Operations virtual BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE); - // オープン + // Open void FASTCALL GetPath(Filepath& path) const; - // パス取得 + // Get the path void FASTCALL Eject(BOOL force); - // イジェクト + // Eject BOOL FASTCALL IsReady() const { return disk.ready; } - // Readyチェック + // Ready check void FASTCALL WriteP(BOOL flag); - // 書き込み禁止 + // Set Write Protect flag BOOL FASTCALL IsWriteP() const { return disk.writep; } - // 書き込み禁止チェック + // Get write protect flag BOOL FASTCALL IsReadOnly() const { return disk.readonly; } - // Read Onlyチェック + // Get read only flag BOOL FASTCALL IsRemovable() const { return disk.removable; } - // リムーバブルチェック + // Get is removable flag BOOL FASTCALL IsLocked() const { return disk.lock; } - // ロックチェック + // Get locked status BOOL FASTCALL IsAttn() const { return disk.attn; } - // 交換チェック + // Get attention flag BOOL FASTCALL Flush(); - // キャッシュフラッシュ + // Flush the cache void FASTCALL GetDisk(disk_t *buffer) const; - // 内部ワーク取得 + // Get the internal data struct - // プロパティ + // Properties void FASTCALL SetLUN(DWORD lun) { disk.lun = lun; } - // LUNセット + // LUN set DWORD FASTCALL GetLUN() { return disk.lun; } - // LUN取得 - // コマンド + // LUN get + // commands virtual int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor); - // INQUIRYコマンド + // INQUIRY command virtual int FASTCALL RequestSense(const DWORD *cdb, BYTE *buf); - // REQUEST SENSEコマンド + // REQUEST SENSE command int FASTCALL SelectCheck(const DWORD *cdb); - // SELECTチェック + // SELECT check int FASTCALL SelectCheck10(const DWORD *cdb); - // SELECT(10)チェック + // SELECT(10) check virtual BOOL FASTCALL ModeSelect(const DWORD *cdb, const BYTE *buf, int length); - // MODE SELECTコマンド + // MODE SELECT command virtual int FASTCALL ModeSense(const DWORD *cdb, BYTE *buf); - // MODE SENSEコマンド + // MODE SENSE command virtual int FASTCALL ModeSense10(const DWORD *cdb, BYTE *buf); - // MODE SENSE(10)コマンド + // MODE SENSE(10) command int FASTCALL ReadDefectData10(const DWORD *cdb, BYTE *buf); - // READ DEFECT DATA(10)コマンド + // READ DEFECT DATA(10) command virtual BOOL FASTCALL TestUnitReady(const DWORD *cdb); - // TEST UNIT READYコマンド + // TEST UNIT READY command BOOL FASTCALL Rezero(const DWORD *cdb); - // REZEROコマンド + // REZERO command BOOL FASTCALL Format(const DWORD *cdb); - // FORMAT UNITコマンド + // FORMAT UNIT command BOOL FASTCALL Reassign(const DWORD *cdb); - // REASSIGN UNITコマンド + // REASSIGN UNIT command virtual int FASTCALL Read(BYTE *buf, DWORD block); - // READコマンド + // READ command int FASTCALL WriteCheck(DWORD block); - // WRITEチェック + // WRITE check BOOL FASTCALL Write(const BYTE *buf, DWORD block); - // WRITEコマンド + // WRITE command BOOL FASTCALL Seek(const DWORD *cdb); - // SEEKコマンド + // SEEK command BOOL FASTCALL Assign(const DWORD *cdb); - // ASSIGNコマンド + // ASSIGN command BOOL FASTCALL Specify(const DWORD *cdb); - // SPECIFYコマンド + // SPECIFY command BOOL FASTCALL StartStop(const DWORD *cdb); - // START STOP UNITコマンド + // START STOP UNIT command BOOL FASTCALL SendDiag(const DWORD *cdb); - // SEND DIAGNOSTICコマンド + // SEND DIAGNOSTIC command BOOL FASTCALL Removal(const DWORD *cdb); - // PREVENT/ALLOW MEDIUM REMOVALコマンド + // PREVENT/ALLOW MEDIUM REMOVAL command int FASTCALL ReadCapacity(const DWORD *cdb, BYTE *buf); - // READ CAPACITYコマンド + // READ CAPACITY command BOOL FASTCALL Verify(const DWORD *cdb); - // VERIFYコマンド + // VERIFY command virtual int FASTCALL ReadToc(const DWORD *cdb, BYTE *buf); - // READ TOCコマンド + // READ TOC command virtual BOOL FASTCALL PlayAudio(const DWORD *cdb); - // PLAY AUDIOコマンド + // PLAY AUDIO command virtual BOOL FASTCALL PlayAudioMSF(const DWORD *cdb); - // PLAY AUDIO MSFコマンド + // PLAY AUDIO MSF command virtual BOOL FASTCALL PlayAudioTrack(const DWORD *cdb); - // PLAY AUDIO TRACKコマンド + // PLAY AUDIO TRACK command void FASTCALL InvalidCmd() { disk.code = DISK_INVALIDCMD; } - // サポートしていないコマンド + // Unsupported command - // その他 + // Other BOOL IsCacheWB() { return cache_wb; } - // キャッシュモード取得 + // Get cache writeback mode void SetCacheWB(BOOL enable) { cache_wb = enable; } - // キャッシュモード設定 + // Set cache writeback mode protected: - // サブ処理 + // Internal processing virtual int FASTCALL AddError(BOOL change, BYTE *buf); - // エラーページ追加 + // Add error virtual int FASTCALL AddFormat(BOOL change, BYTE *buf); - // フォーマットページ追加 + // Add format virtual int FASTCALL AddDrive(BOOL change, BYTE *buf); - // ドライブページ追加 + // Add drive int FASTCALL AddOpt(BOOL change, BYTE *buf); - // オプティカルページ追加 + // Add optical int FASTCALL AddCache(BOOL change, BYTE *buf); - // キャッシュページ追加 + // Add cache int FASTCALL AddCDROM(BOOL change, BYTE *buf); - // CD-ROMページ追加 + // Add CD-ROM int FASTCALL AddCDDA(BOOL change, BYTE *buf); - // CD-DAページ追加 + // Add CD_DA virtual int FASTCALL AddVendor(int page, BOOL change, BYTE *buf); - // ベンダ特殊ページ追加 + // Add vendor special info BOOL FASTCALL CheckReady(); - // レディチェック + // Check if ready - // 内部データ + // Internal data disk_t disk; - // ディスク内部データ + // Internal disk data Filepath diskpath; - // パス(GetPath用) + // File path (for GetPath) BOOL cache_wb; - // キャッシュモード + // Cache mode }; //=========================================================================== // -// SASI ハードディスク +// SASI Hard Disk // //=========================================================================== class SASIHD : public Disk { public: - // 基本ファンクション + // Basic Functions SASIHD(); - // コンストラクタ + // Constructor void FASTCALL Reset(); - // リセット + // Reset BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE); - // オープン - // コマンド + // Open + // commands int FASTCALL RequestSense(const DWORD *cdb, BYTE *buf); - // REQUEST SENSEコマンド + // REQUEST SENSE command }; //=========================================================================== // -// SCSI ハードディスク +// SCSI Hard Disk // //=========================================================================== class SCSIHD : public Disk { public: - // 基本ファンクション + // Basic Functions SCSIHD(); - // コンストラクタ + // Constructor void FASTCALL Reset(); - // リセット + // Reset BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE); - // オープン + // Open - // コマンド + // commands int FASTCALL Inquiry( const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor); - // INQUIRYコマンド + // INQUIRY command BOOL FASTCALL ModeSelect(const DWORD *cdb, const BYTE *buf, int length); - // MODE SELECT(6)コマンド + // MODE SELECT(6) command }; //=========================================================================== // -// SCSI ハードディスク(PC-9801-55 NEC純正/Anex86/T98Next) +// SCSI hard disk (PC-9801-55 NEC genuine /Anex86/T98Next) // //=========================================================================== class SCSIHD_NEC : public SCSIHD { public: - // 基本ファンクション + // Basic Functions SCSIHD_NEC(); - // コンストラクタ + // Constructor BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE); - // オープン + // Open - // コマンド + // commands int FASTCALL Inquiry( const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor); - // INQUIRYコマンド + // INQUIRY command - // サブ処理 + // Internal processing int FASTCALL AddError(BOOL change, BYTE *buf); - // エラーページ追加 + // Add error int FASTCALL AddFormat(BOOL change, BYTE *buf); - // フォーマットページ追加 + // Add format int FASTCALL AddDrive(BOOL change, BYTE *buf); - // ドライブページ追加 + // Add drive private: int cylinders; - // シリンダ数 + // Number of cylinders int heads; - // ヘッド数 + // Number of heads int sectors; - // セクタ数 + // Number of sectors int sectorsize; - // セクタサイズ + // Sector size off64_t imgoffset; - // イメージオフセット + // Image offset off64_t imgsize; - // イメージサイズ + // Image size }; //=========================================================================== // -// SCSI ハードディスク(Macintosh Apple純正) +// SCSI Hard Disk(Genuine Apple Macintosh) // //=========================================================================== class SCSIHD_APPLE : public SCSIHD { public: - // 基本ファンクション + // Basic Functions SCSIHD_APPLE(); - // コンストラクタ - // コマンド + // Constructor + // commands int FASTCALL Inquiry( const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor); - // INQUIRYコマンド + // INQUIRY command - // サブ処理 + // Internal processing int FASTCALL AddVendor(int page, BOOL change, BYTE *buf); - // ベンダ特殊ページ追加 + // Add vendor special page }; //=========================================================================== // -// SCSI 光磁気ディスク +// SCSI magneto-optical disk // //=========================================================================== class SCSIMO : public Disk { public: - // 基本ファンクション + // Basic Functions SCSIMO(); - // コンストラクタ + // Constructor BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE); - // オープン + // Open #ifndef RASCSI BOOL FASTCALL Load(Fileio *fio, int ver); - // ロード + // Load #endif // RASCSI - // コマンド + // commands int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor); - // INQUIRYコマンド + // INQUIRY command BOOL FASTCALL ModeSelect(const DWORD *cdb, const BYTE *buf, int length); - // MODE SELECT(6)コマンド + // MODE SELECT(6) command - // サブ処理 + // Internal processing int FASTCALL AddVendor(int page, BOOL change, BYTE *buf); - // ベンダ特殊ページ追加 + // Add vendor special page }; //--------------------------------------------------------------------------- // -// クラス先行定義 +// Class precedence definition // //--------------------------------------------------------------------------- class SCSICD; //=========================================================================== // -// CD-ROM トラック +// CD-ROM Track // //=========================================================================== class CDTrack { public: - // 基本ファンクション + // Basic Functions CDTrack(SCSICD *scsicd); - // コンストラクタ + // Constructor virtual ~CDTrack(); - // デストラクタ + // Destructor BOOL FASTCALL Init(int track, DWORD first, DWORD last); - // 初期化 + // Initialization - // プロパティ + // Properties void FASTCALL SetPath(BOOL cdda, const Filepath& path); - // パス設定 + // Set the path void FASTCALL GetPath(Filepath& path) const; - // パス取得 + // Get the path void FASTCALL AddIndex(int index, DWORD lba); - // インデックス追加 + // Add index DWORD FASTCALL GetFirst() const; - // 開始LBA取得 + // Get the start LBA DWORD FASTCALL GetLast() const; - // 終端LBA取得 + // Get the last LBA DWORD FASTCALL GetBlocks() const; - // ブロック数取得 + // Get the number of blocks int FASTCALL GetTrackNo() const; - // トラック番号取得 + // Get the track number BOOL FASTCALL IsValid(DWORD lba) const; - // 有効なLBAか + // Is this a valid LBA? BOOL FASTCALL IsAudio() const; - // オーディオトラックか + // Is this an audio track? private: SCSICD *cdrom; - // 親デバイス + // Parent device BOOL valid; - // 有効なトラック + // Valid track int track_no; - // トラック番号 + // Track number DWORD first_lba; - // 開始LBA + // First LBA DWORD last_lba; - // 終了LBA + // Last LBA BOOL audio; - // オーディオトラックフラグ + // Audio track flag BOOL raw; - // RAWデータフラグ + // RAW data flag Filepath imgpath; - // イメージファイルパス + // Image file path }; //=========================================================================== // -// CD-DA バッファ +// CD-DA Buffer // //=========================================================================== class CDDABuf { public: - // 基本ファンクション + // Basic Functions CDDABuf(); - // コンストラクタ + // Constructor virtual ~CDDABuf(); - // デストラクタ + // Destructor #if 0 BOOL Init(); - // 初期化 + // Initialization BOOL FASTCALL Load(const Filepath& path); - // ロード + // Load BOOL FASTCALL Save(const Filepath& path); - // セーブ + // Save // API void FASTCALL Clear(); - // バッファクリア + // Clear the buffer BOOL FASTCALL Open(Filepath& path); - // ファイル指定 + // File specification BOOL FASTCALL GetBuf(DWORD *buffer, int frames); - // バッファ取得 + // Get the buffer BOOL FASTCALL IsValid(); - // 有効チェック + // Check if Valid BOOL FASTCALL ReadReq(); - // 読み込み要求 + // Read Request BOOL FASTCALL IsEnd() const; - // 終了チェック + // Finish check private: Filepath wavepath; - // Waveパス + // Wave path BOOL valid; - // オープン結果 + // Open result (is it valid?) DWORD *buf; - // データバッファ + // Data buffer DWORD read; - // Readポインタ + // Read pointer DWORD write; - // Writeポインタ + // Write pointer DWORD num; - // データ有効数 + // Valid number of data DWORD rest; - // ファイル残りサイズ + // Remaining file size #endif }; @@ -614,95 +615,95 @@ private: class SCSICD : public Disk { public: - // トラック数 + // Number of tracks enum { - TrackMax = 96 // トラック最大数 + TrackMax = 96 // Maximum number of tracks }; public: - // 基本ファンクション + // Basic Functions SCSICD(); - // コンストラクタ + // Constructor virtual ~SCSICD(); - // デストラクタ + // Destructor BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE); - // オープン + // Open #ifndef RASCSI BOOL FASTCALL Load(Fileio *fio, int ver); - // ロード + // Load #endif // RASCSI - // コマンド + // commands int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor); - // INQUIRYコマンド + // INQUIRY command int FASTCALL Read(BYTE *buf, DWORD block); - // READコマンド + // READ command int FASTCALL ReadToc(const DWORD *cdb, BYTE *buf); - // READ TOCコマンド + // READ TOC command BOOL FASTCALL PlayAudio(const DWORD *cdb); - // PLAY AUDIOコマンド + // PLAY AUDIO command BOOL FASTCALL PlayAudioMSF(const DWORD *cdb); - // PLAY AUDIO MSFコマンド + // PLAY AUDIO MSF command BOOL FASTCALL PlayAudioTrack(const DWORD *cdb); - // PLAY AUDIO TRACKコマンド + // PLAY AUDIO TRACK command // CD-DA BOOL FASTCALL NextFrame(); - // フレーム通知 + // Frame notification void FASTCALL GetBuf(DWORD *buffer, int samples, DWORD rate); - // CD-DAバッファ取得 + // Get CD-DA buffer // LBA-MSF変換 void FASTCALL LBAtoMSF(DWORD lba, BYTE *msf) const; - // LBA→MSF変換 + // LBA→MSF conversion DWORD FASTCALL MSFtoLBA(const BYTE *msf) const; - // MSF→LBA変換 + // MSF→LBA conversion private: - // オープン + // Open BOOL FASTCALL OpenCue(const Filepath& path); - // オープン(CUE) + // Open(CUE) BOOL FASTCALL OpenIso(const Filepath& path); - // オープン(ISO) + // Open(ISO) BOOL FASTCALL OpenPhysical(const Filepath& path); - // オープン(Physical) + // Open(Physical) BOOL rawfile; - // RAWフラグ + // RAW flag - // トラック管理 + // Track management void FASTCALL ClearTrack(); - // トラッククリア + // Clear the track int FASTCALL SearchTrack(DWORD lba) const; - // トラック検索 + // Track search CDTrack* track[TrackMax]; - // トラックオブジェクト + // Track opbject references int tracks; - // トラックオブジェクト有効数 + // Effective number of track objects int dataindex; - // 現在のデータトラック + // Current data track int audioindex; - // 現在のオーディオトラック + // Current audio track int frame; - // フレーム番号 + // Frame number #if 0 CDDABuf da_buf; - // CD-DAバッファ + // CD-DA buffer int da_num; - // CD-DAトラック数 + // Number of CD-DA tracks int da_cur; - // CD-DAカレントトラック + // CD-DA current track int da_next; - // CD-DAネクストトラック + // CD-DA next track BOOL da_req; - // CD-DAデータ要求 + // CD-DA data request #endif }; //=========================================================================== // -// SCSI ホストブリッジ +// SCSI Host Bridge // //=========================================================================== #if defined(RASCSI) && !defined(BAREMETAL) @@ -712,430 +713,429 @@ class CFileSys; class SCSIBR : public Disk { public: - // 基本ファンクション + // Basic Functions SCSIBR(); - // コンストラクタ + // Constructor virtual ~SCSIBR(); - // デストラクタ + // Destructor - // コマンド + // commands int FASTCALL Inquiry(const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor); - // INQUIRYコマンド + // INQUIRY command BOOL FASTCALL TestUnitReady(const DWORD *cdb); - // TEST UNIT READYコマンド + // TEST UNIT READY command int FASTCALL GetMessage10(const DWORD *cdb, BYTE *buf); - // GET MESSAGE10コマンド + // GET MESSAGE10 command BOOL FASTCALL SendMessage10(const DWORD *cdb, BYTE *buf); - // SEND MESSAGE10コマンド + // SEND MESSAGE10 command private: #if defined(RASCSI) && !defined(BAREMETAL) int FASTCALL GetMacAddr(BYTE *buf); - // MACアドレス取得 + // Get MAC address void FASTCALL SetMacAddr(BYTE *buf); - // MACアドレス設定 + // Set MAC address void FASTCALL ReceivePacket(); - // パケット受信 + // Receive a packet void FASTCALL GetPacketBuf(BYTE *buf); - // パケット取得 + // Get a packet void FASTCALL SendPacket(BYTE *buf, int len); - // パケット送信 + // Send a packet CTapDriver *tap; - // TAPドライバ + // TAP driver BOOL m_bTapEnable; - // TAP有効フラグ + // TAP valid flag BYTE mac_addr[6]; - // MACアドレス + // MAC Addres int packet_len; - // 受信パケットサイズ + // Receive packet size BYTE packet_buf[0x1000]; - // 受信パケットバッファ + // Receive packet buffer BOOL packet_enable; - // 受信パケット有効 + // Received packet valid #endif // RASCSI && !BAREMETAL int FASTCALL ReadFsResult(BYTE *buf); - // ファイルシステム読み込み(結果コード) + // Read filesystem (result code) int FASTCALL ReadFsOut(BYTE *buf); - // ファイルシステム読み込み(返却データ) + // Read filesystem (return data) int FASTCALL ReadFsOpt(BYTE *buf); - // ファイルシステム読み込み(オプションデータ) + // Read file system (optional data) void FASTCALL WriteFs(int func, BYTE *buf); - // ファイルシステム書き込み(実行) + // File system write (execute) void FASTCALL WriteFsOpt(BYTE *buf, int len); - // ファイルシステム書き込み(オプションデータ) - - // コマンドハンドラ + // File system write (optional data) + // Command handlers void FASTCALL FS_InitDevice(BYTE *buf); - // $40 - デバイス起動 + // $40 - boot void FASTCALL FS_CheckDir(BYTE *buf); - // $41 - ディレクトリチェック + // $41 - directory check void FASTCALL FS_MakeDir(BYTE *buf); - // $42 - ディレクトリ作成 + // $42 - create directory void FASTCALL FS_RemoveDir(BYTE *buf); - // $43 - ディレクトリ削除 + // $43 - delete directory void FASTCALL FS_Rename(BYTE *buf); - // $44 - ファイル名変更 + // $44 - change filename void FASTCALL FS_Delete(BYTE *buf); - // $45 - ファイル削除 + // $45 - delete file void FASTCALL FS_Attribute(BYTE *buf); - // $46 - ファイル属性取得/設定 + // $46 - get/set file attributes void FASTCALL FS_Files(BYTE *buf); - // $47 - ファイル検索 + // $47 - file search void FASTCALL FS_NFiles(BYTE *buf); - // $48 - ファイル次検索 + // $48 - find next file void FASTCALL FS_Create(BYTE *buf); - // $49 - ファイル作成 + // $49 - create file void FASTCALL FS_Open(BYTE *buf); - // $4A - ファイルオープン + // $4A - open file void FASTCALL FS_Close(BYTE *buf); - // $4B - ファイルクローズ + // $4B - close file void FASTCALL FS_Read(BYTE *buf); - // $4C - ファイル読み込み + // $4C - read file void FASTCALL FS_Write(BYTE *buf); - // $4D - ファイル書き込み + // $4D - write file void FASTCALL FS_Seek(BYTE *buf); - // $4E - ファイルシーク + // $4E - seek file void FASTCALL FS_TimeStamp(BYTE *buf); - // $4F - ファイル時刻取得/設定 + // $4F - get/set file time void FASTCALL FS_GetCapacity(BYTE *buf); - // $50 - 容量取得 + // $50 - get capacity void FASTCALL FS_CtrlDrive(BYTE *buf); - // $51 - ドライブ状態検査/制御 + // $51 - drive status check/control void FASTCALL FS_GetDPB(BYTE *buf); - // $52 - DPB取得 + // $52 - get DPB void FASTCALL FS_DiskRead(BYTE *buf); - // $53 - セクタ読み込み + // $53 - read sector void FASTCALL FS_DiskWrite(BYTE *buf); - // $54 - セクタ書き込み + // $54 - write sector void FASTCALL FS_Ioctrl(BYTE *buf); // $55 - IOCTRL void FASTCALL FS_Flush(BYTE *buf); - // $56 - フラッシュ + // $56 - flush cache void FASTCALL FS_CheckMedia(BYTE *buf); - // $57 - メディア交換チェック + // $57 - check media void FASTCALL FS_Lock(BYTE *buf); - // $58 - 排他制御 + // $58 - get exclusive control CFileSys *fs; - // ファイルシステムアクセッサー + // File system accessor DWORD fsresult; - // ファイルシステムアクセス結果コード + // File system access result code BYTE fsout[0x800]; - // ファイルシステムアクセス結果バッファ + // File system access result buffer DWORD fsoutlen; - // ファイルシステムアクセス結果バッファサイズ + // File system access result buffer size BYTE fsopt[0x1000000]; - // ファイルシステムアクセスバッファ + // File system access buffer DWORD fsoptlen; - // ファイルシステムアクセスバッファサイズ + // File system access buffer size }; //=========================================================================== // -// SASI コントローラ +// SASI Controller // //=========================================================================== class SASIDEV { public: - // 論理ユニット最大数 + // Maximum number of logical units enum { UnitMax = 8 }; #ifdef RASCSI - // タイミング調整用 + // For timing adjustments enum { min_exec_time_sasi = 100, // SASI BOOT/FORMAT 30:NG 35:OK min_exec_time_scsi = 50 }; #endif // RASCSI - // 内部データ定義 + // Internal data definition typedef struct { // 全般 - BUS::phase_t phase; // 遷移フェーズ - int id; // コントローラID(0-7) - BUS *bus; // バス + BUS::phase_t phase; // Transition phase + int id; // Controller ID (0-7) + BUS *bus; // Bus - // コマンド - DWORD cmd[10]; // コマンドデータ - DWORD status; // ステータスデータ - DWORD message; // メッセージデータ + // commands + DWORD cmd[10]; // Command data + DWORD status; // Status data + DWORD message; // Message data #ifdef RASCSI - // 実行 - DWORD execstart; // 実行開始時間 + // Run + DWORD execstart; // Execution start time #endif // RASCSI - // 転送 - BYTE *buffer; // 転送バッファ - int bufsize; // 転送バッファサイズ - DWORD blocks; // 転送ブロック数 - DWORD next; // 次のレコード - DWORD offset; // 転送オフセット - DWORD length; // 転送残り長さ + // Transfer + BYTE *buffer; // Transfer data buffer + int bufsize; // Transfer data buffer size + DWORD blocks; // Number of transfer block + DWORD next; // Next record + DWORD offset; // Transfer offset + DWORD length; // Transfer remaining length - // 論理ユニット + // Logical unit Disk *unit[UnitMax]; - // 論理ユニット + // Logical Unit } ctrl_t; public: - // 基本ファンクション + // Basic Functions #ifdef RASCSI SASIDEV(); #else SASIDEV(Device *dev); #endif //RASCSI - // コンストラクタ + // Constructor virtual ~SASIDEV(); - // デストラクタ + // Destructor virtual void FASTCALL Reset(); - // デバイスリセット + // Device Reset #ifndef RASCSI virtual BOOL FASTCALL Save(Fileio *fio, int ver); - // セーブ + // Save virtual BOOL FASTCALL Load(Fileio *fio, int ver); - // ロード + // Load #endif //RASCSI - // 外部API + // External API virtual BUS::phase_t FASTCALL Process(); - // 実行 + // Run - // 接続 + // Connect void FASTCALL Connect(int id, BUS *sbus); - // コントローラ接続 + // Controller connection Disk* FASTCALL GetUnit(int no); - // 論理ユニット取得 + // Get logical unit void FASTCALL SetUnit(int no, Disk *dev); - // 論理ユニット設定 + // Logical unit setting BOOL FASTCALL HasUnit(); - // 有効な論理ユニットを持っているか返す + // Has a valid logical unit - // その他 + // Other BUS::phase_t FASTCALL GetPhase() {return ctrl.phase;} - // フェーズ取得 + // Get the phase int FASTCALL GetID() {return ctrl.id;} - // ID取得 + // Get the ID void FASTCALL GetCTRL(ctrl_t *buffer); - // 内部情報取得 + // Get the internal information ctrl_t* FASTCALL GetWorkAddr() { return &ctrl; } - // 内部情報アドレス取得 + // Get the internal information address virtual BOOL FASTCALL IsSASI() const {return TRUE;} - // SASIチェック + // SASI Check virtual BOOL FASTCALL IsSCSI() const {return FALSE;} - // SCSIチェック + // SCSI check Disk* FASTCALL GetBusyUnit(); - // ビジー状態のユニットを取得 + // Get the busy unit protected: - // フェーズ処理 + // Phase processing virtual void FASTCALL BusFree(); - // バスフリーフェーズ + // Bus free phase virtual void FASTCALL Selection(); - // セレクションフェーズ + // Selection phase virtual void FASTCALL Command(); - // コマンドフェーズ + // Command phase virtual void FASTCALL Execute(); - // 実行フェーズ + // Execution phase void FASTCALL Status(); - // ステータスフェーズ + // Status phase void FASTCALL MsgIn(); - // メッセージインフェーズ + // Message in phase void FASTCALL DataIn(); - // データインフェーズ + // Data in phase void FASTCALL DataOut(); - // データアウトフェーズ + // Data out phase virtual void FASTCALL Error(); - // 共通エラー処理 + // Common error handling - // コマンド + // commands void FASTCALL CmdTestUnitReady(); - // TEST UNIT READYコマンド + // TEST UNIT READY command void FASTCALL CmdRezero(); - // REZERO UNITコマンド + // REZERO UNIT command void FASTCALL CmdRequestSense(); - // REQUEST SENSEコマンド + // REQUEST SENSE command void FASTCALL CmdFormat(); - // FORMATコマンド + // FORMAT command void FASTCALL CmdReassign(); - // REASSIGN BLOCKSコマンド + // REASSIGN BLOCKS command void FASTCALL CmdRead6(); - // READ(6)コマンド + // READ(6) command void FASTCALL CmdWrite6(); - // WRITE(6)コマンド + // WRITE(6) command void FASTCALL CmdSeek6(); - // SEEK(6)コマンド + // SEEK(6) command void FASTCALL CmdAssign(); - // ASSIGNコマンド + // ASSIGN command void FASTCALL CmdSpecify(); - // SPECIFYコマンド + // SPECIFY command void FASTCALL CmdInvalid(); - // サポートしていないコマンド + // Unsupported command // データ転送 virtual void FASTCALL Send(); - // データ送信 + // Send data #ifndef RASCSI virtual void FASTCALL SendNext(); - // データ送信継続 + // Continue sending data #endif // RASCSI virtual void FASTCALL Receive(); - // データ受信 + // Receive data #ifndef RASCSI virtual void FASTCALL ReceiveNext(); - // データ受信継続 + // Continue receiving data #endif // RASCSI BOOL FASTCALL XferIn(BYTE* buf); - // データ転送IN + // Data transfer IN BOOL FASTCALL XferOut(BOOL cont); - // データ転送OUT + // Data transfer OUT - // 特殊 + // Special operations void FASTCALL FlushUnit(); - // 論理ユニットフラッシュ + // Flush the logical unit - // ログ + // Log void FASTCALL Log(Log::loglevel level, const char *format, ...); - // ログ出力 + // Log output protected: #ifndef RASCSI Device *host; - // ホストデバイス + // Host device #endif // RASCSI ctrl_t ctrl; - // 内部データ + // Internal data }; //=========================================================================== // -// SCSI デバイス(SASI デバイスを継承) +// SCSI Device (Interits SASI device) // //=========================================================================== class SCSIDEV : public SASIDEV { public: - // 内部データ定義 + // Internal data definition typedef struct { - // 同期転送 - BOOL syncenable; // 同期転送可能 - int syncperiod; // 同期転送ピリオド - int syncoffset; // 同期転送オフセット - int syncack; // 同期転送ACK数 + // Synchronous transfer + BOOL syncenable; // Synchronous transfer possible + int syncperiod; // Synchronous transfer period + int syncoffset; // Synchronous transfer offset + int syncack; // Number of synchronous transfer ACKs - // ATNメッセージ + // ATN message BOOL atnmsg; int msc; BYTE msb[256]; } scsi_t; public: - // 基本ファンクション + // Basic Functions #ifdef RASCSI SCSIDEV(); #else SCSIDEV(Device *dev); #endif // RASCSI - // コンストラクタ + // Constructor void FASTCALL Reset(); - // デバイスリセット + // Device Reset // 外部API BUS::phase_t FASTCALL Process(); - // 実行 + // Run void FASTCALL SyncTransfer(BOOL enable) { scsi.syncenable = enable; } - // 同期転送可能設定 + // Synchronouse transfer enable setting - // その他 + // Other BOOL FASTCALL IsSASI() const {return FALSE;} - // SASIチェック + // SASI Check BOOL FASTCALL IsSCSI() const {return TRUE;} - // SCSIチェック + // SCSI check private: - // フェーズ + // Phase void FASTCALL BusFree(); - // バスフリーフェーズ + // Bus free phase void FASTCALL Selection(); - // セレクションフェーズ + // Selection phase void FASTCALL Execute(); - // 実行フェーズ + // Execution phase void FASTCALL MsgOut(); - // メッセージアウトフェーズ + // Message out phase void FASTCALL Error(); - // 共通エラー処理 + // Common erorr handling - // コマンド + // commands void FASTCALL CmdInquiry(); - // INQUIRYコマンド + // INQUIRY command void FASTCALL CmdModeSelect(); - // MODE SELECTコマンド + // MODE SELECT command void FASTCALL CmdModeSense(); - // MODE SENSEコマンド + // MODE SENSE command void FASTCALL CmdStartStop(); - // START STOP UNITコマンド + // START STOP UNIT command void FASTCALL CmdSendDiag(); - // SEND DIAGNOSTICコマンド + // SEND DIAGNOSTIC command void FASTCALL CmdRemoval(); - // PREVENT/ALLOW MEDIUM REMOVALコマンド + // PREVENT/ALLOW MEDIUM REMOVAL command void FASTCALL CmdReadCapacity(); - // READ CAPACITYコマンド + // READ CAPACITY command void FASTCALL CmdRead10(); - // READ(10)コマンド + // READ(10) command void FASTCALL CmdWrite10(); - // WRITE(10)コマンド + // WRITE(10) command void FASTCALL CmdSeek10(); - // SEEK(10)コマンド + // SEEK(10) command void FASTCALL CmdVerify(); - // VERIFYコマンド + // VERIFY command void FASTCALL CmdSynchronizeCache(); - // SYNCHRONIZE CACHE コマンド + // SYNCHRONIZE CACHE command void FASTCALL CmdReadDefectData10(); - // READ DEFECT DATA(10) コマンド + // READ DEFECT DATA(10) command void FASTCALL CmdReadToc(); - // READ TOCコマンド + // READ TOC command void FASTCALL CmdPlayAudio10(); - // PLAY AUDIO(10)コマンド + // PLAY AUDIO(10) command void FASTCALL CmdPlayAudioMSF(); - // PLAY AUDIO MSFコマンド + // PLAY AUDIO MSF command void FASTCALL CmdPlayAudioTrack(); - // PLAY AUDIO TRACK INDEXコマンド + // PLAY AUDIO TRACK INDEX command void FASTCALL CmdModeSelect10(); - // MODE SELECT(10)コマンド + // MODE SELECT(10) command void FASTCALL CmdModeSense10(); - // MODE SENSE(10)コマンド + // MODE SENSE(10) command void FASTCALL CmdGetMessage10(); - // GET MESSAGE(10)コマンド + // GET MESSAGE(10) command void FASTCALL CmdSendMessage10(); - // SEND MESSAGE(10)コマンド + // SEND MESSAGE(10) command // データ転送 void FASTCALL Send(); - // データ送信 + // Send data #ifndef RASCSI void FASTCALL SendNext(); - // データ送信継続 + // Continue sending data #endif // RASCSI void FASTCALL Receive(); - // データ受信 + // Receive data #ifndef RASCSI void FASTCALL ReceiveNext(); - // データ受信継続 + // Continue receiving data #endif // RASCSI BOOL FASTCALL XferMsg(DWORD msg); - // データ転送MSG + // Data transfer message scsi_t scsi; - // 内部データ + // Internal data }; #endif // disk_h diff --git a/src/raspberrypi/gpiobus.cpp b/src/raspberrypi/gpiobus.cpp index 69ab840c..e0b8386a 100644 --- a/src/raspberrypi/gpiobus.cpp +++ b/src/raspberrypi/gpiobus.cpp @@ -8,7 +8,7 @@ // // Imported NetBSD support and some optimisation patch by Rin Okuyama. // -// [ GPIO-SCSIバス ] +// [ GPIO-SCSI bus ] // //--------------------------------------------------------------------------- @@ -59,7 +59,7 @@ DWORD bcm_host_get_peripheral_address(void) #endif // __linux__ #ifdef __NetBSD__ -// Raspberry Piシリーズを仮定してCPUからアドレスを推定 +// Assume the Raspberry Pi series and estimate the address from CPU DWORD bcm_host_get_peripheral_address(void) { char buf[1024]; @@ -68,11 +68,11 @@ DWORD bcm_host_get_peripheral_address(void) if (sysctlbyname("hw.model", buf, &len, NULL, 0) || strstr(buf, "ARM1176JZ-S") != buf) { - // CPUモデルの取得に失敗 || BCM2835ではない - // BCM283[67]のアドレスを使用 + // Failed to get CPU model || Not BCM2835 + // use the address of BCM283[67] address = 0x3f000000; } else { - // BCM2835のアドレスを使用 + // Use BCM2835 address address = 0x20000000; } printf("Peripheral address : 0x%lx\n", address); @@ -82,16 +82,16 @@ DWORD bcm_host_get_peripheral_address(void) #endif // BAREMETAL #ifdef BAREMETAL -// IOベースアドレス +// IO base address extern uint32_t RPi_IO_Base_Addr; -// コア周波数 +// Core frequency extern uint32_t RPi_Core_Freq; #ifdef USE_SEL_EVENT_ENABLE //--------------------------------------------------------------------------- // -// 割り込み制御関数 +// Interrupt control function // //--------------------------------------------------------------------------- extern "C" { @@ -103,14 +103,14 @@ extern void WaitForInterrupts (void); //--------------------------------------------------------------------------- // -// 割り込みハンドラ +// Interrupt handler // //--------------------------------------------------------------------------- static GPIOBUS *self; extern "C" void IrqHandler() { - // 割り込みクリア + // Clear interrupt self->ClearSelectEvent(); } #endif // USE_SEL_EVENT_ENABLE @@ -118,7 +118,7 @@ void IrqHandler() //--------------------------------------------------------------------------- // -// コンストラクタ +// Constructor // //--------------------------------------------------------------------------- GPIOBUS::GPIOBUS() @@ -130,7 +130,7 @@ GPIOBUS::GPIOBUS() //--------------------------------------------------------------------------- // -// デストラクタ +// Destructor // //--------------------------------------------------------------------------- GPIOBUS::~GPIOBUS() @@ -155,24 +155,24 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode) #endif // USE_SEL_EVENT_ENABLE #endif // BAREMETAL - // 動作モードの保存 + // Save operation mode actmode = mode; #ifdef BAREMETAL - // ベースアドレスの取得 + // Get the base address baseaddr = RPi_IO_Base_Addr; map = (void*)baseaddr; #else - // ベースアドレスの取得 + // Get the base address baseaddr = (DWORD)bcm_host_get_peripheral_address(); - // /dev/memオープン + // Open /dev/mem fd = open("/dev/mem", O_RDWR | O_SYNC); if (fd == -1) { return FALSE; } - // ペリフェラルリージョンのメモリをマップ + // Map peripheral region memory map = mmap(NULL, 0x1000100, PROT_READ | PROT_WRITE, MAP_SHARED, fd, baseaddr); if (map == MAP_FAILED) { @@ -180,7 +180,7 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode) return FALSE; } #endif - // ベースアドレスからラズパイのタイプを決定 + // Determine the type of raspberry pi from the base address if (baseaddr == 0xfe000000) { rpitype = 4; } else if (baseaddr == 0x3f000000) { @@ -198,12 +198,12 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode) pads = (DWORD *)map; pads += PADS_OFFSET / sizeof(DWORD); - // システムタイマ + // System timer SysTimer::Init( (DWORD *)map + SYST_OFFSET / sizeof(DWORD), (DWORD *)map + ARMT_OFFSET / sizeof(DWORD)); - // 割り込みコントローラ + // Interrupt controller irpctl = (DWORD *)map; irpctl += IRPT_OFFSET / sizeof(DWORD); @@ -214,7 +214,7 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode) #endif // BAREMETAL #ifdef BAREMETAL - // GICのメモリをマップ + // Map GIC memory if (rpitype == 4) { map = (void*)ARM_GICD_BASE; gicd = (DWORD *)map; @@ -225,7 +225,7 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode) gicc = NULL; } #else - // GICのメモリをマップ + // Map GIC memory if (rpitype == 4) { map = mmap(NULL, 8192, PROT_READ | PROT_WRITE, MAP_SHARED, fd, ARM_GICD_BASE); @@ -243,10 +243,10 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode) close(fd); #endif // BAREMETAL - // Drive Strengthを16mAに設定 + // Set Drive Strength to 16mA DrvConfig(7); - // プルアップ/プルダウンを設定 + // Set pull up/pull down #if SIGNAL_CONTROL_MODE == 0 pullmode = GPIO_PULLNONE; #elif SIGNAL_CONTROL_MODE == 1 @@ -255,7 +255,7 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode) pullmode = GPIO_PULLDOWN; #endif - // 全信号初期化 + // Initialize all signals for (i = 0; SignalTable[i] >= 0; i++) { j = SignalTable[i]; PinSetSignal(j, FALSE); @@ -263,7 +263,7 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode) PullConfig(j, pullmode); } - // 制御信号を設定 + // Set control signals PinSetSignal(PIN_ACT, FALSE); PinSetSignal(PIN_TAD, FALSE); PinSetSignal(PIN_IND, FALSE); @@ -273,26 +273,26 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode) PinConfig(PIN_IND, GPIO_OUTPUT); PinConfig(PIN_DTD, GPIO_OUTPUT); - // ENABLE信号を設定 + // Set the ENABLE signal PinSetSignal(PIN_ENB, ENB_OFF); PinConfig(PIN_ENB, GPIO_OUTPUT); - // GPFSELバックアップ + // GPFSEL backup gpfsel[0] = gpio[GPIO_FSEL_0]; gpfsel[1] = gpio[GPIO_FSEL_1]; gpfsel[2] = gpio[GPIO_FSEL_2]; gpfsel[3] = gpio[GPIO_FSEL_3]; - // SEL信号割り込み初期化 + // Initialize SEL signal interrupt #ifdef USE_SEL_EVENT_ENABLE #ifndef BAREMETAL - // GPIOチップオープン + // GPIO chip open fd = open("/dev/gpiochip0", 0); if (fd == -1) { return FALSE; } - // イベント要求設定 + // Event request setting strcpy(selevreq.consumer_label, "RaSCSI"); selevreq.lineoffset = PIN_SEL; selevreq.handleflags = GPIOHANDLE_REQUEST_INPUT; @@ -302,41 +302,41 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode) selevreq.eventflags = GPIOEVENT_REQUEST_RISING_EDGE; #endif // SIGNAL_CONTROL_MODE - // イベント要求取得 + //Get event request if (ioctl(fd, GPIO_GET_LINEEVENT_IOCTL, &selevreq) == -1) { close(fd); return FALSE; } - // GPIOチップクローズ + // Close GPIO chip file handle close(fd); - // epoll初期化 + // epoll initialization epfd = epoll_create(1); memset(&ev, 0, sizeof(ev)); ev.events = EPOLLIN | EPOLLPRI; ev.data.fd = selevreq.fd; epoll_ctl(epfd, EPOLL_CTL_ADD, selevreq.fd, &ev); #else - // エッジ検出設定 + // Edge detection setting #if SIGNAL_CONTROL_MODE == 2 gpio[GPIO_AREN_0] = 1 << PIN_SEL; #else gpio[GPIO_AFEN_0] = 1 << PIN_SEL; #endif // SIGNAL_CONTROL_MODE - // イベントクリア + // Clear event gpio[GPIO_EDS_0] = 1 << PIN_SEL; - // 割り込みハンドラ登録 + // Register interrupt handler setIrqFuncAddress(IrqHandler); - // GPIO割り込み設定 + // GPIO interrupt setting if (rpitype == 4) { - // GIC無効 + // GIC Invalid gicd[GICD_CTLR] = 0; - // 全ての割り込みをコア0にルーティング + // Route all interupts to core 0 for (i = 0; i < 8; i++) { gicd[GICD_ICENABLER0 + i] = 0xffffffff; gicd[GICD_ICPENDR0 + i] = 0xffffffff; @@ -347,32 +347,32 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode) gicd[GICD_ITARGETSR0 + i] = 0x01010101; } - // 全ての割り込みをレベルトリガに設定 + // Set all interrupts as level triggers for (i = 0; i < 16; i++) { gicd[GICD_ICFGR0 + i] = 0; } - // GIC無効 + // GIC Invalid gicd[GICD_CTLR] = 1; - // コア0のCPUインターフェスを有効にする + // Enable CPU interface for core 0 gicc[GICC_PMR] = 0xf0; gicc[GICC_CTLR] = 1; - // 割り込み有効 + // Enable interrupts gicd[GICD_ISENABLER0 + (GIC_GPIO_IRQ / 32)] = 1 << (GIC_GPIO_IRQ % 32); } else { - // 割り込み有効 + // Enable interrupts irpctl[IRPT_ENB_IRQ_2] = (1 << (GPIO_IRQ % 32)); } #endif // BAREMETAL #endif // USE_SEL_EVENT_ENABLE - // ワークテーブル作成 + // Create work table MakeTable(); - // 最後にENABLEをオン + // Finally, enable ENABLE SetControl(PIN_ENB, ENB_ON); return TRUE; @@ -380,7 +380,7 @@ BOOL FASTCALL GPIOBUS::Init(mode_e mode) //--------------------------------------------------------------------------- // -// クリーンアップ +// Cleanup // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::Cleanup() @@ -388,14 +388,14 @@ void FASTCALL GPIOBUS::Cleanup() int i; int pin; - // SEL信号割り込み解放 + // Release SEL signal interrupt #ifdef USE_SEL_EVENT_ENABLE #ifndef BAREMETAL close(selevreq.fd); #endif // BAREMETAL #endif // USE_SEL_EVENT_ENABLE - // 制御信号を設定 + // Set control signals PinSetSignal(PIN_ENB, FALSE); PinSetSignal(PIN_ACT, FALSE); PinSetSignal(PIN_TAD, FALSE); @@ -406,7 +406,7 @@ void FASTCALL GPIOBUS::Cleanup() PinConfig(PIN_IND, GPIO_INPUT); PinConfig(PIN_DTD, GPIO_INPUT); - // 全信号初期化 + // Initialize all signals for (i = 0; SignalTable[i] >= 0; i++) { pin = SignalTable[i]; PinSetSignal(pin, FALSE); @@ -414,13 +414,13 @@ void FASTCALL GPIOBUS::Cleanup() PullConfig(pin, GPIO_PULLNONE); } - // Drive Strengthを8mAに設定 + // Set drive strength back to 8mA DrvConfig(3); } //--------------------------------------------------------------------------- // -// リセット +// Reset // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::Reset() @@ -428,10 +428,10 @@ void FASTCALL GPIOBUS::Reset() int i; int j; - // アクティブ信号をオフ + // Turn off active signal SetControl(PIN_ACT, ACT_OFF); - // 全信号をネゲートに設定 + // Set all signals to off for (i = 0;; i++) { j = SignalTable[i]; if (j < 0) { @@ -442,9 +442,9 @@ void FASTCALL GPIOBUS::Reset() } if (actmode == TARGET) { - // ターゲットモード + // Target mode - // ターゲット信号を入力に設定 + // Set target signal to input SetControl(PIN_TAD, TAD_IN); SetMode(PIN_BSY, IN); SetMode(PIN_MSG, IN); @@ -452,14 +452,14 @@ void FASTCALL GPIOBUS::Reset() SetMode(PIN_REQ, IN); SetMode(PIN_IO, IN); - // イニシエータ信号を入力に設定 + // Set the initiator signal to input SetControl(PIN_IND, IND_IN); SetMode(PIN_SEL, IN); SetMode(PIN_ATN, IN); SetMode(PIN_ACK, IN); SetMode(PIN_RST, IN); - // データバス信号を入力に設定 + // Set data bus signals to input SetControl(PIN_DTD, DTD_IN); SetMode(PIN_DT0, IN); SetMode(PIN_DT1, IN); @@ -471,9 +471,9 @@ void FASTCALL GPIOBUS::Reset() SetMode(PIN_DT7, IN); SetMode(PIN_DP, IN); } else { - // イニシエータモード + // Initiator mode - // ターゲット信号を入力に設定 + // Set target signal to input SetControl(PIN_TAD, TAD_IN); SetMode(PIN_BSY, IN); SetMode(PIN_MSG, IN); @@ -481,14 +481,14 @@ void FASTCALL GPIOBUS::Reset() SetMode(PIN_REQ, IN); SetMode(PIN_IO, IN); - // イニシエータ信号を出力に設定 + // Set the initiator signal to output SetControl(PIN_IND, IND_OUT); SetMode(PIN_SEL, OUT); SetMode(PIN_ATN, OUT); SetMode(PIN_ACK, OUT); SetMode(PIN_RST, OUT); - // データバス信号を出力に設定 + // Set the data bus signals to outpu SetControl(PIN_DTD, DTD_OUT); SetMode(PIN_DT0, OUT); SetMode(PIN_DT1, OUT); @@ -501,13 +501,13 @@ void FASTCALL GPIOBUS::Reset() SetMode(PIN_DP, OUT); } - // 全信号初期化 + // Initialize all signals signals = 0; } //--------------------------------------------------------------------------- // -// バス信号取り込み +// Bus signal acquisition // //--------------------------------------------------------------------------- DWORD FASTCALL GPIOBUS::Aquire() @@ -515,7 +515,7 @@ DWORD FASTCALL GPIOBUS::Aquire() signals = *level; #if SIGNAL_CONTROL_MODE < 2 - // 負論理なら反転する(内部処理は正論理に統一) + // Invert if negative logic (internal processing is unified to positive logic) signals = ~signals; #endif // SIGNAL_CONTROL_MODE @@ -524,7 +524,7 @@ DWORD FASTCALL GPIOBUS::Aquire() //--------------------------------------------------------------------------- // -// ENBシグナル設定 +// ENB signal setting // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::SetENB(BOOL ast) @@ -534,7 +534,7 @@ void FASTCALL GPIOBUS::SetENB(BOOL ast) //--------------------------------------------------------------------------- // -// BSYシグナル取得 +// Get BSY signal // //--------------------------------------------------------------------------- BOOL FASTCALL GPIOBUS::GetBSY() @@ -544,20 +544,20 @@ BOOL FASTCALL GPIOBUS::GetBSY() //--------------------------------------------------------------------------- // -// BSYシグナル設定 +// Set BSY signal // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::SetBSY(BOOL ast) { - // BSY信号を設定 + // Set BSY signal SetSignal(PIN_BSY, ast); if (actmode == TARGET) { if (ast) { - // アクティブ信号をオン + // Turn on ACTIVE signal SetControl(PIN_ACT, ACT_ON); - // ターゲット信号を出力に設定 + // Set Target signal to output SetControl(PIN_TAD, TAD_OUT); SetMode(PIN_BSY, OUT); @@ -566,10 +566,10 @@ void FASTCALL GPIOBUS::SetBSY(BOOL ast) SetMode(PIN_REQ, OUT); SetMode(PIN_IO, OUT); } else { - // アクティブ信号をオフ + // Turn off the ACTIVE signal SetControl(PIN_ACT, ACT_OFF); - // ターゲット信号を入力に設定 + // Set the target signal to input SetControl(PIN_TAD, TAD_IN); SetMode(PIN_BSY, IN); @@ -583,7 +583,7 @@ void FASTCALL GPIOBUS::SetBSY(BOOL ast) //--------------------------------------------------------------------------- // -// SELシグナル取得 +// Get SEL signal // //--------------------------------------------------------------------------- BOOL FASTCALL GPIOBUS::GetSEL() @@ -593,23 +593,23 @@ BOOL FASTCALL GPIOBUS::GetSEL() //--------------------------------------------------------------------------- // -// SELシグナル設定 +// Set SEL signal // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::SetSEL(BOOL ast) { if (actmode == INITIATOR && ast) { - // アクティブ信号をオン + // Turn on ACTIVE signal SetControl(PIN_ACT, ACT_ON); } - // SEL信号を設定 + // Set SEL signal SetSignal(PIN_SEL, ast); } //--------------------------------------------------------------------------- // -// ATNシグナル取得 +// Get ATN signal // //--------------------------------------------------------------------------- BOOL FASTCALL GPIOBUS::GetATN() @@ -619,7 +619,7 @@ BOOL FASTCALL GPIOBUS::GetATN() //--------------------------------------------------------------------------- // -// ATNシグナル設定 +// Get ATN signal // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::SetATN(BOOL ast) @@ -629,7 +629,7 @@ void FASTCALL GPIOBUS::SetATN(BOOL ast) //--------------------------------------------------------------------------- // -// ACKシグナル取得 +// Get ACK signal // //--------------------------------------------------------------------------- BOOL FASTCALL GPIOBUS::GetACK() @@ -639,7 +639,7 @@ BOOL FASTCALL GPIOBUS::GetACK() //--------------------------------------------------------------------------- // -// ACKシグナル設定 +// Set ACK signal // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::SetACK(BOOL ast) @@ -649,7 +649,7 @@ void FASTCALL GPIOBUS::SetACK(BOOL ast) //--------------------------------------------------------------------------- // -// RSTシグナル取得 +// Get RST signal // //--------------------------------------------------------------------------- BOOL FASTCALL GPIOBUS::GetRST() @@ -659,7 +659,7 @@ BOOL FASTCALL GPIOBUS::GetRST() //--------------------------------------------------------------------------- // -// RSTシグナル設定 +// Set RST signal // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::SetRST(BOOL ast) @@ -669,7 +669,7 @@ void FASTCALL GPIOBUS::SetRST(BOOL ast) //--------------------------------------------------------------------------- // -// MSGシグナル取得 +// Get MSG signal // //--------------------------------------------------------------------------- BOOL FASTCALL GPIOBUS::GetMSG() @@ -679,7 +679,7 @@ BOOL FASTCALL GPIOBUS::GetMSG() //--------------------------------------------------------------------------- // -// MSGシグナル設定 +// Set MSG signal // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::SetMSG(BOOL ast) @@ -689,7 +689,7 @@ void FASTCALL GPIOBUS::SetMSG(BOOL ast) //--------------------------------------------------------------------------- // -// CDシグナル取得 +// Get CD signal // //--------------------------------------------------------------------------- BOOL FASTCALL GPIOBUS::GetCD() @@ -699,7 +699,7 @@ BOOL FASTCALL GPIOBUS::GetCD() //--------------------------------------------------------------------------- // -// CDシグナル設定 +// Set CD Signal // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::SetCD(BOOL ast) @@ -709,7 +709,7 @@ void FASTCALL GPIOBUS::SetCD(BOOL ast) //--------------------------------------------------------------------------- // -// IOシグナル取得 +// Get IO Signal // //--------------------------------------------------------------------------- BOOL FASTCALL GPIOBUS::GetIO() @@ -718,7 +718,7 @@ BOOL FASTCALL GPIOBUS::GetIO() ast = GetSignal(PIN_IO); if (actmode == INITIATOR) { - // IO信号によってデータの入出力方向を変更 + // Change the data input/output direction by IO signal if (ast) { SetControl(PIN_DTD, DTD_IN); SetMode(PIN_DT0, IN); @@ -749,7 +749,7 @@ BOOL FASTCALL GPIOBUS::GetIO() //--------------------------------------------------------------------------- // -// IOシグナル設定 +// Set IO signal // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::SetIO(BOOL ast) @@ -757,7 +757,7 @@ void FASTCALL GPIOBUS::SetIO(BOOL ast) SetSignal(PIN_IO, ast); if (actmode == TARGET) { - // IO信号によってデータの入出力方向を変更 + // Change the data input/output direction by IO signal if (ast) { SetControl(PIN_DTD, DTD_OUT); SetDAT(0); @@ -787,7 +787,7 @@ void FASTCALL GPIOBUS::SetIO(BOOL ast) //--------------------------------------------------------------------------- // -// REQシグナル取得 +// Get REQ signal // //--------------------------------------------------------------------------- BOOL FASTCALL GPIOBUS::GetREQ() @@ -797,7 +797,7 @@ BOOL FASTCALL GPIOBUS::GetREQ() //--------------------------------------------------------------------------- // -// REQシグナル設定 +// Set REQ signal // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::SetREQ(BOOL ast) @@ -807,7 +807,7 @@ void FASTCALL GPIOBUS::SetREQ(BOOL ast) //--------------------------------------------------------------------------- // -// データシグナル取得 +// Get data signals // //--------------------------------------------------------------------------- BYTE FASTCALL GPIOBUS::GetDAT() @@ -830,12 +830,12 @@ BYTE FASTCALL GPIOBUS::GetDAT() //--------------------------------------------------------------------------- // -// データシグナル設定 +// Set data signals // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::SetDAT(BYTE dat) { - // ポートへ書き込み + // Write to port #if SIGNAL_CONTROL_MODE == 0 DWORD fsel; @@ -870,7 +870,7 @@ void FASTCALL GPIOBUS::SetDAT(BYTE dat) //--------------------------------------------------------------------------- // -// データパリティシグナル取得 +// Get data parity signal // //--------------------------------------------------------------------------- BOOL FASTCALL GPIOBUS::GetDP() @@ -880,7 +880,7 @@ BOOL FASTCALL GPIOBUS::GetDP() //--------------------------------------------------------------------------- // -// コマンド受信ハンドシェイク +// Receive command handshake // //--------------------------------------------------------------------------- int FASTCALL GPIOBUS::CommandHandShake(BYTE *buf) @@ -889,99 +889,99 @@ int FASTCALL GPIOBUS::CommandHandShake(BYTE *buf) BOOL ret; int count; - // ターゲットモードのみ + // Only works in TARGET mode if (actmode != TARGET) { return 0; } - // IRQ無効 + // IRQs disabled DisableIRQ(); - // 最初のコマンドバイトを取得 + // Get the first command byte i = 0; - // REQアサート + // Assert REQ signal SetSignal(PIN_REQ, ON); - // ACKアサート待ち + // Wait for ACK signal ret = WaitSignal(PIN_ACK, TRUE); - // 信号線が安定するまでウェイト + // Wait until the signal line stabilizes SysTimer::SleepNsec(GPIO_DATA_SETTLING); - // データ取得 + // Get data *buf = GetDAT(); - // REQネゲート + // Disable REQ signal SetSignal(PIN_REQ, OFF); - // ACKアサート待ちでタイムアウト + // Timeout waiting for ACK assertion if (!ret) { goto irq_enable_exit; } - // ACKネゲート待ち + // Wait for ACK to clear ret = WaitSignal(PIN_ACK, FALSE); - // ACKネゲート待ちでタイムアウト + // Timeout waiting for ACK to clear if (!ret) { goto irq_enable_exit; } - // コマンドが6バイトか10バイトか見分ける + // Distinguise whether the command is 6 bytes or 10 bytes if (*buf >= 0x20 && *buf <= 0x7D) { count = 10; } else { count = 6; } - // 次データへ + // Increment buffer pointer buf++; for (i = 1; i < count; i++) { - // REQアサート + // Assert REQ signal SetSignal(PIN_REQ, ON); - // ACKアサート待ち + // Wait for ACK signal ret = WaitSignal(PIN_ACK, TRUE); - // 信号線が安定するまでウェイト + // Wait until the signal line stabilizes SysTimer::SleepNsec(GPIO_DATA_SETTLING); - // データ取得 + // Get data *buf = GetDAT(); - // REQネゲート + // Clear the REQ signal SetSignal(PIN_REQ, OFF); - // ACKアサート待ちでタイムアウト + // Check for timeout waiting for ACK assertion if (!ret) { break; } - // ACKネゲート待ち + // Wait for ACK to clear ret = WaitSignal(PIN_ACK, FALSE); - // ACKネゲート待ちでタイムアウト + // Check for timeout waiting for ACK to clear if (!ret) { break; } - // 次データへ + // Advance the buffer pointer to receive the next byte buf++; } irq_enable_exit: - // IRQ有効 + // IRQs enabled EnableIRQ(); - // 受信数を返却 + // returned the number of bytes received return i; } //--------------------------------------------------------------------------- // -// データ受信ハンドシェイク +// Data reception handshake // //--------------------------------------------------------------------------- int FASTCALL GPIOBUS::ReceiveHandShake(BYTE *buf, int count) @@ -990,100 +990,100 @@ int FASTCALL GPIOBUS::ReceiveHandShake(BYTE *buf, int count) BOOL ret; DWORD phase; - // IRQ無効 + // Disable IRQs DisableIRQ(); if (actmode == TARGET) { for (i = 0; i < count; i++) { - // REQアサート + // Assert the REQ signal SetSignal(PIN_REQ, ON); - // ACKアサート待ち + // Wait for ACK ret = WaitSignal(PIN_ACK, TRUE); - // 信号線が安定するまでウェイト + // Wait until the signal line stabilizes SysTimer::SleepNsec(GPIO_DATA_SETTLING); - // データ取得 + // Get data *buf = GetDAT(); - // REQネゲート + // Clear the REQ signal SetSignal(PIN_REQ, OFF); - // ACKアサート待ちでタイムアウト + // Check for timeout waiting for ACK signal if (!ret) { break; } - // ACKネゲート待ち + // Wait for ACK to clear ret = WaitSignal(PIN_ACK, FALSE); - // ACKネゲート待ちでタイムアウト + // Check for timeout waiting for ACK to clear if (!ret) { break; } - // 次データへ + // Advance the buffer pointer to receive the next byte buf++; } } else { - // フェーズ取得 + // Get phase phase = Aquire() & GPIO_MCI; for (i = 0; i < count; i++) { - // REQアサート待ち + // Wait for the REQ signal to be asserted ret = WaitSignal(PIN_REQ, TRUE); - // REQアサート待ちでタイムアウト + // Check for timeout waiting for REQ signal if (!ret) { break; } - // フェーズエラー + // Phase error if ((signals & GPIO_MCI) != phase) { break; } - // 信号線が安定するまでウェイト + // Wait until the signal line stabilizes SysTimer::SleepNsec(GPIO_DATA_SETTLING); - // データ取得 + // Get data *buf = GetDAT(); - // ACKアサート + // Assert the ACK signal SetSignal(PIN_ACK, ON); - // REQネゲート待ち + // Wait for REQ to clear ret = WaitSignal(PIN_REQ, FALSE); - // ACKネゲート + // Clear the ACK signal SetSignal(PIN_ACK, OFF); - // REQネゲート待ちでタイムアウト + // Check for timeout waiting for REQ to clear if (!ret) { break; } - // フェーズエラー + // Phase error if ((signals & GPIO_MCI) != phase) { break; } - // 次データへ + // Advance the buffer pointer to receive the next byte buf++; } } - // IRQ有効 + // Re-enable IRQ EnableIRQ(); - // 受信数を返却 + // Return the number of bytes received return i; } //--------------------------------------------------------------------------- // -// データ送信ハンドシェイク +// Data transmission handshake // //--------------------------------------------------------------------------- int FASTCALL GPIOBUS::SendHandShake(BYTE *buf, int count) @@ -1092,117 +1092,117 @@ int FASTCALL GPIOBUS::SendHandShake(BYTE *buf, int count) BOOL ret; DWORD phase; - // IRQ無効 + // Disable IRQs DisableIRQ(); if (actmode == TARGET) { for (i = 0; i < count; i++) { - // データ設定 + // Set the DATA signals SetDAT(*buf); - // ACKネゲート待ち + // Wait for ACK to clear ret = WaitSignal(PIN_ACK, FALSE); - // ACKネゲート待ちでタイムアウト + // Check for timeout waiting for ACK to clear if (!ret) { break; } - // ACKネゲート待ちで既にウェイトが入っている + // Already waiting for ACK to clear - // REQアサート + // Assert the REQ signal SetSignal(PIN_REQ, ON); - // ACKアサート待ち + // Wait for ACK ret = WaitSignal(PIN_ACK, TRUE); - // REQネゲート + // Clear REQ signal SetSignal(PIN_REQ, OFF); - // ACKアサート待ちでタイムアウト + // Check for timeout waiting for ACK to clear if (!ret) { break; } - // 次データへ + // Advance the data buffer pointer to receive the next byte buf++; } - // ACKネゲート待ち + // Wait for ACK to clear WaitSignal(PIN_ACK, FALSE); } else { - // フェーズ取得 + // Get Phase phase = Aquire() & GPIO_MCI; for (i = 0; i < count; i++) { - // データ設定 + // Set the DATA signals SetDAT(*buf); - // REQアサート待ち + // Wait for REQ to be asserted ret = WaitSignal(PIN_REQ, TRUE); - // REQアサート待ちでタイムアウト + // Check for timeout waiting for REQ to be asserted if (!ret) { break; } - // フェーズエラー + // Phase error if ((signals & GPIO_MCI) != phase) { break; } - // REQアサート待ちで既にウェイトが入っている - - // ACKアサート + // Already waiting for REQ assertion + + // Assert the ACK signal SetSignal(PIN_ACK, ON); - // REQネゲート待ち + // Wait for REQ to clear ret = WaitSignal(PIN_REQ, FALSE); - // ACKネゲート + // Clear the ACK signal SetSignal(PIN_ACK, OFF); - // REQネゲート待ちでタイムアウト + // Check for timeout waiting for REQ to clear if (!ret) { break; } - // フェーズエラー + // Phase error if ((signals & GPIO_MCI) != phase) { break; } - // 次データへ + // Advance the data buffer pointer to receive the next byte buf++; } } - // IRQ有効 + // Re-enable IRQ EnableIRQ(); - // 送信数を返却 + // Return number of transmissions return i; } #ifdef USE_SEL_EVENT_ENABLE //--------------------------------------------------------------------------- // -// SEL信号イベントポーリング +// SEL signal event polling // //--------------------------------------------------------------------------- int FASTCALL GPIOBUS::PollSelectEvent() { - // errnoクリア + // clear errno errno = 0; #ifdef BAREMETAL - // 割り込み有効 + // Enable interrupts EnableInterrupts(); - // 割り込み待ち + // Wait for interrupts WaitForInterrupts(); - // 割り込み無効 + // Disable interrupts DisableInterrupts(); #else struct epoll_event epev; @@ -1220,7 +1220,7 @@ int FASTCALL GPIOBUS::PollSelectEvent() //--------------------------------------------------------------------------- // -// SEL信号イベント解除 +// Cancel SEL signal event // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::ClearSelectEvent() @@ -1228,15 +1228,15 @@ void FASTCALL GPIOBUS::ClearSelectEvent() #ifdef BAREMETAL DWORD irq; - // イベントクリア + // Clear event gpio[GPIO_EDS_0] = 1 << PIN_SEL; - // GICへの応答 + // Response to GIC if (rpitype == 4) { - // IRQ番号 + // IRQ number irq = gicc[GICC_IAR] & 0x3FF; - // 割り込み応答 + // Interrupt response gicc[GICC_EOIR] = irq; } #endif // BAREMETAL @@ -1245,7 +1245,7 @@ void FASTCALL GPIOBUS::ClearSelectEvent() //--------------------------------------------------------------------------- // -// 信号テーブル +// Signal table // //--------------------------------------------------------------------------- const int GPIOBUS::SignalTable[19] = { @@ -1258,7 +1258,7 @@ const int GPIOBUS::SignalTable[19] = { //--------------------------------------------------------------------------- // -// ワークテーブル作成 +// Create work table // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::MakeTable(void) @@ -1281,7 +1281,7 @@ void FASTCALL GPIOBUS::MakeTable(void) DWORD gpset; #endif - // パリティテーブル作成 + // Create parity table for (i = 0; i < 0x100; i++) { bits = (DWORD)i; parity = 0; @@ -1294,28 +1294,28 @@ void FASTCALL GPIOBUS::MakeTable(void) } #if SIGNAL_CONTROL_MODE == 0 - // マスクと設定データ生成 + // Mask and setting data generation memset(tblDatMsk, 0xff, sizeof(tblDatMsk)); memset(tblDatSet, 0x00, sizeof(tblDatSet)); for (i = 0; i < 0x100; i++) { - // 検査用ビット列 + // Bit string for inspection bits = (DWORD)i; - // パリティ取得 + // Get parity if (tblParity[i]) { bits |= (1 << 8); } - // ビット検査 + // Bit check for (j = 0; j < 9; j++) { - // インデックスとシフト量計算 + // Index and shift amount calculation index = pintbl[j] / 10; shift = (pintbl[j] % 10) * 3; - // マスクデータ + // Mask data tblDatMsk[index][i] &= ~(0x7 << shift); - // 設定データ + // Setting data if (bits & 1) { tblDatSet[index][i] |= (1 << shift); } @@ -1324,24 +1324,24 @@ void FASTCALL GPIOBUS::MakeTable(void) } } #else - // マスクと設定データ生成 + // Mask and setting data generation memset(tblDatMsk, 0x00, sizeof(tblDatMsk)); memset(tblDatSet, 0x00, sizeof(tblDatSet)); for (i = 0; i < 0x100; i++) { - // 検査用ビット列 + // bit string for inspection bits = (DWORD)i; - // パリティ取得 + // get parity if (tblParity[i]) { bits |= (1 << 8); } #if SIGNAL_CONTROL_MODE == 1 - // 負論理は反転 + // Negative logic is inverted bits = ~bits; #endif - // GPIOレジスタ情報の作成 + // Create GPIO register information gpclr = 0; gpset = 0; for (j = 0; j < 9; j++) { @@ -1361,7 +1361,7 @@ void FASTCALL GPIOBUS::MakeTable(void) //--------------------------------------------------------------------------- // -// 制御信号設定 +// Control signal setting // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::SetControl(int pin, BOOL ast) @@ -1371,7 +1371,7 @@ void FASTCALL GPIOBUS::SetControl(int pin, BOOL ast) //--------------------------------------------------------------------------- // -// 入出力モード設定 +// Input/output mode setting // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::SetMode(int pin, int mode) @@ -1399,7 +1399,7 @@ void FASTCALL GPIOBUS::SetMode(int pin, int mode) //--------------------------------------------------------------------------- // -// 入力信号値取得 +// Get input signal value // //--------------------------------------------------------------------------- BOOL FASTCALL GPIOBUS::GetSignal(int pin) @@ -1409,7 +1409,7 @@ BOOL FASTCALL GPIOBUS::GetSignal(int pin) //--------------------------------------------------------------------------- // -// 出力信号値設定 +// Set output signal value // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::SetSignal(int pin, BOOL ast) @@ -1446,7 +1446,7 @@ void FASTCALL GPIOBUS::SetSignal(int pin, BOOL ast) //--------------------------------------------------------------------------- // -// 信号変化待ち +// Wait for signal change // //--------------------------------------------------------------------------- BOOL FASTCALL GPIOBUS::WaitSignal(int pin, BOOL ast) @@ -1454,49 +1454,49 @@ BOOL FASTCALL GPIOBUS::WaitSignal(int pin, BOOL ast) DWORD now; DWORD timeout; - // 現在 + // Get current time now = SysTimer::GetTimerLow(); - // タイムアウト時間(3000ms) + // Calculate timeout (3000ms) timeout = 3000 * 1000; - // 変化したら即終了 + // end immediately if the signal has changed do { - // リセットを受信したら即終了 + // Immediately upon receiving a reset Aquire(); if (GetRST()) { return FALSE; } - // エッジを検出したら - if (((signals >> pin) ^ ~ast) & 1) { + // Check for the signal edge + if (((signals >> pin) ^ ~ast) & 1) { return TRUE; } } while ((SysTimer::GetTimerLow() - now) < timeout); - // タイムアウト + // We timed out waiting for the signal return FALSE; } //--------------------------------------------------------------------------- // -// IRQ禁止 +// Disable IRQ // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::DisableIRQ() { #ifndef BAREMETAL if (rpitype == 4) { - // RPI4はGICCで割り込み禁止に設定 + // RPI4 is disabled by GICC giccpmr = gicc[GICC_PMR]; gicc[GICC_PMR] = 0; } else if (rpitype == 2) { - // RPI2,3はコアタイマーIRQを無効にする + // RPI2,3 disable core timer IRQ tintcore = sched_getcpu() + QA7_CORE0_TINTC; tintctl = qa7regs[tintcore]; qa7regs[tintcore] = 0; } else { - // 割り込みコントローラでシステムタイマー割り込みを止める + // Stop system timer interrupt with interrupt controller irptenb = irpctl[IRPT_ENB_IRQ_1]; irpctl[IRPT_DIS_IRQ_1] = irptenb & 0xf; } @@ -1505,20 +1505,20 @@ void FASTCALL GPIOBUS::DisableIRQ() //--------------------------------------------------------------------------- // -// IRQ有効 +// Enable IRQ // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::EnableIRQ() { #ifndef BAREMETAL if (rpitype == 4) { - // RPI4はGICCを割り込み許可に設定 + // RPI4 enables interrupts via the GICC gicc[GICC_PMR] = giccpmr; } else if (rpitype == 2) { - // RPI2,3はコアタイマーIRQを有効に戻す + // RPI2,3 re-enable core timer IRQ qa7regs[tintcore] = tintctl; } else { - // 割り込みコントローラでシステムタイマー割り込みを再開 + // Restart the system timer interrupt with the interrupt controller irpctl[IRPT_ENB_IRQ_1] = irptenb & 0xf; } #endif // BAREMETAL @@ -1526,7 +1526,7 @@ void FASTCALL GPIOBUS::EnableIRQ() //--------------------------------------------------------------------------- // -// ピン機能設定(入出力設定) +// Pin direction setting (input/output) // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::PinConfig(int pin, int mode) @@ -1534,7 +1534,7 @@ void FASTCALL GPIOBUS::PinConfig(int pin, int mode) int index; DWORD mask; - // 未使用なら無効 + // Check for invalid pin if (pin < 0) { return; } @@ -1546,7 +1546,7 @@ void FASTCALL GPIOBUS::PinConfig(int pin, int mode) //--------------------------------------------------------------------------- // -// ピン機能設定(プルアップ/ダウン) +// Pin pull-up/pull-down setting // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::PullConfig(int pin, int mode) @@ -1555,7 +1555,7 @@ void FASTCALL GPIOBUS::PullConfig(int pin, int mode) DWORD bits; DWORD pull; - // 未使用なら無効 + // Check for invalid pin if (pin < 0) { return; } @@ -1594,12 +1594,12 @@ void FASTCALL GPIOBUS::PullConfig(int pin, int mode) //--------------------------------------------------------------------------- // -// ピン出力設定 +// Set output pin // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::PinSetSignal(int pin, BOOL ast) { - // 未使用なら無効 + // Check for invalid pin if (pin < 0) { return; } @@ -1613,7 +1613,7 @@ void FASTCALL GPIOBUS::PinSetSignal(int pin, BOOL ast) //--------------------------------------------------------------------------- // -// Drive Strength設定 +// Set the signal drive strength // //--------------------------------------------------------------------------- void FASTCALL GPIOBUS::DrvConfig(DWORD drive) @@ -1626,28 +1626,28 @@ void FASTCALL GPIOBUS::DrvConfig(DWORD drive) //--------------------------------------------------------------------------- // -// システムタイマアドレス +// System timer address // //--------------------------------------------------------------------------- volatile DWORD* SysTimer::systaddr; //--------------------------------------------------------------------------- // -// ARMタイマアドレス +// ARM timer address // //--------------------------------------------------------------------------- volatile DWORD* SysTimer::armtaddr; //--------------------------------------------------------------------------- // -// コア周波数 +// Core frequency // //--------------------------------------------------------------------------- volatile DWORD SysTimer::corefreq; //--------------------------------------------------------------------------- // -// システムタイマ初期化 +// Initialize the system timer // //--------------------------------------------------------------------------- void FASTCALL SysTimer::Init(DWORD *syst, DWORD *armt) @@ -1668,14 +1668,14 @@ void FASTCALL SysTimer::Init(DWORD *syst, DWORD *armt) int fd; #endif // BAREMETAL - // ベースアドレス保存 + // Save the base address systaddr = syst; armtaddr = armt; - // ARMタイマをフリーランモードに変更 + // Change the ARM timer to free run mode armtaddr[ARMT_CTRL] = 0x00000282; - // コア周波数取得 + // Get the core frequency #ifdef BAREMETAL corefreq = RPi_Core_Freq / 1000000; #else @@ -1691,7 +1691,7 @@ void FASTCALL SysTimer::Init(DWORD *syst, DWORD *armt) //--------------------------------------------------------------------------- // -// システムタイマ(LO)取得 +// Get system timer low byte // //--------------------------------------------------------------------------- DWORD FASTCALL SysTimer::GetTimerLow() { @@ -1700,7 +1700,7 @@ DWORD FASTCALL SysTimer::GetTimerLow() { //--------------------------------------------------------------------------- // -// システムタイマ(HI)取得 +// Get system timer high byte // //--------------------------------------------------------------------------- DWORD FASTCALL SysTimer::GetTimerHigh() { @@ -1709,7 +1709,7 @@ DWORD FASTCALL SysTimer::GetTimerHigh() { //--------------------------------------------------------------------------- // -// ナノ秒単位のスリープ +// Sleep in nanoseconds // //--------------------------------------------------------------------------- void FASTCALL SysTimer::SleepNsec(DWORD nsec) @@ -1717,36 +1717,36 @@ void FASTCALL SysTimer::SleepNsec(DWORD nsec) DWORD diff; DWORD start; - // ウェイトしない + // If time is 0, don't do anything if (nsec == 0) { return; } - // タイマー差を算出 + // Calculate the timer difference diff = corefreq * nsec / 1000; - // 微小なら復帰 + // Return if the difference in time is too small if (diff == 0) { return; } - // 開始 + // Start start = armtaddr[ARMT_FREERUN]; - // カウントオーバーまでループ + // Loop until timer has elapsed while ((armtaddr[ARMT_FREERUN] - start) < diff); } //--------------------------------------------------------------------------- // -// μ秒単位のスリープ +// Sleep in microseconds // //--------------------------------------------------------------------------- void FASTCALL SysTimer::SleepUsec(DWORD usec) { DWORD now; - // ウェイトしない + // If time is 0, don't do anything if (usec == 0) { return; } diff --git a/src/raspberrypi/gpiobus.h b/src/raspberrypi/gpiobus.h index f9b9db58..340c9585 100644 --- a/src/raspberrypi/gpiobus.h +++ b/src/raspberrypi/gpiobus.h @@ -5,7 +5,7 @@ // // Powered by XM6 TypeG Technology. // Copyright (C) 2016-2020 GIMONS -// [ GPIO-SCSIバス ] +// [ GPIO-SCSI bus ] // //--------------------------------------------------------------------------- @@ -16,121 +16,121 @@ //--------------------------------------------------------------------------- // -// 接続方法定義の選択 +// Connection method definitions // //--------------------------------------------------------------------------- -//#define CONNECT_TYPE_STANDARD // 標準(SCSI論理,標準ピンアサイン) -//#define CONNECT_TYPE_FULLSPEC // フルスペック(SCSI論理,標準ピンアサイン) -//#define CONNECT_TYPE_AIBOM // AIBOM版(正論理,固有ピンアサイン) -//#define CONNECT_TYPE_GAMERNIUM // GAMERnium.com版(標準論理,固有ピンアサイン) +//#define CONNECT_TYPE_STANDARD // Standard (SCSI logic, standard pin assignment) +//#define CONNECT_TYPE_FULLSPEC // Full spec (SCSI logic, standard pin assignment) +//#define CONNECT_TYPE_AIBOM // AIBOM version (positive logic, unique pin assignment) +//#define CONNECT_TYPE_GAMERNIUM // GAMERnium.com version (standard logic, unique pin assignment) //--------------------------------------------------------------------------- // -// 信号制御論理及びピンアサインカスタマイズ +// Signal control logic and pin assignment customization // //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // -// SIGNAL_CONTROL_MODE:信号制御モード選択 -// Version1.22から信号制御の論理をカスタマイズできます。 +// SIGNAL_CONTROL_MODE: Signal control mode selection +// You can customize the signal control logic from Version 1.22 // -// 0:SCSI論理仕様 -// 直結またはHPに公開した74LS641-1等を使用する変換基板 -// アーサート:0V -// ネゲート :オープンコレクタ出力(バスから切り離す) +// 0:SCSI logical specification +// Conversion board using 74LS641-1 etc. directly connected or published on HP +// True : 0V +// False : Open collector output (disconnect from bus) // -// 1:負論理仕様(負論理->SCSI論理への変換基板を使用する場合) -// 現時点でこの仕様による変換基板は存在しません -// アーサート:0V -> (CONVERT) -> 0V -// ネゲート :3.3V -> (CONVERT) -> オープンコレクタ出力 +// 1:Negative logic specification (when using conversion board for negative logic -> SCSI logic) +// There is no conversion board with this specification at this time +// True : 0V -> (CONVERT) -> 0V +// False : 3.3V -> (CONVERT) -> Open collector output // -// 2:正論理仕様(正論理->SCSI論理への変換基板を使用する場合) -// RaSCSI Adapter Rev.C @132sync等 +// 2:Positive logic specification (when using the conversion board for positive logic -> SCSI logic) +// RaSCSI Adapter Rev.C @132sync etc. // -// アーサート:3.3V -> (CONVERT) -> 0V -// ネゲート :0V -> (CONVERT) -> オープンコレクタ出力 +// True : 3.3V -> (CONVERT) -> 0V +// False : 0V -> (CONVERT) -> Open collector output // //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // -// 制御信号ピンアサイン設定 -// 制御信号に対するGPIOピンのマッピングテーブルです。 +// Control signal pin assignment setting +// GPIO pin mapping table for control signals. // -// 制御信号 +// Control signal: // PIN_ACT -// SCSIコマンドを処理中の状態を示す信号のピン番号。 +// Signal that indicates the status of processing SCSI command. // PIN_ENB -// 起動から終了の間の有効信号を示す信号のピン番号。 +// Signal that indicates the valid signal from start to finish. // PIN_TAD -// ターゲット信号(BSY,IO,CD,MSG,REG)の入出力方向を示す信号のピン番号。 +// Signal that indicates the input/output direction of the target signal (BSY,IO,CD,MSG,REG). // PIN_IND -// イニシーエータ信号(SEL,ATN,RST,ACK)の入出力方向を示す信号のピン番号。 +// Signal that indicates the input/output direction of the initiator signal (SEL, ATN, RST, ACK). // PIN_DTD -// データ信号(DT0...DT7,DP)の入出力方向を示す信号のピン番号。 +// Signal that indicates the input/output direction of the data lines (DT0...DT7,DP). // //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // -// 制御信号出力論理 -// 0V:FALSE 3.3V:TRUEで指定します。 +// Control signal output logic +// 0V:FALSE 3.3V:TRUE // // ACT_ON -// PIN_ACT信号の論理です。 +// PIN_ACT signal // ENB_ON -// PIN_ENB信号の論理です。 +// PIN_ENB signal // TAD_IN -// PIN_TAD入力方向時の論理です。 +// PIN_TAD This is the logic when inputting. // IND_IN -// PIN_ENB入力方向時の論理です。 +// PIN_ENB This is the logic when inputting. // DTD_IN -// PIN_ENB入力方向時の論理です。 +// PIN_ENB This is the logic when inputting. // //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // -// SCSI信号ピンアサイン設定 -// SCSIの信号に対するGPIOピンのマッピングテーブルです。 +// SCSI signal pin assignment setting +// GPIO pin mapping table for SCSI signals. // PIN_DT0~PIN_SEL // //--------------------------------------------------------------------------- #ifdef CONNECT_TYPE_STANDARD // -// RaSCSI 標準(SCSI論理,標準ピンアサイン) +// RaSCSI standard (SCSI logic, standard pin assignment) // -#define CONNECT_DESC "STANDARD" // 起動時メッセージ +#define CONNECT_DESC "STANDARD" // Startup message -// 信号制御モード選択 -#define SIGNAL_CONTROL_MODE 0 // SCSI論理仕様 +// Select signal control mode +#define SIGNAL_CONTROL_MODE 0 // SCSI logical specification -// 制御信号ピンアサイン(-1の場合は制御無し) +// Control signal pin assignment (-1 means no control) #define PIN_ACT 4 // ACTIVE #define PIN_ENB 5 // ENABLE #define PIN_IND -1 // INITIATOR CTRL DIRECTION #define PIN_TAD -1 // TARGET CTRL DIRECTION #define PIN_DTD -1 // DATA DIRECTION -// 制御信号出力論理 +// Control signal output logic #define ACT_ON TRUE // ACTIVE SIGNAL ON #define ENB_ON TRUE // ENABLE SIGNAL ON #define IND_IN FALSE // INITIATOR SIGNAL INPUT #define TAD_IN FALSE // TARGET SIGNAL INPUT #define DTD_IN TRUE // DATA SIGNAL INPUT -// SCSI信号ピンアサイン -#define PIN_DT0 10 // データ0 -#define PIN_DT1 11 // データ1 -#define PIN_DT2 12 // データ2 -#define PIN_DT3 13 // データ3 -#define PIN_DT4 14 // データ4 -#define PIN_DT5 15 // データ5 -#define PIN_DT6 16 // データ6 -#define PIN_DT7 17 // データ7 -#define PIN_DP 18 // パリティ +// SCSI signal pin assignment +#define PIN_DT0 10 // Data 0 +#define PIN_DT1 11 // Data 1 +#define PIN_DT2 12 // Data 2 +#define PIN_DT3 13 // Data 3 +#define PIN_DT4 14 // Data 4 +#define PIN_DT5 15 // Data 5 +#define PIN_DT6 16 // Data 6 +#define PIN_DT7 17 // Data 7 +#define PIN_DP 18 // Data parity #define PIN_ATN 19 // ATN #define PIN_RST 20 // RST #define PIN_ACK 21 // ACK @@ -144,37 +144,37 @@ #ifdef CONNECT_TYPE_FULLSPEC // -// RaSCSI 標準(SCSI論理,標準ピンアサイン) +// RaSCSI standard (SCSI logic, standard pin assignment) // -#define CONNECT_DESC "FULLSPEC" // 起動時メッセージ +#define CONNECT_DESC "FULLSPEC" // Startup message -// 信号制御モード選択 -#define SIGNAL_CONTROL_MODE 0 // SCSI論理仕様 +// Select signal control mode +#define SIGNAL_CONTROL_MODE 0 // SCSI logical specification -// 制御信号ピンアサイン(-1の場合は制御無し) +// Control signal pin assignment (-1 means no control) #define PIN_ACT 4 // ACTIVE #define PIN_ENB 5 // ENABLE #define PIN_IND 6 // INITIATOR CTRL DIRECTION #define PIN_TAD 7 // TARGET CTRL DIRECTION #define PIN_DTD 8 // DATA DIRECTION -// 制御信号出力論理 +// Control signal output logic #define ACT_ON TRUE // ACTIVE SIGNAL ON #define ENB_ON TRUE // ENABLE SIGNAL ON #define IND_IN FALSE // INITIATOR SIGNAL INPUT #define TAD_IN FALSE // TARGET SIGNAL INPUT #define DTD_IN TRUE // DATA SIGNAL INPUT -// SCSI信号ピンアサイン -#define PIN_DT0 10 // データ0 -#define PIN_DT1 11 // データ1 -#define PIN_DT2 12 // データ2 -#define PIN_DT3 13 // データ3 -#define PIN_DT4 14 // データ4 -#define PIN_DT5 15 // データ5 -#define PIN_DT6 16 // データ6 -#define PIN_DT7 17 // データ7 -#define PIN_DP 18 // パリティ +// SCSI signal pin assignment +#define PIN_DT0 10 // Data 0 +#define PIN_DT1 11 // Data 1 +#define PIN_DT2 12 // Data 2 +#define PIN_DT3 13 // Data 3 +#define PIN_DT4 14 // Data 4 +#define PIN_DT5 15 // Data 5 +#define PIN_DT6 16 // Data 6 +#define PIN_DT7 17 // Data 7 +#define PIN_DP 18 // Data parity #define PIN_ATN 19 // ATN #define PIN_RST 20 // RST #define PIN_ACK 21 // ACK @@ -188,38 +188,38 @@ #ifdef CONNECT_TYPE_AIBOM // -// RaSCSI Adapter あいぼむ版 +// RaSCSI Adapter Aibomu version // -#define CONNECT_DESC "AIBOM PRODUCTS version" // 起動時メッセージ +#define CONNECT_DESC "AIBOM PRODUCTS version" // Startup message -// 信号制御モード選択 -#define SIGNAL_CONTROL_MODE 2 // SCSI正論理仕様 +// Select signal control mode +#define SIGNAL_CONTROL_MODE 2 // SCSI positive logic specification -// 制御信号出力論理 +// Control signal output logic #define ACT_ON TRUE // ACTIVE SIGNAL ON #define ENB_ON TRUE // ENABLE SIGNAL ON #define IND_IN FALSE // INITIATOR SIGNAL INPUT #define TAD_IN FALSE // TARGET SIGNAL INPUT #define DTD_IN FALSE // DATA SIGNAL INPUT -// 制御信号ピンアサイン(-1の場合は制御無し) +// Control signal pin assignment (-1 means no control) #define PIN_ACT 4 // ACTIVE #define PIN_ENB 17 // ENABLE #define PIN_IND 27 // INITIATOR CTRL DIRECTION #define PIN_TAD -1 // TARGET CTRL DIRECTION #define PIN_DTD 18 // DATA DIRECTION -// SCSI信号ピンアサイン -#define PIN_DT0 6 // データ0 -#define PIN_DT1 12 // データ1 -#define PIN_DT2 13 // データ2 -#define PIN_DT3 16 // データ3 -#define PIN_DT4 19 // データ4 -#define PIN_DT5 20 // データ5 -#define PIN_DT6 26 // データ6 -#define PIN_DT7 21 // データ7 -#define PIN_DP 5 // パリティ +// SCSI signal pin assignment +#define PIN_DT0 6 // Data 0 +#define PIN_DT1 12 // Data 1 +#define PIN_DT2 13 // Data 2 +#define PIN_DT3 16 // Data 3 +#define PIN_DT4 19 // Data 4 +#define PIN_DT5 20 // Data 5 +#define PIN_DT6 26 // Data 6 +#define PIN_DT7 21 // Data 7 +#define PIN_DP 5 // Data parity #define PIN_ATN 22 // ATN #define PIN_RST 25 // RST #define PIN_ACK 10 // ACK @@ -236,35 +236,35 @@ // RaSCSI Adapter GAMERnium.com版 // -#define CONNECT_DESC "GAMERnium.com version"// 起動時メッセージ +#define CONNECT_DESC "GAMERnium.com version"// Startup message -// 信号制御モード選択 -#define SIGNAL_CONTROL_MODE 0 // SCSI論理仕様 +// Select signal control mode +#define SIGNAL_CONTROL_MODE 0 // SCSI logical specification -// 制御信号出力論理 +// Control signal output logic #define ACT_ON TRUE // ACTIVE SIGNAL ON #define ENB_ON TRUE // ENABLE SIGNAL ON #define IND_IN FALSE // INITIATOR SIGNAL INPUT #define TAD_IN FALSE // TARGET SIGNAL INPUT #define DTD_IN TRUE // DATA SIGNAL INPUT -// 制御信号ピンアサイン(-1の場合は制御無し) +// Control signal pin assignment (-1 means no control) #define PIN_ACT 14 // ACTIVE #define PIN_ENB 6 // ENABLE #define PIN_IND 7 // INITIATOR CTRL DIRECTION #define PIN_TAD 8 // TARGET CTRL DIRECTION #define PIN_DTD 5 // DATA DIRECTION -// SCSI信号ピンアサイン -#define PIN_DT0 21 // データ0 -#define PIN_DT1 26 // データ1 -#define PIN_DT2 20 // データ2 -#define PIN_DT3 19 // データ3 -#define PIN_DT4 16 // データ4 -#define PIN_DT5 13 // データ5 -#define PIN_DT6 12 // データ6 -#define PIN_DT7 11 // データ7 -#define PIN_DP 25 // パリティ +// SCSI signal pin assignment +#define PIN_DT0 21 // Data 0 +#define PIN_DT1 26 // Data 1 +#define PIN_DT2 20 // Data 2 +#define PIN_DT3 19 // Data 3 +#define PIN_DT4 16 // Data 4 +#define PIN_DT5 13 // Data 5 +#define PIN_DT6 12 // Data 6 +#define PIN_DT7 11 // Data 7 +#define PIN_DP 25 // Data parity #define PIN_ATN 10 // ATN #define PIN_RST 22 // RST #define PIN_ACK 24 // ACK @@ -278,7 +278,7 @@ //--------------------------------------------------------------------------- // -// 定数宣言(GPIO) +// Constant declarations(GPIO) // //--------------------------------------------------------------------------- #define SYST_OFFSET 0x00003000 @@ -355,7 +355,7 @@ //--------------------------------------------------------------------------- // -// 定数宣言(GIC) +// Constant declarations(GIC) // //--------------------------------------------------------------------------- #define ARM_GICD_BASE 0xFF841000 @@ -380,7 +380,7 @@ //--------------------------------------------------------------------------- // -// 定数宣言(GIC IRQ) +// Constant declarations(GIC IRQ) // //--------------------------------------------------------------------------- #define GIC_IRQLOCAL0 (16 + 14) @@ -388,7 +388,7 @@ //--------------------------------------------------------------------------- // -// 定数宣言(制御信号) +// Constant declarations (Control signals) // //--------------------------------------------------------------------------- #define ACT_OFF !ACT_ON @@ -399,7 +399,7 @@ //--------------------------------------------------------------------------- // -// 定数宣言(SCSI) +// Constant declarations(SCSI) // //--------------------------------------------------------------------------- #define IN GPIO_INPUT @@ -409,214 +409,214 @@ //--------------------------------------------------------------------------- // -// 定数宣言(バス制御タイミング) +// Constant declarations (bus control timing) // //--------------------------------------------------------------------------- -#define GPIO_DATA_SETTLING 100 // データバスが安定する時間(ns) +#define GPIO_DATA_SETTLING 100 // Data bus stabilization time (ns) //--------------------------------------------------------------------------- // -// クラス定義 +// Class definition // //--------------------------------------------------------------------------- class GPIOBUS : public BUS { public: - // 基本ファンクション + // Basic Functions GPIOBUS(); - // コンストラクタ + // Constructor virtual ~GPIOBUS(); - // デストラクタ + // Destructor BOOL FASTCALL Init(mode_e mode = TARGET); - // 初期化 + // Initialization void FASTCALL Reset(); - // リセット + // Reset void FASTCALL Cleanup(); - // クリーンアップ + // Cleanup DWORD FASTCALL Aquire(); - // 信号取り込み + // Signal acquisition void FASTCALL SetENB(BOOL ast); - // ENBシグナル設定 + // Set ENB signal BOOL FASTCALL GetBSY(); - // BSYシグナル取得 + // Get BSY signal void FASTCALL SetBSY(BOOL ast); - // BSYシグナル設定 + // Set BSY signal BOOL FASTCALL GetSEL(); - // SELシグナル取得 + // Get SEL signal void FASTCALL SetSEL(BOOL ast); - // SELシグナル設定 + // Set SEL signal BOOL FASTCALL GetATN(); - // ATNシグナル取得 + // Get ATN signal void FASTCALL SetATN(BOOL ast); - // ATNシグナル設定 + // Set ATN signal BOOL FASTCALL GetACK(); - // ACKシグナル取得 + // Get ACK signal void FASTCALL SetACK(BOOL ast); - // ACKシグナル設定 + // Set ACK signal BOOL FASTCALL GetRST(); - // RSTシグナル取得 + // Get RST signal void FASTCALL SetRST(BOOL ast); - // RSTシグナル設定 + // Set RST signal BOOL FASTCALL GetMSG(); - // MSGシグナル取得 + // Get MSG signal void FASTCALL SetMSG(BOOL ast); - // MSGシグナル設定 + // Set MSG signal BOOL FASTCALL GetCD(); - // CDシグナル取得 + // Get CD signal void FASTCALL SetCD(BOOL ast); - // CDシグナル設定 + // Set CD signal BOOL FASTCALL GetIO(); - // IOシグナル取得 + // Get IO signal void FASTCALL SetIO(BOOL ast); - // IOシグナル設定 + // Set IO signal BOOL FASTCALL GetREQ(); - // REQシグナル取得 + // Get REQ signal void FASTCALL SetREQ(BOOL ast); - // REQシグナル設定 + // Set REQ signal BYTE FASTCALL GetDAT(); - // データシグナル取得 + // Get DAT signal void FASTCALL SetDAT(BYTE dat); - // データシグナル設定 + // Set DAT signal BOOL FASTCALL GetDP(); - // パリティシグナル取得 + // Get Data parity signal int FASTCALL CommandHandShake(BYTE *buf); - // コマンド受信ハンドシェイク + // Command receive handshake int FASTCALL ReceiveHandShake(BYTE *buf, int count); - // データ受信ハンドシェイク + // Data receive handshake int FASTCALL SendHandShake(BYTE *buf, int count); - // データ送信ハンドシェイク + // Data transmission handshake #ifdef USE_SEL_EVENT_ENABLE - // SEL信号割り込み関係 + // SEL signal interrupt int FASTCALL PollSelectEvent(); - // SEL信号イベントポーリング + // SEL signal event polling void FASTCALL ClearSelectEvent(); - // SEL信号イベントクリア + // Clear SEL signal event #endif // USE_SEL_EVENT_ENABLE private: - // SCSI入出力信号制御 + // SCSI I/O signal control void FASTCALL MakeTable(); - // ワークテーブル作成 + // Create work data void FASTCALL SetControl(int pin, BOOL ast); - // 制御信号設定 + // Set Control Signal void FASTCALL SetMode(int pin, int mode); - // SCSI入出力モード設定 + // Set SCSI I/O mode BOOL FASTCALL GetSignal(int pin); - // SCSI入力信号値取得 + // Get SCSI input signal value void FASTCALL SetSignal(int pin, BOOL ast); - // SCSI出力信号値設定 + // Set SCSI output signal value BOOL FASTCALL WaitSignal(int pin, BOOL ast); - // 信号変化待ち - // 割り込み制御 + // Wait for a signal to change + // Interrupt control void FASTCALL DisableIRQ(); - // IRQ禁止 + // IRQ Disabled void FASTCALL EnableIRQ(); - // IRQ有効 + // IRQ Enabled - // GPIOピン機能設定 + // GPIO pin functionality settings void FASTCALL PinConfig(int pin, int mode); - // GPIOピン機能設定(入出力設定) + // GPIO pin direction setting void FASTCALL PullConfig(int pin, int mode); - // GPIOピン機能設定(プルアップ/ダウン) + // GPIO pin pull up/down resistor setting void FASTCALL PinSetSignal(int pin, BOOL ast); - // GPIOピン出力信号設定 + // Set GPIO output signal void FASTCALL DrvConfig(DWORD drive); - // GPIOドライブ能力設定 + // Set GPIO drive strength - mode_e actmode; // 動作モード + mode_e actmode; // Operation mode - DWORD baseaddr; // ベースアドレス + DWORD baseaddr; // Base address int rpitype; - // ラズパイ種別 + // Type of Raspberry Pi - volatile DWORD *gpio; // GPIOレジスタ + volatile DWORD *gpio; // GPIO register - volatile DWORD *pads; // PADSレジスタ + volatile DWORD *pads; // PADS register - volatile DWORD *level; // GPIO入力レベル + volatile DWORD *level; // GPIO input level - volatile DWORD *irpctl; // 割り込み制御レジスタ + volatile DWORD *irpctl; // Interrupt control register #ifndef BAREMETAL - volatile DWORD irptenb; // 割り込み有効状態 + volatile DWORD irptenb; // Interrupt enabled state - volatile DWORD *qa7regs; // QA7レジスタ + volatile DWORD *qa7regs; // QA7 register - volatile int tintcore; // 割り込み制御対象CPU + volatile int tintcore; // Interupt control target CPU. - volatile DWORD tintctl; // 割り込みコントロール + volatile DWORD tintctl; // Interupt control - volatile DWORD giccpmr; // GICC 優先度設定 + volatile DWORD giccpmr; // GICC priority setting #endif // BAREMETAL - volatile DWORD *gicd; // GIC 割り込み分配器レジスタ + volatile DWORD *gicd; // GIC Interrupt distributor register - volatile DWORD *gicc; // GIC CPUインターフェースレジスタ + volatile DWORD *gicc; // GIC CPU interface register - DWORD gpfsel[4]; // GPFSEL0-4バックアップ + DWORD gpfsel[4]; // GPFSEL0-4 backup values - DWORD signals; // バス全信号 + DWORD signals; // All bus signals #if defined(USE_SEL_EVENT_ENABLE) && !defined(BAREMETAL) - struct gpioevent_request selevreq; // SEL信号イベント要求 + struct gpioevent_request selevreq; // SEL signal event request - int epfd; // epollファイルディスクプリタ + int epfd; // epoll file descriptor #endif // USE_SEL_EVENT_ENABLE && !BAREMETAL #if SIGNAL_CONTROL_MODE == 0 - DWORD tblDatMsk[3][256]; // データマスク用テーブル + DWORD tblDatMsk[3][256]; // Data mask table - DWORD tblDatSet[3][256]; // データ設定用テーブル + DWORD tblDatSet[3][256]; // Data setting table #else - DWORD tblDatMsk[256]; // データマスク用テーブル + DWORD tblDatMsk[256]; // Data mask table - DWORD tblDatSet[256]; // データ設定用テーブル + DWORD tblDatSet[256]; // Table setting table #endif - static const int SignalTable[19]; // シグナルテーブル + static const int SignalTable[19]; // signal table }; //=========================================================================== // -// システムタイマ +// System timer // //=========================================================================== class SysTimer { public: static void FASTCALL Init(DWORD *syst, DWORD *armt); - // 初期化 + // Initialization static DWORD FASTCALL GetTimerLow(); - // システムタイマ(LO)取得 + // Get system timer low byte static DWORD FASTCALL GetTimerHigh(); - // システムタイマ(HI)取得 + // Get system timer high byte static void FASTCALL SleepNsec(DWORD nsec); - // ナノ秒単位のスリープ + // Sleep for N nanoseconds static void FASTCALL SleepUsec(DWORD usec); - // μ秒単位のスリープ + // Sleep for N microseconds private: static volatile DWORD *systaddr; - // システムタイマアドレス + // System timer address static volatile DWORD *armtaddr; - // ARMタイマアドレス + // ARM timer address static volatile DWORD corefreq; - // コア周波数 + // Core frequency }; #endif // gpiobus_h diff --git a/src/raspberrypi/rascsi.cpp b/src/raspberrypi/rascsi.cpp index 8717daa3..4e55f007 100644 --- a/src/raspberrypi/rascsi.cpp +++ b/src/raspberrypi/rascsi.cpp @@ -5,7 +5,7 @@ // // Powered by XM6 TypeG Technology. // Copyright (C) 2016-2020 GIMONS -// [ メイン ] +// [ RaSCSI main ] // //--------------------------------------------------------------------------- @@ -18,11 +18,11 @@ //--------------------------------------------------------------------------- // -// 定数宣言 +// Constant declarations // //--------------------------------------------------------------------------- -#define CtrlMax 8 // 最大SCSIコントローラ数 -#define UnitNum 2 // コントローラ辺りのユニット数 +#define CtrlMax 8 // Maximum number of SCSI controllers +#define UnitNum 2 // Number of units around controller #ifdef BAREMETAL #define FPRT(fp, ...) printf( __VA_ARGS__ ) #else @@ -31,38 +31,38 @@ //--------------------------------------------------------------------------- // -// 変数宣言 +// Variable declarations // //--------------------------------------------------------------------------- -static volatile BOOL running; // 実行中フラグ -static volatile BOOL active; // 処理中フラグ -SASIDEV *ctrl[CtrlMax]; // コントローラ -Disk *disk[CtrlMax * UnitNum]; // ディスク -GPIOBUS *bus; // GPIOバス +static volatile BOOL running; // Running flag +static volatile BOOL active; // Processing flag +SASIDEV *ctrl[CtrlMax]; // Controller +Disk *disk[CtrlMax * UnitNum]; // Disk +GPIOBUS *bus; // GPIO Bus #ifdef BAREMETAL FATFS fatfs; // FatFS #else -int monsocket; // モニター用ソケット -pthread_t monthread; // モニタースレッド +int monsocket; // Monitor Socket +pthread_t monthread; // Monitor Thread static void *MonThread(void *param); #endif // BAREMETAL #ifndef BAREMETAL //--------------------------------------------------------------------------- // -// シグナル処理 +// Signal Processing // //--------------------------------------------------------------------------- void KillHandler(int sig) { - // 停止指示 + // Stop instruction running = FALSE; } #endif // BAREMETAL //--------------------------------------------------------------------------- // -// バナー出力 +// Banner Output // //--------------------------------------------------------------------------- void Banner(int argc, char* argv[]) @@ -104,7 +104,7 @@ void Banner(int argc, char* argv[]) //--------------------------------------------------------------------------- // -// 初期化 +// Initialization // //--------------------------------------------------------------------------- BOOL Init() @@ -115,31 +115,31 @@ BOOL Init() struct sockaddr_in server; int yes; - // モニター用ソケット生成 + // Create socket for monitor monsocket = socket(PF_INET, SOCK_STREAM, 0); memset(&server, 0, sizeof(server)); server.sin_family = PF_INET; server.sin_port = htons(6868); server.sin_addr.s_addr = htonl(INADDR_ANY); - // アドレスの再利用を許可する + // allow address reuse yes = 1; if (setsockopt( monsocket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0){ return FALSE; } - // バインド + // Bind if (bind(monsocket, (struct sockaddr *)&server, sizeof(struct sockaddr_in)) < 0) { FPRT(stderr, "Error : Already running?\n"); return FALSE; } - // モニタースレッド生成 + // Create Monitor Thread pthread_create(&monthread, NULL, MonThread, NULL); - // 割り込みハンドラ設定 + // Interrupt handler settings if (signal(SIGINT, KillHandler) == SIG_ERR) { return FALSE; } @@ -151,28 +151,28 @@ BOOL Init() } #endif // BAREMETAL - // GPIOBUS生成 + // GPIOBUS creation bus = new GPIOBUS(); - // GPIO初期化 + // GPIO Initialization if (!bus->Init()) { return FALSE; } - // バスリセット + // Bus Reset bus->Reset(); - // コントローラ初期化 + // Controller initialization for (i = 0; i < CtrlMax; i++) { ctrl[i] = NULL; } - // ディスク初期化 + // Disk Initialization for (i = 0; i < CtrlMax; i++) { disk[i] = NULL; } - // その他 + // Other running = FALSE; active = FALSE; @@ -181,14 +181,14 @@ BOOL Init() //--------------------------------------------------------------------------- // -// クリーンアップ +// Cleanup // //--------------------------------------------------------------------------- void Cleanup() { int i; - // ディスク削除 + // Delete the disks for (i = 0; i < CtrlMax * UnitNum; i++) { if (disk[i]) { delete disk[i]; @@ -196,7 +196,7 @@ void Cleanup() } } - // コントローラ削除 + // Delete the Controllers for (i = 0; i < CtrlMax; i++) { if (ctrl[i]) { delete ctrl[i]; @@ -204,14 +204,14 @@ void Cleanup() } } - // バスをクリーンアップ + // Cleanup the Bus bus->Cleanup(); - // GPIOBUS破棄 + // Discard the GPIOBUS object delete bus; #ifndef BAREMETAL - // モニター用ソケットクローズ + // Close the monitor socket if (monsocket >= 0) { close(monsocket); } @@ -220,27 +220,27 @@ void Cleanup() //--------------------------------------------------------------------------- // -// リセット +// Reset // //--------------------------------------------------------------------------- void Reset() { int i; - // コントローラリセット + // Reset all of the controllers for (i = 0; i < CtrlMax; i++) { if (ctrl[i]) { ctrl[i]->Reset(); } } - // バス信号線をリセット + // Reset the bus bus->Reset(); } //--------------------------------------------------------------------------- // -// デバイス一覧表示 +// List Devices // //--------------------------------------------------------------------------- void ListDevice(FILE *fp) @@ -256,18 +256,18 @@ void ListDevice(FILE *fp) find = FALSE; type[4] = 0; for (i = 0; i < CtrlMax * UnitNum; i++) { - // IDとユニット + // Initialize ID and unit number id = i / UnitNum; un = i % UnitNum; pUnit = disk[i]; - // ユニットが存在しないまたはヌルディスクならスキップ + // skip if unit does not exist or null disk if (pUnit == NULL || pUnit->IsNULL()) { continue; } - // ヘッダー出力 - if (!find) { + // Output the header + if (!find) { FPRT(fp, "\n"); FPRT(fp, "+----+----+------+-------------------------------------\n"); FPRT(fp, "| ID | UN | TYPE | DEVICE STATUS\n"); @@ -275,14 +275,14 @@ void ListDevice(FILE *fp) find = TRUE; } - // ID,UNIT,タイプ出力 + // ID,UNIT,Type,Device Status type[0] = (char)(pUnit->GetID() >> 24); type[1] = (char)(pUnit->GetID() >> 16); type[2] = (char)(pUnit->GetID() >> 8); type[3] = (char)(pUnit->GetID()); FPRT(fp, "| %d | %d | %s | ", id, un, type); - // マウント状態出力 + // mount status output if (pUnit->GetID() == MAKEID('S', 'C', 'B', 'R')) { FPRT(fp, "%s", "HOST BRIDGE"); } else { @@ -292,16 +292,16 @@ void ListDevice(FILE *fp) "NO MEDIA" : filepath.GetPath()); } - // ライトプロテクト状態出力 + // Write protection status if (pUnit->IsRemovable() && pUnit->IsReady() && pUnit->IsWriteP()) { FPRT(fp, "(WRITEPROTECT)"); } - // 次の行へ + // Goto the next line FPRT(fp, "\n"); } - // コントローラが無い場合 + // If there is no controller, find will be null if (!find) { FPRT(fp, "No device is installed.\n"); return; @@ -312,7 +312,7 @@ void ListDevice(FILE *fp) //--------------------------------------------------------------------------- // -// コントローラマッピング +// Controller Mapping // //--------------------------------------------------------------------------- void MapControler(FILE *fp, Disk **map) @@ -323,53 +323,53 @@ void MapControler(FILE *fp, Disk **map) int sasi_num; int scsi_num; - // 変更されたユニットの置き換え + // Replace the changed unit for (i = 0; i < CtrlMax; i++) { for (j = 0; j < UnitNum; j++) { unitno = i * UnitNum + j; if (disk[unitno] != map[unitno]) { - // 元のユニットが存在する + // Check if the original unit exists if (disk[unitno]) { - // コントローラから切り離す + // Disconnect it from the controller if (ctrl[i]) { ctrl[i]->SetUnit(j, NULL); } - // ユニットを解放 + // Free the Unit delete disk[unitno]; } - // 新しいユニットの設定 + // Setup a new unit disk[unitno] = map[unitno]; } } } - // 全コントローラを再構成 + // Reconfigure all of the controllers for (i = 0; i < CtrlMax; i++) { - // ユニット構成を調べる + // Examine the unit configuration sasi_num = 0; scsi_num = 0; for (j = 0; j < UnitNum; j++) { unitno = i * UnitNum + j; - // ユニットの種類で分岐 + // branch by unit type if (disk[unitno]) { if (disk[unitno]->IsSASI()) { - // SASIドライブ数加算 + // Drive is SASI, so increment SASI count sasi_num++; } else { - // SCSIドライブ数加算 + // Drive is SCSI, so increment SCSI count scsi_num++; } } - // ユニットを取り外す + // Remove the unit if (ctrl[i]) { ctrl[i]->SetUnit(j, NULL); } } - // 接続ユニットなし + // If there are no units connected if (sasi_num == 0 && scsi_num == 0) { if (ctrl[i]) { delete ctrl[i]; @@ -378,47 +378,47 @@ void MapControler(FILE *fp, Disk **map) } } - // SASI,SCSI混在 + // Mixture of SCSI and SASI if (sasi_num > 0 && scsi_num > 0) { FPRT(fp, "Error : SASI and SCSI can't be mixed\n"); continue; } if (sasi_num > 0) { - // SASIのユニットのみ + // Only SASI Unit(s) - // コントローラのタイプが違うなら解放 + // Release the controller if it is not SASI if (ctrl[i] && !ctrl[i]->IsSASI()) { delete ctrl[i]; ctrl[i] = NULL; } - // SASIコントローラ生成 + // Create a new SASI controller if (!ctrl[i]) { ctrl[i] = new SASIDEV(); ctrl[i]->Connect(i, bus); } } else { - // SCSIのユニットのみ + // Only SCSI Unit(s) - // コントローラのタイプが違うなら解放 + // Release the controller if it is not SCSI if (ctrl[i] && !ctrl[i]->IsSCSI()) { delete ctrl[i]; ctrl[i] = NULL; } - // SCSIコントローラ生成 + // Create a new SCSI controller if (!ctrl[i]) { ctrl[i] = new SCSIDEV(); ctrl[i]->Connect(i, bus); } } - // 全ユニット接続 + // connect all units for (j = 0; j < UnitNum; j++) { unitno = i * UnitNum + j; if (disk[unitno]) { - // ユニット接続 + // Add the unit connection ctrl[i]->SetUnit(j, disk[unitno]); } } @@ -427,7 +427,7 @@ void MapControler(FILE *fp, Disk **map) //--------------------------------------------------------------------------- // -// コマンド処理 +// Command Processing // //--------------------------------------------------------------------------- BOOL ProcessCmd(FILE *fp, int id, int un, int cmd, int type, char *file) @@ -438,51 +438,51 @@ BOOL ProcessCmd(FILE *fp, int id, int un, int cmd, int type, char *file) Filepath filepath; Disk *pUnit; - // ユニット一覧を複写 + // Copy the Unit List memcpy(map, disk, sizeof(disk)); - // IDチェック + // Check the Controller Number if (id < 0 || id >= CtrlMax) { FPRT(fp, "Error : Invalid ID\n"); return FALSE; } - // ユニットチェック + // Check the Unit Number if (un < 0 || un >= UnitNum) { FPRT(fp, "Error : Invalid unit number\n"); return FALSE; } - // 接続コマンド + // Connect Command if (cmd == 0) { // ATTACH - // SASIとSCSIを見分ける + // Distinguish between SASI and SCSI ext = NULL; pUnit = NULL; if (type == 0) { - // パスチェック + // Passed the check if (!file) { return FALSE; } - // 最低5文字 + // Check that command is at least 5 characters long len = strlen(file); if (len < 5) { return FALSE; } - // 拡張子チェック + // Check the extension if (file[len - 4] != '.') { return FALSE; } - // 拡張子がSASIタイプで無ければSCSIに差し替え + // If the extension is not SASI type, replace with SCSI ext = &file[len - 3]; if (xstrcasecmp(ext, "hdf") != 0) { type = 1; } } - // タイプ別のインスタンスを生成 + // Create a new drive, based upon type switch (type) { case 0: // HDF pUnit = new SASIHD(); @@ -514,12 +514,12 @@ BOOL ProcessCmd(FILE *fp, int id, int un, int cmd, int type, char *file) return FALSE; } - // ドライブはファイルの確認を行う + // drive checks files if (type <= 1 || (type <= 3 && xstrcasecmp(file, "-") != 0)) { - // パスを設定 + // Set the Path filepath.SetPath(file); - // オープン + // Open the file path if (!pUnit->Open(filepath)) { FPRT(fp, "Error : File open error [%s]\n", file); delete pUnit; @@ -527,47 +527,47 @@ BOOL ProcessCmd(FILE *fp, int id, int un, int cmd, int type, char *file) } } - // ライトスルーに設定 + // Set the cache to write-through pUnit->SetCacheWB(FALSE); - // 新しいユニットで置き換え + // Replace with the newly created unit map[id * UnitNum + un] = pUnit; - // コントローラマッピング + // Re-map the controller MapControler(fp, map); return TRUE; } - // 有効なコマンドか + // Is this a valid command? if (cmd > 4) { FPRT(fp, "Error : Invalid command\n"); return FALSE; } - // コントローラが存在するか + // Does the controller exist? if (ctrl[id] == NULL) { FPRT(fp, "Error : No such device\n"); return FALSE; } - // ユニットが存在するか + // Does the unit exist? pUnit = disk[id * UnitNum + un]; if (pUnit == NULL) { FPRT(fp, "Error : No such device\n"); return FALSE; } - // 切断コマンド + // Disconnect Command if (cmd == 1) { // DETACH - // 既存のユニットを解放 + // Free the existing unit map[id * UnitNum + un] = NULL; - // コントローラマッピング + // Re-map the controller MapControler(fp, map); return TRUE; } - // MOかCDの場合だけ有効 + // Valid only for MO or CD if (pUnit->GetID() != MAKEID('S', 'C', 'M', 'O') && pUnit->GetID() != MAKEID('S', 'C', 'C', 'D')) { FPRT(fp, "Error : Operation denied(Deveice isn't removable)\n"); @@ -576,10 +576,10 @@ BOOL ProcessCmd(FILE *fp, int id, int un, int cmd, int type, char *file) switch (cmd) { case 2: // INSERT - // パスを設定 + // Set the file path filepath.SetPath(file); - // オープン + // Open the file if (pUnit->Open(filepath)) { FPRT(fp, "Error : File open error [%s]\n", file); return FALSE; @@ -607,7 +607,7 @@ BOOL ProcessCmd(FILE *fp, int id, int un, int cmd, int type, char *file) //--------------------------------------------------------------------------- // -// 引数処理 +// Argument Parsing // //--------------------------------------------------------------------------- BOOL ParseArgument(int argc, char* argv[]) @@ -628,20 +628,20 @@ BOOL ParseArgument(int argc, char* argv[]) char *ext; #ifdef BAREMETAL - // SDカードマウント + // Mount the SD card fr = f_mount(&fatfs, "", 1); if (fr != FR_OK) { FPRT(stderr, "Error : SD card mount failed.\n"); return FALSE; } - // 設定ファイルがなければ処理を中断 + // If there is no setting file, the processing is interrupted fr = f_open(&fp, "rascsi.ini", FA_READ); if (fr != FR_OK) { return FALSE; } #else - // IDとパス指定がなければ処理を中断 + // If the ID and path are not specified, the processing is interrupted if (argc < 3) { return TRUE; } @@ -649,17 +649,17 @@ BOOL ParseArgument(int argc, char* argv[]) argc--; #endif // BAREMETAL - // 解読開始 + // Start Decoding while (TRUE) { #ifdef BAREMETAL - // 1行取得 + // Get one Line memset(line, 0x00, sizeof(line)); if (f_gets(line, sizeof(line) -1, &fp) == NULL) { break; } - // CR/LF削除 + // Delete the CR/LF len = strlen(line); while (len > 0) { if (line[len - 1] != '\r' && line[len - 1] != '\n') { @@ -676,13 +676,13 @@ BOOL ParseArgument(int argc, char* argv[]) argc -= 2; #endif // BAREMETAL - // IDとパスを取得 + // Get the ID and Path #ifdef BAREMETAL argID = &line[0]; argPath = &line[4]; line[3] = '\0'; - // 事前チェック + // Check if the line is an empty string if (argID[0] == '\0' || argPath[0] == '\0') { continue; } @@ -690,7 +690,7 @@ BOOL ParseArgument(int argc, char* argv[]) argID = argv[i++]; argPath = argv[i++]; - // 事前チェック + // Check if the argument is invalid if (argID[0] != '-') { FPRT(stderr, "Error : Invalid argument(-IDn or -HDn) [%s]\n", argID); @@ -700,41 +700,41 @@ BOOL ParseArgument(int argc, char* argv[]) #endif // BAREMETAL if (strlen(argID) == 3 && xstrncasecmp(argID, "id", 2) == 0) { - // ID or idの形式 + // ID or ID Format - // ID番号をチェック(0-7) + // Check that the ID number is valid (0-7) if (argID[2] < '0' || argID[2] > '7') { FPRT(stderr, "Error : Invalid argument(IDn n=0-7) [%c]\n", argID[2]); goto parse_error; } - // ID,ユニット確定 - id = argID[2] - '0'; + // The ID unit is good + id = argID[2] - '0'; un = 0; } else if (xstrncasecmp(argID, "hd", 2) == 0) { - // HD or hdの形式 + // HD or HD format if (strlen(argID) == 3) { - // HD番号をチェック(0-9) + // Check that the HD number is valid (0-9) if (argID[2] < '0' || argID[2] > '9') { FPRT(stderr, "Error : Invalid argument(HDn n=0-15) [%c]\n", argID[2]); goto parse_error; } - // ID,ユニット確定 + // ID was confirmed id = (argID[2] - '0') / UnitNum; un = (argID[2] - '0') % UnitNum; } else if (strlen(argID) == 4) { - // HD番号をチェック(10-15) + // Check that the HD number is valid (10-15) if (argID[2] != '1' || argID[3] < '0' || argID[3] > '5') { FPRT(stderr, "Error : Invalid argument(HDn n=0-15) [%c]\n", argID[2]); goto parse_error; } - // ID,ユニット確定 + // The ID unit is good - create the id and unit number id = ((argID[3] - '0') + 10) / UnitNum; un = ((argID[3] - '0') + 10) % UnitNum; #ifdef BAREMETAL @@ -751,20 +751,20 @@ BOOL ParseArgument(int argc, char* argv[]) goto parse_error; } - // すでにアクティブなデバイスがあるならスキップ + // Skip if there is already an active device if (disk[id * UnitNum + un] && !disk[id * UnitNum + un]->IsNULL()) { continue; } - // デバイスタイプを初期化 + // Initialize device type type = -1; - // イーサネットとホストブリッジのチェック + // Check ethernet and host bridge if (xstrcasecmp(argPath, "bridge") == 0) { type = 4; } else { - // パスの長さをチェック + // Check the path length len = strlen(argPath); if (len < 5) { FPRT(stderr, @@ -773,14 +773,14 @@ BOOL ParseArgument(int argc, char* argv[]) goto parse_error; } - // 拡張子を持っているか? + // Does the file have an extension? if (argPath[len - 4] != '.') { FPRT(stderr, "Error : Invalid argument(No extension) [%s]\n", argPath); goto parse_error; } - // タイプを決める + // Figure out what the type is ext = &argPath[len - 3]; if (xstrcasecmp(ext, "hdf") == 0 || xstrcasecmp(ext, "hds") == 0 || @@ -796,25 +796,25 @@ BOOL ParseArgument(int argc, char* argv[]) // CD type = 3; } else { - // タイプが判別できない + // Cannot determine the file type FPRT(stderr, "Error : Invalid argument(file type) [%s]\n", ext); goto parse_error; } } - // コマンド実行 + // Execute the command if (!ProcessCmd(stderr, id, un, 0, type, argPath)) { goto parse_error; } } #ifdef BAREMETAL - // 設定ファイルクローズ + // Close the configuration file f_close(&fp); #endif // BAREMETAL - // デバイスリスト表示 + // Display the device list ListDevice(stdout); return TRUE; @@ -822,7 +822,7 @@ BOOL ParseArgument(int argc, char* argv[]) parse_error: #ifdef BAREMETAL - // 設定ファイルクローズ + // Close the configuration file f_close(&fp); #endif // BAREMETAL @@ -832,7 +832,7 @@ parse_error: #ifndef BAREMETAL //--------------------------------------------------------------------------- // -// スレッドを特定のCPUに固定する +// Pin the thread to a specific CPU // //--------------------------------------------------------------------------- void FixCpu(int cpu) @@ -840,12 +840,12 @@ void FixCpu(int cpu) cpu_set_t cpuset; int cpus; - // CPU数取得 + // Get the number of CPUs CPU_ZERO(&cpuset); sched_getaffinity(0, sizeof(cpu_set_t), &cpuset); cpus = CPU_COUNT(&cpuset); - // アフィニティ設定 + // Set the thread affinity if (cpu < cpus) { CPU_ZERO(&cpuset); CPU_SET(cpu, &cpuset); @@ -855,7 +855,7 @@ void FixCpu(int cpu) //--------------------------------------------------------------------------- // -// モニタースレッド +// Monitor Thread // //--------------------------------------------------------------------------- static void *MonThread(void *param) @@ -875,23 +875,23 @@ static void *MonThread(void *param) int type; char *file; - // スケジューラ設定 + // Scheduler Settings schedparam.sched_priority = 0; sched_setscheduler(0, SCHED_IDLE, &schedparam); - // CPUを固定 + // Set the affinity to a specific processor core FixCpu(2); - // 実行開始待ち + // Wait for the execution to start while (!running) { usleep(1); } - // 監視準備 + // Setup the monitor socket to receive commands listen(monsocket, 1); while (1) { - // 接続待ち + // Wait for connection memset(&client, 0, sizeof(client)); len = sizeof(client); fd = accept(monsocket, (struct sockaddr*)&client, &len); @@ -899,68 +899,68 @@ static void *MonThread(void *param) break; } - // コマンド取得 + // Fetch the command fp = fdopen(fd, "r+"); p = fgets(buf, BUFSIZ, fp); - // コマンド取得に失敗 + // Failed to get the command if (!p) { goto next; } - // 改行文字を削除 + // Remove the newline character p[strlen(p) - 1] = 0; - // デバイスリスト表示 + // List all of the devices if (xstrncasecmp(p, "list", 4) == 0) { ListDevice(fp); goto next; } - // パラメータの分離 + // Parameter separation argv[0] = p; for (i = 1; i < 5; i++) { - // パラメータ値をスキップ + // Skip parameter values while (*p && (*p != ' ')) { p++; } - // スペースをNULLに置換 + // Replace spaces with null characters while (*p && (*p == ' ')) { *p++ = 0; } - // パラメータを見失った + // The parameters were lost if (!*p) { break; } - // パラメータとして認識 + // Recognized as a parameter argv[i] = p; } - // 全パラメータの取得失敗 + // Failed to get all parameters if (i < 5) { goto next; } - // ID,ユニット,コマンド,タイプ,ファイル + // ID, unit, command, type, file id = atoi(argv[0]); un = atoi(argv[1]); cmd = atoi(argv[2]); type = atoi(argv[3]); file = argv[4]; - // アイドルになるまで待つ + // Wait until we becom idle while (active) { usleep(500 * 1000); } - // コマンド実行 + // Execute the command ProcessCmd(fp, id, un, cmd, type, file); next: - // 接続解放 + // Release the connection fclose(fp); close(fd); } @@ -971,7 +971,7 @@ next: //--------------------------------------------------------------------------- // -// 主処理 +// Main processing // //--------------------------------------------------------------------------- #ifdef BAREMETAL @@ -994,66 +994,66 @@ int main(int argc, char* argv[]) struct sched_param schparam; #endif // BAREMETAL - // バナー出力 + // Output the Banner Banner(argc, argv); - // 初期化 + // Initialize ret = 0; if (!Init()) { ret = EPERM; goto init_exit; } - // リセット + // Reset Reset(); #ifdef BAREMETAL - // BUSYアサート(ホスト側を待たせるため) + // BUSY assert (to hold the host side) bus->SetBSY(TRUE); #endif - // 引数処理 + // Argument parsing if (!ParseArgument(argc, argv)) { ret = EINVAL; goto err_exit; } #ifdef BAREMETAL - // BUSYネゲート(ホスト側を待たせるため) + // Release the busy signal bus->SetBSY(FALSE); #endif #ifndef BAREMETAL - // CPUを固定 + // Set the affinity to a specific processor core FixCpu(3); #ifdef USE_SEL_EVENT_ENABLE - // スケジューリングポリシー設定(最優先) + // Scheduling policy setting (highest priority) schparam.sched_priority = sched_get_priority_max(SCHED_FIFO); sched_setscheduler(0, SCHED_FIFO, &schparam); #endif // USE_SEL_EVENT_ENABLE #endif // BAREMETAL - // 実行開始 + // Start execution running = TRUE; - // メインループ + // Main Loop while (running) { - // ワーク初期化 + // Work initialization actid = -1; phase = BUS::busfree; #ifdef USE_SEL_EVENT_ENABLE - // SEL信号ポーリング + // SEL signal polling if (bus->PollSelectEvent() < 0) { - // 割り込みで停止 + // Stop on interrupt if (errno == EINTR) { break; } continue; } - // バスの状態取得 + // Get the bus bus->Aquire(); #else bus->Aquire(); @@ -1065,8 +1065,8 @@ int main(int argc, char* argv[]) } #endif // USE_SEL_EVENT_ENABLE - // イニシエータがID設定中にアサートしている - // 可能性があるのでBSYが解除されるまで待つ(最大3秒) + // Wait until BSY is released as there is a possibility for the + // initiator to assert it while setting the ID (for up to 3 seconds) if (bus->GetBSY()) { now = SysTimer::GetTimerLow(); while ((SysTimer::GetTimerLow() - now) < 3 * 1000 * 1000) { @@ -1077,66 +1077,66 @@ int main(int argc, char* argv[]) } } - // ビジー、または他のデバイスが応答したので止める + // Stop because it the bus is busy or another device responded if (bus->GetBSY() || !bus->GetSEL()) { continue; } - // 全コントローラに通知 + // Notify all controllers data = bus->GetDAT(); for (i = 0; i < CtrlMax; i++) { if (!ctrl[i] || (data & (1 << i)) == 0) { continue; } - // セレクションフェーズに移行したターゲットを探す + // Find the target that has moved to the selection phase if (ctrl[i]->Process() == BUS::selection) { - // ターゲットのIDを取得 + // Get the target ID actid = i; - // セレクションフェーズ + // Bus Selection phase phase = BUS::selection; break; } } - // セレクションフェーズが開始されていなければバスの監視へ戻る + // Return to bus monitoring if the selection phase has not started if (phase != BUS::selection) { continue; } - // ターゲット走行開始 + // Start target device active = TRUE; #if !defined(USE_SEL_EVENT_ENABLE) && !defined(BAREMETAL) - // スケジューリングポリシー設定(最優先) + // Scheduling policy setting (highest priority) schparam.sched_priority = sched_get_priority_max(SCHED_FIFO); sched_setscheduler(0, SCHED_FIFO, &schparam); #endif // !USE_SEL_EVENT_ENABLE && !BAREMETAL - // バスフリーになるまでループ + // Loop until the bus is free while (running) { - // ターゲット駆動 + // Target drive phase = ctrl[actid]->Process(); - // バスフリーになったら終了 + // End when the bus is free if (phase == BUS::busfree) { break; } } #if !defined(USE_SEL_EVENT_ENABLE) && !defined(BAREMETAL) - // スケジューリングポリシー設定(ノーマル) + // Set the scheduling priority back to normal schparam.sched_priority = 0; sched_setscheduler(0, SCHED_OTHER, &schparam); #endif // !USE_SEL_EVENT_ENABLE && !BAREMETAL - // ターゲット走行終了 + // End the target travel active = FALSE; } err_exit: - // クリーンアップ + // Cleanup Cleanup(); init_exit: diff --git a/src/raspberrypi/rasctl.cpp b/src/raspberrypi/rasctl.cpp index 75a9d407..35630b31 100644 --- a/src/raspberrypi/rasctl.cpp +++ b/src/raspberrypi/rasctl.cpp @@ -5,7 +5,7 @@ // // Powered by XM6 TypeG Technology. // Copyright (C) 2016-2020 GIMONS -// [ 制御コマンド送信 ] +// [ Send Control Command ] // //--------------------------------------------------------------------------- @@ -13,7 +13,7 @@ //--------------------------------------------------------------------------- // -// コマンド送信 +// Send Command // //--------------------------------------------------------------------------- BOOL SendCommand(char *buf) @@ -22,26 +22,26 @@ BOOL SendCommand(char *buf) struct sockaddr_in server; FILE *fp; - // コマンド用ソケット生成 + // Create a socket to send the command fd = socket(PF_INET, SOCK_STREAM, 0); memset(&server, 0, sizeof(server)); server.sin_family = PF_INET; server.sin_port = htons(6868); server.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - // 接続 + // Connect if (connect(fd, (struct sockaddr *)&server, sizeof(struct sockaddr_in)) < 0) { fprintf(stderr, "Error : Can't connect to rascsi process\n"); return FALSE; } - // 送信 + // Send the command fp = fdopen(fd, "r+"); setvbuf(fp, NULL, _IONBF, 0); fprintf(fp, buf); - // メッセージ受信 + // Receive the message while (1) { if (fgets((char *)buf, BUFSIZ, fp) == NULL) { break; @@ -49,7 +49,7 @@ BOOL SendCommand(char *buf) printf("%s", buf); } - // ソケットを閉じる + // Close the socket when we're done fclose(fp); close(fd); @@ -58,7 +58,7 @@ BOOL SendCommand(char *buf) //--------------------------------------------------------------------------- // -// 主処理 +// Main processing // //--------------------------------------------------------------------------- int main(int argc, char* argv[]) @@ -81,7 +81,7 @@ int main(int argc, char* argv[]) file = NULL; list = FALSE; - // ヘルプの表示 + // Display help if (argc < 2) { fprintf(stderr, "SCSI Target Emulator RaSCSI Controller\n"); fprintf(stderr, @@ -98,7 +98,7 @@ int main(int argc, char* argv[]) exit(0); } - // 引数解析 + // Parse the arguments opterr = 0; while ((opt = getopt(argc, argv, "i:u:c:t:f:l")) != -1) { switch (opt) { @@ -168,34 +168,34 @@ int main(int argc, char* argv[]) } } - // リスト表示のみ + // List display only if (id < 0 && cmd < 0 && type < 0 && file == NULL && list) { sprintf(buf, "list\n"); SendCommand(buf); exit(0); } - // IDチェック + // Check the ID number if (id < 0 || id > 7) { fprintf(stderr, "Error : Invalid ID\n"); exit(EINVAL); } - // ユニットチェック + // Check the unit number if (un < 0 || un > 1) { fprintf(stderr, "Error : Invalid UNIT\n"); exit(EINVAL); } - // コマンドチェック + // Command check if (cmd < 0) { - cmd = 0; // デフォルトはATTATCHとする + cmd = 0; // Default command is ATTATCH } - // タイプチェック + // Type Check if (cmd == 0 && type < 0) { - // 拡張子からタイプ判別を試みる + // Try to determine the file type from the extension len = file ? strlen(file) : 0; if (len > 4 && file[len - 4] == '.') { ext = &file[len - 3]; @@ -222,7 +222,7 @@ int main(int argc, char* argv[]) } } - // ファイルチェック(コマンドはATTACHでタイプはHD) + // File check (command is ATTACH and type is HD) if (cmd == 0 && type >= 0 && type <= 1) { if (!file) { fprintf(stderr, "Error : Invalid file path\n"); @@ -230,7 +230,7 @@ int main(int argc, char* argv[]) } } - // ファイルチェック(コマンドはINSERT) + // File check (command is INSERT) if (cmd == 2) { if (!file) { fprintf(stderr, "Error : Invalid file path\n"); @@ -238,23 +238,23 @@ int main(int argc, char* argv[]) } } - // 必要でないtypeは0としておく + // Set unnecessary type to 0 if (type < 0) { type = 0; } - // 送信コマンド生成 + // Generate the command and send it sprintf(buf, "%d %d %d %d %s\n", id, un, cmd, type, file ? file : "-"); if (!SendCommand(buf)) { exit(ENOTCONN); } - // リスト表示 + // Display the list if (list) { sprintf(buf, "list\n"); SendCommand(buf); } - // 終了 + // All done! exit(0); } diff --git a/src/raspberrypi/scsi.cpp b/src/raspberrypi/scsi.cpp index 914472d1..f9f13537 100644 --- a/src/raspberrypi/scsi.cpp +++ b/src/raspberrypi/scsi.cpp @@ -5,7 +5,7 @@ // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) // Copyright (C) 2014-2020 GIMONS // -// [ SCSI共通 ] +// [ SCSI Common Functionality ] // //--------------------------------------------------------------------------- @@ -15,7 +15,7 @@ //--------------------------------------------------------------------------- // -// フェーズ取得 +// Phase Acquisition // //--------------------------------------------------------------------------- BUS::phase_t FASTCALL BUS::GetPhase() @@ -24,17 +24,17 @@ BUS::phase_t FASTCALL BUS::GetPhase() ASSERT(this); - // セレクションフェーズ + // Selection Phase if (GetSEL()) { return selection; } - // バスフリーフェーズ + // Bus busy phase if (!GetBSY()) { return busfree; } - // バスの信号線からターゲットのフェーズを取得 + // Get target phase from bus signal line mci = GetMSG() ? 0x04 : 0x00; mci |= GetCD() ? 0x02 : 0x00; mci |= GetIO() ? 0x01 : 0x00; @@ -43,7 +43,7 @@ BUS::phase_t FASTCALL BUS::GetPhase() //--------------------------------------------------------------------------- // -// フェーズテーブル +// Phase Table // //--------------------------------------------------------------------------- const BUS::phase_t BUS::phase_table[8] = { diff --git a/src/raspberrypi/scsi.h b/src/raspberrypi/scsi.h index b4d987dd..2ce46239 100644 --- a/src/raspberrypi/scsi.h +++ b/src/raspberrypi/scsi.h @@ -5,7 +5,7 @@ // Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp) // Copyright (C) 2014-2020 GIMONS // -// [ SCSI共通 ] +// [ SCSI Common Functionality ] // //--------------------------------------------------------------------------- @@ -14,20 +14,20 @@ //=========================================================================== // -// SASI/SCSI バス +// SASI/SCSI Bus // //=========================================================================== class BUS { public: - // 動作モード定義 + // Operation modes definition enum mode_e { TARGET = 0, INITIATOR = 1, MONITOR = 2, }; - // フェーズ定義 + // Phase definition enum phase_t { busfree, // バスフリーフェーズ arbitration, // アービトレーションフェーズ @@ -43,6 +43,7 @@ public: reserved // 未使用/リザーブ }; + // Basic Functions // 基本ファンクション virtual BOOL FASTCALL Init(mode_e mode) = 0; // 初期化 diff --git a/src/raspberrypi/xm6.h b/src/raspberrypi/xm6.h index 6ebda50d..a349b788 100644 --- a/src/raspberrypi/xm6.h +++ b/src/raspberrypi/xm6.h @@ -6,7 +6,7 @@ // Powered by XM6 TypeG Technology. // Copyright (C) 2016-2020 GIMONS // -// [ 共通定義 ] +// [ Common Definition ] // //--------------------------------------------------------------------------- @@ -29,30 +29,30 @@ //--------------------------------------------------------------------------- // -// IDマクロ +// ID Macro // //--------------------------------------------------------------------------- #define MAKEID(a, b, c, d) ((DWORD)((a<<24) | (b<<16) | (c<<8) | d)) //--------------------------------------------------------------------------- // -// 各種動作設定 +// Various Operation Settings // //--------------------------------------------------------------------------- -#define USE_SEL_EVENT_ENABLE // SEL信号をイベントでチェックする -#define REMOVE_FIXED_SASIHD_SIZE // SASIHDのサイズ制限を解除する -#define USE_MZ1F23_1024_SUPPORT // MZ-1F23(SASI 20M/セクタサイズ1024) +#define USE_SEL_EVENT_ENABLE // Check SEL signal by event +#define REMOVE_FIXED_SASIHD_SIZE // remove the size limitation of SASIHD +#define USE_MZ1F23_1024_SUPPORT // MZ-1F23 (SASI 20M/sector size 1024) //--------------------------------------------------------------------------- // -// クラス宣言 +// Class Declaration // //--------------------------------------------------------------------------- class Fileio; - // ファイル入出力 + // File I/O class Disk; - // SASI/SCSIディスク + // SASI/SCSI Disk class Filepath; - // ファイルパス + // File Path #endif // xm6_h