From 46ffc27c2c018795f0ff1fd0eac3a67c0df7c9cd Mon Sep 17 00:00:00 2001 From: Rafael Zurita Date: Tue, 23 Jun 2020 00:03:03 -0300 Subject: [PATCH] concurrent processes ok --- device/nam/naminit.c | 3 +- device/nam/namopen.c | 3 +- device/tty/ttycontrol.c | 3 +- device/tty/ttygetc.c | 3 +- device/tty/ttyhandler.c | 3 +- device/tty/ttyinit.c | 3 +- device/tty/ttyputc.c | 3 +- device/tty/ttyread.c | 3 +- device/tty/ttywrite.c | 3 +- include/prototypes.h | 23 ++++++++---- include/shell.h | 5 ++- include/shprototypes.h | 3 +- lib/change_proc_name.c | 16 ++++++++ main/main.c | 81 ++++++++++++++++++++++++----------------- main/xsh_echo.c | 2 +- main/xsh_forever.c | 17 +++++++++ main/xsh_kill.c | 47 ++++++++++++++++++++++++ main/xsh_uptime.c | 47 ++++++++++++++++++++++++ system/clkhandler.c | 15 +++++--- system/close.c | 3 +- system/control.c | 3 +- system/getc.c | 3 +- system/init.c | 3 +- system/open.c | 3 +- system/putc.c | 3 +- system/read.c | 3 +- system/seek.c | 3 +- system/write.c | 3 +- xinu-avr-port.txt | 2 + 29 files changed, 245 insertions(+), 67 deletions(-) create mode 100644 lib/change_proc_name.c create mode 100644 main/xsh_forever.c create mode 100644 main/xsh_kill.c create mode 100644 main/xsh_uptime.c diff --git a/device/nam/naminit.c b/device/nam/naminit.c index 44e3934..feb4044 100644 --- a/device/nam/naminit.c +++ b/device/nam/naminit.c @@ -24,7 +24,8 @@ int32 nnames; /* Number of entries allocated */ status naminit(void) { did32 i; /* Index into devtab */ - struct dentry *devptr; /* Pointer to device table entry*/ + // struct dentry *devptr; /* Pointer to device table entry*/ + const __flash struct dentry *devptr; /* Pointer to device table entry*/ char tmpstr[NM_MAXLEN]; /* String to hold a name */ status retval; /* Return value */ char *tptr; /* Pointer into tempstring */ diff --git a/device/nam/namopen.c b/device/nam/namopen.c index 1a83254..9097582 100644 --- a/device/nam/namopen.c +++ b/device/nam/namopen.c @@ -7,7 +7,8 @@ *------------------------------------------------------------------------ */ devcall namopen( - struct dentry *devptr, /* Entry in device switch table */ + // struct dentry *devptr, /* Entry in device switch table */ + const __flash struct dentry *devptr, /* Entry in device switch table */ char *name, /* Name to open */ char *mode /* Mode argument */ ) diff --git a/device/tty/ttycontrol.c b/device/tty/ttycontrol.c index eeeb5e2..e15eb03 100644 --- a/device/tty/ttycontrol.c +++ b/device/tty/ttycontrol.c @@ -7,7 +7,8 @@ *------------------------------------------------------------------------ */ devcall ttycontrol( - struct dentry *devptr, /* Entry in device switch table */ + // struct dentry *devptr, /* Entry in device switch table */ + const __flash struct dentry *devptr, /* Entry in device switch table */ int32 func, /* Function to perform */ int32 arg1, /* Argument 1 for request */ int32 arg2 /* Argument 2 for request */ diff --git a/device/tty/ttygetc.c b/device/tty/ttygetc.c index 8388a50..16c52f3 100644 --- a/device/tty/ttygetc.c +++ b/device/tty/ttygetc.c @@ -7,7 +7,8 @@ *------------------------------------------------------------------------ */ devcall ttygetc( - struct dentry *devptr /* Entry in device switch table */ + // struct dentry *devptr /* Entry in device switch table */ + const __flash struct dentry *devptr /* Entry in device switch table */ ) { char ch; /* Character to return */ diff --git a/device/tty/ttyhandler.c b/device/tty/ttyhandler.c index c27f946..e59585d 100644 --- a/device/tty/ttyhandler.c +++ b/device/tty/ttyhandler.c @@ -7,7 +7,8 @@ *------------------------------------------------------------------------ */ void ttyhandler(uint32 xnum, char c, int flag) { - struct dentry *devptr; /* Address of device control blk*/ + // struct dentry *devptr; /* Address of device control blk*/ + const __flash struct dentry *devptr; /* Address of device control blk*/ struct ttycblk *typtr; /* Pointer to ttytab entry */ struct uart_csreg *csrptr; /* Address of UART's CSR */ // uint32 iir = 0; /* Interrupt identification */ diff --git a/device/tty/ttyinit.c b/device/tty/ttyinit.c index b6463c4..9de9af7 100644 --- a/device/tty/ttyinit.c +++ b/device/tty/ttyinit.c @@ -9,7 +9,8 @@ struct ttycblk ttytab[Ntty]; *------------------------------------------------------------------------ */ devcall ttyinit( - struct dentry *devptr /* Entry in device switch table */ + // struct dentry *devptr /* Entry in device switch table */ + const __flash struct dentry *devptr /* Entry in device switch table */ ) { struct ttycblk *typtr; /* Pointer to ttytab entry */ diff --git a/device/tty/ttyputc.c b/device/tty/ttyputc.c index f546c18..5e3d4ae 100644 --- a/device/tty/ttyputc.c +++ b/device/tty/ttyputc.c @@ -7,7 +7,8 @@ *------------------------------------------------------------------------ */ devcall ttyputc( - struct dentry *devptr, /* Entry in device switch table */ + // struct dentry *devptr, /* Entry in device switch table */ + const __flash struct dentry *devptr, /* Entry in device switch table */ char ch /* Character to write */ ) { diff --git a/device/tty/ttyread.c b/device/tty/ttyread.c index 88ca170..df1204e 100644 --- a/device/tty/ttyread.c +++ b/device/tty/ttyread.c @@ -7,7 +7,8 @@ *------------------------------------------------------------------------ */ devcall ttyread( - struct dentry *devptr, /* Entry in device switch table */ + // struct dentry *devptr, /* Entry in device switch table */ + const __flash struct dentry *devptr, /* Entry in device switch table */ char *buff, /* Buffer of characters */ int32 count /* Count of character to read */ ) diff --git a/device/tty/ttywrite.c b/device/tty/ttywrite.c index f9f4ada..3d0c547 100644 --- a/device/tty/ttywrite.c +++ b/device/tty/ttywrite.c @@ -7,7 +7,8 @@ *------------------------------------------------------------------------ */ devcall ttywrite( - struct dentry *devptr, /* Entry in device switch table */ + // struct dentry *devptr, /* Entry in device switch table */ + const __flash struct dentry *devptr, /* Entry in device switch table */ char *buff, /* Buffer of characters */ int32 count /* Count of character to write */ ) diff --git a/include/prototypes.h b/include/prototypes.h index 209caa1..3b88ad5 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -313,7 +313,8 @@ extern did32 namrepl(char *, char[]); extern status namcpy(char *, char *, int32); /* in file namopen.c */ -extern devcall namopen(struct dentry *, char *, char *); +// extern devcall namopen(struct dentry *, char *, char *); +extern devcall namopen(const __flash struct dentry *, char *, char *); /* in file newqueue.c */ extern qid16 newqueue(void); @@ -537,10 +538,12 @@ extern int32 insw(int32, int32 ,int32); extern syscall suspend(pid32); /* in file ttycontrol.c */ -extern devcall ttycontrol(struct dentry *, int32, int32, int32); +// extern devcall ttycontrol(struct dentry *, int32, int32, int32); +extern devcall ttycontrol(const __flash struct dentry *, int32, int32, int32); /* in file ttygetc.c */ -extern devcall ttygetc(struct dentry *); +// extern devcall ttygetc(struct dentry *); +extern devcall ttygetc(const __flash struct dentry *); /* in file ttyhandle_in.c */ extern void ttyhandle_in(struct ttycblk *, struct uart_csreg *, char c); @@ -552,19 +555,23 @@ extern void ttyhandle_out(struct ttycblk *, struct uart_csreg *); extern void ttyhandler(uint32, char c, int tipo); /* in file ttyinit.c */ -extern devcall ttyinit(struct dentry *); +// extern devcall ttyinit(struct dentry *); +extern devcall ttyinit(const __flash struct dentry *); /* in file ttykickout.c */ extern void ttykickout(struct uart_csreg *); /* in file ttyputc.c */ -extern devcall ttyputc(struct dentry *, char); +// extern devcall ttyputc(struct dentry *, char); +extern devcall ttyputc(const __flash struct dentry *, char); /* in file ttyread.c */ -extern devcall ttyread(struct dentry *, char *, int32); +// extern devcall ttyread(struct dentry *, char *, int32); +extern devcall ttyread(const __flash struct dentry *, char *, int32); /* in file ttywrite.c */ -extern devcall ttywrite(struct dentry *, char *, int32); +// extern devcall ttywrite(struct dentry *, char *, int32); +extern devcall ttywrite(const __flash struct dentry *, char *, int32); /* in file udp.c */ @@ -635,6 +642,8 @@ extern devcall spiputc(struct dentry *, char); /* avr specific */ extern void avr_printf(char mess[]); extern void avr_kprintf(const unsigned char *msg); +extern void change_proc_name( char *name); + // extern void avr_kprintf(char mess[]); extern void blink_avr(); diff --git a/include/shell.h b/include/shell.h index bc6fa2c..4e3d5ef 100644 --- a/include/shell.h +++ b/include/shell.h @@ -70,12 +70,13 @@ //typedef void (*cfunc)(void); // typedef void (*CmdFunc_t)(char); -//typedef char *cname; +//typedef int32 (*cfunc_t)(int32,char*[]);/* Function for command */ +typedef int32 (*cfunc_t)(int,char*[]);/* Function for command */ struct cmdent { /* Entry in command table */ //char *cname; /* Name of command */ bool8 cbuiltin; /* Is this a builtin command? */ - int32 (*cfunc)(int32,char*[]);/* Function for command */ + int32 (*cfunc)(int,char*[]);/* Function for command */ }; extern uint32 ncmd; diff --git a/include/shprototypes.h b/include/shprototypes.h index b7ab057..69ecab8 100644 --- a/include/shprototypes.h +++ b/include/shprototypes.h @@ -32,7 +32,7 @@ extern shellcmd xsh_exit (int32, char *[]); // extern shellcmd xsh_help (int32, char *[]); /* in file xsh_kill.c */ -extern shellcmd xsh_kill (int32, char *[]); +// extern shellcmd xsh_kill (int32, char *[]); /* in file xsh_ls.c */ extern shellcmd xsh_ls (int32, char *[]); @@ -83,3 +83,4 @@ extern shellcmd xsh_editor (int32, char *[]); extern shellcmd xsh_basic (int32, char *[]); extern shellcmd xsh_ps (int32, char *[]); extern shellcmd xsh_free (int32, char *[]); +extern shellcmd xsh_forever (int32, char *[]); diff --git a/lib/change_proc_name.c b/lib/change_proc_name.c new file mode 100644 index 0000000..6420676 --- /dev/null +++ b/lib/change_proc_name.c @@ -0,0 +1,16 @@ + +#include + +void change_proc_name( char *name) +{ + struct procent *prptr; /* pointer to proc. table entry */ + int i; + + + prptr = &proctab[currpid]; + + prptr->prname[PNMLEN-1] = NULLCH; + for (i=0 ; iprname[i]=name[i])!=NULLCH; i++) + ; +} + diff --git a/main/main.c b/main/main.c index ad349bd..6fc6f06 100644 --- a/main/main.c +++ b/main/main.c @@ -4,10 +4,10 @@ #include -//#include #include "shprototypes.h" void xsh_help(void); +shellcmd xsh_kill(int nargs, char *args[]); typedef void (*CmdFunc_t)(char); typedef struct cmdent cmdent_t; @@ -23,40 +23,72 @@ const __flash uint8_t * const __flash cmdtab_cname[] = (const __flash uint8_t[]) { "basic" }, (const __flash uint8_t[]) { "help" }, (const __flash uint8_t[]) { "sleep" }, + (const __flash uint8_t[]) { "forever" }, + (const __flash uint8_t[]) { "uptime" }, + (const __flash uint8_t[]) { "kill" }, (const __flash uint8_t[]) { "free" }, (const __flash uint8_t[]) { "clear" }, (const __flash uint8_t[]) { "ps" }, (const __flash uint8_t[]) { "echo" } }; -// {"sleep", FALSE, xsh_sleep}, const __flash uint8_t * const __flash cmdtab_help[] = { - (const __flash uint8_t[]) { "[from to] : tisplay SRAM memory contents using ASCII." }, - (const __flash uint8_t[]) { ": text editor." }, - (const __flash uint8_t[]) { ": basic language interpreter." }, - (const __flash uint8_t[]) { ": this help." }, - (const __flash uint8_t[]) { "n : sleep n seconds." }, - (const __flash uint8_t[]) { ": display amount of free and used memory in the system." }, - (const __flash uint8_t[]) { ": clear the terminal screen." }, - (const __flash uint8_t[]) { ": display current processes table." }, - (const __flash uint8_t[]) { "[arg ...] : write arguments to standard output." } + (const __flash uint8_t[]) { "[from to] : display SRAM memory contents" }, + (const __flash uint8_t[]) { ": text editor" }, + (const __flash uint8_t[]) { ": basic language interpreter" }, + (const __flash uint8_t[]) { ": this help" }, + (const __flash uint8_t[]) { "n : sleep n seconds" }, + (const __flash uint8_t[]) { ": for (;;); for ever" }, + (const __flash uint8_t[]) { ": tell how long the Xinu system has been running" }, + (const __flash uint8_t[]) { "n : kill (terminates) the n ID process" }, + (const __flash uint8_t[]) { ": display amount of free and used memory in the system" }, + (const __flash uint8_t[]) { ": clear the terminal screen" }, + (const __flash uint8_t[]) { ": display current processes table" }, + (const __flash uint8_t[]) { "[arg ...] : write arguments to standard output" } }; typedef int32 (*cmdfunc_t)(int32,char*[]); -const __flash cmdent_t cmdtab[] = { +const cmdent_t __flash cmdtab[] = { {FALSE, xsh_memdump}, {FALSE, xsh_editor}, {FALSE, xsh_basic}, {TRUE, xsh_help}, {FALSE, xsh_sleep}, + {FALSE, xsh_forever}, + {FALSE, xsh_uptime}, + {TRUE, xsh_kill}, {TRUE, xsh_free}, {TRUE, xsh_clear}, {TRUE, xsh_ps}, {FALSE, xsh_echo} }; +const __flash int cmdtab_stk[] = { + 256, /* memdump */ + 400, /* editor */ + 400, /* basic */ + 128, /* help */ + 128, /* sleep */ + 256, /* forever */ + 200, /* uptime */ + 300, /* kill */ + 128, + 64, + 128, + 256, +}; + +//const __flash int32 (*f2)(int32,char*[]); +//struct cmdent p[2]; + + +//shellcmd rafa(int a, char*args[]) { +// printf("a:%d\n",a); +//} + const __flash char shell_commands[] = "\n\rCommands:\n\n\r"; +const __flash char shell_init_msg[] = "\n\rfor a list of programs on this system type 'help'\nREADY\n\r"; void xsh_help(void) { @@ -93,7 +125,6 @@ void xsh_help(void) //}; uint32 ncmd = sizeof(cmdtab) / sizeof(struct cmdent); -//uint32 ncmd = 5; /************************************************************************/ /* shell - Provide an interactive user interface that executes */ @@ -144,6 +175,9 @@ process main(void) did32 dev = 0; /* ID of tty device from which */ char cname[8]; + + change_proc_name("shell"); + /* Print shell banner and startup message */ /* @@ -154,7 +188,6 @@ process main(void) fprintf(dev, "%s\n\n", SHELL_STRTMSG); */ - cmdfunc_t f; int len_p; /* Continually prompt the user, read input, and execute command */ @@ -297,7 +330,6 @@ process main(void) if (diff || (*(cmp+len_p) != NULLCH)) { continue; } else { - //printf("IGUA:j2:%d\n",j); break; } } @@ -326,8 +358,6 @@ process main(void) /* Call builtin shell function */ if ((*cmdtab[j].cfunc)(ntok, args) - //f = cmdtab_cfunc[j]; - //if (f(ntok, args) == SHELL_EXIT) { break; } @@ -354,38 +384,27 @@ process main(void) } } - // int eeprom_fd = open(RAM0, nombre, "w"); - // char raf[32] = "pepe"; - // write(fd, pepe, 32); - // int eeprom_fd = open(RAM0, nombre, "w"); - /* Spawn child thread for non-built-in commands */ // RAFA child = create(cmdtab[j].cfunc, // RAFA SHELL_CMDSTK, SHELL_CMDPRIO, // RAFA cmdtab[j].cname, 2, ntok, &tmparg); /* 160 bytes de stack perfecto */ -// f = cmdtab_cfunc[j]; strncpy_P(cname, cmdtab_cname[j], len_p); cname[len_p] = 0; child = create(cmdtab[j].cfunc, // 560, SHELL_CMDPRIO, // 470, SHELL_CMDPRIO, // 360, SHELL_CMDPRIO, - 128, SHELL_CMDPRIO, + cmdtab_stk[j], SHELL_CMDPRIO, cname, 2, ntok, &tmparg); - // cmdtab_cname[j], 2, ntok, &tmparg); //cmdtab[j].cname, 2, ntok, &tmparg); /* If creation or argument copy fails, report error */ - // serial_put_char('X'); - // if (child == SYSERR) - // serial_put_char('Y'); if ((child == SYSERR) || (addargs(child, ntok, tok, tlen, tokbuf, &tmparg) == SYSERR) ) { - // serial_put_char('Z'); // fprintf(dev, SHELL_CREATMSG); fprintf(dev, "?\n\r"); continue; @@ -399,10 +418,6 @@ process main(void) msg = recvclr(); resume(child); - // RAFA AGREGA - resched(); - // serial_put_char('X'); - if (! backgnd) { msg = receive(); while (msg != child) { diff --git a/main/xsh_echo.c b/main/xsh_echo.c index 393c81a..dbb99ac 100644 --- a/main/xsh_echo.c +++ b/main/xsh_echo.c @@ -4,7 +4,7 @@ #include /*------------------------------------------------------------------------ - * xhs_echo - write argument strings to stdout + * xsh_echo - write argument strings to stdout *------------------------------------------------------------------------ */ shellcmd xsh_echo(int nargs, char *args[]) diff --git a/main/xsh_forever.c b/main/xsh_forever.c new file mode 100644 index 0000000..94c2e46 --- /dev/null +++ b/main/xsh_forever.c @@ -0,0 +1,17 @@ +/* xsh_forever.c - xsh_forever */ + +#include +#include + +/*------------------------------------------------------------------------ + * xsh_forever + *------------------------------------------------------------------------ + */ +shellcmd xsh_forever(int nargs, char *args[]) +{ + + for (;;) + printf("a"); + + return 0; +} diff --git a/main/xsh_kill.c b/main/xsh_kill.c new file mode 100644 index 0000000..cb04ed5 --- /dev/null +++ b/main/xsh_kill.c @@ -0,0 +1,47 @@ +/* xsh_kill.c - xsh_kill */ + +#include +#include +#include + +/*------------------------------------------------------------------------ + * xsh_kill - obtain and print the current month, day, year, and time + *------------------------------------------------------------------------ + */ +shellcmd xsh_kill(int nargs, char *args[]) { + + int32 retval; /* return value */ + pid32 pid; /* ID of process to kill */ + char ch; /* next character of argument */ + char *chptr; /* walks along argument string */ + + /* Check argument count */ + + if (nargs != 2) { + return SYSERR; + } + + /* compute process ID from argument string */ + + chptr = args[1]; + ch = *chptr++; + pid = 0; + while(ch != NULLCH) { + if ( (ch < '0') || (ch > '9') ) { + return 1; + } + pid = 10*pid + (ch - '0'); + ch = *chptr++; + } + if (pid == 0) { + return 1; + } + + retval = kill(pid); + if (retval == SYSERR) { + //fprintf(stderr, "%s: cannot kill process %d\n", + // args[0], pid); + return 1; + } + return 0; +} diff --git a/main/xsh_uptime.c b/main/xsh_uptime.c new file mode 100644 index 0000000..32645db --- /dev/null +++ b/main/xsh_uptime.c @@ -0,0 +1,47 @@ +/* xsh_uptime.c - xsh_uptime */ +#include +#include +#include + +/*------------------------------------------------------------------------ + * xsh_uptime - shell to print the time the system has been up + *------------------------------------------------------------------------ + */ +shellcmd xsh_uptime(int nargs, char *args[]) +{ + long days, hrs, mins, secs; /* days, hours, minutes, and */ + /* seconds since system boot */ + long secperday = 86400; /* seconds in a day */ + long secperhr = 3600; /* seconds in an hour */ + long secpermin = 60; /* seconds in a minute */ + + /* Check for valid number of arguments */ + + if (nargs > 1) { + return 1; + } + + secs = clktime; /* total seconds since boot */ + + /* subtract number of whole days */ + + days = secs/secperday; + secs -= days*secperday; + + /* subtract number of hours */ + + hrs = secs/secperhr; + secs -= hrs*secperhr; + + /* subtract number of minutes */ + + mins = secs/secpermin; + secs -= mins*secpermin; + + printf(" %d day(s) &", days); + printf(" %dh:", hrs); + printf("%dm:", mins); + printf("%ds\n", secs); + + return 0; +} diff --git a/system/clkhandler.c b/system/clkhandler.c index 1967df8..572282e 100644 --- a/system/clkhandler.c +++ b/system/clkhandler.c @@ -24,10 +24,6 @@ ISR(TIMER0_COMPA_vect) /* every second */ /* if avr_ticks == 1000 then 1 second */ - /* our MCU is slow 16Mhz, so we do clkhandler every 100ms */ - avr_ticks ++; - if (avr_ticks > 100) { - avr_ticks=0; /* Increment 1000ms counter */ @@ -36,13 +32,16 @@ ISR(TIMER0_COMPA_vect) /* After 1 sec, increment clktime */ - if(count1000 >= 10) { /* previous was: if(count1000 >= 1000) */ + //if(count1000 >= 100) { /* previous was: if(count1000 >= 1000) */ + if(count1000 >= 1000) { /* previous was: if(count1000 >= 1000) */ clktime++; count1000 = 0; } /* check if sleep queue is empty */ + //if ((count1000 % 10) == 0) /* every 100ms */ + if ((count1000 % 100) == 0) /* every 100ms */ if(!isempty(sleepq)) { /* sleepq nonempty, decrement the key of */ /* topmost process on sleepq */ @@ -53,6 +52,12 @@ ISR(TIMER0_COMPA_vect) } } + /* our MCU is slow 16Mhz, so we do clkhandler every 100ms */ + avr_ticks ++; +// if (avr_ticks > 100) { + if (avr_ticks > 300) { + // if (avr_ticks > 10) { + avr_ticks=0; /* Decrement the preemption counter */ /* Reschedule if necessary */ diff --git a/system/close.c b/system/close.c index 52a701e..8a72f32 100644 --- a/system/close.c +++ b/system/close.c @@ -11,7 +11,8 @@ syscall close( ) { intmask mask; /* Saved interrupt mask */ - struct dentry *devptr; /* Entry in device switch table */ + // struct dentry *devptr; /* Entry in device switch table */ + const __flash struct dentry *devptr; /* Entry in device switch table */ int32 retval; /* Value to return to caller */ mask = disable(); diff --git a/system/control.c b/system/control.c index 7581177..018c0ac 100644 --- a/system/control.c +++ b/system/control.c @@ -14,7 +14,8 @@ syscall control( ) { intmask mask; /* Saved interrupt mask */ - struct dentry *devptr; /* Entry in device switch table */ + // struct dentry *devptr; /* Entry in device switch table */ + const __flash struct dentry *devptr; /* Entry in device switch table */ int32 retval; /* Value to return to caller */ mask = disable(); diff --git a/system/getc.c b/system/getc.c index bed57c3..2a02576 100644 --- a/system/getc.c +++ b/system/getc.c @@ -11,7 +11,8 @@ syscall getc( ) { intmask mask; /* Saved interrupt mask */ - struct dentry *devptr; /* Entry in device switch table */ + // struct dentry *devptr; /* Entry in device switch table */ + const __flash struct dentry *devptr; /* Entry in device switch table */ int32 retval; /* Value to return to caller */ mask = disable(); diff --git a/system/init.c b/system/init.c index 535bdd3..a429918 100644 --- a/system/init.c +++ b/system/init.c @@ -11,7 +11,8 @@ syscall init( ) { intmask mask; /* Saved interrupt mask */ - struct dentry *devptr; /* Entry in device switch table */ + // struct dentry *devptr; /* Entry in device switch table */ + const __flash struct dentry *devptr; /* Entry in device switch table */ int32 retval; /* Value to return to caller */ mask = disable(); diff --git a/system/open.c b/system/open.c index c3b3517..44ffeea 100644 --- a/system/open.c +++ b/system/open.c @@ -13,7 +13,8 @@ syscall open( ) { intmask mask; /* Saved interrupt mask */ - struct dentry *devptr; /* Entry in device switch table */ + // struct dentry *devptr; /* Entry in device switch table */ + const __flash struct dentry *devptr; /* Entry in device switch table */ int32 retval; /* Value to return to caller */ mask = disable(); diff --git a/system/putc.c b/system/putc.c index f94b526..28da8cc 100644 --- a/system/putc.c +++ b/system/putc.c @@ -12,7 +12,8 @@ syscall putc( ) { intmask mask; /* Saved interrupt mask */ - struct dentry *devptr; /* Entry in device switch table */ + // struct dentry *devptr; /* Entry in device switch table */ + const __flash struct dentry *devptr; /* Entry in device switch table */ int32 retval; /* Value to return to caller */ mask = disable(); diff --git a/system/read.c b/system/read.c index fd3caaf..576a4cf 100644 --- a/system/read.c +++ b/system/read.c @@ -13,7 +13,8 @@ syscall read( ) { intmask mask; /* Saved interrupt mask */ - struct dentry *devptr; /* Entry in device switch table */ + // struct dentry *devptr; /* Entry in device switch table */ + const __flash struct dentry *devptr; /* Entry in device switch table */ int32 retval; /* Value to return to caller */ mask = disable(); diff --git a/system/seek.c b/system/seek.c index 38cd6b7..509a012 100644 --- a/system/seek.c +++ b/system/seek.c @@ -12,7 +12,8 @@ syscall seek( ) { intmask mask; /* Saved interrupt mask */ - struct dentry *devptr; /* Entry in device switch table */ + // struct dentry *devptr; /* Entry in device switch table */ + const __flash struct dentry *devptr; /* Entry in device switch table */ int32 retval; /* Value to return to caller */ mask = disable(); diff --git a/system/write.c b/system/write.c index 0cbcb78..95c18b3 100644 --- a/system/write.c +++ b/system/write.c @@ -13,7 +13,8 @@ syscall write( ) { intmask mask; /* Saved interrupt mask */ - struct dentry *devptr; /* Entry in device switch table */ + // struct dentry *devptr; /* Entry in device switch table */ + const __flash struct dentry *devptr; /* Entry in device switch table */ int32 retval; /* Value to return to caller */ mask = disable(); diff --git a/xinu-avr-port.txt b/xinu-avr-port.txt index c6dab8b..c5167fc 100644 --- a/xinu-avr-port.txt +++ b/xinu-avr-port.txt @@ -12,6 +12,8 @@ y como qkey en queue.h es char (originalmente es int32, pero con int32 nos quita muchisima RAM) tenemos un hack/workaround para lograr el sleepms acorde, pero no es en ms. SOLUCIONAR. +- ademas como las key en queue son char, podemos tener +sleep de maximo 20 segundos aprox. (de la llamada 20*10ms de sleep100ms()) - agregar a la tabla de cmdtab del shell que pueda indicar el stack para cada proceso.