Skip to content

Commit

Permalink
Example DMA command block
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronJackson committed May 1, 2022
1 parent e5c58e1 commit ecd4477
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
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
43 changes: 26 additions & 17 deletions sys/pdpuba/sbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,38 @@ sbdattach(addr, 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;
{
static int cmd[] = {
22, /* 22 bytes / 11 words */
(0 << 9) | SBD_FCPIX,
(0 << 9) | SBD_FCRUB,
(2 << 9) | SBD_FCALP,
0300, /* x coord */
0300, /* y coord */
06, /* 6 characters */
"eh",
"ll",
"!o",
-1
};

/* we can probably ignore bits above 16 i think? */
unsigned int addr = (unsigned int)cmd;
/* 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;

sbd->hahl = 0000376 & addr;
sbd->hahr = 0177400 & addr;
/* 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;
Expand Down
2 changes: 1 addition & 1 deletion sys/pdpuba/sbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* 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 1.
* 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.
Expand Down

0 comments on commit ecd4477

Please sign in to comment.