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; }