Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dowty SBD skeleton #6

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sys/conf/GENERIC
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,5 @@ PROFILE NO # system profiling with KW11P clock

INGRES NO # include the Ingres lock driver

NIBV 1 # IBV11 GPIB
NIBV 1 # IBV11 GPIB
NSBD 1 # Dowty SBD
4 changes: 2 additions & 2 deletions sys/conf/Make.pdpuba
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ VPATH= ../pdpuba
CFILES= ${U}/br.c ${U}/dh.c ${U}/dn.c ${U}/dhu.c ${U}/dhv.c ${U}/dkbad.c \
${U}/dr.c ${U}/dz.c ${U}/hk.c ${U}/ht.c ${U}/lp.c ${U}/ra.c ${U}/rk.c \
${U}/rl.c ${U}/rx.c ${U}/si.c ${U}/tm.c ${U}/tmscp.c ${U}/tmscpdump.c \
${U}/ts.c ${U}/xp.c ${U}/ibv.c
${U}/ts.c ${U}/xp.c ${U}/ibv.c ${U}/sbd.c
OBJS= br.o dh.o dhu.o dhv.o dkbad.o dn.o dr.o dz.o hk.o ht.o lp.o ra.o rk.o \
rl.o rx.o si.o tm.o tmscp.o tmscpdump.o ts.o xp.o dn.o ibv.o
rl.o rx.o si.o tm.o tmscp.o tmscpdump.o ts.o xp.o dn.o ibv.o sbd.o

.c.o:
${CC} ${CFLAGS} -S $*.c
Expand Down
2 changes: 1 addition & 1 deletion sys/conf/Make.sunix
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ OV3= clock.o cons.o kern_time.o \
machdep2.o quota_sys.o subr_prf.o sys_process.o \
syscalls.o ufs_mount.o
OV4= hk.o init_main.o kern_prot.o tty_pty.o quota_kern.o quota_subr.o \
quota_ufs.o vm_swp.o vm_swap.o vm_proc.o ibv.o
quota_ufs.o vm_swp.o vm_swap.o vm_proc.o ibv.o sbd.o
OV5= ht.o tm.o ts.o
OV6= tmscp.o tmscpdump.o mem.o
OV7= mch_fpsim.o ingreslock.o ufs_disksubr.o
Expand Down
1 change: 1 addition & 0 deletions sys/conf/config
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ echo "#define NLP $NLP" > ../$MACHINE/lp.h
echo "#define LP_MAXCOL $LP_MAXCOL" >> ../$MACHINE/lp.h
echo "#define NPTY $NPTY" > ../$MACHINE/pty.h
echo "#define NIBV $NIBV" > ../$MACHINE/ibv.h
echo "#define NSBD $NSBD" > ../$MACHINE/sbd.h
if [ $INGRES = YES ]; then
echo "#define NINGRES 1" > ../$MACHINE/ingres.h
else
Expand Down
18 changes: 16 additions & 2 deletions sys/pdp/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,15 @@ int ibvopen(), ibvclose(), ibvread(), ibvwrite();
#define ibvwrite nodev
#endif

#include "sbd.h"
#if NSBD > 0
int sbdopen(), sbdclose(), sbdwrite();
#else
#define sbdopen nodev
#define sbdclose nodev
#define sbdwrite nodev
#endif

int logopen(), logclose(), logread(), logioctl(), logselect();
int syopen(), syread(), sywrite(), syioctl(), syselect();

Expand Down Expand Up @@ -481,6 +490,10 @@ struct cdevsw cdevsw[] = {
ibvopen, ibvclose, ibvread, ibvwrite,
nodev, nulldev, 0, nodev,
nulldev,
/* sbd = 28 */
sbdopen, sbdclose, nodev, sbdwrite,
nodev, nulldev, 0, nodev,
nulldev,
};

int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
Expand Down Expand Up @@ -539,7 +552,7 @@ isdisk(dev, type)
/* NOTREACHED */
}

#define MAXDEV 28
#define MAXDEV 29
static char chrtoblktbl[MAXDEV] = {
/* CHR */ /* BLK */
/* 0 */ NODEV,
Expand Down Expand Up @@ -569,7 +582,8 @@ static char chrtoblktbl[MAXDEV] = {
/* 24 */ NODEV,
/* 25 */ NODEV,
/* 26 */ NODEV,
/* 27 */ NODEV /* IBV11 */
/* 27 */ NODEV, /* IBV11 */
/* 28 */ NODEV /* Dowty SBD */
};

/*
Expand Down
1 change: 1 addition & 0 deletions sys/pdp/scb.s
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "xp.h"
#include "vv.h"
#include "ibv.h"
#include "sbd.h"

/*
* Reference the global symbol "_end" so that ld(1) will define it for us.
Expand Down
78 changes: 78 additions & 0 deletions sys/pdpuba/sbd.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#include "../h/param.h"
#include "../h/errno.h"
#include "../h/syslog.h"
#include "../h/uio.h"
#include "sbd.h"

#define NSBD 1

/*
* Default status register 0760040
* Default vector 0270 (PRI 4)
*/

#define dev_t int

struct sbddevice *sbd = (struct sbddevice *)0760040;

sbdattach(addr, unit)
struct sbddevice *addr;
u_int unit;
{

return 1;
}

/* Simple example to set to graphics mode, erase screen and write hello */
static int sbdcmd[] = {
22, /* 22 bytes / 11 words */
(0 << 8) | SBD_FCPIX,
(0 << 8) | SBD_FCRUB,
(4 << 8) | SBD_FCALP,
0300, /* x coord */
0300, /* y coord */
06, /* 6 characters */
"eh",
"ll",
"!o",
-1
};

sbdopen(dev, flag)
dev_t dev;
short flag;
{

/* Since the command block will remain in kernel space (i.e. lower
* addresses), we can ignore the most significant bits of the
* command block address. This will avoid needing to handle pages
* etc.
*/
unsigned int addr = (unsigned int)sbdcmd;

/* 0376 to avoid overwriting Q (abort) - we are guarenteed a word
* aligned memory block anyway.
*/
sbd->hahl = 0376 & addr;
sbd->hahr = 0377 & (addr >> 8);
sbd->hcsr = 0;

return 0;
}

sbdclose(dev, flag)
dev_t dev;
int flag;
{

return 0;
}

sbdwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
int flag;
{

return 0;
}
53 changes: 53 additions & 0 deletions sys/pdpuba/sbd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

/*
* Bit No: 7 6 5 4 3 2 1 0
* +---+---+---+---+---+---+---+---+
* Interrupt Vec HIVR | V7 - V0 |
* +---+---+-----------------------+
* Cmd and Status HCSR | R | I | A21 - A16 |
* +---+---+-----------------------+
* Addr High HAHR | A15 - A8 |
* +---------------------------+---+
* Addr Low HAHL | A7 - A1 | Q |
* +---+---+---+---+---+---+---+---+
*
* Q = Abort
* R = Ready
* I = Interrupt Enable
*
* Command buffer address is set in Q,A1-A21.
* Q should always be 0, hence it must be word aligned.
* Execution of command buffer is performed when R is set to 0.
*
* Each register is in its own word but only the least significant 8
* bits are used.
*/

struct sbddevice {
char hinv; /* Interrupt Vector */
char u0; /* Unused */
char hcsr; /* Cmd and Status Register */
char u1; /* Unused */
char hahr; /* Host Address High */
char u2; /* Unused */
char hahl; /* Host Address Low */
char u3; /* Unused */
};

/* SBD Register Bitmasks */
#define SBD_INTEN_HCSR 0200 /* _ I _ _ _ _ _ _ */
#define SBD_READY_HCSR 0400 /* R _ _ _ _ _ _ _ */
#define SBD_HADDR_HCSR 0077 /* _ _ A A A A A A */
#define SBD_HADDR_HAHR 0377 /* A A A A A A A A */
#define SBD_HADDR_HAHL 0376 /* A A A A A A A _ */
#define SBD_ABORT_HAHL 0001 /* _ _ _ _ _ _ _ Q */

/* SBD Function Codes */
#define SBD_FCRUB 0006 /* Erase rectangle */
#define SBD_FCPIX 0014 /* Display pixel graphics area */
#define SBD_FCVEC 0027 /* Draw vector */
#define SBD_FCCIR 0032 /* Draw circle */
#define SBD_FCALP 0035 /* Display text on pixel area */
#define SBD_FCWIB 0046 /* Write image block */
#define SBD_FCRIB 0047 /* Read image block */