[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(toppers-users 44) Re: $B%9%/%m!<%k=hM}$rDI2C$7$F$_$^$7$?(B




$B<+8J%U%)%m!o$K%9%/%m!<%k$G$-$k$h$&$K$J$j$^$7$?!#(B

$B$I$&$b!"8fLBOG$r$*$+$1$7$^$7$?!#(B


$B=$@5$7$?$b$N$rE:IU%U%!%$%k$K$D$1$F$^$9!#(B

$B$^$?!":#2s$O!"(Bconfig/i386/pcat/sys_config.c $B$@$1$G$O$J$/!"(B
PCAT/sample1.c $B$b$D$1$F$$$^$9!#(B
$B$3$A$i$N%U%!%$%k$O!"%9%/%m!<%k$N$?$a!"(B26 $B9TJ,$N=PNO$r9T$C$F(B
$B$$$^$9!#(B

$B$G$O$G$O!#(B

---
$BFbF#N40l(B (rnaitoh at st rim or jp)



From: "Ryuichi NAITOH" <liu1 at at sakura ne jp>
Subject: (toppers-users 43) Re: $B%9%/%m!<%k=hM}$rDI2C$7$F$_$^$7$?(B
Date: Wed, 29 Nov 2000 12:54:32 +0900
Message-ID: <20001129125432L night at at sakura ne jp>
Reply-to: rnaitoh at st rim or jp
Fcc: +outbox
> 
> $BFbF#$G$9!#(B
> 
> 
> From: ACKyugo <ackyugo at geocities co jp>
> Subject: (toppers-users 41) Re: $B%9%/%m!<%k=hM}$rDI2C$7$F$_$^$7$?(B
> Date: Wed, 29 Nov 2000 01:14:59 +0900
> Message-ID: <3A23DA03294 1DA6ACKYUGO at mail geocities co jp>
> 
> > $B$3$s$K$A$O!#(B
> > 
> > On Tue, 28 Nov 2000 12:26:01 +0900
> > "Ryuichi NAITOH" <liu1 at at sakura ne jp> wrote:
> > 
> > > $B2hLL$KI=<($9$k=hM}$G!"2hLL$N:G2<9T$r1[$($k$H2hLL$N0lHV>e$KI=<(0LCV$rJQ(B
> > > $B99$7$F$$$k$_$?$$$G$9$M!#(B
> > > $B$3$l$@$H!"$A$g$C$H8+$K$/$$$H;W$&$N$G!"%9%/%m!<%k=hM}$rDI2C$7$F$_$^$7$?!#(B
> > 
> > $B>eJ,$7$+!"%3%T!<$7$F$$$^$;$s$G$7$?(B(sizeof (short)/2 ==
> sizeof (char) $B$N$?$a(B)$B!#(B
> 
> $B=$@5$7$?$b$N$r!"$"$H$G=P$9$3$H$K$7$^$9!#(B
> 
> 
> $B$G$O$G$O!#(B
> 
/*
 *  TOPPERS/JSP Kernel
 *      Toyohashi Open Platform for Embedded Real-Time Systems/
 *      Just Standard Profile Kernel
 * 
 *  Copyright (C) 2000 by ????
 * 
 *  $B>e5-Cx:n8"r7o$rK~$?$9>l9g$K8B$j!$K\%=%U%H%&%'%"!JK\%=(B
 *  $B%U%H%&%'%"$r2~JQ$7$?$b$N$r4^$`!%0J2l9g$K$O!$>e5-$NCx:n(B
 *      $B8"I=<(!$$3$NMxMQ>r7o$*$h$S2<5-$NL5J]>Z5,Dj$,!$$=$N$^$^$N7A$G%=!<(B
 *      $B%9%3!<%ICf$K4^$^$l$F$$$k$3$H!%(B
 *  (2) $BK\%=%U%H%&%'%"$r%P%$%J%j%3!<%I$N7A$^$?$O5!4o$KAH$_9~$s$@7A$GMx(B
 *      $BMQ$9$k>l9g$K$O!$r7o$rK~$?$9$3$H!%(B
 *    (a) $BMxMQ$KH<$&%I%-%e%a%s%H!JMxMQe5-$NCx:n(B
 *        $B8"I=<(!$$3$NMxMQ>r7o$*$h$S2<5-$NL5J]>Z5,Dj$r7G:\$9$k$3$H!%(B
 *    (b) $BMxMQ$N7ABV$r!$JL$KDj$a$kJ}K!$K$h$C$F!$>e5-Cx:n8"@\E*$^$?$O4V@\E*$K@8$8$k$$$+$J$kB;(B
 *      $B32$+$i$b!$>e5-Cx:n8"Z$GDs6!$5$l$F$$$k$b$N$G$"$k!%>e5-Cx:n8"Z$b9T$o(B
 *  $B$J$$!%$^$?!$K\%=%U%H%&%'%"$NMxMQ$K$h$jD>@\E*$^$?$O4V@\E*$K@8$8$?$$(B
 *  $B$+$J$kB;32$K4X$7$F$b!$$=$N@UG$$rIi$o$J$$!%(B
 */

/* modified by R.Naitoh (2000/11/28)
 *	$B2hLL$N:G2<9T$r1[$($?$i%9%/%m!<%k$9$k=hM}$rDI2C!#(B
 *      $B%+!<%=%k$r0\F0$9$k=hM}$rDI2C!#(B
 */


/*
 *	$B%?!<%2%C%H%7%9%F%`0MB8%b%8%e!<%k!J(BPC/AT$BMQ!K(B
 */

#include "jsp_kernel.h"
#include "sys_insn.h"

#define DISPLAY_IO	0x03d4
#define	COLUMNS		80
#define	LINES		24
#define	ATTRIBUTE	7
static int xpos;
static int ypos;
static volatile UB *video;

static void	scroll_up();
static void	move_cursor();


/*
 *  $B%?!<%2%C%H%7%9%F%`0MB8$N=i4|2=(B
 */
void
sys_initialize()
{
	W i;

	video = (UB *)0xB8000;
	xpos = 0;
	ypos = 0;

	for(i = 0; i < COLUMNS * LINES * 2; i++)
	{
		*(video + i) = 0;
	}

	/* $B$F$-$H!<(B(^^; */
	outb(0x20, 0x11);
	outb(0x21, 0x20);
	outb(0x21, 0x04);
	outb(0x21, 0x01);
	outb(0xA0, 0x11);
	outb(0xA1, 0x28);
	outb(0xA1, 0x02);
	outb(0xA1, 0x01);
	outb(0x21, ~(0x04));
	outb(0xA1, ~(0x00));	
}

/*
 *  $B%?!<%2%C%H%7%9%F%`$N=*N;(B
 */
void
sys_exit(void)
{
	while(1);
}


/*
 *  $B%?!<%2%C%H%7%9%F%`$NJ8;z=PNO(B
 */
void
sys_putc(char c)
{
	if(c == '\n' || c == '\r')
	{
		newline:
		xpos = 0;
		ypos++;
		if(ypos >= LINES)
		{
			scroll_up();
			ypos = LINES - 1;
		}
		move_cursor(xpos, ypos);
		return;
	}

	*(video + (xpos + ypos * COLUMNS) * 2) = c & 0xFF;
	*(video + (xpos + ypos * COLUMNS) * 2 + 1) = ATTRIBUTE;

	xpos++;
	if(xpos >= COLUMNS)
		goto newline;
	move_cursor(xpos, ypos);
}


/* $B%+!<%=%k$r;XDj$7$?0LCV$K0\F0$9$k(B
 */
static void
move_cursor()
{
	int	addr;

	addr = xpos + ypos * 80;

	outb(DISPLAY_IO,	0x0e );
	outb(DISPLAY_IO + 1,	addr >> 8 );

	outb(DISPLAY_IO,	0x0f );
	outb(DISPLAY_IO + 1,	addr & 0xFF );
}


/* 1 $B9T$@$1%9%/%m!<%k$9$k(B
 * $B%+!<%=%k$O0\F0$7$J$$(B
 * ($B%+!<%=%k$K$D$$$F$N=hM}$O8F$S=P$7B&$G9T$&I,MW$,$"$k(B)$B!#(B
 */
static void
scroll_up()
{
	int		x, y;
	unsigned short	*p;


	p = (unsigned short *)video;

	/* $B9T$r%3%T!<(B */
	for (y = 0; y < LINES - 1; y++) {
		for (x = 0; x < COLUMNS; x++) {
			p[x + y * COLUMNS] = p[x + (y + 1) * COLUMNS];
		}
	}

	/* $B:G2<9T$r%/%j%"(B */
	for (x = 0; x < COLUMNS; x++) {
		p[x + (LINES - 1) * COLUMNS] = ' ' | ATTRIBUTE;
	}
}
/*
 *  TOPPERS/JSP Kernel
 *      Toyohashi Open Platform for Embedded Real-Time Systems/
 *      Just Standard Profile Kernel
 * 
 *  Copyright (C) 2000 by $B$I$3$+$N$@$l$+(B
 * 
 *  $B>e5-Cx:n8"r7o$rK~$?$9>l9g$K8B$j!$K\%=%U%H%&%'%"!JK\%=(B
 *  $B%U%H%&%'%"$r2~JQ$7$?$b$N$r4^$`!%0J2l9g$K$O!$>e5-$NCx:n(B
 *      $B8"I=<(!$$3$NMxMQ>r7o$*$h$S2<5-$NL5J]>Z5,Dj$,!$$=$N$^$^$N7A$G%=!<(B
 *      $B%9%3!<%ICf$K4^$^$l$F$$$k$3$H!%(B
 *  (2) $BK\%=%U%H%&%'%"$r%P%$%J%j%3!<%I$N7A$^$?$O5!4o$KAH$_9~$s$@7A$GMx(B
 *      $BMQ$9$k>l9g$K$O!$r7o$rK~$?$9$3$H!%(B
 *    (a) $BMxMQ$KH<$&%I%-%e%a%s%H!JMxMQe5-$NCx:n(B
 *        $B8"I=<(!$$3$NMxMQ>r7o$*$h$S2<5-$NL5J]>Z5,Dj$r7G:\$9$k$3$H!%(B
 *    (b) $BMxMQ$N7ABV$r!$JL$KDj$a$kJ}K!$K$h$C$F!$>e5-Cx:n8"@\E*$^$?$O4V@\E*$K@8$8$k$$$+$J$kB;(B
 *      $B32$+$i$b!$>e5-Cx:n8"Z$GDs6!$5$l$F$$$k$b$N$G$"$k!%>e5-Cx:n8"Z$b9T$o(B
 *  $B$J$$!%$^$?!$K\%=%U%H%&%'%"$NMxMQ$K$h$jD>@\E*$^$?$O4V@\E*$K@8$8$?$$(B
 *  $B$+$J$kB;32$K4X$7$F$b!$$=$N@UG$$rIi$o$J$$!%(B
 * 
 */

#include <jsp_services.h>
#include "kernel_id.h"
#include "sample1.h"

void task(VP_INT exinf)
{
	syslog(LOG_EMERG, "task1");
}

void main_task(VP_INT exinf)
{
	int	i;

	syslog(LOG_EMERG, "main_task");
	Asm("int $80");
	syslog(LOG_EMERG, "I'm main_task.");

	for (i = 0; i < 26; i++) {
		syslog (LOG_EMERG, "test line: %d", i);
	}

	kernel_exit();
}

void sample_init(VP_INT exinf)
{
	syslog(LOG_EMERG, "sample1");
}

void exc_handler(VP _sp)
{
	UW *sp = _sp;
	ER ercd;

	syslog(LOG_EMERG, "exc_handler(%d)", sp[0]);
	ercd = iact_tsk(TASK1);
	syslog(LOG_EMERG, "iact_tsk(TASK1) ercd == %d", ercd);
	syslog(LOG_EMERG, "end of exc_handler(%d)", sp[0]);
}

void int_handler(void)
{
	syslog(LOG_EMERG, "int_handler");
	Asm("int $0");
	syslog(LOG_EMERG, "end of int_handler");
}


Inline void
write_vram(int x, int y, int ch)
{
        UB *video = (UB *)0xB8000;
        *(video + ((x + y * 80) * 2)) = ch & 0xFF;
        *(video + ((x + y * 80) * 2) + 1) = 7;
}

void cyclic_handler(VP_INT exinf)
{
	static UB flag = 0;

	if(flag == 0)
	{
		write_vram(78, 0, 'o');
		flag = 1;
	}
	else
	{
		write_vram(78, 0, 'x');
		flag = 0;
	}
}