mirror of
https://github.com/thewesker/RASCSI.git
synced 2025-12-21 04:41:12 -05:00
Changed gpiobus back to a common version. Restored rascsi.cpp to original version
This commit is contained in:
@@ -460,7 +460,6 @@ void FASTCALL GPIOBUS::Reset()
|
|||||||
SetMode(PIN_SEL, IN);
|
SetMode(PIN_SEL, IN);
|
||||||
SetMode(PIN_ATN, IN);
|
SetMode(PIN_ATN, IN);
|
||||||
SetMode(PIN_ACK, IN);
|
SetMode(PIN_ACK, IN);
|
||||||
printf("ACK is set to IN\n");
|
|
||||||
SetMode(PIN_RST, IN);
|
SetMode(PIN_RST, IN);
|
||||||
|
|
||||||
// Set data bus signals to input
|
// Set data bus signals to input
|
||||||
@@ -489,7 +488,6 @@ void FASTCALL GPIOBUS::Reset()
|
|||||||
SetControl(PIN_IND, IND_OUT);
|
SetControl(PIN_IND, IND_OUT);
|
||||||
SetMode(PIN_SEL, OUT);
|
SetMode(PIN_SEL, OUT);
|
||||||
SetMode(PIN_ATN, OUT);
|
SetMode(PIN_ATN, OUT);
|
||||||
printf("ACK is set to OUT\n");
|
|
||||||
SetMode(PIN_ACK, OUT);
|
SetMode(PIN_ACK, OUT);
|
||||||
SetMode(PIN_RST, OUT);
|
SetMode(PIN_RST, OUT);
|
||||||
|
|
||||||
@@ -510,8 +508,6 @@ void FASTCALL GPIOBUS::Reset()
|
|||||||
signals = 0;
|
signals = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD high_bits = 0x0;
|
|
||||||
static DWORD low_bits = 0xFFFFFFFF;
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Bus signal acquisition
|
// Bus signal acquisition
|
||||||
@@ -521,17 +517,6 @@ DWORD FASTCALL GPIOBUS::Aquire()
|
|||||||
{
|
{
|
||||||
signals = *level;
|
signals = *level;
|
||||||
|
|
||||||
DWORD prev_high = high_bits;
|
|
||||||
DWORD prev_low = low_bits;
|
|
||||||
|
|
||||||
high_bits |= signals;
|
|
||||||
low_bits &= signals;
|
|
||||||
|
|
||||||
if ((high_bits != prev_high) || (low_bits != prev_low))
|
|
||||||
{
|
|
||||||
printf(" %08lX %08lX\n",high_bits, low_bits);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if SIGNAL_CONTROL_MODE < 2
|
#if SIGNAL_CONTROL_MODE < 2
|
||||||
// Invert if negative logic (internal processing is unified to positive logic)
|
// Invert if negative logic (internal processing is unified to positive logic)
|
||||||
signals = ~signals;
|
signals = ~signals;
|
||||||
@@ -567,36 +552,40 @@ BOOL FASTCALL GPIOBUS::GetBSY()
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void FASTCALL GPIOBUS::SetBSY(BOOL ast)
|
void FASTCALL GPIOBUS::SetBSY(BOOL ast)
|
||||||
{
|
{
|
||||||
// // Set BSY signal
|
if(actmode == MONITOR){
|
||||||
// SetSignal(PIN_BSY, ast);
|
return;
|
||||||
//
|
}
|
||||||
// if (actmode == TARGET) {
|
|
||||||
// if (ast) {
|
// Set BSY signal
|
||||||
// // Turn on ACTIVE signal
|
SetSignal(PIN_BSY, ast);
|
||||||
// SetControl(PIN_ACT, ACT_ON);
|
|
||||||
//
|
if (actmode == TARGET) {
|
||||||
// // Set Target signal to output
|
if (ast) {
|
||||||
// SetControl(PIN_TAD, TAD_OUT);
|
// Turn on ACTIVE signal
|
||||||
//
|
SetControl(PIN_ACT, ACT_ON);
|
||||||
// SetMode(PIN_BSY, OUT);
|
|
||||||
// SetMode(PIN_MSG, OUT);
|
// Set Target signal to output
|
||||||
// SetMode(PIN_CD, OUT);
|
SetControl(PIN_TAD, TAD_OUT);
|
||||||
// SetMode(PIN_REQ, OUT);
|
|
||||||
// SetMode(PIN_IO, OUT);
|
SetMode(PIN_BSY, OUT);
|
||||||
// } else {
|
SetMode(PIN_MSG, OUT);
|
||||||
// // Turn off the ACTIVE signal
|
SetMode(PIN_CD, OUT);
|
||||||
// SetControl(PIN_ACT, ACT_OFF);
|
SetMode(PIN_REQ, OUT);
|
||||||
//
|
SetMode(PIN_IO, OUT);
|
||||||
// // Set the target signal to input
|
} else {
|
||||||
// SetControl(PIN_TAD, TAD_IN);
|
// Turn off the ACTIVE signal
|
||||||
//
|
SetControl(PIN_ACT, ACT_OFF);
|
||||||
// SetMode(PIN_BSY, IN);
|
|
||||||
// SetMode(PIN_MSG, IN);
|
// Set the target signal to input
|
||||||
// SetMode(PIN_CD, IN);
|
SetControl(PIN_TAD, TAD_IN);
|
||||||
// SetMode(PIN_REQ, IN);
|
|
||||||
// SetMode(PIN_IO, IN);
|
SetMode(PIN_BSY, IN);
|
||||||
// }
|
SetMode(PIN_MSG, IN);
|
||||||
// }
|
SetMode(PIN_CD, IN);
|
||||||
|
SetMode(PIN_REQ, IN);
|
||||||
|
SetMode(PIN_IO, IN);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -616,13 +605,17 @@ BOOL FASTCALL GPIOBUS::GetSEL()
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void FASTCALL GPIOBUS::SetSEL(BOOL ast)
|
void FASTCALL GPIOBUS::SetSEL(BOOL ast)
|
||||||
{
|
{
|
||||||
// if (actmode == INITIATOR && ast) {
|
if(actmode == MONITOR){
|
||||||
// // Turn on ACTIVE signal
|
return;
|
||||||
// SetControl(PIN_ACT, ACT_ON);
|
}
|
||||||
// }
|
|
||||||
//
|
if (actmode == INITIATOR && ast) {
|
||||||
// // Set SEL signal
|
// Turn on ACTIVE signal
|
||||||
// SetSignal(PIN_SEL, ast);
|
SetControl(PIN_ACT, ACT_ON);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set SEL signal
|
||||||
|
SetSignal(PIN_SEL, ast);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -642,7 +635,11 @@ BOOL FASTCALL GPIOBUS::GetATN()
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void FASTCALL GPIOBUS::SetATN(BOOL ast)
|
void FASTCALL GPIOBUS::SetATN(BOOL ast)
|
||||||
{
|
{
|
||||||
// SetSignal(PIN_ATN, ast);
|
if(actmode == MONITOR){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetSignal(PIN_ATN, ast);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -662,7 +659,31 @@ BOOL FASTCALL GPIOBUS::GetACK()
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void FASTCALL GPIOBUS::SetACK(BOOL ast)
|
void FASTCALL GPIOBUS::SetACK(BOOL ast)
|
||||||
{
|
{
|
||||||
//SetSignal(PIN_ACK, ast);
|
if(actmode == MONITOR){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetSignal(PIN_ACK, ast);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Get ACK signal
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
BOOL FASTCALL GPIOBUS::GetACT()
|
||||||
|
{
|
||||||
|
return GetSignal(PIN_ACT);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Set ACK signal
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
void FASTCALL GPIOBUS::SetACT(BOOL ast)
|
||||||
|
{
|
||||||
|
SetSignal(PIN_ACT, ast);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -682,7 +703,11 @@ BOOL FASTCALL GPIOBUS::GetRST()
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void FASTCALL GPIOBUS::SetRST(BOOL ast)
|
void FASTCALL GPIOBUS::SetRST(BOOL ast)
|
||||||
{
|
{
|
||||||
//SetSignal(PIN_RST, ast);
|
if(actmode == MONITOR){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetSignal(PIN_RST, ast);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -702,7 +727,11 @@ BOOL FASTCALL GPIOBUS::GetMSG()
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void FASTCALL GPIOBUS::SetMSG(BOOL ast)
|
void FASTCALL GPIOBUS::SetMSG(BOOL ast)
|
||||||
{
|
{
|
||||||
//SetSignal(PIN_MSG, ast);
|
if(actmode == MONITOR){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetSignal(PIN_MSG, ast);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -722,7 +751,11 @@ BOOL FASTCALL GPIOBUS::GetCD()
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void FASTCALL GPIOBUS::SetCD(BOOL ast)
|
void FASTCALL GPIOBUS::SetCD(BOOL ast)
|
||||||
{
|
{
|
||||||
//SetSignal(PIN_CD, ast);
|
if(actmode == MONITOR){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetSignal(PIN_CD, ast);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -772,6 +805,10 @@ BOOL FASTCALL GPIOBUS::GetIO()
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void FASTCALL GPIOBUS::SetIO(BOOL ast)
|
void FASTCALL GPIOBUS::SetIO(BOOL ast)
|
||||||
{
|
{
|
||||||
|
if(actmode == MONITOR){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SetSignal(PIN_IO, ast);
|
SetSignal(PIN_IO, ast);
|
||||||
|
|
||||||
if (actmode == TARGET) {
|
if (actmode == TARGET) {
|
||||||
@@ -820,7 +857,11 @@ BOOL FASTCALL GPIOBUS::GetREQ()
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void FASTCALL GPIOBUS::SetREQ(BOOL ast)
|
void FASTCALL GPIOBUS::SetREQ(BOOL ast)
|
||||||
{
|
{
|
||||||
// SetSignal(PIN_REQ, ast);
|
if(actmode == MONITOR){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetSignal(PIN_REQ, ast);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -853,37 +894,41 @@ BYTE FASTCALL GPIOBUS::GetDAT()
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void FASTCALL GPIOBUS::SetDAT(BYTE dat)
|
void FASTCALL GPIOBUS::SetDAT(BYTE dat)
|
||||||
{
|
{
|
||||||
|
if(actmode == MONITOR){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Write to port
|
// Write to port
|
||||||
//#if SIGNAL_CONTROL_MODE == 0
|
#if SIGNAL_CONTROL_MODE == 0
|
||||||
// DWORD fsel;
|
DWORD fsel;
|
||||||
//
|
|
||||||
// fsel = gpfsel[0];
|
fsel = gpfsel[0];
|
||||||
// fsel &= tblDatMsk[0][dat];
|
fsel &= tblDatMsk[0][dat];
|
||||||
// fsel |= tblDatSet[0][dat];
|
fsel |= tblDatSet[0][dat];
|
||||||
// if (fsel != gpfsel[0]) {
|
if (fsel != gpfsel[0]) {
|
||||||
// gpfsel[0] = fsel;
|
gpfsel[0] = fsel;
|
||||||
// gpio[GPIO_FSEL_0] = fsel;
|
gpio[GPIO_FSEL_0] = fsel;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// fsel = gpfsel[1];
|
fsel = gpfsel[1];
|
||||||
// fsel &= tblDatMsk[1][dat];
|
fsel &= tblDatMsk[1][dat];
|
||||||
// fsel |= tblDatSet[1][dat];
|
fsel |= tblDatSet[1][dat];
|
||||||
// if (fsel != gpfsel[1]) {
|
if (fsel != gpfsel[1]) {
|
||||||
// gpfsel[1] = fsel;
|
gpfsel[1] = fsel;
|
||||||
// gpio[GPIO_FSEL_1] = fsel;
|
gpio[GPIO_FSEL_1] = fsel;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// fsel = gpfsel[2];
|
fsel = gpfsel[2];
|
||||||
// fsel &= tblDatMsk[2][dat];
|
fsel &= tblDatMsk[2][dat];
|
||||||
// fsel |= tblDatSet[2][dat];
|
fsel |= tblDatSet[2][dat];
|
||||||
// if (fsel != gpfsel[2]) {
|
if (fsel != gpfsel[2]) {
|
||||||
// gpfsel[2] = fsel;
|
gpfsel[2] = fsel;
|
||||||
// gpio[GPIO_FSEL_2] = fsel;
|
gpio[GPIO_FSEL_2] = fsel;
|
||||||
// }
|
}
|
||||||
//#else
|
#else
|
||||||
// gpio[GPIO_CLR_0] = tblDatMsk[dat];
|
gpio[GPIO_CLR_0] = tblDatMsk[dat];
|
||||||
// gpio[GPIO_SET_0] = tblDatSet[dat];
|
gpio[GPIO_SET_0] = tblDatSet[dat];
|
||||||
//#endif // SIGNAL_CONTROL_MODE
|
#endif // SIGNAL_CONTROL_MODE
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -460,6 +460,11 @@ public:
|
|||||||
void FASTCALL SetACK(BOOL ast);
|
void FASTCALL SetACK(BOOL ast);
|
||||||
// Set ACK signal
|
// Set ACK signal
|
||||||
|
|
||||||
|
BOOL FASTCALL GetACT();
|
||||||
|
// Get ACT signal
|
||||||
|
void FASTCALL SetACT(BOOL ast);
|
||||||
|
// Set ACT signal
|
||||||
|
|
||||||
BOOL FASTCALL GetRST();
|
BOOL FASTCALL GetRST();
|
||||||
// Get RST signal
|
// Get RST signal
|
||||||
void FASTCALL SetRST(BOOL ast);
|
void FASTCALL SetRST(BOOL ast);
|
||||||
|
|||||||
@@ -15,9 +15,6 @@
|
|||||||
#include "fileio.h"
|
#include "fileio.h"
|
||||||
#include "disk.h"
|
#include "disk.h"
|
||||||
#include "gpiobus.h"
|
#include "gpiobus.h"
|
||||||
#include "spdlog/spdlog.h"
|
|
||||||
//#include <sys/timespec_util.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
@@ -49,23 +46,6 @@ int monsocket; // Monitor Socket
|
|||||||
pthread_t monthread; // Monitor Thread
|
pthread_t monthread; // Monitor Thread
|
||||||
static void *MonThread(void *param);
|
static void *MonThread(void *param);
|
||||||
#endif // BAREMETAL
|
#endif // BAREMETAL
|
||||||
typedef struct data_capture{
|
|
||||||
DWORD data;
|
|
||||||
timeval timestamp;
|
|
||||||
} data_capture_t;
|
|
||||||
|
|
||||||
|
|
||||||
#define MAX_BUFF_SIZE 1000000
|
|
||||||
|
|
||||||
data_capture data_buffer[MAX_BUFF_SIZE];
|
|
||||||
int data_idx = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define SECONDS_1 (1000 * 1000)
|
|
||||||
#define SECONDS_3 (3 * 1000 * 1000)
|
|
||||||
#define WAIT_FOR_EQUAL(x,y,timeout) { DWORD now = SysTimer::GetTimerLow(); while ((SysTimer::GetTimerLow() - now) < timeout) { bus->Aquire();if (x == y) {break;}}}
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef BAREMETAL
|
#ifndef BAREMETAL
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -200,149 +180,6 @@ BOOL Init()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#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 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
|
|
||||||
#define PIN_REQ 22 // REQ
|
|
||||||
#define PIN_MSG 23 // MSG
|
|
||||||
#define PIN_CD 24 // CD
|
|
||||||
#define PIN_IO 25 // IO
|
|
||||||
#define PIN_BSY 26 // BSY
|
|
||||||
#define PIN_SEL 27 // SEL
|
|
||||||
|
|
||||||
|
|
||||||
BOOL get_pin_value(DWORD data, int pin)
|
|
||||||
{
|
|
||||||
return (data >> pin) & 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
BYTE get_data_field(DWORD data)
|
|
||||||
{
|
|
||||||
DWORD data_out;
|
|
||||||
data_out =
|
|
||||||
((data >> (PIN_DT0 - 0)) & (1 << 0)) |
|
|
||||||
((data >> (PIN_DT1 - 1)) & (1 << 1)) |
|
|
||||||
((data >> (PIN_DT2 - 2)) & (1 << 2)) |
|
|
||||||
((data >> (PIN_DT3 - 3)) & (1 << 3)) |
|
|
||||||
((data >> (PIN_DT4 - 4)) & (1 << 4)) |
|
|
||||||
((data >> (PIN_DT5 - 5)) & (1 << 5)) |
|
|
||||||
((data >> (PIN_DT6 - 6)) & (1 << 6)) |
|
|
||||||
((data >> (PIN_DT7 - 7)) & (1 << 7));
|
|
||||||
|
|
||||||
return (BYTE)data_out;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int pin_nums[] = {PIN_BSY,PIN_SEL,PIN_CD,PIN_IO,PIN_MSG,PIN_REQ,PIN_ACK,PIN_ATN,PIN_RST,PIN_DT0};
|
|
||||||
|
|
||||||
char* pin_names[] = {"BSY","SEL","CD","IO","MSG","REQ","ACK","ATN","RST","DAT"};
|
|
||||||
|
|
||||||
|
|
||||||
void dump_data()
|
|
||||||
{
|
|
||||||
char outstr[1024];
|
|
||||||
int i = 0;
|
|
||||||
timeval time_diff;
|
|
||||||
FILE *fp;
|
|
||||||
timeval start_time = data_buffer[0].timestamp;
|
|
||||||
fp = fopen("log.txt","w");
|
|
||||||
|
|
||||||
|
|
||||||
fprintf(fp, "idx\traw\ttimestamp\tBSY\tSEL\tC/D\tI/O\tMSG\tREQ\tACK\tATN\tRST\tData..\n");
|
|
||||||
|
|
||||||
while(i < data_idx)
|
|
||||||
{
|
|
||||||
timersub(&(data_buffer[i].timestamp), &start_time, &time_diff);
|
|
||||||
//timediff = difftime(data_buffer[i].timestamp, start_time);
|
|
||||||
fprintf(fp, "%d\t%08lX\t%d:%d\t",data_idx, data_buffer[i].data, time_diff.tv_sec, time_diff.tv_usec);
|
|
||||||
fprintf(fp, "%d\t", get_pin_value(data_buffer[i].data, PIN_BSY));
|
|
||||||
fprintf(fp, "%d\t", get_pin_value(data_buffer[i].data, PIN_SEL));
|
|
||||||
fprintf(fp, "%d\t", get_pin_value(data_buffer[i].data, PIN_CD));
|
|
||||||
fprintf(fp, "%d\t", get_pin_value(data_buffer[i].data, PIN_IO));
|
|
||||||
fprintf(fp, "%d\t", get_pin_value(data_buffer[i].data, PIN_MSG));
|
|
||||||
fprintf(fp, "%d\t", get_pin_value(data_buffer[i].data, PIN_REQ));
|
|
||||||
fprintf(fp, "%d\t", get_pin_value(data_buffer[i].data, PIN_ACK));
|
|
||||||
fprintf(fp, "%d\t", get_pin_value(data_buffer[i].data, PIN_ATN));
|
|
||||||
fprintf(fp, "%d\t", get_pin_value(data_buffer[i].data, PIN_RST));
|
|
||||||
fprintf(fp, "%02X\t", get_data_field(data_buffer[i].data));
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
|
|
||||||
i=0;
|
|
||||||
printf("Creating timing_drawer.txt\n");
|
|
||||||
fp = fopen("timing_drawer.txt","w");
|
|
||||||
while(i < data_idx)
|
|
||||||
{
|
|
||||||
timersub(&(data_buffer[i].timestamp), &start_time, &time_diff);
|
|
||||||
//timediff = difftime(data_buffer[i].timestamp, start_time);
|
|
||||||
fprintf(fp, "TIME=%d:%d;", time_diff.tv_sec, time_diff.tv_usec);
|
|
||||||
fprintf(fp, "BSY=%d;", get_pin_value(data_buffer[i].data, PIN_BSY));
|
|
||||||
fprintf(fp, "SEL=%d;", get_pin_value(data_buffer[i].data, PIN_SEL));
|
|
||||||
fprintf(fp, "CD=%d;", get_pin_value(data_buffer[i].data, PIN_CD));
|
|
||||||
fprintf(fp, "IO=%d;", get_pin_value(data_buffer[i].data, PIN_IO));
|
|
||||||
fprintf(fp, "MSG=%d;", get_pin_value(data_buffer[i].data, PIN_MSG));
|
|
||||||
fprintf(fp, "REQ=%d;", get_pin_value(data_buffer[i].data, PIN_REQ));
|
|
||||||
fprintf(fp, "ACK=%d;", get_pin_value(data_buffer[i].data, PIN_ACK));
|
|
||||||
fprintf(fp, "ATN=%d;", get_pin_value(data_buffer[i].data, PIN_ATN));
|
|
||||||
fprintf(fp, "RST=%d;", get_pin_value(data_buffer[i].data, PIN_RST));
|
|
||||||
fprintf(fp, "DATA=%02X.", get_data_field(data_buffer[i].data));
|
|
||||||
fprintf(fp, "\n");
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// fp = fopen("log2.txt","w");
|
|
||||||
//
|
|
||||||
// for(int pin=0; pin < ARRAY_SIZE(pin_names); pin++)
|
|
||||||
// {
|
|
||||||
// i=0;
|
|
||||||
// while(i < data_idx)
|
|
||||||
// {
|
|
||||||
// char this_point = ((get_pin_value(data_buffer[i].data), pin_nums[pin]) == TRUE) ? "-", "_";
|
|
||||||
// fprintf(fp, this_point)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Cleanup
|
// Cleanup
|
||||||
@@ -352,14 +189,6 @@ void Cleanup()
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
printf("In cleanup....\n");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dump_data();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Delete the disks
|
// Delete the disks
|
||||||
for (i = 0; i < CtrlMax * UnitNum; i++) {
|
for (i = 0; i < CtrlMax * UnitNum; i++) {
|
||||||
if (disk[i]) {
|
if (disk[i]) {
|
||||||
@@ -1141,8 +970,6 @@ next:
|
|||||||
}
|
}
|
||||||
#endif // BAREMETAL
|
#endif // BAREMETAL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Main processing
|
// Main processing
|
||||||
@@ -1158,23 +985,18 @@ int startrascsi(void)
|
|||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
#endif // BAREMETAL
|
#endif // BAREMETAL
|
||||||
DWORD prev_sample = 0xFFFFFFFF;
|
int i;
|
||||||
DWORD this_sample = 0;
|
|
||||||
//int i;
|
|
||||||
int ret;
|
int ret;
|
||||||
// int actid;
|
int actid;
|
||||||
//DWORD now;
|
DWORD now;
|
||||||
//BUS::phase_t phase;
|
BUS::phase_t phase;
|
||||||
// BYTE data;
|
BYTE data;
|
||||||
#ifndef BAREMETAL
|
#ifndef BAREMETAL
|
||||||
struct sched_param schparam;
|
struct sched_param schparam;
|
||||||
#endif // BAREMETAL
|
#endif // BAREMETAL
|
||||||
|
|
||||||
spdlog::set_level(spdlog::level::trace);
|
|
||||||
spdlog::trace("Entering the function with {0:x}{1:X} arguments", argc,20);
|
|
||||||
// Output the Banner
|
// Output the Banner
|
||||||
Banner(argc, argv);
|
Banner(argc, argv);
|
||||||
memset(data_buffer,0,sizeof(data_buffer));
|
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@@ -1215,235 +1037,103 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// Start execution
|
// Start execution
|
||||||
running = TRUE;
|
running = TRUE;
|
||||||
bus->SetAct(FALSE);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
spdlog::trace("Going into running mode {}", 1);
|
|
||||||
// Main Loop
|
// Main Loop
|
||||||
while (running) {
|
while (running) {
|
||||||
// Work initialization
|
// Work initialization
|
||||||
this_sample = bus->Aquire();
|
actid = -1;
|
||||||
|
phase = BUS::busfree;
|
||||||
|
|
||||||
if(this_sample != prev_sample)
|
#ifdef USE_SEL_EVENT_ENABLE
|
||||||
{
|
// SEL signal polling
|
||||||
//printf("%d Sample %08lX\n", data_idx, this_sample);
|
if (bus->PollSelectEvent() < 0) {
|
||||||
data_buffer[data_idx].data = this_sample;
|
// Stop on interrupt
|
||||||
(void)gettimeofday(&(data_buffer[data_idx].timestamp), NULL);
|
if (errno == EINTR) {
|
||||||
data_idx = (data_idx + 1) % MAX_BUFF_SIZE;
|
break;
|
||||||
prev_sample = this_sample;
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the bus
|
||||||
|
bus->Aquire();
|
||||||
|
#else
|
||||||
|
bus->Aquire();
|
||||||
|
if (!bus->GetSEL()) {
|
||||||
|
#if !defined(BAREMETAL)
|
||||||
|
usleep(0);
|
||||||
|
#endif // !BAREMETAL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
////////
|
}
|
||||||
//////// // Target sending data
|
#endif // USE_SEL_EVENT_ENABLE
|
||||||
//////// if(!bus->GetIO() && bus->GetREQ() && bus->GetACK())
|
|
||||||
//////// {
|
// Wait until BSY is released as there is a possibility for the
|
||||||
//////// BYTE data = bus->GetDAT();
|
// initiator to assert it while setting the ID (for up to 3 seconds)
|
||||||
//////// printf("+%02X ",data);
|
if (bus->GetBSY()) {
|
||||||
////////
|
now = SysTimer::GetTimerLow();
|
||||||
////////
|
while ((SysTimer::GetTimerLow() - now) < 3 * 1000 * 1000) {
|
||||||
////////
|
bus->Aquire();
|
||||||
//////// DWORD now = SysTimer::GetTimerLow();
|
if (!bus->GetBSY()) {
|
||||||
//////// while ((SysTimer::GetTimerLow() - now) < SECONDS_1/100)
|
break;
|
||||||
//////// {
|
}
|
||||||
//////// bus->Aquire();
|
}
|
||||||
//////// if (bus->GetACK() == FALSE) {
|
}
|
||||||
//////// break;
|
|
||||||
//////// }
|
// Stop because it the bus is busy or another device responded
|
||||||
//////// }
|
if (bus->GetBSY() || !bus->GetSEL()) {
|
||||||
////////
|
continue;
|
||||||
//////// if(bus->GetACK() != FALSE)
|
}
|
||||||
//////// {
|
|
||||||
//////// spdlog::warn("got an invalid req/ack sequence for target sending data");
|
// Notify all controllers
|
||||||
//////// }
|
data = bus->GetDAT();
|
||||||
//////// }
|
for (i = 0; i < CtrlMax; i++) {
|
||||||
////////
|
if (!ctrl[i] || (data & (1 << i)) == 0) {
|
||||||
////////
|
continue;
|
||||||
////////
|
}
|
||||||
//////// if(bus->GetIO() && bus->GetREQ() && !bus->GetACK())
|
|
||||||
//////// {
|
// Find the target that has moved to the selection phase
|
||||||
//////// BYTE data = bus->GetDAT();
|
if (ctrl[i]->Process() == BUS::selection) {
|
||||||
//////// printf("-%02X ",data);
|
// Get the target ID
|
||||||
////////
|
actid = i;
|
||||||
////////
|
|
||||||
//////// DWORD now = SysTimer::GetTimerLow();
|
// Bus Selection phase
|
||||||
//////// while ((SysTimer::GetTimerLow() - now) < SECONDS_1/100)
|
phase = BUS::selection;
|
||||||
//////// {
|
break;
|
||||||
//////// bus->Aquire();
|
}
|
||||||
//////// if (bus->GetREQ() == FALSE) {
|
}
|
||||||
//////// break;
|
|
||||||
//////// }
|
// Return to bus monitoring if the selection phase has not started
|
||||||
//////// }
|
if (phase != BUS::selection) {
|
||||||
////////
|
continue;
|
||||||
//////// if(bus->GetREQ() != TRUE)
|
}
|
||||||
//////// {
|
|
||||||
//////// spdlog::warn("REQ didn't de-assert when I wanted it to.");
|
// 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);
|
||||||
//////// continue;
|
sched_setscheduler(0, SCHED_FIFO, &schparam);
|
||||||
////////
|
#endif // !USE_SEL_EVENT_ENABLE && !BAREMETAL
|
||||||
//////// // 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)
|
// Loop until the bus is free
|
||||||
//////// if (bus->GetSEL() ) {
|
while (running) {
|
||||||
//////// BYTE data = bus->GetDAT();
|
// Target drive
|
||||||
//////// printf("SEL is asserted. Data: %02X, BSY: %d, SEL %d\n", data, bus->GetBSY(), bus->GetSEL());
|
phase = ctrl[actid]->Process();
|
||||||
//////// now = SysTimer::GetTimerLow();
|
|
||||||
//////// while ((SysTimer::GetTimerLow() - now) < 3 * 1000 * 1000) {
|
// End when the bus is free
|
||||||
//////// bus->Aquire();
|
if (phase == BUS::busfree) {
|
||||||
//////// if (!bus->GetSEL()) {
|
break;
|
||||||
//////// printf("SEL is clear. Data: %02X, BSY: %d, SEL %d\n", data, bus->GetBSY(), bus->GetSEL());
|
}
|
||||||
//////// break;
|
}
|
||||||
//////// }
|
|
||||||
//////// }
|
#if !defined(USE_SEL_EVENT_ENABLE) && !defined(BAREMETAL)
|
||||||
//////// }
|
// Set the scheduling priority back to normal
|
||||||
//////// else{
|
schparam.sched_priority = 0;
|
||||||
////////
|
sched_setscheduler(0, SCHED_OTHER, &schparam);
|
||||||
//////// continue;
|
#endif // !USE_SEL_EVENT_ENABLE && !BAREMETAL
|
||||||
//////// }
|
|
||||||
////////// spdlog::trace("Busy: {}",bus->GetBSY());
|
// End the target travel
|
||||||
////////
|
active = FALSE;
|
||||||
////////
|
|
||||||
//////// // For monitor mode, we just want to make sure the initiator
|
|
||||||
//////// // released the BSY signal within 3 seconds. If it hasn't
|
|
||||||
//////// // the initiator is misbehaving
|
|
||||||
////////// if (bus->GetBSY()) {
|
|
||||||
////////// spdlog::warn("The initiator (%d) did not release the BSY signal after 3 seconds", bus->GetDAT());
|
|
||||||
////////// continue;
|
|
||||||
////////// }
|
|
||||||
////////
|
|
||||||
//////////////////////
|
|
||||||
////////////////////// // Stop because it the bus is busy or another device responded
|
|
||||||
////////////////////// if (bus->GetBSY() || !bus->GetSEL()) {
|
|
||||||
////////////////////// continue;
|
|
||||||
////////////////////// }
|
|
||||||
//
|
|
||||||
// // Notify all controllers
|
|
||||||
// data = bus->GetDAT();
|
|
||||||
//// spdlog::trace("Data is {x}",data);
|
|
||||||
// for (i = 0; i < CtrlMax; i++) {
|
|
||||||
// if (!ctrl[i] || (data & (1 << i)) == 0) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
//// spdlog::trace("Found an active controller! Let's do some selection {}", i);
|
|
||||||
// // Find the target that has moved to the selection phase
|
|
||||||
// if (ctrl[i]->Process() == BUS::selection) {
|
|
||||||
// // 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;
|
|
||||||
// spdlog::trace("Found a target device {} ID:{}",actid, ctrl[actid]->GetID());
|
|
||||||
//
|
|
||||||
//#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:
|
err_exit:
|
||||||
@@ -1457,3 +1147,4 @@ init_exit:
|
|||||||
return ret;
|
return ret;
|
||||||
#endif // BAREMETAL
|
#endif // BAREMETAL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -258,12 +258,11 @@ BYTE get_data_field(DWORD data)
|
|||||||
|
|
||||||
int pin_nums[] = {PIN_BSY,PIN_SEL,PIN_CD,PIN_IO,PIN_MSG,PIN_REQ,PIN_ACK,PIN_ATN,PIN_RST,PIN_DT0};
|
int pin_nums[] = {PIN_BSY,PIN_SEL,PIN_CD,PIN_IO,PIN_MSG,PIN_REQ,PIN_ACK,PIN_ATN,PIN_RST,PIN_DT0};
|
||||||
|
|
||||||
char* pin_names[] = {"BSY","SEL","CD","IO","MSG","REQ","ACK","ATN","RST","DAT"};
|
std::string pin_names[] = {"BSY","SEL","CD","IO","MSG","REQ","ACK","ATN","RST","DAT"};
|
||||||
|
|
||||||
|
|
||||||
void dump_data()
|
void dump_data()
|
||||||
{
|
{
|
||||||
char outstr[1024];
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
timeval time_diff;
|
timeval time_diff;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@@ -277,7 +276,7 @@ void dump_data()
|
|||||||
{
|
{
|
||||||
timersub(&(data_buffer[i].timestamp), &start_time, &time_diff);
|
timersub(&(data_buffer[i].timestamp), &start_time, &time_diff);
|
||||||
//timediff = difftime(data_buffer[i].timestamp, start_time);
|
//timediff = difftime(data_buffer[i].timestamp, start_time);
|
||||||
fprintf(fp, "%d\t%08lX\t%d:%d\t",data_idx, data_buffer[i].data, time_diff.tv_sec, time_diff.tv_usec);
|
fprintf(fp, "%d\t%08lX\t%ld:%ld\t",data_idx, data_buffer[i].data, time_diff.tv_sec, time_diff.tv_usec);
|
||||||
fprintf(fp, "%d\t", get_pin_value(data_buffer[i].data, PIN_BSY));
|
fprintf(fp, "%d\t", get_pin_value(data_buffer[i].data, PIN_BSY));
|
||||||
fprintf(fp, "%d\t", get_pin_value(data_buffer[i].data, PIN_SEL));
|
fprintf(fp, "%d\t", get_pin_value(data_buffer[i].data, PIN_SEL));
|
||||||
fprintf(fp, "%d\t", get_pin_value(data_buffer[i].data, PIN_CD));
|
fprintf(fp, "%d\t", get_pin_value(data_buffer[i].data, PIN_CD));
|
||||||
@@ -301,7 +300,7 @@ void dump_data()
|
|||||||
{
|
{
|
||||||
timersub(&(data_buffer[i].timestamp), &start_time, &time_diff);
|
timersub(&(data_buffer[i].timestamp), &start_time, &time_diff);
|
||||||
//timediff = difftime(data_buffer[i].timestamp, start_time);
|
//timediff = difftime(data_buffer[i].timestamp, start_time);
|
||||||
fprintf(fp, "TIME=%d:%d;", time_diff.tv_sec, time_diff.tv_usec);
|
fprintf(fp, "TIME=%ld:%ld;", time_diff.tv_sec, time_diff.tv_usec);
|
||||||
fprintf(fp, "BSY=%d;", get_pin_value(data_buffer[i].data, PIN_BSY));
|
fprintf(fp, "BSY=%d;", get_pin_value(data_buffer[i].data, PIN_BSY));
|
||||||
fprintf(fp, "SEL=%d;", get_pin_value(data_buffer[i].data, PIN_SEL));
|
fprintf(fp, "SEL=%d;", get_pin_value(data_buffer[i].data, PIN_SEL));
|
||||||
fprintf(fp, "CD=%d;", get_pin_value(data_buffer[i].data, PIN_CD));
|
fprintf(fp, "CD=%d;", get_pin_value(data_buffer[i].data, PIN_CD));
|
||||||
@@ -1141,6 +1140,8 @@ next:
|
|||||||
}
|
}
|
||||||
#endif // BAREMETAL
|
#endif // BAREMETAL
|
||||||
|
|
||||||
|
static DWORD high_bits = 0x0;
|
||||||
|
static DWORD low_bits = 0xFFFFFFFF;
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -1158,6 +1159,8 @@ int startrascsi(void)
|
|||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
#endif // BAREMETAL
|
#endif // BAREMETAL
|
||||||
|
DWORD prev_high = high_bits;
|
||||||
|
DWORD prev_low = low_bits;
|
||||||
DWORD prev_sample = 0xFFFFFFFF;
|
DWORD prev_sample = 0xFFFFFFFF;
|
||||||
DWORD this_sample = 0;
|
DWORD this_sample = 0;
|
||||||
//int i;
|
//int i;
|
||||||
@@ -1215,9 +1218,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// Start execution
|
// Start execution
|
||||||
running = TRUE;
|
running = TRUE;
|
||||||
bus->SetAct(FALSE);
|
bus->SetACT(FALSE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
spdlog::trace("Going into running mode {}", 1);
|
spdlog::trace("Going into running mode {}", 1);
|
||||||
// Main Loop
|
// Main Loop
|
||||||
@@ -1227,6 +1228,19 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
if(this_sample != prev_sample)
|
if(this_sample != prev_sample)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// This is intended to be a debug check to see if every pin is set
|
||||||
|
// high and low at some point.
|
||||||
|
high_bits |= this_sample;
|
||||||
|
low_bits &= this_sample;
|
||||||
|
|
||||||
|
if ((high_bits != prev_high) || (low_bits != prev_low))
|
||||||
|
{
|
||||||
|
printf(" %08lX %08lX\n",high_bits, low_bits);
|
||||||
|
}
|
||||||
|
prev_high = high_bits;
|
||||||
|
prev_low = low_bits;
|
||||||
|
|
||||||
//printf("%d Sample %08lX\n", data_idx, this_sample);
|
//printf("%d Sample %08lX\n", data_idx, this_sample);
|
||||||
data_buffer[data_idx].data = this_sample;
|
data_buffer[data_idx].data = this_sample;
|
||||||
(void)gettimeofday(&(data_buffer[data_idx].timestamp), NULL);
|
(void)gettimeofday(&(data_buffer[data_idx].timestamp), NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user