Browse Source

forever more or less okey

pull/1/head
Rafael Zurita 6 years ago
parent
commit
1f8fdacd63
  1. 14
      config/Configuration
  2. 13
      config/config.y
  3. 14
      device/nam/naminit.c
  4. 5
      device/nam/nammap.c
  5. 2
      device/nam/namopen.c
  6. 9
      device/tty/ttygetc.c
  7. 8
      device/tty/ttyhandle_in.c
  8. 10
      device/tty/ttyread.c
  9. 6
      include/name.h
  10. 1
      include/shprototypes.h
  11. 16
      lib/avr_messages.c
  12. 12
      lib/printf.c
  13. 29
      main/main.c
  14. 4
      main/xsh_forever.c
  15. 16
      main/xsh_reboot.c
  16. 12
      system/clkhandler.c
  17. 49
      system/conf.c
  18. 2
      system/initialize.c
  19. 4
      system/serial_avr.c
  20. 1
      system/wait.c

14
config/Configuration

@ -58,6 +58,12 @@ ram:
-w ramwrite -s ioerr -n ioerr -w ramwrite -s ioerr -n ioerr
-intr ionull -intr ionull
FIN DE RAFA */ FIN DE RAFA */
eeprom:
on disk
-i eeprom_init -o eeprom_open -c eeprom_close
-r eeprom_read -g ioerr -p ioerr
-w eeprom_write -s ioerr -n ioerr
-intr ionull
/* type of namespace device */ /* type of namespace device */
nam: nam:
@ -104,6 +110,7 @@ FIN DE RAFA */
/* Define a ram disk device */ /* Define a ram disk device */
/* RAFA RAM0 is ram on mem */ /* RAFA RAM0 is ram on mem */
EEPROM0 is eeprom on disk
%% %%
@ -111,10 +118,5 @@ FIN DE RAFA */
#define NPROC 4 /* number of user processes */ #define NPROC 4 /* number of user processes */
// RAFA #define NSEM 4 /* number of semaphores */ // RAFA #define NSEM 4 /* number of semaphores */
// #define NSEM 2 /* number of semaphores */
#define NSEM 2 /* number of semaphores */ #define NSEM 2 /* number of semaphores */
#define IRQBASE 32 /* base ivec for IRQ0 */
#define IRQ_TIMER IRQ_HW5 /* timer IRQ is wired to hardware 5 */
#define IRQ_ATH_MISC IRQ_HW4 /* Misc. IRQ is wired to hardware 4 */
#define CLKFREQ 200000000 /* 200 MHz clock */
// #define LF_DISK_DEV RAM0

13
config/config.y

