mirror of
https://github.com/dschmenk/apple2pi.git
synced 2024-11-27 17:51:42 +00:00
Clean up build
This commit is contained in:
parent
4513da7ab6
commit
8b8e17eda2
44
src/Makefile
44
src/Makefile
@ -1,42 +1,24 @@
|
||||
PACKAGE=a2pi
|
||||
VERSION=0.9.0
|
||||
PREFIX=/usr/local
|
||||
BIN= a2serclk a2pid a2joy a2joymou a2joypad a2mon a2term dskread dskwrite bintomon bload brun text2merlin merlin2text
|
||||
BINDIR=$(PREFIX)/bin
|
||||
DIST=$(PACKAGE)-$(VERSION)
|
||||
DISTDIR=./$(DIST)
|
||||
DESTDIR=/usr/local/bin
|
||||
SHAREDIR=/usr/share/a2pi
|
||||
BIN=a2pid a2joy a2joymou a2joypad a2mon a2term fusea2pi dskread dskwrite bload brun
|
||||
A2PIDEFS=-DSETSERCLK
|
||||
|
||||
all: $(BIN) fusea2pi
|
||||
all: $(BIN)
|
||||
|
||||
a2pid: a2pid.c gpclk.c
|
||||
$(CC) $(A2PIDEFS) a2pid.c -o a2pid
|
||||
|
||||
fusea2pi: fusea2pi.c a2lib.c
|
||||
$(CC) -I/usr/include/fuse -D_FILE_OFFSET_BITS=64 fusea2pi.c -lfuse -o fusea2pi
|
||||
|
||||
clean:
|
||||
-rm $(BIN) *~ fusea2pi
|
||||
-rm $(BIN) *~ *.tar.gz
|
||||
|
||||
install:
|
||||
cp $(BIN) fusea2pi a2mount $(BINDIR)
|
||||
cp $(BIN) a2mount $(DESTDIR)
|
||||
-mkdir $(SHAREDIR)
|
||||
cp ../share/* $(SHAREDIR)
|
||||
$(BASH) ./a2pi-setup.sh
|
||||
|
||||
uninstall:
|
||||
cd $(BINDIR); rm $(BIN) fusea2pi a2mount
|
||||
|
||||
dist:
|
||||
-rm -rf $(DISTDIR)
|
||||
mkdir $(DISTDIR)
|
||||
-chmod 777 $(DISTDIR)
|
||||
cp ../LICENSE.txt $(DISTDIR)
|
||||
cp ../README.md $(DISTDIR)
|
||||
mkdir $(DISTDIR)/docs
|
||||
cp ../docs/* $(DISTDIR)/docs
|
||||
mkdir $(DISTDIR)/src
|
||||
cp *.c $(DISTDIR)/src
|
||||
cp *.sh $(DISTDIR)/src
|
||||
cp *.conf $(DISTDIR)/src
|
||||
cp *.bin $(DISTDIR)/src
|
||||
cp *.mon $(DISTDIR)/src
|
||||
cp *.PO $(DISTDIR)/src
|
||||
cp a2mount execfile Makefile $(DISTDIR)/src
|
||||
-chmod -R a+r $(DISTDIR)
|
||||
tar czf $(DIST).tar.gz $(DISTDIR)
|
||||
rm -rf $(DISTDIR)
|
||||
cd $(DESTDIR); rm $(BIN) a2mount
|
||||
|
@ -15,12 +15,12 @@ if [ -n "$gettyline" -a ${gettyline:0:1} = T ] ; then
|
||||
sed 's/^T0*/#T0*/' /etc/inittab.bak > /etc/inittab
|
||||
fi
|
||||
#
|
||||
# Add a2serclk and a2pid to rc.local
|
||||
# Add a2joy and a2pid to rc.local
|
||||
#
|
||||
if [ -f /etc/rc.local ] ; then
|
||||
if ! grep a2pid /etc/rc.local > /dev/null ; then
|
||||
mv /etc/rc.local /etc/rc.local.bak
|
||||
sed -e '/^exit/i\# Start Apple II Pi' -e '/^exit/i\/usr/local/bin/a2serclk' -e '/^exit/i\/usr/local/bin/a2pid --daemon' -e '/^exit/i\wait 1' -e '/^exit/i\/usr/local/bin/a2joy' /etc/rc.local.bak > /etc/rc.local
|
||||
sed -e '/^exit/i\# Start Apple II Pi' -e '/^exit/i\/usr/local/bin/a2pid --daemon' -e '/^exit/i\wait 1' -e '/^exit/i\/usr/local/bin/a2joy' /etc/rc.local.bak > /etc/rc.local
|
||||
chmod +x /etc/rc.local
|
||||
fi
|
||||
fi
|
||||
|
25
src/a2pid.c
25
src/a2pid.c
@ -7,6 +7,7 @@
|
||||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@ -14,6 +15,10 @@
|
||||
#include <linux/input.h>
|
||||
#include <linux/uinput.h>
|
||||
|
||||
#ifdef SETSERCLK
|
||||
#include "gpclk.c"
|
||||
#endif
|
||||
|
||||
#define BAUDRATE B115200
|
||||
#define _POSIX_SOURCE 1 /* POSIX compliant source */
|
||||
#define FALSE 0
|
||||
@ -586,6 +591,13 @@ void flushreqs(int a2fd, int clidx, int status, int result)
|
||||
}
|
||||
}
|
||||
}
|
||||
static void sig_bye(int signo)
|
||||
{
|
||||
/*
|
||||
* Exit gracefully
|
||||
*/
|
||||
state = STOP;
|
||||
}
|
||||
void main(int argc, char **argv)
|
||||
{
|
||||
struct uinput_user_dev uidev;
|
||||
@ -622,6 +634,13 @@ void main(int argc, char **argv)
|
||||
*/
|
||||
devtty = argv[1];
|
||||
}
|
||||
/*
|
||||
* Add signal handlers.
|
||||
*/
|
||||
if (signal(SIGINT, sig_bye) == SIG_ERR)
|
||||
die("signal");
|
||||
if (signal(SIGHUP, sig_bye) == SIG_ERR)
|
||||
die("signal");
|
||||
/*
|
||||
* Create keyboard input device
|
||||
*/
|
||||
@ -709,6 +728,12 @@ void main(int argc, char **argv)
|
||||
evrely.type = EV_REL;
|
||||
evrely.code = REL_Y;
|
||||
evsync.type = EV_SYN;
|
||||
#ifdef SETSERCLK
|
||||
/*
|
||||
* Initialize ACIA clock for Apple II Pi card
|
||||
*/
|
||||
gpclk(271); /* divisor for ~1.8 MHz => (500/271) MHz */
|
||||
#endif
|
||||
/*
|
||||
* Open serial port.
|
||||
*/
|
||||
|
@ -67,7 +67,7 @@ void release_io(volatile unsigned int *io_map)
|
||||
munmap((void *)io_map, IOMAP_LEN);
|
||||
}
|
||||
|
||||
void setserclk(void)
|
||||
void gpclk(int idiv)
|
||||
{
|
||||
// I/O access
|
||||
volatile unsigned *gpio, *cmgp;
|
||||
@ -77,7 +77,7 @@ void setserclk(void)
|
||||
cmgp = setup_io(ARM_PERI_BASE + CMGP_OFFSET);
|
||||
gpio = setup_io(ARM_PERI_BASE + GPIO_OFFSET);
|
||||
|
||||
// Set Clock Manager to provivede ~1.8432 MHz from 500 MHz source (PLLD)
|
||||
// Set Clock Manager to 500 MHz source (PLLD)
|
||||
CMGP_REG(CM_GP0CTL) = (0x5A << 24) // Password
|
||||
// Disable
|
||||
| (1); // Src = oscillator
|
||||
@ -86,7 +86,7 @@ void setserclk(void)
|
||||
// Disable
|
||||
| (6); // Src = PLLD
|
||||
CMGP_REG(CM_GP0DIV) = (0x5A << 24) // Password
|
||||
| (271 << 12); // IDIV
|
||||
| ((idiv) << 12); // IDIV
|
||||
usleep(1000);
|
||||
CMGP_REG(CM_GP0CTL) = (0x5A << 24) // Password
|
||||
| (1 << 4) // Enable
|
||||
|
Loading…
Reference in New Issue
Block a user