Plan 9 from Bell Labs’s /usr/web/sources/contrib/maht/inferno/appl/cmd/stk500/stk500.b

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



implement Stk500;


include "stk500.m";
include "command.m";o

include "draw.m";
draw : Draw;

include "sys.m";
sys: Sys;
FD : import Sys;

include "devices.m";
devices : Devices;

init(nil: ref Draw->Context, nil: list of string)
{
	sys = load Sys Sys->PATH;
	draw = load Draw Draw->PATH;
	devices = load Devices "devices.dis";
	ATMega8515 : import devices;
	sys->print("STK 500\n");

	sys->print("init comm port %d : %d\n", 0, init_comm(0));

	sys->print("timeout %d", ATMega8515.IspEnterProgMode_timeout);
}

init_comm(port:int) : int
{
	cfd, dfd: ref FD;
	dev := sys->sprint("/dev/eia%dctl", port);
	cfd = sys->open(dev, sys->ORDWR);
	if(cfd == nil)
		return -1;
	sys->fprint(cfd, "b115200");
	sys->fprint(cfd, "l8");
	sys->fprint(cfd, "pn");
	sys->fprint(cfd, "s1");
	sys->fprint(cfd, "x0");
	return 1;
}

Message.write(m: self ref Message) : int
{
	
	return 0;
}

Message.read(m: self ref Message) : int
{

	return 0;
}



Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.