@ -96,7 +96,9 @@ char *devstab[] = {
"\tint32 dvnum;", "\tint32 dvnum;",
"\tint32 dvminor;", "\tint32 dvminor;",
// RAFA "\tchar *dvname;", // RAFA "\tchar *dvname;",
"\tchar dvname[16];", // "\tchar dvname[16];",
// RAFA BIEN "\tchar dvname[8];",
"\tchar dvname[10];",
"\tdevcall (*dvinit) (struct dentry *);", "\tdevcall (*dvinit) (struct dentry *);",
"\tdevcall (*dvopen) (struct dentry *, char *, char *);", "\tdevcall (*dvopen) (struct dentry *, char *, char *);",
"\tdevcall (*dvclose)(struct dentry *);", "\tdevcall (*dvclose)(struct dentry *);",
@ -110,9 +112,12 @@ char *devstab[] = {
"\tvoid (*dvintr)(void);", "\tvoid (*dvintr)(void);",
"\tbyte dvirq;", "\tbyte dvirq;",
"};\n", "};\n",
"extern struct dentry devtab[]; /* one entry per device */", "extern const __flash struct dentry devtab[] ; /* one entry per device */",
// "extern struct dentry devtab[] ; /* one entry per device */",
NULL NULL
}; };
//"};\n",
// "extern struct dentry devtab[] PROGMEM; /* one entry per device */",
char saveattrid[MAXNAME]; /* Holds the IDENT from an attribute */ char saveattrid[MAXNAME]; /* Holds the IDENT from an attribute */
@ -392,8 +397,8 @@ int main(int argc, char **argv) {
{ {
// fprintf(confc, "typedef unsigned int size_t;\n"); // fprintf(confc, "typedef unsigned int size_t;\n");
// fprintf(confc, "#include <avr/pgmspace.h>\n"); // fprintf(confc, "#include <avr/pgmspace.h>\n");
// fprintf(confc, "const struct dentry devtab[] PROGMEM =\n{\n"); fprintf(confc, "const __flash struct dentry devtab[] =\n{\n");
fprintf(confc, "struct dentry devtab[] =\n{\n"); // fprintf(confc, "struct dentry devtab[] =\n{\n");
fprintf(confc, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n", fprintf(confc, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n",
"/**", "/**",
" * Format of entries is:", " * Format of entries is:",

14
device/nam/naminit.c

@ -38,6 +38,10 @@ status naminit(void)
nnames = 0; nnames = 0;
// RAFA
/* avr specific */
char name[10];
for (i=0; i<NDEVS ; i++) { for (i=0; i<NDEVS ; i++) {
tptr = tmpstr; tptr = tmpstr;
nptr = devprefix; nptr = devprefix;
@ -51,6 +55,9 @@ status naminit(void)
tptr--; /* Move pointer to position before NULLCH */ tptr--; /* Move pointer to position before NULLCH */
devptr = &devtab[i]; devptr = &devtab[i];
nptr = devptr->dvname; /* Move to device name */ nptr = devptr->dvname; /* Move to device name */
/* avr specific */
strncpy_P(name, devptr->dvname, 10);
nptr = name;
/* Map device name to lower case and append */ /* Map device name to lower case and append */
@ -65,17 +72,18 @@ status naminit(void)
} }
if (len > NM_MAXLEN) { if (len > NM_MAXLEN) {
// RAFA kprintf("namespace: device name %s too long\r\n",
avr_kprintf(m5); avr_kprintf(m5);
kprintf("%s", devptr->dvname); //kprintf("%s", devptr->dvname);
continue; continue;
} }
// RAFA
kprintf("m:%s\n",tmpstr);
retval = mount(tmpstr, NULLSTR, devptr->dvnum); retval = mount(tmpstr, NULLSTR, devptr->dvnum);
if (retval == SYSERR) { if (retval == SYSERR) {
// RAFA kprintf("namespace: cannot mount device %d\r\n", // RAFA kprintf("namespace: cannot mount device %d\r\n",
avr_kprintf(m4); avr_kprintf(m4);
kprintf("%s", devptr->dvname); // kprintf("%s", devptr->dvname);
continue; continue;
} }
} }

5
device/nam/nammap.c

@ -19,6 +19,8 @@ devcall nammap(
char tmpname[NM_MAXLEN]; /* Temporary buffer for name */ char tmpname[NM_MAXLEN]; /* Temporary buffer for name */
int32 iter; /* Number of iterations */ int32 iter; /* Number of iterations */
//RAFA
// kprintf("no:%s", name);
/* Place original name in temporary buffer and null terminate */ /* Place original name in temporary buffer and null terminate */
if (namcpy(tmpname, name, NM_MAXLEN) == SYSERR) { if (namcpy(tmpname, name, NM_MAXLEN) == SYSERR) {
@ -28,6 +30,7 @@ devcall nammap(
/* Repeatedly substitute the name prefix until a non-namespace */ /* Repeatedly substitute the name prefix until a non-namespace */
/* device is reached or an iteration limit is exceeded */ /* device is reached or an iteration limit is exceeded */
for (iter=0; iter<nnames ; iter++) { for (iter=0; iter<nnames ; iter++) {
newdev = namrepl(tmpname, newname); newdev = namrepl(tmpname, newname);
if (newdev != namdev) { if (newdev != namdev) {
@ -66,6 +69,8 @@ did32 namrepl(
namptr = &nametab[i]; namptr = &nametab[i];
optr = name; /* Start at beginning of name */ optr = name; /* Start at beginning of name */
pptr = namptr->nprefix; /* Start at beginning of prefix */ pptr = namptr->nprefix; /* Start at beginning of prefix */
// RAFA
// kprintf("pr:%s", pptr);
/* Compare prefix to string and count prefix size */ /* Compare prefix to string and count prefix size */

2
device/nam/namopen.c

@ -16,6 +16,8 @@ devcall namopen(
char newname[NM_MAXLEN]; /* Name with prefix replaced */ char newname[NM_MAXLEN]; /* Name with prefix replaced */
did32 newdev; /* Device ID after mapping */ did32 newdev; /* Device ID after mapping */
//RAFA
// kprintf("i:%s", name);
/* Use namespace to map name to a new name and new descriptor */ /* Use namespace to map name to a new name and new descriptor */
newdev = nammap(name, newname, devptr->dvnum); newdev = nammap(name, newname, devptr->dvnum);

9
device/tty/ttygetc.c

@ -22,9 +22,18 @@ devcall ttygetc(
// struct sentry * semptr; // struct sentry * semptr;
// semptr = &semtab[typtr->tyisem]; // semptr = &semtab[typtr->tyisem];
// while(--(semptr->scount) < 0); // while(--(semptr->scount) < 0);
wait(typtr->tyisem); wait(typtr->tyisem);
// RAFA : HORRIBLE WORKAROUND TO THE BUG FOREVER
ch = 0; // RAFA : HORRIBLE WORKAROUND TO THE BUG FOREVER
while (ch == 0) { // RAFA : HORRIBLE WORKAROUND TO THE BUG FOREVER
ch = *typtr->tyihead++; ch = *typtr->tyihead++;
} // RAFA : HORRIBLE WORKAROUND TO THE BUG FOREVER
/* Wrap around to beginning of buffer, if needed */ /* Wrap around to beginning of buffer, if needed */
if (typtr->tyihead >= &typtr->tyibuff[TY_IBUFLEN]) { if (typtr->tyihead >= &typtr->tyibuff[TY_IBUFLEN]) {

8
device/tty/ttyhandle_in.c

@ -132,7 +132,12 @@ void ttyhandle_in (
if (typtr->tyitail>=&typtr->tyibuff[TY_IBUFLEN]) { if (typtr->tyitail>=&typtr->tyibuff[TY_IBUFLEN]) {
typtr->tyitail = typtr->tyibuff; typtr->tyitail = typtr->tyibuff;
} }
// RAFA
// serial_put_char('*');
/* Make entire line (plus \n or \r) available */ /* Make entire line (plus \n or \r) available */
//RAFA
//semreset(typtr->tyisem, 1);
signaln(typtr->tyisem, typtr->tyicursor + 1); signaln(typtr->tyisem, typtr->tyicursor + 1);
typtr->tyicursor = 0; /* Reset for next line */ typtr->tyicursor = 0; /* Reset for next line */
return; return;
@ -177,6 +182,9 @@ void ttyhandle_in (
typtr->tyicursor++; typtr->tyicursor++;
*typtr->tyitail++ = ch; *typtr->tyitail++ = ch;
// RAFA
// signal(typtr->tyisem);
/* Wrap around if needed */ /* Wrap around if needed */
if (typtr->tyitail >= &typtr->tyibuff[TY_IBUFLEN]) { if (typtr->tyitail >= &typtr->tyibuff[TY_IBUFLEN]) {

10
device/tty/ttyread.c

@ -42,6 +42,16 @@ devcall ttyread(
return nread; return nread;
} }
// RAFA: HORRIBLE WORKAROUND TO THE FOREVER BUG
char *c; // RAFA: HORRIBLE WORKAROUND TO THE FOREVER BUG
int i; // RAFA: HORRIBLE WORKAROUND TO THE FOREVER BUG
c = typtr->tyibuff; // RAFA: HORRIBLE WORKAROUND TO THE FOREVER BUG
for (i=0; i<TY_IBUFLEN; i++) // RAFA: HORRIBLE WORKAROUND TO THE FOREVER BUG
c[i] = 0; // RAFA: HORRIBLE WORKAROUND TO THE FOREVER BUG
typtr->tyihead = typtr->tyitail = typtr->tyibuff; // RAFA: HORRIBLE WORKAROUND TO THE FOREVER BUG
/* Block until input arrives */ /* Block until input arrives */
firstch = ttygetc(devptr); firstch = ttygetc(devptr);

6
include/name.h

@ -5,8 +5,10 @@
/* Constants that define the namespace mapping table sizes */ /* Constants that define the namespace mapping table sizes */
#define NM_PRELEN 16 /* Max size of a prefix string */ #define NM_PRELEN 16 /* Max size of a prefix string */
#define NM_REPLLEN 8 /* Maximum size of a replacement*/ // RAFA #define NM_REPLLEN 8 /* Maximum size of a replacement*/
#define NM_MAXLEN 8 /* Maximum size of a file name */ // RAFA #define NM_MAXLEN 8 /* Maximum size of a file name */
#define NM_REPLLEN 16 /* Maximum size of a replacement*/
#define NM_MAXLEN 16 /* Maximum size of a file name */
#define NNAMES 4 /* Number of prefix definitions */ #define NNAMES 4 /* Number of prefix definitions */
/* Definition of the name prefix table that defines all name mappings */ /* Definition of the name prefix table that defines all name mappings */

1
include/shprototypes.h

@ -84,3 +84,4 @@ extern shellcmd xsh_basic (int32, char *[]);
extern shellcmd xsh_ps (int32, char *[]); extern shellcmd xsh_ps (int32, char *[]);
extern shellcmd xsh_free (int32, char *[]); extern shellcmd xsh_free (int32, char *[]);
extern shellcmd xsh_forever (int32, char *[]); extern shellcmd xsh_forever (int32, char *[]);
extern shellcmd xsh_reboot (int32, char *[]);

16
lib/avr_messages.c

@ -5,8 +5,21 @@ typedef unsigned int size_t;
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
// const char CONSOLE_RESET[] PROGMEM = " \033[0m\033[2J\033[;H"; // const char CONSOLE_RESET[] PROGMEM = " \033[0m\033[2J\033[;H";
// const char m0[] PROGMEM = "Welcome to Xinu for AVR microcontrollers!\n v0.1 rafa@fi.uncoma.edu.ar";
const char m0[] PROGMEM = "\nWelcome to Xinu!\n\n\r\tXinu OS Copyright (c) 2012, 2015\n\r\tDouglas E. Comer and CRC Press, Inc.\n\n\r\tThis version for AVR atmega328p v0.1 (c) 2020\n\r\tRafael Ignacio Zurita <rafa@fi.uncoma.edu.ar>\n\n\r"; const char m0[] PROGMEM = "\nWelcome to Xinu!\n\n\r\tXinu OS Copyright (c) 2012, 2015\n\r\tDouglas E. Comer and CRC Press, Inc.\n\n\r\tThis version for AVR atmega328p v0.1 (c) 2020\n\r\tRafael Ignacio Zurita <rafa@fi.uncoma.edu.ar>\n\n\r";
const char m1[] PROGMEM = "\n\nRecreating shell\n\n";
const char m2[] PROGMEM = "Out of message nodes";
const char m3[] PROGMEM = "\n\nAll user processes have completed.\n\n";
const char m4[] PROGMEM = "namespace: cannot mount %d\r\n";
const char m5[] PROGMEM = "namespace: device name %s too long\r\n";
const char m6[] PROGMEM = "Can't startup system";
const char m7[] PROGMEM = "ptinit - insufficient memory";
const char m8[] PROGMEM = "freemem: %10d bytes. Free-list:\n";
const char m9[] PROGMEM = "Syscall not implemented\n";
const char m10[] PROGMEM = "ERROR GETSTK %s\n";
const char m11[] PROGMEM = "0x%08x %d\n";
const char m12[] PROGMEM = "looping... press reset\n";
/* orig :
const char m1[] PROGMEM = "\n\nMain process recreating shell\n\n"; const char m1[] PROGMEM = "\n\nMain process recreating shell\n\n";
const char m2[] PROGMEM = "Port system ran out of message nodes"; const char m2[] PROGMEM = "Port system ran out of message nodes";
const char m3[] PROGMEM = "\n\nAll user processes have completed.\n\n"; const char m3[] PROGMEM = "\n\nAll user processes have completed.\n\n";
@ -19,4 +32,5 @@ const char m9[] PROGMEM = "System call not implemented\n";
const char m10[] PROGMEM = "ERROR GETSTK %s\n"; const char m10[] PROGMEM = "ERROR GETSTK %s\n";
const char m11[] PROGMEM = "0x%08x %d\n"; const char m11[] PROGMEM = "0x%08x %d\n";
const char m12[] PROGMEM = "looping... press reset\n"; const char m12[] PROGMEM = "looping... press reset\n";
*/

12
lib/printf.c

@ -41,10 +41,19 @@ int printf(
char *c;
char buf[PRINTF_BUF]; char buf[PRINTF_BUF];
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap); vsnprintf(buf, sizeof(buf), fmt, ap);
c = buf;
while(*c) {
if(*c == '\n')
putc(stdout, '\r');
putc(stdout, *c);
c++;
};
/*
for(char *p = &buf[0]; *p; p++) // emulate cooked mode for newlines for(char *p = &buf[0]; *p; p++) // emulate cooked mode for newlines
{ {
if(*p == '\n') if(*p == '\n')
@ -53,6 +62,7 @@ int printf(
} }
putchar(*p); putchar(*p);
} }
va_end(ap); */
va_end(ap);
return 0; return 0;
} }

29
main/main.c

@ -25,6 +25,7 @@ const __flash uint8_t * const __flash cmdtab_cname[] =
(const __flash uint8_t[]) { "sleep" }, (const __flash uint8_t[]) { "sleep" },
(const __flash uint8_t[]) { "forever" }, (const __flash uint8_t[]) { "forever" },
(const __flash uint8_t[]) { "uptime" }, (const __flash uint8_t[]) { "uptime" },
(const __flash uint8_t[]) { "reboot" },
(const __flash uint8_t[]) { "kill" }, (const __flash uint8_t[]) { "kill" },
(const __flash uint8_t[]) { "free" }, (const __flash uint8_t[]) { "free" },
(const __flash uint8_t[]) { "clear" }, (const __flash uint8_t[]) { "clear" },
@ -36,13 +37,14 @@ const __flash uint8_t * const __flash cmdtab_help[] =
{ {
(const __flash uint8_t[]) { "[from to] : display SRAM memory contents" }, (const __flash uint8_t[]) { "[from to] : display SRAM memory contents" },
(const __flash uint8_t[]) { ": text editor" }, (const __flash uint8_t[]) { ": text editor" },
(const __flash uint8_t[]) { ": basic language interpreter" }, (const __flash uint8_t[]) { ": BASIC language interpreter" },
(const __flash uint8_t[]) { ": this help" }, (const __flash uint8_t[]) { ": this help" },
(const __flash uint8_t[]) { "n : sleep n seconds" }, (const __flash uint8_t[]) { "n : sleep n seconds" },
(const __flash uint8_t[]) { ": for (;;); for ever" }, (const __flash uint8_t[]) { ": for (;;);" },
(const __flash uint8_t[]) { ": tell how long the Xinu system has been running" }, (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[]) { ": reset the Xinu system sw. THIS IS NOT a hw reset" },
(const __flash uint8_t[]) { ": display amount of free and used memory in the system" }, (const __flash uint8_t[]) { "n : kill (terminates) the n (ID) process" },
(const __flash uint8_t[]) { ": display amount of free and used memory" },
(const __flash uint8_t[]) { ": clear the terminal screen" }, (const __flash uint8_t[]) { ": clear the terminal screen" },
(const __flash uint8_t[]) { ": display current processes table" }, (const __flash uint8_t[]) { ": display current processes table" },
(const __flash uint8_t[]) { "[arg ...] : write arguments to standard output" } (const __flash uint8_t[]) { "[arg ...] : write arguments to standard output" }
@ -57,21 +59,24 @@ const cmdent_t __flash cmdtab[] = {
{FALSE, xsh_sleep}, {FALSE, xsh_sleep},
{FALSE, xsh_forever}, {FALSE, xsh_forever},
{FALSE, xsh_uptime}, {FALSE, xsh_uptime},
{FALSE, xsh_reboot},
{TRUE, xsh_kill}, {TRUE, xsh_kill},
{TRUE, xsh_free}, {TRUE, xsh_free},
{TRUE, xsh_clear}, {TRUE, xsh_clear},
{TRUE, xsh_ps}, // {TRUE, xsh_ps},
{FALSE, xsh_ps},
{FALSE, xsh_echo} {FALSE, xsh_echo}
}; };
const __flash int cmdtab_stk[] = { const __flash int cmdtab_stk[] = {
256, /* memdump */ 256, /* memdump */
400, /* editor */ 400, /* editor */
400, /* basic */ 500, /* basic */
128, /* help */ 128, /* help */
128, /* sleep */ 128, /* sleep */
256, /* forever */ 128, /* forever */
200, /* uptime */ 200, /* uptime */
128, /* reboot */
300, /* kill */ 300, /* kill */
128, 128,
64, 64,
@ -178,6 +183,8 @@ process main(void)
change_proc_name("shell"); change_proc_name("shell");
for (i=0;i<NDEVS;i++)
printf("%S\n", devtab[i].dvname);
/* Print shell banner and startup message */ /* Print shell banner and startup message */
/* /*
@ -192,15 +199,16 @@ process main(void)
/* Continually prompt the user, read input, and execute command */ /* Continually prompt the user, read input, and execute command */
char *c;
while (TRUE) { while (TRUE) {
// RAFA
// fprintf(dev, "\033[2J");
// fprintf(dev, "\033[H");
/* Display prompt */ /* Display prompt */
fprintf(dev, SHELL_PROMPT); fprintf(dev, SHELL_PROMPT);
// c = buf;
// for (i=0;i<SHELL_BUFLEN; i++)
// c[i] = 0;
len = read(dev, buf, sizeof(buf)); len = read(dev, buf, sizeof(buf));
@ -365,6 +373,7 @@ process main(void)
continue; continue;
} }
/* Open files and redirect I/O if specified */ /* Open files and redirect I/O if specified */
if (inname != NULL) { if (inname != NULL) {

4
main/xsh_forever.c

@ -10,8 +10,8 @@
shellcmd xsh_forever(int nargs, char *args[]) shellcmd xsh_forever(int nargs, char *args[])
{ {
for (;;) for (;;);
printf("a"); //sleep(1);
return 0; return 0;
} }

16
main/xsh_reboot.c

@ -0,0 +1,16 @@
/* xsh_reboot.c - xsh_reboot */
#include <xinu.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
/*------------------------------------------------------------------------
* xsh_reboot - reset Xinu system. WARNING: this is not a hardware reset
*------------------------------------------------------------------------
*/
shellcmd xsh_reboot(int nargs, char *args[])
{
void(* reset_func) (void) = 0;//declare reset function at address 0
cli(); // disable interrupts
reset_func();
}

12
system/clkhandler.c

@ -26,6 +26,7 @@ ISR(TIMER0_COMPA_vect)
/* Increment 1000ms counter */ /* Increment 1000ms counter */
count1000++; count1000++;
@ -38,7 +39,7 @@ ISR(TIMER0_COMPA_vect)
count1000 = 0; count1000 = 0;
} }
/* check if sleep queue is empty */ /* check if sleep queue is empty every 100ms */
//if ((count1000 % 10) == 0) /* every 100ms */ //if ((count1000 % 10) == 0) /* every 100ms */
if ((count1000 % 100) == 0) /* every 100ms */ if ((count1000 % 100) == 0) /* every 100ms */
@ -52,15 +53,16 @@ ISR(TIMER0_COMPA_vect)
} }
} }
/* our MCU is slow 16Mhz, so we do clkhandler every 100ms */ /* our MCU is slow (16Mhz), so we do resched/preemption every 300ms */
avr_ticks ++; avr_ticks ++;
// if (avr_ticks > 100) { //// if (avr_ticks > 100) {
if (avr_ticks > 300) { if (avr_ticks > 300) {
// if (avr_ticks > 10) { // // if (avr_ticks > 10) {
avr_ticks=0; avr_ticks=0;
/* Decrement the preemption counter */ /* Decrement the preemption counter */
/* Reschedule if necessary */ /* Reschedule if necessary */
if((--preempt) == 0) { if((--preempt) == 0) {
preempt = QUANTUM; preempt = QUANTUM;
resched(); resched();

49
system/conf.c

@ -0,0 +1,49 @@
/* conf.c (GENERATED FILE; DO NOT EDIT) */
#include <xinu.h>
extern devcall ioerr(void);
extern devcall ionull(void);
/* Device independent I/O switch */
const __flash struct dentry devtab[] =
{
/**
* Format of entries is:
* dev-number, minor-number, dev-name,
* init, open, close,
* read, write, seek,
* getc, putc, control,
* dev-csr-address, intr-handler, irq
*/
/* CONSOLE is tty */
{ 0, 0, "CONSOLE",
(void *)ttyinit, (void *)ionull, (void *)ionull,
(void *)ttyread, (void *)ttywrite, (void *)ioerr,
(void *)ttygetc, (void *)ttyputc, (void *)ttycontrol,
(void *)0x40013800, (void *)ttyhandler, 53 },
/* NULLDEV is null */
{ 1, 0, "NULLDEV",
(void *)ionull, (void *)ionull, (void *)ionull,
(void *)ionull, (void *)ionull, (void *)ioerr,
(void *)ionull, (void *)ionull, (void *)ioerr,
(void *)0x0, (void *)ioerr, 0 },
/* NAMESPACE is nam */
{ 2, 0, "NAMESPACE",
(void *)naminit, (void *)namopen, (void *)ioerr,
(void *)ioerr, (void *)ioerr, (void *)ioerr,
(void *)ioerr, (void *)ioerr, (void *)ioerr,
(void *)0x0, (void *)ioerr, 0 },
/* EEPROM0 is eeprom */
{ 3, 0, "EEPROM0",
(void *)eeprom_init, (void *)eeprom_open, (void *)eeprom_close,
(void *)eeprom_read, (void *)eeprom_write, (void *)ioerr,
(void *)ioerr, (void *)ioerr, (void *)ioerr,
(void *)0x0, (void *)ionull, 0 }
};

2
system/initialize.c

@ -64,7 +64,7 @@ void nullprocess(void) {
// resume(create((void *)main, INITSTK, INITPRIO, "Main Process", 0, NULL)); // resume(create((void *)main, INITSTK, INITPRIO, "Main Process", 0, NULL));
// 200 ok and 400 ok // 200 ok and 400 ok
// resume(create((void *)shell, 360, INITPRIO, "shell", 0, NULL)); // resume(create((void *)shell, 360, INITPRIO, "shell", 0, NULL));
resume(create((void *)main, 500, INITPRIO, "main", 0, NULL)); resume(create((void *)main, 400, INITPRIO, "main", 0, NULL));
// resume(create((void *)test, 256, INITPRIO, "test", 0, NULL)); // resume(create((void *)test, 256, INITPRIO, "test", 0, NULL));

4
system/serial_avr.c

@ -67,11 +67,9 @@ char value;
* RX interrupt service rutine * RX interrupt service rutine
*/ */
ISR(USART_RX_vect){ ISR(USART_RX_vect){
cli();
value = UDR0; //read UART register into value value = UDR0; //read UART register into value
// serial_put_char (value);
ttyhandler (1, value, 0); ttyhandler (1, value, 0);
sei();
} }
char serial_get_char(void) char serial_get_char(void)

1
system/wait.c

@ -26,6 +26,7 @@ syscall wait(
return SYSERR; return SYSERR;
} }
// serial_put_char('%');
if (--(semptr->scount) < 0) { /* If caller must block */ if (--(semptr->scount) < 0) { /* If caller must block */
prptr = &proctab[currpid]; prptr = &proctab[currpid];
prptr->prstate = PR_WAIT; /* Set state to waiting */ prptr->prstate = PR_WAIT; /* Set state to waiting */

Loading…
Cancel
Save