1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-05 10:28:58 +00:00

Reduces output noise.

This commit is contained in:
Thomas Harte 2019-09-18 21:41:29 -04:00
parent f53411a319
commit 8d4a96683a
4 changed files with 21 additions and 21 deletions

View File

@ -23,7 +23,7 @@ NCR5380::NCR5380(SCSI::Bus &bus, int clock_rate) :
void NCR5380::write(int address, uint8_t value, bool dma_acknowledge) { void NCR5380::write(int address, uint8_t value, bool dma_acknowledge) {
switch(address & 7) { switch(address & 7) {
case 0: case 0:
LOG("[SCSI 0] Set current SCSI bus state to " << PADHEX(2) << int(value)); // LOG("[SCSI 0] Set current SCSI bus state to " << PADHEX(2) << int(value));
data_bus_ = value; data_bus_ = value;
if(dma_request_ && dma_operation_ == DMAOperation::Send) { if(dma_request_ && dma_operation_ == DMAOperation::Send) {
@ -36,7 +36,7 @@ void NCR5380::write(int address, uint8_t value, bool dma_acknowledge) {
break; break;
case 1: { case 1: {
LOG("[SCSI 1] Initiator command register set: " << PADHEX(2) << int(value)); // LOG("[SCSI 1] Initiator command register set: " << PADHEX(2) << int(value));
initiator_command_ = value; initiator_command_ = value;
bus_output_ &= ~(Line::Reset | Line::Acknowledge | Line::Busy | Line::SelectTarget | Line::Attention); bus_output_ &= ~(Line::Reset | Line::Acknowledge | Line::Busy | Line::SelectTarget | Line::Attention);
@ -52,7 +52,7 @@ void NCR5380::write(int address, uint8_t value, bool dma_acknowledge) {
} break; } break;
case 2: case 2:
LOG("[SCSI 2] Set mode: " << PADHEX(2) << int(value)); // LOG("[SCSI 2] Set mode: " << PADHEX(2) << int(value));
mode_ = value; mode_ = value;
// bit 7: 1 = use block mode DMA mode (if DMA mode is also enabled) // bit 7: 1 = use block mode DMA mode (if DMA mode is also enabled)
@ -87,27 +87,27 @@ void NCR5380::write(int address, uint8_t value, bool dma_acknowledge) {
break; break;
case 3: { case 3: {
LOG("[SCSI 3] Set target command: " << PADHEX(2) << int(value)); // LOG("[SCSI 3] Set target command: " << PADHEX(2) << int(value));
target_command_ = value; target_command_ = value;
update_control_output(); update_control_output();
} break; } break;
case 4: case 4:
LOG("[SCSI 4] Set select enabled: " << PADHEX(2) << int(value)); // LOG("[SCSI 4] Set select enabled: " << PADHEX(2) << int(value));
break; break;
case 5: case 5:
LOG("[SCSI 5] Start DMA send: " << PADHEX(2) << int(value)); // LOG("[SCSI 5] Start DMA send: " << PADHEX(2) << int(value));
dma_operation_ = DMAOperation::Send; dma_operation_ = DMAOperation::Send;
break; break;
case 6: case 6:
LOG("[SCSI 6] Start DMA target receive: " << PADHEX(2) << int(value)); // LOG("[SCSI 6] Start DMA target receive: " << PADHEX(2) << int(value));
dma_operation_ = DMAOperation::TargetReceive; dma_operation_ = DMAOperation::TargetReceive;
break; break;
case 7: case 7:
LOG("[SCSI 7] Start DMA initiator receive: " << PADHEX(2) << int(value)); // LOG("[SCSI 7] Start DMA initiator receive: " << PADHEX(2) << int(value));
dma_operation_ = DMAOperation::InitiatorReceive; dma_operation_ = DMAOperation::InitiatorReceive;
break; break;
} }
@ -131,7 +131,7 @@ void NCR5380::write(int address, uint8_t value, bool dma_acknowledge) {
uint8_t NCR5380::read(int address, bool dma_acknowledge) { uint8_t NCR5380::read(int address, bool dma_acknowledge) {
switch(address & 7) { switch(address & 7) {
case 0: case 0:
LOG("[SCSI 0] Get current SCSI bus state: " << PADHEX(2) << (bus_.get_state() & 0xff)); // LOG("[SCSI 0] Get current SCSI bus state: " << PADHEX(2) << (bus_.get_state() & 0xff));
if(dma_request_ && dma_operation_ == DMAOperation::InitiatorReceive) { if(dma_request_ && dma_operation_ == DMAOperation::InitiatorReceive) {
dma_acknowledge_ = true; dma_acknowledge_ = true;
@ -142,7 +142,7 @@ uint8_t NCR5380::read(int address, bool dma_acknowledge) {
return uint8_t(bus_.get_state()); return uint8_t(bus_.get_state());
case 1: case 1:
LOG("[SCSI 1] Initiator command register get: " << (arbitration_in_progress_ ? 'p' : '-') << (lost_arbitration_ ? 'l' : '-')); // LOG("[SCSI 1] Initiator command register get: " << (arbitration_in_progress_ ? 'p' : '-') << (lost_arbitration_ ? 'l' : '-'));
return return
// Bits repeated as they were set. // Bits repeated as they were set.
(initiator_command_ & ~0x60) | (initiator_command_ & ~0x60) |
@ -154,11 +154,11 @@ uint8_t NCR5380::read(int address, bool dma_acknowledge) {
(lost_arbitration_ ? 0x20 : 0x00); (lost_arbitration_ ? 0x20 : 0x00);
case 2: case 2:
LOG("[SCSI 2] Get mode"); // LOG("[SCSI 2] Get mode");
return mode_; return mode_;
case 3: case 3:
LOG("[SCSI 3] Get target command"); // LOG("[SCSI 3] Get target command");
return target_command_; return target_command_;
case 4: { case 4: {
@ -172,7 +172,7 @@ uint8_t NCR5380::read(int address, bool dma_acknowledge) {
((bus_state & Line::Input) ? 0x04 : 0x00) | ((bus_state & Line::Input) ? 0x04 : 0x00) |
((bus_state & Line::SelectTarget) ? 0x02 : 0x00) | ((bus_state & Line::SelectTarget) ? 0x02 : 0x00) |
((bus_state & Line::Parity) ? 0x01 : 0x00); ((bus_state & Line::Parity) ? 0x01 : 0x00);
LOG("[SCSI 4] Get current bus state: " << PADHEX(2) << int(result)); // LOG("[SCSI 4] Get current bus state: " << PADHEX(2) << int(result));
return result; return result;
} }
@ -191,16 +191,16 @@ uint8_t NCR5380::read(int address, bool dma_acknowledge) {
/* b2 = busy error */ /* b2 = busy error */
((bus_state & Line::Attention) ? 0x02 : 0x00) | ((bus_state & Line::Attention) ? 0x02 : 0x00) |
((bus_state & Line::Acknowledge) ? 0x01 : 0x00); ((bus_state & Line::Acknowledge) ? 0x01 : 0x00);
LOG("[SCSI 5] Get bus and status: " << PADHEX(2) << int(result)); // LOG("[SCSI 5] Get bus and status: " << PADHEX(2) << int(result));
return result; return result;
} }
case 6: case 6:
LOG("[SCSI 6] Get input data"); // LOG("[SCSI 6] Get input data");
return 0xff; return 0xff;
case 7: case 7:
LOG("[SCSI 7] Reset parity/interrupt"); // LOG("[SCSI 7] Reset parity/interrupt");
return 0xff; return 0xff;
} }
return 0; return 0;

View File

@ -7,10 +7,10 @@
// //
#include "DirectAccessDevice.hpp" #include "DirectAccessDevice.hpp"
#include "../../../Outputs/Log.hpp"
using namespace SCSI; using namespace SCSI;
void DirectAccessDevice::set_storage(const std::shared_ptr<Storage::MassStorage::MassStorageDevice> &device) { void DirectAccessDevice::set_storage(const std::shared_ptr<Storage::MassStorage::MassStorageDevice> &device) {
device_ = device; device_ = device;
} }
@ -19,7 +19,7 @@ bool DirectAccessDevice::read(const Target::CommandState &state, Target::Respond
if(!device_) return false; if(!device_) return false;
const auto specs = state.read_write_specs(); const auto specs = state.read_write_specs();
printf("Read: %d from %d\n", specs.number_of_blocks, specs.address); LOG("Read: " << specs.number_of_blocks << " from " << specs.address);
std::vector<uint8_t> output = device_->get_block(specs.address); std::vector<uint8_t> output = device_->get_block(specs.address);
for(uint32_t offset = 1; offset < specs.number_of_blocks; ++offset) { for(uint32_t offset = 1; offset < specs.number_of_blocks; ++offset) {

View File

@ -10,6 +10,7 @@
#define SCSI_Target_hpp #define SCSI_Target_hpp
#include "SCSI.hpp" #include "SCSI.hpp"
#include "../../../Outputs/Log.hpp"
#include <cstring> #include <cstring>
#include <functional> #include <functional>

View File

@ -125,7 +125,6 @@ template <typename Executor> void Target<Executor>::scsi_bus_did_change(Bus *, B
bus_state_ &= ~(Line::Request | 0xff); bus_state_ &= ~(Line::Request | 0xff);
++data_pointer_; ++data_pointer_;
// printf("DP: %zu\n", data_pointer_);
break; break;
case 0: case 0:
@ -177,7 +176,7 @@ template <typename Executor> bool Target<Executor>::dispatch_command() {
#define G1(x) (0x20|x) #define G1(x) (0x20|x)
#define G5(x) (0xa0|x) #define G5(x) (0xa0|x)
printf("---Command %02x---\n", command_[0]); LOG("---Command " << PADHEX(2) << int(command_[0]) << "---");
switch(command_[0]) { switch(command_[0]) {
default: return false; default: return false;
@ -277,5 +276,5 @@ template <typename Executor> void Target<Executor>::end_command() {
bus_state_ = DefaultBusState; bus_state_ = DefaultBusState;
set_device_output(bus_state_); set_device_output(bus_state_);
printf("---Done---\n"); LOG("---Done---");
} }