mirror of
https://github.com/dougg3/mac-rom-simm-programmer.git
synced 2024-11-25 10:30:49 +00:00
1595c69890
It does add some complexity to the code. I may be going through a chain of calls just to turn the CS pin on, for instance. Hopefully I'm not going too crazy with this. Anyway, this means that I can control the ports from a SIMM electrical test routine using the same types of functions that the actual programming controlling code would use, without having to duplicate a bunch of port definitions and bit manipulation. I made sure to add all the functions I can think of needing to the ports module. We'll see if I got them all!
61 lines
2.0 KiB
C
61 lines
2.0 KiB
C
/*
|
|
* ports.h
|
|
*
|
|
* Created on: Nov 26, 2011
|
|
* Author: Doug
|
|
*/
|
|
|
|
#ifndef PORTS_H_
|
|
#define PORTS_H_
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
// Under normal operation, we will only be using the address pins as outputs.
|
|
// The data pins will switch back and forth between all inputs and all outputs.
|
|
// The CS/OE/WE pins will always be outputs.
|
|
// The pullups will all be turned off.
|
|
// So you should use Ports_SetAddressOut(),
|
|
// Ports_SetDataOut(),
|
|
// Ports_SetAddressDDR() [once at the beginning]
|
|
// Ports_SetDataDDR(),
|
|
// and Ports_ReadDataInData
|
|
//
|
|
// The reason I have implemented all this functionality is to give me complete
|
|
// control over all the pins for other use cases, such as a SIMM electrical test.
|
|
// By playing with pull-ups and inputs and outputs, I should be able to detect
|
|
// many shorted output/input scenarios. So even though these functions are overkill,
|
|
// they will be useful for diagnostics.
|
|
|
|
void Ports_Init(void);
|
|
|
|
void Ports_SetAddressOut(uint32_t data);
|
|
void Ports_AddressOut_RMW(uint32_t data, uint32_t modifyMask);
|
|
void Ports_SetDataOut(uint32_t data);
|
|
void Ports_DataOut_RMW(uint32_t data, uint32_t modifyMask);
|
|
void Ports_SetCSOut(bool data);
|
|
void Ports_SetOEOut(bool data);
|
|
void Ports_SetWEOut(bool data);
|
|
|
|
void Ports_SetAddressDDR(uint32_t ddr);
|
|
void Ports_AddressDDR_RMW(uint32_t ddr, uint32_t modifyMask);
|
|
void Ports_SetDataDDR(uint32_t ddr);
|
|
void Ports_DataDDR_RMW(uint32_t ddr, uint32_t modifyMask);
|
|
void Ports_SetCSDDR(bool ddr);
|
|
void Ports_SetOEDDR(bool ddr);
|
|
void Ports_SetWEDDR(bool ddr);
|
|
|
|
void Ports_AddressPullups_RMW(uint32_t pullups, uint32_t modifyMask);
|
|
void Ports_DataPullups_RMW(uint32_t pullups, uint32_t modifyMask);
|
|
void Ports_SetCSPullup(bool pullup);
|
|
void Ports_SetOEPullup(bool pullup);
|
|
void Ports_SetWEPullup(bool pullup);
|
|
|
|
uint32_t Ports_ReadAddress(void);
|
|
uint32_t Ports_ReadData(void);
|
|
bool Ports_ReadCS(void);
|
|
bool Ports_ReadOE(void);
|
|
bool Ports_ReadWE(void);
|
|
|
|
#endif /* PORTS_H_ */
|