mirror of
https://github.com/dschmenk/apple2pi.git
synced 2025-02-26 04:29:04 +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
|
DESTDIR=/usr/local/bin
|
||||||
VERSION=0.9.0
|
SHAREDIR=/usr/share/a2pi
|
||||||
PREFIX=/usr/local
|
BIN=a2pid a2joy a2joymou a2joypad a2mon a2term fusea2pi dskread dskwrite bload brun
|
||||||
BIN= a2serclk a2pid a2joy a2joymou a2joypad a2mon a2term dskread dskwrite bintomon bload brun text2merlin merlin2text
|
A2PIDEFS=-DSETSERCLK
|
||||||
BINDIR=$(PREFIX)/bin
|
|
||||||
DIST=$(PACKAGE)-$(VERSION)
|
|
||||||
DISTDIR=./$(DIST)
|
|
||||||
|
|
||||||
all: $(BIN) fusea2pi
|
all: $(BIN)
|
||||||
|
|
||||||
|
a2pid: a2pid.c gpclk.c
|
||||||
|
$(CC) $(A2PIDEFS) a2pid.c -o a2pid
|
||||||
|
|
||||||
fusea2pi: fusea2pi.c a2lib.c
|
fusea2pi: fusea2pi.c a2lib.c
|
||||||
$(CC) -I/usr/include/fuse -D_FILE_OFFSET_BITS=64 fusea2pi.c -lfuse -o fusea2pi
|
$(CC) -I/usr/include/fuse -D_FILE_OFFSET_BITS=64 fusea2pi.c -lfuse -o fusea2pi
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm $(BIN) *~ fusea2pi
|
-rm $(BIN) *~ *.tar.gz
|
||||||
|
|
||||||
install:
|
install:
|
||||||
cp $(BIN) fusea2pi a2mount $(BINDIR)
|
cp $(BIN) a2mount $(DESTDIR)
|
||||||
|
-mkdir $(SHAREDIR)
|
||||||
|
cp ../share/* $(SHAREDIR)
|
||||||
$(BASH) ./a2pi-setup.sh
|
$(BASH) ./a2pi-setup.sh
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
cd $(BINDIR); rm $(BIN) fusea2pi a2mount
|
cd $(DESTDIR); rm $(BIN) 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)
|
|
||||||
|
@ -15,12 +15,12 @@ if [ -n "$gettyline" -a ${gettyline:0:1} = T ] ; then
|
|||||||
sed 's/^T0*/#T0*/' /etc/inittab.bak > /etc/inittab
|
sed 's/^T0*/#T0*/' /etc/inittab.bak > /etc/inittab
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
# Add a2serclk and a2pid to rc.local
|
# Add a2joy and a2pid to rc.local
|
||||||
#
|
#
|
||||||
if [ -f /etc/rc.local ] ; then
|
if [ -f /etc/rc.local ] ; then
|
||||||
if ! grep a2pid /etc/rc.local > /dev/null ; then
|
if ! grep a2pid /etc/rc.local > /dev/null ; then
|
||||||
mv /etc/rc.local /etc/rc.local.bak
|
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
|
chmod +x /etc/rc.local
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
25
src/a2pid.c
25
src/a2pid.c
@ -7,6 +7,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
@ -14,6 +15,10 @@
|
|||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <linux/uinput.h>
|
#include <linux/uinput.h>
|
||||||
|
|
||||||
|
#ifdef SETSERCLK
|
||||||
|
#include "gpclk.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define BAUDRATE B115200
|
#define BAUDRATE B115200
|
||||||
#define _POSIX_SOURCE 1 /* POSIX compliant source */
|
#define _POSIX_SOURCE 1 /* POSIX compliant source */
|
||||||
#define FALSE 0
|
#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)
|
void main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct uinput_user_dev uidev;
|
struct uinput_user_dev uidev;
|
||||||
@ -622,6 +634,13 @@ void main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
devtty = argv[1];
|
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
|
* Create keyboard input device
|
||||||
*/
|
*/
|
||||||
@ -709,6 +728,12 @@ void main(int argc, char **argv)
|
|||||||
evrely.type = EV_REL;
|
evrely.type = EV_REL;
|
||||||
evrely.code = REL_Y;
|
evrely.code = REL_Y;
|
||||||
evsync.type = EV_SYN;
|
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.
|
* Open serial port.
|
||||||
*/
|
*/
|
||||||
|
@ -67,7 +67,7 @@ void release_io(volatile unsigned int *io_map)
|
|||||||
munmap((void *)io_map, IOMAP_LEN);
|
munmap((void *)io_map, IOMAP_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setserclk(void)
|
void gpclk(int idiv)
|
||||||
{
|
{
|
||||||
// I/O access
|
// I/O access
|
||||||
volatile unsigned *gpio, *cmgp;
|
volatile unsigned *gpio, *cmgp;
|
||||||
@ -77,7 +77,7 @@ void setserclk(void)
|
|||||||
cmgp = setup_io(ARM_PERI_BASE + CMGP_OFFSET);
|
cmgp = setup_io(ARM_PERI_BASE + CMGP_OFFSET);
|
||||||
gpio = setup_io(ARM_PERI_BASE + GPIO_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
|
CMGP_REG(CM_GP0CTL) = (0x5A << 24) // Password
|
||||||
// Disable
|
// Disable
|
||||||
| (1); // Src = oscillator
|
| (1); // Src = oscillator
|
||||||
@ -86,7 +86,7 @@ void setserclk(void)
|
|||||||
// Disable
|
// Disable
|
||||||
| (6); // Src = PLLD
|
| (6); // Src = PLLD
|
||||||
CMGP_REG(CM_GP0DIV) = (0x5A << 24) // Password
|
CMGP_REG(CM_GP0DIV) = (0x5A << 24) // Password
|
||||||
| (271 << 12); // IDIV
|
| ((idiv) << 12); // IDIV
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
CMGP_REG(CM_GP0CTL) = (0x5A << 24) // Password
|
CMGP_REG(CM_GP0CTL) = (0x5A << 24) // Password
|
||||||
| (1 << 4) // Enable
|
| (1 << 4) // Enable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user