[inferno-ds] r192 committed - fixes, cleanup & add swidebug (tested only on desmume)

5 views
Skip to first unread message

infer...@googlecode.com

unread,
Aug 24, 2010, 4:39:13 AM8/24/10
to inferno-d...@googlegroups.com
Revision: 192
Author: saoret.one
Date: Tue Aug 24 01:38:37 2010
Log: fixes, cleanup & add swidebug (tested only on desmume)
http://code.google.com/p/inferno-ds/source/detail?r=192

Modified:
/trunk/archds.c
/trunk/arm7/audio.c
/trunk/arm7/fns.h
/trunk/arm7/l.s
/trunk/arm7/main.c
/trunk/arm7/mkfile
/trunk/arm7/print.c
/trunk/arm7/rtc.c
/trunk/arm7/trap.c
/trunk/devdldi.c
/trunk/devnds.c
/trunk/dsinit.b
/trunk/ethernds.c
/trunk/lcd.c
/trunk/main.c
/trunk/root/usr/inferno/lib/wmsetup
/trunk/screen.c
/trunk/screen.h
/trunk/trap.c

=======================================
--- /trunk/archds.c Sun Mar 14 15:25:40 2010
+++ /trunk/archds.c Tue Aug 24 01:38:37 2010
@@ -207,27 +207,32 @@
return 0;
}

