M bitsy/dat.h => bitsy/dat.h +4 -83
@@ 189,85 189,6 @@ enum
OneMeg= 1024*1024,
};
-#ifdef NDEF
-/*
- * routines to access UART hardware
- */
-struct PhysUart
-{
- void (*enable)(Uart*, int);
- void (*disable)(Uart*);
- void (*kick)(Uart*);
- void (*intr)(Ureg*, void*);
- void (*dobreak)(Uart*, int);
- void (*baud)(Uart*, int);
- void (*bits)(Uart*, int);
- void (*stop)(Uart*, int);
- void (*parity)(Uart*, int);
- void (*modemctl)(Uart*, int);
- void (*rts)(Uart*, int);
- void (*dtr)(Uart*, int);
- long (*status)(Uart*, void*, long, long);
-};
-
-enum {
- Stagesize= 1024
-};
-
-/*
- * software UART
- */
-struct Uart
-{
- QLock;
- int type;
- int dev;
- int opens;
- void *regs;
- PhysUart *phys;
-
- int enabled;
- Uart *elist; /* next enabled interface */
- char name[NAMELEN];
-
- uchar sticky[4]; /* sticky write register values */
- ulong freq; /* clock frequency */
- uchar mask; /* bits/char */
- int baud; /* baud rate */
-
- int parity; /* parity errors */
- int frame; /* framing errors */
- int overrun; /* rcvr overruns */
-
- /* buffers */
- int (*putc)(Queue*, int);
- Queue *iq;
- Queue *oq;
-
- uchar istage[Stagesize];
- uchar *iw;
- uchar *ir;
- uchar *ie;
-
- Lock tlock; /* transmit */
- uchar ostage[Stagesize];
- uchar *op;
- uchar *oe;
-
- int modem; /* hardware flow control on */
- int xonoff; /* software flow control on */
- int blocked;
- int cts, dsr, dcd, dcdts; /* keep track of modem status */
- int ctsbackoff;
- int hup_dsr, hup_dcd; /* send hangup upstream? */
- int dohup;
-
- int kinuse; /* device in use by kernel */
-
- Rendez r;
-};
-#endif
-
/*
* PCMCIA structures known by both port/cis.c and the pcmcia driver
*/
@@ 357,10 278,10 @@ struct PCMslot
*/
struct DevConf
{
- ulong mem; /* mapped memory address */
+ ulong mem; /* mapped memory address */
ulong port; /* mapped i/o regs */
- int size; /* access size */
- int itype; /* type of interrupt */
+ int size; /* access size */
+ int itype; /* type of interrupt */
ulong interrupt; /* interrupt number */
- char *type; /* card type, mallocated */
+ char *type; /* card type, mallocated */
};
M bitsy/devpcmcia.c => bitsy/devpcmcia.c +23 -12
@@ 34,16 34,24 @@ enum
Clevel= (1<<6), /* level sensitive interrupt line */
};
-#define SLOTNO(c) ((ulong)((c->qid.path>>8)&0xff))
-#define TYPE(c) ((ulong)(c->qid.path&0xff))
-#define QID(s,t) (((s)<<8)|(t))
-
static void increfp(PCMslot*);
static void decrefp(PCMslot*);
static void slotmap(int, ulong, ulong, ulong);
static void slottiming(int, int, int, int, int);
static void slotinfo(Ureg*, void*);
+#define TYPE(c) (((ulong)c->qid.path)&0xff)
+#define PATH(s,t) (((s)<<8)|(t))
+
+static PCMslot*
+slotno(Chan *c)
+{
+ ulong x;
+
+ x = c->qid.path;
+ return slot + ((x>>8)&0xff);
+}
+
static int
pcmgen(Chan *c, char *, Dirtab * , int, int i, Dir *dp)
{
@@ 66,17 74,17 @@ pcmgen(Chan *c, char *, Dirtab * , int, int i, Dir *dp)
len = 0;
switch(i%Nents){
case 0:
- qid.path = QID(slotno, Qmem);
+ qid.path = PATH(slotno, Qmem);
snprint(up->genbuf, sizeof up->genbuf, "pcm%dmem", slotno);
len = sp->memlen;
break;
case 1:
- qid.path = QID(slotno, Qattr);
+ qid.path = PATH(slotno, Qattr);
snprint(up->genbuf, sizeof up->genbuf, "pcm%dattr", slotno);
len = sp->memlen;
break;
case 2:
- qid.path = QID(slotno, Qctl);
+ qid.path = PATH(slotno, Qctl);
snprint(up->genbuf, sizeof up->genbuf, "pcm%dctl", slotno);
break;
}
@@ 140,11 148,12 @@ pcmciastat(Chan *c, uchar *db, int n)
static Chan*
pcmciaopen(Chan *c, int omode)
{
+ print("pcmciaopen\n");
if(c->qid.type & QTDIR){
if(omode != OREAD)
error(Eperm);
} else
- increfp(slot + SLOTNO(c));
+ increfp(slotno(c));
c->mode = openmode(omode);
c->flag |= COPEN;
c->offset = 0;
@@ 156,7 165,7 @@ pcmciaclose(Chan *c)
{
if(c->flag & COPEN)
if((c->qid.type & QTDIR) == 0)
- decrefp(slot+SLOTNO(c));
+ decrefp(slotno(c));
}
/* a memmove using only bytes */
@@ 235,7 244,7 @@ pcmciaread(Chan *c, void *a, long n, vlong off)
PCMslot *sp;
ulong offset = off;
- sp = slot + SLOTNO(c);
+ sp = slotno(c);
switch(TYPE(c)){
case Qdir:
@@ 346,7 355,7 @@ pcmciawrite(Chan *c, void *a, long n, vlong off)
PCMslot *sp;
ulong offset = off;
- sp = slot + SLOTNO(c);
+ sp = slotno(c);
switch(TYPE(c)){
case Qmem:
@@ 420,6 429,7 @@ slotinfo(Ureg*, void*)
static void
increfp(PCMslot *sp)
{
+ print("increfp\n");
wlock(sp);
if(waserror()){
wunlock(sp);
@@ 436,8 446,9 @@ increfp(PCMslot *sp)
}
incref(&sp->ref);
slotinfo(nil, nil);
- if(sp->occupied && sp->cisread == 0)
+ if(sp->occupied && sp->cisread == 0) {
pcmcisread(sp);
+ }
wunlock(sp);
poperror();
M bitsy/devsac.c => bitsy/devsac.c +17 -2
@@ 139,8 139,12 @@ sacinit(void)
p = (uchar*)Flash_tar+4;
data = tarlookup(p, sacfs, &i);
if(data == 0) {
- print("devsac: could not find file: %s\n", sacfs);
- return;
+ p = (uchar*)Flash_tar;
+ data = tarlookup(p, sacfs, &i);
+ if(data == 0) {
+ print("devsac: could not find file: %s\n", sacfs);
+ return;
+ }
}
hdr = (SacHeader*)data;
if(getl(hdr->magic) != Magic) {
@@ 179,6 183,16 @@ sacattach(char* spec)
return c;
}
+static void listprint(char **name, int nname, int j)
+{
+ int i;
+
+ print("%d ", j);
+ for(i = 0; i< nname; i++)
+ print("%s/", name[i]);
+ print("\n");
+}
+
static Walkqid*
sacwalk(Chan *c, Chan *nc, char **name, int nname)
{
@@ 225,6 239,7 @@ sacwalk(Chan *c, Chan *nc, char **name, int nname)
}
poperror();
if(wq->nqid < nname){
+// listprint(name, wq->nqid, j);
if(alloc)
cclose(wq->clone);
wq->clone = nil;
M bitsy/mem.h => bitsy/mem.h +1 -1
@@ 64,7 64,7 @@
#define MACHADDR (KZERO+0x00001000)
#define EVECTORS 0xFFFF0000 /* virt base of exception vectors */
-#define KSTACK (16*1024) /* Size of kernel stack */
+#define KSTACK (32*1024) /* Size of kernel stack */
/*
* Offsets into flash