~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Minix Cross Reference
Minix/kernel/table.c


  1 static char rcsid[] = "$Id";
  2 
  3 /* The object file of "table.c" contains all the data.  In the *.h files, 
  4  * declared variables appear with EXTERN in front of them, as in
  5  *
  6  *    EXTERN int x;
  7  *
  8  * Normally EXTERN is defined as extern, so when they are included in another
  9  * file, no storage is allocated.  If the EXTERN were not present, but just
 10  * say,
 11  *
 12  *    int x;
 13  *
 14  * then including this file in several source files would cause 'x' to be
 15  * declared several times.  While some linkers accept this, others do not,
 16  * so they are declared extern when included normally.  However, it must
 17  * be declared for real somewhere.  That is done here, by redefining
 18  * EXTERN as the null string, so the inclusion of all the *.h files in
 19  * table.c actually generates storage for them.  All the initialized
 20  * variables are also declared here, since
 21  *
 22  * extern int x = 4;
 23  *
 24  * is not allowed.  If such variables are shared, they must also be declared
 25  * in one of the *.h files without the initialization.
 26  */
 27 
 28 #define _TABLE
 29 
 30 #include "kernel.h"
 31 #include <termios.h>
 32 #include <minix/com.h>
 33 #include "proc.h"
 34 #include "tty.h"
 35 
 36 /* The startup routine of each task is given below, from -NR_TASKS upwards.
 37  * The order of the names here MUST agree with the numerical values assigned to
 38  * the tasks in <minix/com.h>.
 39  */
 40 #if (MACHINE == SUN)
 41 #define SMALL_STACK     (1024 * sizeof (char *))
 42 #else
 43 #define SMALL_STACK     (128 * sizeof(char *))
 44 #endif
 45 
 46 #define TTY_STACK       (3 * SMALL_STACK)
 47 #define SYN_ALRM_STACK  SMALL_STACK
 48 
 49 #define DP8390_STACK    (SMALL_STACK * ENABLE_NETWORKING)
 50 
 51 #if (CHIP == INTEL)
 52 #define IDLE_STACK      ((3+3+4) * sizeof(char *))  /* 3 intr, 3 temps, 4 db */
 53 #else
 54 #define IDLE_STACK      SMALL_STACK
 55 #endif
 56 
 57 #define PRINTER_STACK   SMALL_STACK
 58 
 59 #if (CHIP == INTEL)
 60 #define WINCH_STACK     (2 * SMALL_STACK * ENABLE_WINI)
 61 #else
 62 #define WINCH_STACK     (3 * SMALL_STACK * ENABLE_WINI)
 63 #endif
 64 
 65 #if (MACHINE == ATARI)
 66 #define SCSI_STACK      (3 * SMALL_STACK)
 67 #endif
 68 
 69 #if (MACHINE == IBM_PC)
 70 #define SCSI_STACK      (2 * SMALL_STACK * ENABLE_SCSI)
 71 #endif
 72 
 73 #if (MACHINE == SUN)
 74 #define SCSI_STACK      0
 75 #endif
 76 
 77 #define CDROM_STACK     (4 * SMALL_STACK * ENABLE_CDROM)
 78 #define AUDIO_STACK     (4 * SMALL_STACK * ENABLE_AUDIO)
 79 #define MIXER_STACK     (4 * SMALL_STACK * ENABLE_AUDIO)
 80 
 81 #define FLOP_STACK      (3 * SMALL_STACK)
 82 #define MEM_STACK       SMALL_STACK
 83 #define CLOCK_STACK     SMALL_STACK
 84 #define SYS_STACK       SMALL_STACK
 85 #define HARDWARE_STACK  0               /* dummy task, uses kernel stack */
 86 
 87 
 88 #define TOT_STACK_SPACE         (TTY_STACK + DP8390_STACK + SCSI_STACK + \
 89         SYN_ALRM_STACK + IDLE_STACK + HARDWARE_STACK + PRINTER_STACK + \
 90         WINCH_STACK + FLOP_STACK + MEM_STACK + CLOCK_STACK + SYS_STACK + \
 91         CDROM_STACK + AUDIO_STACK + MIXER_STACK)
 92 
 93 
 94 /* SCSI, CDROM and AUDIO may in the future have different choices like
 95  * WINCHESTER, but for now the choice is fixed.
 96  */
 97 #define scsi_task       aha_scsi_task
 98 #define cdrom_task      mcd_task
 99 #define audio_task      dsp_task
100 
101 
102 /*
103  * Some notes about the following table:
104  *  1) The tty_task should always be first so that other tasks can use printf
105  *     if their initialisation has problems.
106  *  2) If you add a new kernel task, add it before the printer task.
107  *  3) The task name is used for the process name (p_name).
108  */
109 
110 PUBLIC struct tasktab tasktab[] = {
111         { tty_task,             TTY_STACK,      "TTY"           },
112 #if ENABLE_NETWORKING
113         { dp8390_task,          DP8390_STACK,   "DP8390"        },
114 #endif
115 #if ENABLE_CDROM
116         { cdrom_task,           CDROM_STACK,    "CDROM"         },
117 #endif
118 #if ENABLE_AUDIO
119         { audio_task,           AUDIO_STACK,    "AUDIO"         },
120         { mixer_task,           MIXER_STACK,    "MIXER"         },
121 #endif
122 #if ENABLE_SCSI
123         { scsi_task,            SCSI_STACK,     "SCSI"          },
124 #endif
125 #if ENABLE_WINI
126         { winchester_task,      WINCH_STACK,    "WINCH"         },
127 #endif
128         { syn_alrm_task,        SYN_ALRM_STACK, "SYN_AL"        },
129         { idle_task,            IDLE_STACK,     "IDLE"          },
130         { printer_task,         PRINTER_STACK,  "PRINTER"       },
131         { floppy_task,          FLOP_STACK,     "HDDISK"        },
132         { mem_task,             MEM_STACK,      "MEMORY"        },
133         { clock_task,           CLOCK_STACK,    "CLOCK"         },
134         { sys_task,             SYS_STACK,      "SYS"           },
135         { 0,                    HARDWARE_STACK, "HARDWAR"       },
136         { 0,                    0,              "MM"            },
137         { 0,                    0,              "FS"            },
138 #if ENABLE_NETWORKING
139         { 0,                    0,              "INET"          },
140 #endif
141         { 0,                    0,              "INIT"          },
142 };
143 
144 /* Stack space for all the task stacks.  (Declared as (double) to align it.) */
145 PUBLIC double t_stack[TOT_STACK_SPACE / sizeof(double)];
146 
147 /*
148  * The number of kernel tasks must be the same as NR_TASKS.
149  * If NR_TASKS is not correct then you will get the compile error:
150  *   "array size is negative"
151  */
152 
153 #define NKT (sizeof tasktab / sizeof (struct tasktab) - (INIT_PROC_NR + 1))
154 
155 extern int dummy_tasktab_check[NR_TASKS == NKT ? 1 : -1];
156 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.