-/* desmume/ideas only debug print */
+/* debug print only for desmume/ideas */
void
-uartputs(char* s, int n) {
+uartputs(char* s, int n)
+{
USED(n);
- if(0) swidebug(s);
+ UserInfo *pu = UINFOREG;
+ char desmume[]="D\0e\0S\0m\0u\0M\0E";
+
+ if(memcmp(desmume, pu->name, sizeof(desmume)) == 0)
+ swidebug(s);
}

/*
- * set ether parameters: the contents should be derived from EEPROM or
NVRAM
+ * set ether parameters: see ethernds.c:/w_option
*/
int
archether(int ctlno, Ether *ether)
{
- static char opt[128];
+ static char opt[]="dbg=1 station=ds power=on channel=6 scan=1
essid=SoftAP";

if(ctlno > 0)
return -1;

sprint(ether->type, "nds");
+ ether->nopt = tokenize(opt, (char **)ether->opt, nelem(ether->opt));
ether->mem = 0;
- ether->nopt = 0;
ether->port = 0;
ether->irq = IPCSYNCbit;
ether->itype = 0;
@@ -239,11 +244,5 @@
memset(ether->ea, 0xff, Eaddrlen);
nbfifoput(F9TWifi|F9WFrmac, (ulong)uncached(ether->ea)); /* mac from
arm7 */

- if(0) /* use WFC settings */
- strcpy(opt, "power=on channel=11 scan=0 station=ds essid=default");
- else /* use specific ap */
- strcpy(opt, "power=on channel=11 scan=0 station=ds essid=cain");
- ether->nopt = tokenize(opt, (char **)ether->opt, nelem(ether->opt));
-
return 1;
}
=======================================
--- /trunk/arm7/audio.c Sun Mar 15 04:11:32 2009
+++ /trunk/arm7/audio.c Tue Aug 24 01:38:37 2010
@@ -46,7 +46,6 @@
{
TxSound *snd = a;

- //print("snd7 %lx %lx %lx\n", (ulong)snd, (ulong)snd->d, snd->n);
if(snd->inuse && nrs++ < snd->n){
switch(snd->flags & (AFlagsigned|AFlag8bit)){
case (AFlag8bit):
=======================================
--- /trunk/arm7/fns.h Sun Jan 4 05:47:26 2009
+++ /trunk/arm7/fns.h Tue Aug 24 01:38:37 2010
@@ -14,3 +14,4 @@
void swiWaitForVBlank(void);
void swiDelay(ulong);
void swiSleep(void);
+void swidebug(char *);
=======================================
--- /trunk/arm7/l.s Sun Jan 4 05:47:26 2009
+++ /trunk/arm7/l.s Tue Aug 24 01:38:37 2010
@@ -72,3 +72,10 @@
TEXT swiCRC16(SB), $-4
SWI 0x0E0000
RET
+
+/*
+ * swidebug: print debug string in R0
+ */
+TEXT swidebug(SB), $-4
+ SWI 0xFC0000
+ RET
=======================================
--- /trunk/arm7/main.c Sun Mar 14 15:25:40 2010
+++ /trunk/arm7/main.c Tue Aug 24 01:38:37 2010
@@ -7,6 +7,8 @@
#include "audio.h"
#include "wifi.h"

+#define DPRINT if(1)print
+
/* So we can initialize our own data section and bss */
extern char bdata[];
extern char edata[];
@@ -54,9 +56,14 @@
while(!(FIFOREG->ctl & FifoRempty)) {
vv = FIFOREG->recv;
v = vv>>Fcmdlen;
+
+ DPRINT("FRX %lux %lux\n", vv & Fcmdtmask, vv & Fcmdsmask);
switch(vv&Fcmdtmask) {
+ default:
+ print("F7rx err %lux\n", vv);
+ break;
+
case F9TSystem:
- if(0)print("F9S %lux\n", vv & Fcmdsmask);
switch(vv&Fcmdsmask){
case F9Sysbright:
read_firmware(FWconsoletype, ndstype, sizeof ndstype);
@@ -105,7 +112,6 @@
break;

case F9TWifi:
- if(0)print("F9W %lux\n", vv & Fcmdmask);
switch(vv&Fcmdsmask){
case F9WFrmac:
// mac is needed early by the arm9 in archds.c:/^archether
@@ -118,7 +124,6 @@
break;

case F9TAudio:
- if(0)print("F9A %lux\n", vv & Fcmdsmask);
switch(vv&Fcmdsmask){
case F9Auplay:
audioplay((TxSound*)v, 1);
@@ -134,10 +139,6 @@
break;
}
break;
-
- default:
- print("F7rx err %lux\n", vv);
- break;
}
}

=======================================
--- /trunk/arm7/mkfile Tue Jun 30 12:43:25 2009
+++ /trunk/arm7/mkfile Tue Aug 24 01:38:37 2010
@@ -11,12 +11,12 @@
OFILES=\
l.$O\
main.$O\
- print.$O\
trap.$O\
spi.$O\
rtc.$O\
audio.$O\
wifi.$O\
+ print.$O\
# dma.$O\

HFILES=\
@@ -37,10 +37,11 @@
i$CONF: $OFILES
$LD -o $target -R4 -T$KTZERO7 -l $OFILES $libs $SYSLIBS

+# must be ARM code, even when OBJTYPE=thumb
trap.t: trap.5
cp trap.5 trap.t
-trap.5: trap.c
- 5c $CFLAGS trap.c
+%.5: %.c
+ 5c $CFLAGS $stem.c

syms: $OFILES
$CC $CFLAGS -a '-DKERNDATE='$KERNDATE main.c >syms
=======================================
--- /trunk/arm7/print.c Wed Jan 21 17:26:32 2009
+++ /trunk/arm7/print.c Tue Aug 24 01:38:37 2010
@@ -96,14 +96,24 @@
return n;
}

-#define SData ((char*)IPC)
+/* debug print only for desmume/ideas */
+void
+uartputs(char* s, int n)
+{
+ USED(n);
+ UserInfo *pu = UINFOREG;
+ char desmume[]="D\0e\0S\0m\0u\0M\0E";
+
+ if(memcmp(desmume, pu->name, sizeof(desmume)) == 0)
+ swidebug(s);
+}

int
print(char *fmt, ...)
{
static int n = 0;
va_list ap;
- char *s = SData;
+ char *s = (char*)IPC;

if(n)
memset((void*)s, '\0', n);
@@ -111,6 +121,7 @@
n = vsprint(s, fmt, ap);
va_end(ap);

- while(!nbfifoput(F7print, (ulong)s));
+ uartputs(s, n);
+ //while(!nbfifoput(F7print, (ulong)s));
return n;
}
=======================================
--- /trunk/arm7/rtc.c Wed Jan 21 17:26:32 2009
+++ /trunk/arm7/rtc.c Tue Aug 24 01:38:37 2010
@@ -97,8 +97,7 @@
tm.year = time[0] + 2000;
tm.tzoff = -1;

- if(0)
- print("%d:%d:%d %d/%d/%d [HH:MM:SS YY/MM/DD]\n",
+ if(0)print("%d:%d:%d %d/%d/%d [HH:MM:SS YY/MM/DD]\n",
tm.hour, tm.min, tm.sec, tm.year, tm.mon, tm.mday);

return tm2sec(&tm);
=======================================
--- /trunk/arm7/trap.c Fri Aug 29 03:32:59 2008
+++ /trunk/arm7/trap.c Tue Aug 24 01:38:37 2010
@@ -48,8 +48,7 @@
static void
panic(void)
{
- /* sauve qui peut! */
- print("panic: arm7 cpu halted\n");
+ print("panic7!\n");
while(1);
}

=======================================
--- /trunk/devdldi.c Wed Jan 21 17:26:32 2009
+++ /trunk/devdldi.c Tue Aug 24 01:38:37 2010
@@ -19,7 +19,7 @@
#include "io.h"
#include "../port/error.h"

-#define DPRINT if(0)print
+#define DPRINT if(0)iprint

enum{
Qdir,
=======================================
--- /trunk/devnds.c Sun Mar 14 15:25:40 2010
+++ /trunk/devnds.c Tue Aug 24 01:38:37 2010
@@ -83,7 +83,7 @@
}
break;
case F7mousedown:
- //print("mdown %lux %lud %lud %lud %lud\n", v, v&0xff, (v>>8)&0xff,
(v>>16)&0xff, mousemod);
+ DPRINT("mdown %lux %lud %lud %lud %lud\n", v, v&0xff, (v>>8)&0xff,
(v>>16)&0xff, mousemod);
mousetrack(mousemod, v&0xff, (v>>8)&0xff, 0);
m = mousexy();
if(om.x != m.x || om.y != m.y)
=======================================
--- /trunk/dsinit.b Sun Mar 14 15:25:40 2010
+++ /trunk/dsinit.b Tue Aug 24 01:38:37 2010
@@ -44,7 +44,7 @@

sys->bind("/", "/", Sys->MREPL);

- lightup();
+ lightup(0);

localok := 0;
if(lfs("#L/data") >= 0){
@@ -88,7 +88,7 @@
break; # internal
(rc, nil) := sys->stat(rootsource+"/dis/sh.dis");
if(rc < 0)
- err("%s has no shell");
+ err(rootsource+" has no shell\n");
else if(sys->bind(rootsource, "/", Sys->MAFTER) < 0)
sys->print("can't bind %s on /: %r\n", rootsource);
else{
@@ -142,11 +142,11 @@
return ret;
}

-lightup()
+lightup(level: int)
{
fd := sys->open("#T/ndsctl", Sys->OWRITE);
if(fd != nil)
- sys->fprint(fd, "blight 0");
+ sys->fprint(fd, "blight %d", level);
}

#
=======================================
--- /trunk/ethernds.c Sun Mar 15 04:11:32 2009
+++ /trunk/ethernds.c Tue Aug 24 01:38:37 2010
@@ -10,9 +10,9 @@
#include "../port/netif.h"
#include "etherif.h"

-static int dbg = 1;
-#define DBG if(dbg)
-#define DPRINT if(dbg)iprint
+static int dbg = 0;
+#define DBG if(dbg)
+#define DPRINT DBG iprint

enum
{
@@ -69,22 +69,22 @@
Rendez timer;

uchar *base;
- int type;
- int rev;
- int hasmii;
- int phyad;
- int bank; /* currently selected bank */
+ int type;
+ int rev;
+ int hasmii;
+ int phyad;
+ int bank; /* currently selected bank */
Block* waiting; /* waiting for space in FIFO */

- int attached;
+ int attached;
char wantname[WNameLen];
char nodename[WNameLen];

- int ptype; // AP mode/type
- int crypt; // encryption off/on
- int txkey; // transmit key
+ int ptype; // AP mode/type
+ int crypt; // encryption off/on
+ int txkey; // transmit key
WKey keys[WNKeys]; // default keys
- int scan;
+ int scan;

Stats;
};
@@ -115,7 +115,7 @@
void ethhdr_print(char f, void * d) {
Etherpkt *p = d;

- print("%c:%x%x%x%x%x%x %x%x%x%x%x%x %x%x\n",
+ DPRINT("%c:%x%x%x%x%x%x %x%x%x%x%x%x %x%x\n",
f,
p->d[0], p->d[1], p->d[2], p->d[3], p->d[4], p->d[5],
p->s[0], p->s[1], p->s[2], p->s[3], p->s[4], p->s[5],
@@ -264,24 +264,24 @@
}

int Wifi_GetAPData(int apnum, Wifi_AccessPoint * apdata) {
- int j;
-
+ int j;
+
if(!apdata) return WIFI_RETURN_PARAMERROR;


if(WifiData->aplist[apnum].flags&WFLAG_APDATA_ACTIVE) {
- while(Spinlock_Acquire(WifiData->aplist[apnum])!=SPINLOCK_OK);
- {
+ while(Spinlock_Acquire(WifiData->aplist[apnum])!=SPINLOCK_OK);
+ {
// additionally calculate average RSSI here
WifiData->aplist[apnum].rssi=0;
for(j=0;j<8;j++) {
- WifiData->aplist[apnum].rssi+=WifiData->aplist[apnum].rssi_past[j];
+ WifiData->aplist[apnum].rssi+=WifiData->aplist[apnum].rssi_past[j];
}
WifiData->aplist[apnum].rssi = WifiData->aplist[apnum].rssi >> 3;
*apdata = WifiData->aplist[apnum]; // yay for struct copy!
Spinlock_Release(WifiData->aplist[apnum]);
return WIFI_RETURN_OK;
- }
+ }
}

return WIFI_RETURN_ERROR;
@@ -411,9 +411,9 @@
case WIFIMODE_NORMAL:
case WIFIMODE_DISASSOCIATE:
return ASSOCSTATUS_DISCONNECTED;
- case WIFIMODE_SCAN:
- if(WifiData->reqReqFlags&WFLAG_REQ_APCONNECT) return
ASSOCSTATUS_AUTHENTICATING;
- return ASSOCSTATUS_DISCONNECTED;
+ case WIFIMODE_SCAN:
+ if(WifiData->reqReqFlags&WFLAG_REQ_APCONNECT) return
ASSOCSTATUS_AUTHENTICATING;
+ return ASSOCSTATUS_DISCONNECTED;
case WIFIMODE_ASSOCIATE:
switch(WifiData->authlevel) {
case WIFI_AUTHLEVEL_DISCONNECTED:
@@ -466,7 +466,7 @@
wifi_connect_state=3;
WifiData->flags9|=WFLAG_ARM9_NETREADY;
sgIP_ARP_SendGratARP(wifi_hw);
- sgIP_DNS_Record_Localhost();
+ sgIP_DNS_Record_Localhost();
return ASSOCSTATUS_ASSOCIATED;
default:
case SGIP_DHCP_STATUS_IDLE:
@@ -531,9 +531,8 @@
nbfifoput(F9TWifi|F9WFinit, (ulong)WifiData);

// wait for arm7 to be ready
- //while(Wifi_CheckInit()==0);
-}
-
+ while(Wifi_CheckInit()==0) Wifi_Update();
+}

int Wifi_CheckInit(void) {
if(!WifiData) return 0;
@@ -551,7 +550,7 @@
// add network interface.
#ifdef WIFI_USE_TCP_SGIP
wifi_hw =
sgIP_Hub_AddHardwareInterface(&Wifi_TransmitFunction,&Wifi_Interface_Init);
- sgIP_timems=WifiData->random; //hacky! but it should work just
fine :)
+ sgIP_timems=WifiData->random; //hacky! but it should work just fine :)

#endif
}
@@ -576,16 +575,16 @@
base2=base;
Wifi_RxRawReadPacket(base,22*2,framehdr);

- ethhdr_print('!',framehdr+8);
+ ethhdr_print('!',framehdr+8);
if((framehdr[8]==((u16 *)WifiData->MacAddr)[0] && framehdr[9]==((u16
*)WifiData->MacAddr)[1] && framehdr[10]==((u16 *)WifiData->MacAddr)[2]) ||
(framehdr[8]==0xFFFF && framehdr[9]==0xFFFF && framehdr[10]==0xFFFF)) {
// destination matches our mac address, or the broadcast address.
//if(framehdr[6]&0x4000) { // wep enabled (when receiving WEP packets,
the IV is stripped for us! how nice :|
// base2+=24; hdrlen=28; // base2+=[wifi hdr 12byte]+[802 header
hdrlen]+[slip hdr 8byte]
//} else {
- base2+=22; hdrlen=24;
+ // base2+=22; hdrlen=24;
//}
- //
SGIP_DEBUG_MESSAGE(("%04X %04X %04X %04X %04X",Wifi_RxReadOffset(base2-8,0),Wifi_RxReadOffset(base2-7,0),Wifi_RxReadOffset(base2-6,0),Wifi_RxReadOffset(base2-5,0),Wifi_RxReadOffset(base2-4,0)));
+ //
SGIP_DEBUG_MESSAGE(("%04X %04X %04X %04X %04X",Wifi_RxReadOffset(base2-8,0),Wifi_RxReadOffset(base2-7,0),Wifi_RxReadOffset(base2-6,0),Wifi_RxReadOffset(base2-5,0),Wifi_RxReadOffset(base2-4,0)));
// check for LLC/SLIP header...

#ifdef WIFI_USE_TCP_SGIP
@@ -643,12 +642,12 @@
framelen=BLEN(b)-14+8 + (WifiData->wepmode7?4:0);

if(!(WifiData->flags9&WFLAG_ARM9_NETUP)) {
- DPRINT(("Transmit:err_netdown"));
+ DPRINT(("tx:err_netdown\n"));
freeb(b);
return 0; //?
}
if(framelen+40>Wifi_TxBufferWordsAvailable()*2) { // error, can't send
this much!
- DPRINT(("Transmit:err_space"));
+ DPRINT(("tx:err_space\n"));
freeb(b);
return 0; //?
}
@@ -673,7 +672,7 @@
Wifi_CopyMacAddr(framehdr+11,WifiData->MacAddr);
Wifi_CopyMacAddr(framehdr+14,((u8 *)b->rp));
}
- if(WifiData->wepmode7) { framehdr[6] |=0x4000; hdrlen=20; }
+ if(WifiData->wepmode7) { framehdr[6] |=0x4000; hdrlen=20; }
framehdr[17] = 0;
framehdr[18] = 0; // wep IV, will be filled in if needed on the arm7 side.
framehdr[19] = 0;
@@ -802,10 +801,7 @@
if ((void*)ap == nil || !(ap->flags & WFLAG_APDATA_ACTIVE))
continue;

- p = seprint(p, e, "%d: %s ch=%d (0x%ux)", i, ap->ssid, ap->channel,
ap->flags);
-
- if(1)
- p = seprint(p, e, " q=%x", ap->rssi);
+ p = seprint(p, e, "%d: %s ch=%d (0x%ux) q=%x", i, ap->ssid, ap->channel,
ap->flags, ap->rssi);

if(0)
p = seprint(p, e, "sec=%s%s%s m=%s c=%s%s",
@@ -857,16 +853,14 @@
Wifi_AutoConnect();
}else {
wifi_connect_state = 0;
- /* search AP by ssid name */
j = Wifi_GetNumAP();
- for (i=0; i < j; i++)
+ for (i=0; i < j; i++){
if (strcmp(WifiData->aplist[i].ssid, cb->f[1]) == 0)
break;
-
+ }
if(i < j)
Wifi_ConnectAP(&WifiData->aplist[i], WEPMODE_NONE, ctlr->txkey,
(u8*)ctlr->keys[ctlr->txkey].dat);
-
- Wifi_Update();
+ while(Wifi_AssocStatus() != ASSOCSTATUS_AUTHENTICATING);
}
}
else if(cistrcmp(cb->f[0], "station") == 0){
@@ -880,11 +874,7 @@
r = -1;
}
else if(cistrcmp(cb->f[0], "crypt") == 0){
- if(cistrcmp(cb->f[1], "off") == 0)
- ctlr->crypt = 0;
- else if(cistrcmp(cb->f[1], "on") == 0)
- ctlr->crypt = 1;
- else if((i = atoi(cb->f[1])) >= 0 && i < 3)
+ if((i = atoi(cb->f[1])) >= 0 && i < 3)
ctlr->crypt = i;
else
r = -1;
@@ -909,18 +899,13 @@
r = -1;
}
else if(cistrcmp(cb->f[0], "scan") == 0){
- if(cistrcmp(cb->f[1], "off") == 0)
- ctlr->scan = 0;
- else if(cistrcmp(cb->f[1], "on") == 0)
- ctlr->scan = 1;
- else if((i = atoi(cb->f[1])) == 0 || i == 1)
+ if((i = atoi(cb->f[1])) == 0 || i == 1)
ctlr->scan = i;
else
r = -1;
-
+
if(ctlr->scan){
Wifi_ScanMode();
- while(WifiData->reqChannel!=1);
}
}
else if(cistrcmp(cb->f[0], "dbg") == 0){
@@ -993,7 +978,8 @@
Ctlr* ctlr;

DPRINT("attach\n");
- if (ether->ctlr == nil)
+
+ if(!ether || !ether->ctlr)
return;

ctlr = (Ctlr*) ether->ctlr;
@@ -1045,7 +1031,6 @@
{
Ether *ether;
Ctlr *ctlr;
- ulong type;

DPRINT("interrupt\n");
ether = arg;
@@ -1053,7 +1038,7 @@
if (ctlr == nil)
return;

- /* could call Wifi_Update */
+ //Wifi_Update();
}

/* set scanning interval */
@@ -1113,6 +1098,6 @@
void
etherndslink(void)
{
- addethercard("nds", etherndsreset);
+ addethercard("nds", etherndsreset);
}

=======================================
--- /trunk/lcd.c Sun Mar 14 15:25:40 2010
+++ /trunk/lcd.c Tue Aug 24 01:38:37 2010
@@ -97,11 +97,9 @@
LCDparam;
ushort* pal;
ushort* subpal;
- ushort* upper;
- ushort* lower;
} LCDdisplay;

-static LCDdisplay *ld; // current active display
+static LCDdisplay *ld;
static LCDdisplay main_display;

/* TODO: use 256 color palette */
@@ -118,7 +116,7 @@
{
Lcdytrig = 80,
Black = 0x00,
- White = 0xff,
+ White = 0xFF,
};

#define SetYtrigger(n) ((lcd->lcsr&0x7F) | (n<<8) | ((n&0x100)>>2))
@@ -205,7 +203,7 @@
lcd_flush(void)
{
// DPRINT("lcd_flush\n");
-// dcflushall(); /* need more precise addresses */
+ dcflushall(); /* need more precise addresses */
}

void
=======================================
--- /trunk/main.c Sun Mar 14 15:25:40 2010
+++ /trunk/main.c Tue Aug 24 01:38:37 2010
@@ -7,6 +7,8 @@
#include "../port/error.h"
#include "version.h"

+#define DPRINT if(1)iprint
+
Mach *m = (Mach*)MACHADDR;
Proc *up = 0;
Conf conf;
@@ -56,7 +58,7 @@
halt(void)
{
spllo();
- print("cpu halted\n");
+ DPRINT("cpu halted\n");
while(1);
}

@@ -82,41 +84,38 @@
m->ticks = 1;
m->cpuhz = 66*1000000;
}
-
-#define doc if(0)iprint

void
main(void)
{
memset(edata, 0, end-edata); /* clear the BSS */

- doc("mpuinit...\n");
+ DPRINT("mpuinit...\n");
mpuinit();
wcpctl(rcpctl() | CpCmpu); /* TODO: should be in mpuinit */
- doc("machinit...\n");
+ DPRINT("machinit...\n");
machinit();
archreset();
quotefmtinstall();
- doc("confinit...\n");
+ DPRINT("confinit...\n");
confinit();

- doc("xinit...\n");
+ DPRINT("xinit...\n");
xinit();
- doc("poolinit...\n");
+ DPRINT("poolinit...\n");
poolsizeinit();
poolinit();

- doc("trapinit...\n");
+ DPRINT("trapinit...\n");
trapinit();
- doc("clockinit...\n");
+ DPRINT("clockinit...\n");
clockinit();
- doc("printinit...\n");
+ DPRINT("printinit...\n");
printinit();

- doc("screeninit...\n");
+ DPRINT("screeninit...\n");
screeninit();

- doc("links...\n");
links();
procinit();
chandevreset();
=======================================
--- /trunk/root/usr/inferno/lib/wmsetup Sun Mar 14 15:25:40 2010
+++ /trunk/root/usr/inferno/lib/wmsetup Tue Aug 24 01:38:37 2010
@@ -13,14 +13,14 @@
fn rnes { cat /net/ether0/ifstats }
fn wnec { echo -n $* > /net/ether0/0/ctl }

- cat /net/ether0/clone > /dev/null
- wnec scan 1
- wnec essid default
+# cat /net/ether0/clone > /dev/null
+# wnec scan 1
+# wnec essid default
rnes

date

- #echo debug > /dev/audioctl
- auplay /usr/inferno/lib/invhit.iaf
- #cat /dev/audio | read 16000 > /dev/audio
- '
+# echo debug > /dev/audioctl
+# auplay /usr/inferno/lib/invhit.iaf
+# cat /dev/audio | read 16000 > /dev/audio
+ '
=======================================
--- /trunk/screen.c Sun Mar 14 15:25:40 2010
+++ /trunk/screen.c Tue Aug 24 01:38:37 2010
@@ -13,22 +13,22 @@

#include "screen.h"

-#define DPRINT if(0)iprint
+#define DPRINT if(1)iprint

static Memdata xgdata;
static Memimage xgscreen =
{
{0, 0, 0, 0}, /* r */
{0, 0, 0, 0}, /* clipr */
- 8, /* depth */
- 1, /* nchan */
+ 8, /* depth */
+ 1, /* nchan */
CMAP8, /* chan */
- nil, /* cmap */
- &xgdata, /* data */
- 0, /* zero */
- 0, /* width */
- nil, /* layer */
- 0, /* flags */
+ nil, /* cmap */
+ &xgdata, /* data */
+ 0, /* zero */
+ 0, /* width */
+ nil, /* layer */
+ 0, /* flags */
};

Memimage *gscreen;
@@ -49,21 +49,19 @@
static void screenpbuf(char*, int);
void (*screenputs)(char*, int) = screenpbuf;

-static void (*flushpixels)(Rectangle, uchar*, int, uchar*, int);
-
static Cursor arrow = {
.offset = { -1, -1 },
.clr = {
- [0x00] 0xFF, 0xFF, 0x80, 0x01, 0x80, 0x02, 0x80, 0x0C,
- [0x08] 0x80, 0x10, 0x80, 0x10, 0x80, 0x08, 0x80, 0x04,
- [0x10] 0x80, 0x02, 0x80, 0x01, 0x80, 0x02, 0x8C, 0x04,
- [0x18] 0x92, 0x08, 0x91, 0x10, 0xA0, 0xA0, 0xC0, 0x40,
+ [0x00] 0xFF, 0xFF, 0x80, 0x01, 0x80, 0x02, 0x80, 0x0C,
+ [0x08] 0x80, 0x10, 0x80, 0x10, 0x80, 0x08, 0x80, 0x04,
+ [0x10] 0x80, 0x02, 0x80, 0x01, 0x80, 0x02, 0x8C, 0x04,
+ [0x18] 0x92, 0x08, 0x91, 0x10, 0xA0, 0xA0, 0xC0, 0x40,
},
.set = {
- [0x00] 0x00, 0x00, 0x7F, 0xFE, 0x7F, 0xFC, 0x7F, 0xF0,
- [0x08] 0x7F, 0xE0, 0x7F, 0xE0, 0x7F, 0xF0, 0x7F, 0xF8,
- [0x10] 0x7F, 0xFC, 0x7F, 0xFE, 0x7F, 0xFC, 0x73, 0xF8,
- [0x18] 0x61, 0xF0, 0x60, 0xE0, 0x40, 0x40, 0x00, 0x00,
+ [0x00] 0x00, 0x00, 0x7F, 0xFE, 0x7F, 0xFC, 0x7F, 0xF0,
+ [0x08] 0x7F, 0xE0, 0x7F, 0xE0, 0x7F, 0xF0, 0x7F, 0xF8,
+ [0x10] 0x7F, 0xFC, 0x7F, 0xFE, 0x7F, 0xFC, 0x73, 0xF8,
+ [0x18] 0x61, 0xF0, 0x60, 0xE0, 0x40, 0x40, 0x00, 0x00,
},
};

@@ -141,7 +139,7 @@
static void
screenclear(void)
{
- memimagedraw(gscreen, gscreen->r, memwhite, ZP, memopaque, ZP, SoverD);
+ memimagedraw(gscreen, gscreen->r, back, ZP, memopaque, ZP, SoverD);
curpos = window.min;
flushmemscreen(gscreen->r);
}
@@ -152,17 +150,15 @@
{
int h, w;

- /*
- DPRINT("1) s=%lux sw=%d d=%lux dw=%d r=(%d,%d)(%d,%d)\n",
- s, sw, d, dw, r.min.x, r.min.y, r.max.x, r.max.y);
-
+// DPRINT("1) s=%lux sw=%d d=%lux dw=%d r=(%d,%d)(%d,%d)\n", s, sw, d, dw,
r.min.x, r.min.y, r.max.x, r.max.y);
+/*
// TODO: sync with vblank period: 192 < vcount < 261
if (LCDREG->vcount - 192 > 1){
while(LCDREG->vcount>192);
while(LCDREG->vcount<192);
}
- */
-
+*/
+
if (conf.screens >= 1){
ulong *ud = (ulong*)d;
ulong *us = (ulong*)s;
@@ -171,11 +167,12 @@
r.min.x &= ~15;
r.max.x = (r.max.x + 15) & ~15;

- for(h = r.min.y; h < r.max.y; h++)
- for(w = r.min.x; w < r.max.x; w++){
- i = (h * Scrwidth + w)/2;
+ for(h = r.min.y; h <= r.max.y; h++){
+ for(w = r.min.x; w <= r.max.x; w++){
+ i = (h * Scrwidth + w)/2; w++;
ud[i] = (1<<31)|(1<<15)|us[i];
}
+ }
}
if (conf.screens == 2){
ushort *ud = (ushort*)(d + 0x00200000);
@@ -221,14 +218,13 @@
gscreen->width = wordsperline(gscreen->r, gscreen->depth);

xgdata.bdata = (uchar*)vd->sfb;
- flushpixels = flush2fb;

memimageinit();
memdefont = getmemdefont();
memsetchan(gscreen, XBGR15);
back = memwhite;
conscol = memblack;
- memimagedraw(gscreen, gscreen->r, memwhite, ZP, memopaque, ZP, SoverD);
+
DPRINT("vd->wid=%d bwid=%d gscreen->width=%ld fb=%p data=%p\n",
vd->x, vd->bwid, gscreen->width, vd->fb, xgdata.bdata);
graphicscmap(0);
@@ -267,17 +263,6 @@
*chan = gscreen->chan;
*width = gscreen->width;
*softscreen = (gscreen->data->bdata != (uchar*)vd->fb);
-
-while(0){ /* just to get some video memory timings */
- int tstart, vstart;
-
- tstart = m->ticks;
- vstart = LCDREG->vcount;
- while(LCDREG->vcount>192);
- while(LCDREG->vcount<192);
-
- print("t %d v %d-%d\n", m->ticks-tstart, vstart, LCDREG->vcount);
-}

return (uchar*)gscreen->data->bdata;
}
@@ -290,13 +275,12 @@
void
flushmemscreen(Rectangle r)
{
-
if(rectclip(&r, gscreen->r) == 0)
return;
if(r.min.x >= r.max.x || r.min.y >= r.max.y)
- return;
- if(flushpixels != nil)
- flushpixels(r, (uchar*)gscreen->data->bdata, gscreen->width,
(uchar*)vd->fb, vd->bwid >> 2);
+ return;
+
+ flush2fb(r, (uchar*)gscreen->data->bdata, gscreen->width, (uchar*)vd->fb,
vd->bwid >> 2);
lcd_flush();
}

=======================================
--- /trunk/screen.h Sun Jan 4 05:47:26 2009
+++ /trunk/screen.h Tue Aug 24 01:38:37 2010
@@ -23,7 +23,9 @@

struct Vdisplay {
ushort* fb; /* frame buffer */
- ushort* sfb; /* soft frame buffer */
+ ushort* sfb; /* soft frame buffer */
+ ushort* upper;
+ ushort* lower;
ulong colormap[256][3];
int bwid;
Lock;
=======================================
--- /trunk/trap.c Sun Mar 15 04:11:32 2009
+++ /trunk/trap.c Tue Aug 24 01:38:37 2010
@@ -143,7 +143,7 @@

/* setup TCM(base, size): stores highly accessed data: vectors, Mach0,
stacks */
witcm(0x00000000 | 0x20); /* size = 32 MB */
- wdtcm(0x00000000 | 0x0a); /* size = 16 KB */
+ //wdtcm(0x00000000 | 0x0a); /* size = 16 KB */

cp = rcpctl();
wcpctl(cp | CpCdtcml);

Reply all
Reply to author
Forward
0 new messages