Merge pull request #7 from alexanderk23/patch-1

Add invertIECOutputs and ignoreReset options; fix Makefile.rules
This commit is contained in:
Stephen White 2018-05-27 18:51:47 +10:00 committed by GitHub
commit 37f65f1c40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 61 additions and 8 deletions

View file

@ -30,8 +30,8 @@ endif
AFLAGS += $(ARCH)
CFLAGS += $(ARCH) -Wall -Wno-psabi -fsigned-char -fno-builtin -Ofast -DNDEBUG
CPPFLAGS += $(CFLAGS) -fno-exceptions -fno-rtti -std=c++0x -Wno-write-strings
CFLAGS += -fno-delete-null-pointer-checks -fdata-sections -ffunction-sections -u _printf_float
CPPFLAGS := $(CFLAGS) $(CPPFLAGS) -fno-exceptions -fno-rtti -std=c++0x -Wno-write-strings
CFLAGS += -fno-delete-null-pointer-checks -fdata-sections -ffunction-sections -u _printf_float -std=gnu99
.PHONY: clean

View file

@ -16,7 +16,8 @@ static void TimerPollKernelTimers()
{
//EnterCritical();
for (unsigned hTimer = 0; hTimer < KERNEL_TIMERS; hTimer++)
unsigned hTimer;
for (hTimer = 0; hTimer < KERNEL_TIMERS; hTimer++)
{
volatile TKernelTimer* pTimer = &m_KernelTimer[hTimer];
@ -71,7 +72,8 @@ void TimerSystemInitialize()
DataMemBarrier();
for (unsigned hTimer = 0; hTimer < KERNEL_TIMERS; hTimer++)
unsigned hTimer;
for (hTimer = 0; hTimer < KERNEL_TIMERS; hTimer++)
{
m_KernelTimer[hTimer].m_pHandler = 0;
}

View file

@ -44,6 +44,8 @@ bool IEC_Bus::Resetting = false;
bool IEC_Bus::splitIECLines = false;
bool IEC_Bus::invertIECInputs = false;
bool IEC_Bus::invertIECOutputs = true;
bool IEC_Bus::ignoreReset = false;
u32 IEC_Bus::myOutsGPFSEL1 = 0;
u32 IEC_Bus::myOutsGPFSEL0 = 0;
@ -122,5 +124,5 @@ void IEC_Bus::Read(void)
if (VIA) portB->SetInput(VIAPORTPINS_CLOCKIN, true); // simulate the read in software
}
Resetting = (gplev0 & PIGPIO_MASK_IN_RESET) == (invertIECInputs ? PIGPIO_MASK_IN_RESET : 0);
Resetting = !ignoreReset && ((gplev0 & PIGPIO_MASK_IN_RESET) == (invertIECInputs ? PIGPIO_MASK_IN_RESET : 0));
}

View file

@ -336,7 +336,8 @@ public:
do
{
gplev0 = read32(ARM_GPIO_GPLEV0);
Resetting = (gplev0 & PIGPIO_MASK_IN_RESET) == (invertIECInputs ? PIGPIO_MASK_IN_RESET : 0);
Resetting = !ignoreReset && ((gplev0 & PIGPIO_MASK_IN_RESET) == \
(invertIECInputs ? PIGPIO_MASK_IN_RESET : 0));
if (Resetting)
IEC_Bus::WaitMicroSeconds(100);
@ -395,6 +396,7 @@ public:
{
unsigned set = 0;
unsigned clear = 0;
unsigned tmp;
if (!splitIECLines)
{
@ -408,11 +410,19 @@ public:
}
else
{
clear |= 1 << PIGPIO_OUT_ATN;
if (AtnaDataSetToOut || DataSetToOut) set |= 1 << PIGPIO_OUT_DATA;
else clear |= 1 << PIGPIO_OUT_DATA;
if (ClockSetToOut) set |= 1 << PIGPIO_OUT_CLOCK;
else clear |= 1 << PIGPIO_OUT_CLOCK;
if (!invertIECOutputs) {
tmp = set;
set = clear;
clear = tmp;
}
}
if (OutputLED) set |= 1 << PIGPIO_OUT_LED;
@ -477,6 +487,7 @@ public:
RefreshOuts();
}
}
static inline bool GetPI_Atn() { return PI_Atn; }
static inline bool IsAtnAsserted() { return PI_Atn; }
static inline bool IsAtnReleased() { return !PI_Atn; }
@ -526,6 +537,16 @@ public:
}
}
static inline void SetInvertIECOutputs(bool value)
{
invertIECOutputs = value;
}
static inline void SetIgnoreReset(bool value)
{
ignoreReset = value;
}
// CA1 input ATN
// If CA1 is ever set to output
// - CA1 will start to drive pb7
@ -570,6 +591,9 @@ public:
private:
static bool splitIECLines;
static bool invertIECInputs;
static bool invertIECOutputs;
static bool ignoreReset;
static u32 PIGPIO_MASK_IN_ATN;
static u32 PIGPIO_MASK_IN_DATA;
static u32 PIGPIO_MASK_IN_CLOCK;

View file

@ -96,7 +96,9 @@ bool quickBoot = false;
bool displayPNGIcons = false;
bool soundOnGPIO = false;
bool invertIECInputs = false;
bool invertIECOutputs = true;
bool splitIECLines = false;
bool ignoreReset = false;
const char* termainalTextRed = "\E[31m";
const char* termainalTextNormal = "\E[0m";
@ -958,10 +960,11 @@ static void LoadOptions()
displayPNGIcons = options.DisplayPNGIcons();
soundOnGPIO = options.SoundOnGPIO();
invertIECInputs = options.InvertIECInputs();
invertIECOutputs = options.InvertIECOutputs();
splitIECLines = options.SplitIECLines();
if (!splitIECLines)
invertIECInputs = false;
ignoreReset = options.IgnoreReset();
ROMName = options.GetRomFontName();
if (ROMName)
@ -1096,6 +1099,8 @@ extern "C"
IEC_Bus::SetSplitIECLines(splitIECLines);
IEC_Bus::SetInvertIECInputs(invertIECInputs);
IEC_Bus::SetInvertIECOutputs(invertIECOutputs);
IEC_Bus::SetIgnoreReset(ignoreReset);
if (!soundOnGPIO)
{

View file

@ -129,7 +129,9 @@ Options::Options(void)
, displayPNGIcons(0)
, soundOnGPIO(0)
, invertIECInputs(0)
, invertIECOutputs(1)
, splitIECLines(0)
, ignoreReset(0)
{
strcpy(ROMFontName, "chargen");
ROMName[0] = 0;
@ -212,12 +214,24 @@ void Options::Process(char* buffer)
if ((nValue = GetDecimal(pValue)) != INVALID_VALUE)
invertIECInputs = nValue;
}
else if (strcasecmp(pOption, "invertIECOutputs") == 0)
{
unsigned nValue = 0;
if ((nValue = GetDecimal(pValue)) != INVALID_VALUE)
invertIECOutputs = nValue;
}
else if (strcasecmp(pOption, "splitIECLines") == 0)
{
unsigned nValue = 0;
if ((nValue = GetDecimal(pValue)) != INVALID_VALUE)
splitIECLines = nValue;
}
else if (strcasecmp(pOption, "ignoreReset") == 0)
{
unsigned nValue = 0;
if ((nValue = GetDecimal(pValue)) != INVALID_VALUE)
ignoreReset = nValue;
}
else if ((strcasecmp(pOption, "Font") == 0))
{
strncpy(ROMFontName, pValue, 255);

View file

@ -58,6 +58,8 @@ public:
unsigned int SoundOnGPIO() const { return soundOnGPIO; }
unsigned int SplitIECLines() const { return splitIECLines; }
unsigned int InvertIECInputs() const { return invertIECInputs; }
unsigned int InvertIECOutputs() const { return invertIECOutputs; }
unsigned int IgnoreReset() const { return ignoreReset; }
static unsigned GetDecimal(char* pString);
@ -72,7 +74,9 @@ private:
unsigned int displayPNGIcons;
unsigned int soundOnGPIO;
unsigned int invertIECInputs;
unsigned int invertIECOutputs;
unsigned int splitIECLines;
unsigned int ignoreReset;
char ROMFontName[256];
char ROMName[256];

View file

@ -39,6 +39,8 @@ void RPI_PropertyAddTag( rpi_mailbox_tag_t tag, ... )
{
int* ptr;
int value;
int index;
va_list vl;
va_start( vl, tag );
@ -197,7 +199,7 @@ void RPI_PropertyAddTag( rpi_mailbox_tag_t tag, ... )
ptr++;
pt[pt_index++] = value;
{
for (int index = 0; index < value; ++index)
for (index = 0; index < value; ++index)
{
pt[pt_index++] = *ptr++;
}