$compact debug pw(79) rom startup: DO; $INCLUDE(:RMX:inc/rmxplm.ext) $if rmx=3 DECLARE SIZE$OF$OFFSET LITERALLY 'DWORD'; $else DECLARE SIZE$OF$OFFSET LITERALLY 'WORD'; $endif DECLARE NO$NPX LITERALLY '0', ALL$ERRORS LITERALLY '3', THIS$JOB LITERALLY '1', THIS$TASK LITERALLY 'SELECTOR$OF(NIL)'; sbx350_task: PROCEDURE EXTERNAL; END sbx350_task; term_init_task: PROCEDURE EXTERNAL; END term_init_task; procio_task: PROCEDURE EXTERNAL; END procio_task; /* Set up a public data variable so this can be configured * in as a first level user job. */ DECLARE dummy$data$variable BYTE PUBLIC; init_task: PROCEDURE PUBLIC; /* init_task is the initial task of ur first level job. it * creates two other tasks: sbx350_task, which will become the * interrupt task handling digital input, and PROCIO_task, which * is responsible for processing the input data and providing * formatted I/O for the operator. This task also creates a * separate job for terminal I/O. */ DECLARE term$job$token TOKEN, init$job$token TOKEN, sbx350$task$token TOKEN, procio$task$token TOKEN, status WORD, dummy$eh$struc STRUCTURE (eh$ptr POINTER, eh$mode BYTE); $if not cusp /* Break to the debug monitor. */ CAUSE$INTERRUPT (3); $endif /* Set up the exception handler structure. PL\M does not allow NIL * to be used within a data declaration. Setup of dummy$eh$struc * must be done dynamically. Note that we could have lied to PL\M * by declaring eh$ptr to be SIZE$OF$OFFSET + WORD. */ dummy$eh$struc.eh$ptr = NIL; dummy$eh$struc.eh$mode = ALL$ERRORS; /* Create the task which handles digital input from the iSBX350. * Note: This will become an interrupt task. */ sbx350$task$token = rq$create$task ( 139, /* task priority */ @sbx350_task, /* task start address */ SELECTOR$OF(@dummy$data$variable), /* Initialize the DS since we */ /* are in compact mode. */ NIL, /* Let iRMX assign the stack */ 600H, /* stack size */ NO$NPX, /* This task doesn't use NPX. */ @status); /* Create the process control task that manipulates the digital data. */ procio$task$token = rq$create$task ( 139, /* task priority */ @procio_task, /* task start address */ SELECTOR$OF(@dummy$data$variable), /* Initialize the DS since we */ /* are in compact mode. */ NIL, /* Let iRMX assign the stack */ 600H, /* stack size */ NO$NPX, /* This task doesn't use NPX. */ @status); /* Create the terminal job to process console input. The terminal * init task will create an input task and an output task. A job * is not actually required for this application, but we are doing * it to show rqe$create$job. */ init$job$token = rq$get$task$tokens (THIS$JOB, @status); term$job$token = rqe$create$job ( 40H, /* job's object directory size */ init$job$token, /* pass this job's token to the terminal job */ 400H, /* memory pool minimum */ 0FFFFFH, /* memory pool maximum */ 100H, /* maximum number of objects this job can own */ 3, /* maximum of 3 tasks in this job */ 0, /* no limit on priority of tasks in this job */ @dummy$eh$struc,/* Use SDB as error handler */ 0, /* validate Nucleus system call parameters */ 139, /* initial task priority */ @term_init_task,/* initial task start address */ SELECTOR$OF(@dummy$data$variable), /* Initialize the DS since we are in compact mode. */ NIL, /* Let iRMX assign the stack of the initial task */ 600H, /* initial task's stack size */ NO$NPX, /* The initial task does not use the NPX. */ @status); /* Initialization is complete so delete this task. */ CALL rq$delete$task (THIS$TASK, @status); END init_task; $if cusp /* Create an entry point for the CUSP version of this example. */ CALL init_task; /* init_task deletes itself and never returns. */ $endif END startup;