📄 root.c
字号:
/* * Copyright (C) 1999-2005 Wind River Systems, Inc. * All rights reserved. Provided under license only. * Distribution or other use of this software is only * permitted pursuant to the terms of a license agreement * from Wind River Systems (and is otherwise prohibited). * Refer to that license agreement for terms of use. *//**************************************************************************** * Copyright 1998 Integrated Systems, Inc. * All rights reserved. ****************************************************************************//***********************************************************************//* *//* MODULE: root.c *//* DATE: 98/6/23 *//* PURPOSE: Code for sample application 'ROOT' task *//* *//*---------------------------------------------------------------------*//* *//* Copyright 1991 - 1998 Integrated Systems, Inc. *//* ALL RIGHTS RESERVED *//* *//* Permission is hereby granted to licensees of Integrated Systems, *//* Inc. products to use or abstract this computer program for the *//* sole purpose of implementing a product based on Integrated *//* Systems, Inc. products. No other rights to reproduce, use, *//* or disseminate this computer program, whether in part or in *//* whole, are granted. *//* *//* Integrated Systems, Inc. makes no representation or warranties *//* with respect to the performance of this computer program, and *//* specifically disclaims any responsibility for any damages, *//* special or consequential, connected with the use of this program. *//* *//***********************************************************************//* * $Log: root.c,v $ * Revision 1.3 2003/01/15 14:04:55 josh * directory structure shifting * * Revision 1.2 2001/11/08 16:47:29 tneale * Updated for newset file layout * * Revision 1.1.1.1 2001/11/05 17:49:12 tneale * Tornado shuffle * * Revision 1.5 2001/01/19 22:24:49 paul * Update copyright. * * Revision 1.4 2000/03/17 00:14:35 meister * Update copyright message * * Revision 1.3 1998/12/17 17:35:50 meister * sync snmptalk/root.c with router/root.c * * Revision 1.7 1998/12/12 18:53:40 sra * Changes to pSOS port of Attache: support non-Ethernet NI drivers, * simplify packet buffer implementation, general cleanup. * * Revision 1.6 1998/09/18 18:52:47 meister * consolidation based on Qing code review * * Revision 1.5 1998/09/17 23:05:10 meister * Per Qing: MUXD task can be eliminated * * Revision 1.4 1998/08/19 19:52:58 meister * renamed CLIENT_<xxx> flags to SNARK_CLIENT_<xxx> * * Revision 1.3 1998/08/05 18:53:29 meister * attache_task () --> snark_task (), moved to this file * * Revision 1.2 1998/08/03 21:35:47 meister * added old revision histories comment * * Revision 1.1 1998/08/03 21:33:59 meister * added root.c and drv_conf.c to snark/router *//* [clearcase]modification history-------------------01a,19apr05,job update copyright notices*//* $Header: /usr/cvsroot/target/src/wrn/wm/demo/snmptalk/root.c,v 1.3 2003/01/15 14:04:55 josh Exp $ *//* * Old revision history from snark/psos/router * * Revision 1.8 1998/07/27 20:27:41 meister * Create NIDD and AKBD tasks using routines now provided in libattpsos.a * * Revision 1.7 1998/07/20 21:24:26 sra * Cleanup. * * Revision 1.6 1998/07/17 21:50:05 meister * get rid of vestigial KBDQUEUE #ifdef * * Revision 1.5 1998/07/15 17:47:18 meister * Code shuffling to allow nidrive.c to be moved into snark/lib, * and remove dependencies on sys_conf.h from Snark portions of this * application. * * Revision 1.4 1998/07/10 21:58:30 meister * added populate_attache_ni_table() call * * Revision 1.3 1998/06/24 18:46:50 meister * More cosmetics * * Revision 1.2 1998/06/24 17:38:54 meister * Legal boilerplate. * * Revision 1.1 1998/06/04 21:31:51 meister * moved these files to their proper place. * This is the pSOS "router" application * * Revision 1.7 1998/06/03 21:40:38 meister * modified for use with ni-to-ni mux. * * Revision 1.6 1998/05/13 21:13:29 meister * memory based Snark initialization for pHILEless intalls. * Conditionalize ramdisk and saci initialization based on whether ths pSOS * anchor indicates that we have pHILE installed. * * Revision 1.5 1998/05/06 23:38:08 meister * some attempts at determining pSOS system config * * Revision 1.4 1998/04/29 23:13:38 meister * Configuration via etc,ini (written into pHILE ramdisk) added. * */#include <wrn/wm/common/install.h>#include <sys_conf.h>#include <psos.h>#include <configs.h>#include <drv_intf.h>#include <probe.h>#include <prepc.h>#include <phile.h>#include <wrn/wm/demo/read_ini.h>#define SNARK_CLIENT_PRIO 190 /* Priority of the client task */#define SNARK_CLIENT_USRSTACK 1024 /* User stack size of client task */#define SNARK_CLIENT_SYSSTACK 4096 /* Supervisor stack size */#define SNARK_CLIENT_FLAGS 0x00 /* Flags for client task */#define SNARK_CLIENT_INITMODE 0x2000 /* Initial mode of the client task */#define NIDD_TASK_PRIORITY 189static void error(char *str);unsigned long AttTid;unsigned long AttKbdTid;extern NODE_CT *anchor;/***********************************************************************//* root: Code for the ROOT task *//* *//* NOTE: This executes as the 'ROOT' task. It suspends itself *//* when finished. *//* *//***********************************************************************/extern void psos_main (int, char **);void snark_task (){ char * main_argv[] = { "psos_main", (char *) 0 }; term_setup (); psos_main (1, main_argv);}void root(void){ ULONG i; printf ("System contains: "); if (anchor->pnact) printf ("pNA "); if (anchor->psosct) printf ("pSOS "); if (anchor->probect) printf ("pROBE "); if (anchor->philect) printf ("pHILE "); if (anchor->psect) printf ("pSE "); if (anchor->pmct) printf ("pMONT "); if (anchor->prepct) printf ("pREPC "); printf ("\n"); CreateNiDrvTask (NIDD_TASK_PRIORITY); if (t_create("ATTD", SNARK_CLIENT_PRIO, SNARK_CLIENT_SYSSTACK, SNARK_CLIENT_USRSTACK, SNARK_CLIENT_FLAGS, &AttTid) != 0) { printf("Task creation error (ATTD). Suspending root task.\n"); t_suspend (0L); } CreateKbdTask (100, GetAttacheQueueId (), AttTid); StartNiDrvTask (); if (t_start(AttTid, SNARK_CLIENT_INITMODE, snark_task, &i) != 0) { printf ("Task start error"); } StartKbdTask ();/*---------------------------------------------------------------------*//* That's the end of the 'ROOT' task, and the end of this application. *//* Now suspend the 'ROOT' task. *//*---------------------------------------------------------------------*/ printf("suspending root task\n"); t_suspend(0L);}/***********************************************************************//* error: Error handling routine *//* *//* INPUT: pointer to character string. *//***********************************************************************/static void error(char *str){ printf("%s %x\n", str, errno); t_suspend(0L);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -