void boardGame()
{
    clearScreen();
    printLogo();
    pauseMessageAndClearScreen(NULL);
    printInstruction();
    pauseMessageAndClearScreen(NULL);
    boardLoop();
}
示例#2
0
void* display_disk_info(void* nouse) {
//	THREAD_LOCK;

	displayDisk();
	displayMenu();
	displayDiskUsage();
	printLogo();

	createSuperBlockWindow();
//	THREAD_UNLOCK;
}
示例#3
0
int main(int argc, char **argv)
{
	char* line;
	unsigned int promptNb = 1;
	char promptMsg[100];
	
	srand(time(NULL));
    printLogo();

	/* Set the completion callback. This will be called every time the
	 * user uses the <tab> key. */
	linenoiseSetCompletionCallback(completion);

	/* Load history from file.*/
	linenoiseHistoryLoad(HIST_FILENAME); /* Load the history at startup */

	snprintf(promptMsg, 100, "%s[%d]: ", "\033[0m", promptNb); 
	while((line = linenoise(promptMsg)) != NULL)
	{    
		linenoiseHistoryAdd(line); /* Add to the history. */
		linenoiseHistorySave(HIST_FILENAME); /* Save the history on disk. */
		/* Do something with the string. */
        rmSuperscript(line);

		if(line[0] == '/')
			parseCommand(&(line[1]));

		else if(!strcmp(line, "exit") || !strcmp(line, "quit") || (line[1] == 0 && (line[0] == 'e' || line[0] == 'q')))
			break;
			
		else if(line[0] != '\0')
		{
			simpleParserAPI(line);
		}

		snprintf(promptMsg, 100, "[%d]: ", ++promptNb);
	}
	
	finalProcessing();
	return 0;
}
示例#4
0
文件: trainer.c 项目: Lelv/testing
int main(){

	POKEMON pokemones[6];
	generatePokemons(pokemones);

	printf("\033[2J\033[1;1H");
	printLogo();
	printf("\t\t    ---- POKEMON CENTER ----\n\n");
	printf("Your pokemons are: \n");
	printPokemons(pokemones);


	char buffer[256];

	forever{
		printf("\n--> What do you want to do?\n$ ");
		bzero(buffer, 256);
		fgets(buffer, 255, stdin);

		if(strcmp(buffer,"heal\n") == 0){
			curar_pokemones(pokemones, 6);
		}else if (strcmp(buffer, "new pokemons\n") == 0)
		{
			generatePokemons(pokemones);
			printf("Your new pokemons are\n");
			printPokemons(pokemones);
		}else if(strcmp(buffer, "my pokemons\n") == 0){
			printPokemons(pokemones);
		}else if((strcmp(buffer, "help\n")) == 0 || (strcmp(buffer, "man\n")) == 0){
			printHelp();
		}else{
			printf("Invalid command\n");
		}

		
	
  }

}
示例#5
0
void initKeycodes()
{
    pc("[06.000050] -initKeycodes() called");
    int line;
    int scan;
    if (askKeycodes)
    {
        pc("[06.000055] +Ask User");
        pc("[06.000056] +Attemp Overlay - Debug Output frozen");
        char vm[25 * 2 * 80];
        kmemcpy(&(vm[0]), &(video[0]), 25 * 80 * 2);
        setFix(0);
        clearscreen();
        printLogo();
        for(line = 1; line <= 23; line++) kprintf(" ");
        kprintf("%c Please choose Keyboard layout %c\n\n", (char) 174, (char) 175);
        for(line = 1; line <= 26; line++) kprintf(" ");
        kprintf("<1> QWERTY (English Layout)\n");
        for(line = 1; line <= 26; line++) kprintf(" ");
        kprintf("<2> QWERTZ (German Layout)\n");
        changeColor(0x0, 0x0);
        kprintf(" \b");
        scan = FetchAndAnalyzeScancode();
        changeColor(0x0, 0xF);
        kmemcpy(&(video[0]), &(vm[0]), 25 * 80 * 2);
        setFix(10);
        pc("[06.000056] +overlay finished");
    }
    else
    {
        PS("[06.%s] +echo \"Using Keyboard Layout QWERTZ (GERMAN)", dl);
        DEBUG_MSG("IO:       Using Keyboard Layout QWERTZ (German)...");
        scan = 3;
        dbg(true);
    }
    pc("[06.000081] +setIOKbLeyout to %s", (scan == 2) ? "QWERTY - US" : "QWERTZ - DE");
    if (scan == 2) // QWERTY -- US
    {
        unsigned char tasciiNonShift[100] = {
            0, ESC, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', BACKSPACE,
            TAB, 'q', 'w',   'e', 'r', 't', 'y', 'u', 'i', 'o', 'p',   '[', ']', ENTER, 0,
            'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', 0, '\\',
            'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 0, 0, 0, ' ', 0,
            KF1, KF2, KF3, KF4, KF5, KF6, KF7, KF8, KF9, KF10, 0, 0,
            KHOME, KUP, KPGUP,'-', KLEFT, '5', KRIGHT, '+', KEND, KDOWN, KPGDN, KINS, KDEL, 0, 0, 0, KF11, KF12
        };
        tasciiNonShift[86] = '<';

        unsigned char tasciiShift[100] = {
            0, ESC, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', BACKSPACE,
            TAB, 'Q', 'W',   'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P',   '{', '}', ENTER, 0,
            'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '\"', '~', 0, '|',
            'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?', 0, 0, 0, ' ', 0,
            KF1,   KF2, KF3, KF4, KF5, KF6, KF7, KF8, KF9, KF10, 0, 0,
            KHOME, KUP, KPGUP, '-', KLEFT, '5',   KRIGHT, '+', KEND, KDOWN, KPGDN, KINS, KDEL, 0, 0, 0, KF11, KF12
        };
        tasciiShift[86] = '>';

        unsigned char tasciiAltGR[100] = {
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
        };
        tasciiAltGR[86] = '|';
        int i;
        for(i = 0; i <= 100; i++)
        {
            asciiNonShift[i] = tasciiNonShift[i];
            asciiShift[i] = tasciiShift[i];
            asciiAltGR[i] = tasciiAltGR[i];
        }
    }
    else // QWERTZ -- Germany
    {
        unsigned char tasciiNonShift[100] = {
            0, ESC, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 225,0, BACKSPACE,
            TAB, 'q', 'w',   'e', 'r', 't', 'z', 'u', 'i', 'o', 'p',   0, '+', ENTER, 0,//29
            'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 0,0, '#', 0, '#',
            'y', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '-', '<', 0, 0, ' ', 0,
            KF1, KF2, KF3, KF4, KF5, KF6, KF7, KF8, KF9, KF10, 0, 0,
            KHOME, KUP, KPGUP,'-', KLEFT, '5', KRIGHT, '+', KEND, KDOWN, KPGDN, KINS, KDEL, 0, 0, 0, KF11, KF12
        };
        tasciiNonShift[86] = '<';
        tasciiNonShift[26] = (char) 129;
        tasciiNonShift[39] = (char) 148;
        tasciiNonShift[40] = (char) 132;
        tasciiNonShift[41] = (char) 95;

        unsigned char tasciiShift[100] = {
            0, ESC, '!', '\"', 0, '$', '%', '&', '/', '(', ')', '=', '?', '`', BACKSPACE,
            TAB, 'Q', 'W',   'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P',   0, '*', ENTER, 0,
            'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 0,0, '\'', 0, '\'',
            'Y', 'X', 'C', 'V', 'B', 'N', 'M', ';', ':', '_', '>', 0, 0, ' ', 0,
            KF1,   KF2, KF3, KF4, KF5, KF6, KF7, KF8, KF9, KF10, 0, 0,
            KHOME, KUP, KPGUP, '-', KLEFT, '5',   KRIGHT, '+', KEND, KDOWN, KPGDN, KINS, KDEL, 0, 0, 0, KF11, KF12
        };
        tasciiShift[86] = '>';
        tasciiShift[26] = (char) 154;
        tasciiShift[39] = (char) 153;
        tasciiShift[40] = (char) 142;
        tasciiShift[41] = (char) 248;

        unsigned char tasciiAltGR[100] = {
            0, 170, 173,253,0, 0,0,0, '{', '[', ']', '}', '\\', 0, 0,
            0, '@', 0,   0, 0, 0,0,0, 0,237,0,   0, '~', 0, 0,
            145, 0, 0, 0,0,0, 0, 0,0,0, '^', '`', 0, 0,
            0,0,0,0,0,0, 0,0,0, 0, '|', 0, 0, 0, 0,
            0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
        };
        tasciiAltGR[86] = '|';

        int i;
        for(i = 0; i < 100; i++)
        {
            asciiNonShift[i] = tasciiNonShift[i];
            asciiShift[i] = tasciiShift[i];
            asciiAltGR[i] = tasciiAltGR[i];
        }
    }
    pc("[06.000165] +ret");
}
示例#6
0
/*-----------------------------------------------------------------------------*/
int main(int argc, char **argv)
{
  char str[MAX_STR];
  char userID[MAX_USER_NAME];
  char buffer[MAX_BUFF];
  SongType tempSong;
  
  /* Ncurses Menu */
  char *mContent[] = {
                      "Add Song", 
                      "Delete Song", 
                      "View Song(s)",
                      "Quit"
                     };
  
//  dealWithIt();
  printLogo("CLIENT", CLEAR);
  
  /* External Preprocessor commands */
  if (extArguments (argc,argv) == 0) {return 0;}
  
  /* Welcome Screen and ask for username */
  getUserID(userID, (unsigned) sizeof(userID));

  /* Initiats connections */
  initClientSocket();

  /* Display confirmation for user */
  printf(ANSI_COLOR_GREEN
         "Establising connection to server %s:%d \n\n"
         "For further assistance or "
         "help, please visit the help page by simply typing "
         ANSI_COLOR_YELLOW 
         "'/h'"
         ANSI_COLOR_RESET" \n", SERVER_IP, SERVER_PORT);

  /* SEND USER THAT WE GOT FROM THE ABOVE fgets */
  userID[strlen(userID)-1] = '\0'; // add a terminator at the end of the char[]
  strcpy(buffer, userID);
  send(mySocket, buffer, strlen(buffer), 0);

  /* Display Menu - Keep this if not using dup / dup2*/
  dispMenu();

  while (1) {
    /* For eye candy */
    // printLogo("CLIENT", NO_CLEAR);

    /* Display Menu first */
    // dispMenu();
    // initNcursesMenu((sizeof(mContent) / sizeof(char*)),*mContent);
    printf("Please choose from the menu above: ");

    fgets(str, sizeof(str), stdin);
    str[strlen(str)-1] = '\0';
    /* Deprecated 
     * if (strcmp(str, "/h") == 0) {
     *  printf(ANSI_COLOR_CYAN
     *       "Welcome to the help page. This is a beta-help page\n"
     *       "With later releases the help page should be using\n"
     *       "the ncurses library.\n"
     *       "Commands include :\n"
     *       ANSI_COLOR_RED
     *       "\t/h\t: For this lovely page\n"
     *       "\t/q\t: Closes this program.\n"
     *       ANSI_COLOR_RESET
     *      );
     * } else
     */
 
    strcpy(buffer, str);
    /*Encryption - Usually one would use a key, but not in this case.*/
 //   encrypt(buffer);
 //   send(mySocket, buffer, strlen(buffer), 0); 
    encryptSend(mySocket, buffer, strlen(buffer),0);
    if (strcmp(str, "/q") == 0) {
      /* Soft-quiting */
      break;
    } else if (strcmp(str, "a") == 0) {
      /* Add Song */
      printf("You are about to send a song over: Please enter the following: \n"
             ANSI_COLOR_YELLOW 
             "Name  : ");
      fgets(str, sizeof(str), stdin);
      str[strlen(str) - 1] = '\0';
      encryptSend(mySocket, str, strlen(str),0);

      printf("Artist: ");
      fgets(str, sizeof(str), stdin);
      str[strlen(str) - 1] = '\0';
      encryptSend(mySocket, str, strlen(str),0);

      printf("Album : ");
      fgets(str, sizeof(str), stdin);
      str[strlen(str) - 1] = '\0';
      encryptSend(mySocket, str, strlen(str),0);
    
      printf("Duration (mins) : ");
      /* Just to make sure the user will use integars, if it is not the case
       * then he/she will be promted again to repeat their input.
       */
      for(;;){
       short *illegals = 0;
       fgets(str, sizeof(str), stdin);
       /* Check if str contains any non-ints*/
       for (int i = 0; i < strlen(str) - 1; ++i) {
         if(!isdigit(str[i])) ++illegals;
       } 
       /* If everything seems to be good, then exit*/
       if ( illegals == 0) {
         tempSong.duration = atoi(str);
      //   fgets(str, sizeof(str), stdin);
         str[strlen(str) - 1] = '\0';
         encryptSend(mySocket, str, strlen(str),0);

         /* Free illegals ... */
         free(illegals);
         break;
       }
       printf(ANSI_COLOR_RED 
              "EYYY!!! YO CHILL MAN!!"
              ANSI_COLOR_RESET 
              " Only Integar values!\nLet's try that again...\n"
              ANSI_COLOR_YELLOW
              "Duration (mins) : "
             );
      } // end sentinital loop ( I don't know how to spell, don't judge sheesh )
      
      printf(ANSI_COLOR_GREEN 
             "We are all good. Converting your song to send over\n"
             ANSI_COLOR_RESET
            );
    } else if (strcmp(str, "b") == 0) {
      /* Delete Song */
      printf(ANSI_COLOR_YELLOW);
      printf("Which song do you want to delete?\n"
             "Name ? : ");
      fgets(str, sizeof(str), stdin);
      str[strlen(str) - 1] = '\0';
      encryptSend(mySocket, str, strlen(str),0);

      printf("Artist : ");
      fgets(str, sizeof(str), stdin);
      str[strlen(str) - 1] = '\0';
      encryptSend(mySocket, str, strlen(str),0);

      printf("That should be enough info\n");
      printf(ANSI_COLOR_RESET);      
    } else if (strcmp(str, "c") == 0) {
      /* View Song(s) */
      fgets(str, sizeof(str), stdin);
      str[strlen(str) - 1] = '\0';
      encryptSend(mySocket, str, strlen(str),0);
      
    } else if (strcmp(str, "d") == 0) {
      break;
    }
 }
  close(mySocket);
  return 0;
}
示例#7
0
void usrRoot
    (
    char *	pMemPoolStart,		/* start of system memory partition */
    unsigned	memPoolSize		/* initial size of mem pool */
    )
    {
    char tyName [20];
    int  ix;

    /* Initialize the memory pool before initializing any other package.
     * The memory associated with the root task will be reclaimed at the
     * completion of its activities.
     */

#ifdef INCLUDE_MEM_MGR_FULL
    memInit (pMemPoolStart, memPoolSize);	/* initialize memory pool */
#else
    memPartLibInit (pMemPoolStart, memPoolSize);/* initialize memory pool */
#endif /* INCLUDE_MEM_MGR_FULL */

#ifdef	INCLUDE_SHOW_ROUTINES
    memShowInit ();				/* initialize memShow routine */
#endif	/* INCLUDE_SHOW_ROUTINES */

#if	defined(INCLUDE_MMU_BASIC) || defined(INCLUDE_MMU_FULL) || \
	defined(INCLUDE_MMU_MPU)
    usrMmuInit ();				/* initialize the mmu */
#endif	/* defined(INCLUDE_MMU_BASIC, INCLUDE_MMU_FULL, INCLUDE_MMU_MPU) */

    /* set up system timer */

    sysClkConnect ((FUNCPTR) usrClock, 0);	/* connect clock ISR */
    sysClkRateSet (SYS_CLK_RATE);	/* set system clock rate */
    sysClkEnable ();				/* start it */

#ifdef INCLUDE_FAST_DRAM
/*
 * make use of data cache as fast DRAM,
 * establish parameters in config.h, MMU
 * must be initialed before data cache is
 * initialized as data ram...
 */
  cacheCreateInternalDataRAM((UINT32 *)FD_ORIGIN, FD_NUMLINES);
#endif

    /*
     * The select library needs to be initialized before the tyLib module
     * since the _func_selWakeupListInit FUNCPTR is required (SPR #3314).
     * The installation of the select task delete hooks is performed
     * later in usrRoot() after NFS and RPC have been initialized.
     */

#ifdef  INCLUDE_SELECT
    selectInit (NUM_FILES);
#endif	/* INCLUDE_SELECT */


    /* initialize I/O system */

#ifdef  INCLUDE_IO_SYSTEM
    iosInit (NUM_DRIVERS, NUM_FILES, "/null");

    consoleFd = NONE;                           /* assume no console device */

#ifdef  INCLUDE_TYCODRV_5_2
#ifdef  INCLUDE_TTY_DEV
    if (NUM_TTY > 0)
	{
	tyCoDrv ();				/* install console driver */

	for (ix = 0; ix < NUM_TTY; ix++)	/* create serial devices */
	    {
	    sprintf (tyName, "%s%d", "/tyCo/", ix);

	    (void) tyCoDevCreate (tyName, ix, 512, 512);

	    if (ix == CONSOLE_TTY)
		strcpy (consoleName, tyName);	/* store console name */
	    }

	consoleFd = open (consoleName, O_RDWR, 0);

	/* set baud rate */

	(void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
	(void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);
	}
#endif	/* INCLUDE_TTY_DEV */

#else   /* !INCLUDE_TYCODRV_5_2 */
#ifdef  INCLUDE_TTY_DEV
    if (NUM_TTY > 0)
	{
	ttyDrv();				/* install console driver */

	for (ix = 0; ix < NUM_TTY; ix++)	/* create serial devices */
	    {
#if     (defined(INCLUDE_WDB) && (WDB_COMM_TYPE == WDB_COMM_SERIAL))
	    if (ix == WDB_TTY_CHANNEL)		/* don't use WDBs channel */
		continue;
#endif
	    sprintf (tyName, "%s%d", "/tyCo/", ix);
	    (void) ttyDevCreate (tyName, sysSerialChanGet(ix), 512, 512);

	    if (ix == CONSOLE_TTY)		/* init the tty console */
		{
		strcpy (consoleName, tyName);
		consoleFd = open (consoleName, O_RDWR, 0);
		(void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
		(void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);
		}
	    }
	}
#endif  /* INCLUDE_TTY_DEV */

#ifdef INCLUDE_PC_CONSOLE
    pcConDrv ();
    for (ix = 0; ix < N_VIRTUAL_CONSOLES; ix++)
	{
	sprintf (tyName, "%s%d", "/pcConsole/", ix);
	(void) pcConDevCreate (tyName,ix, 512, 512);
	if (ix == PC_CONSOLE)		/* init the console device */
	    {
	    strcpy (consoleName, tyName);
	    consoleFd = open (consoleName, O_RDWR, 0);
	    (void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
	    (void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);
	    }
	}
#endif	/* INCLUDE_PC_CONSOLE */

#endif  /* !INCLUDE_TYCODRV_5_2 */

    ioGlobalStdSet (STD_IN,  consoleFd);
    ioGlobalStdSet (STD_OUT, consoleFd);
    ioGlobalStdSet (STD_ERR, consoleFd);
#endif  /* INCLUDE_IO_SYSTEM */

    /* initialize symbol table facilities */

#ifdef	INCLUDE_SYM_TBL
    hashLibInit ();			/* initialize hash table package */
    symLibInit ();			/* initialize symbol table package */
#ifdef 	INCLUDE_SHOW_ROUTINES
    symShowInit ();			/* initialize symbol table show */
#endif	/* INCLUDE_SHOW_ROUTINES */
#endif	/* INCLUDE_SYM_TBL */

    /* initialize exception handling */

#if     defined(INCLUDE_EXC_HANDLING) && defined(INCLUDE_EXC_TASK)
#ifdef	INCLUDE_EXC_SHOW
    excShowInit ();
#endif
    excInit ();				/* initialize exception handling */
#endif  /* defined(INCLUDE_EXC_HANDLING) && defined(INCLUDE_EXC_TASK) */

#ifdef	INCLUDE_LSTLIB
    lstLibInit ();
#endif

#ifdef	INCLUDE_LOGGING
    logInit (consoleFd, MAX_LOG_MSGS);	/* initialize logging */
# ifdef	INCLUDE_LOG_STARTUP
    logMsg ("logging started to %s [%d], queue size %d\n",
		consoleName, consoleFd, MAX_LOG_MSGS, 4,5,6);
    taskDelay (2);	/* allow time for message to be displayed */
# endif	/* INCLUDE_LOG_STARTUP */
#endif	/* INCLUDE_LOGGING */

#ifdef	INCLUDE_SIGNALS
    sigInit ();				/* initialize signals */
#endif	/* INCLUDE_SIGNALS */

    /* initialize debugging */

#ifdef	INCLUDE_DEBUG
    dbgInit ();				/* initialize debugging */
#endif	/* INCLUDE_DEBUG */


    /* initialize pipe driver */

#ifdef	INCLUDE_PIPES
    pipeDrv ();				/* install pipe driver */
#endif	/* INCLUDE_PIPES */


    /* initialize standard I/O package */

#ifdef	INCLUDE_STDIO
    stdioInit ();			/* initialize standard I/O library */
#ifdef  INCLUDE_SHOW_ROUTINES
    stdioShowInit ();
#endif  /* INCLUDE_SHOW_ROUTINES */
#endif	/* INCLUDE_STDIO */

    /* initialize POSIX queued signals */

#if defined(INCLUDE_POSIX_SIGNALS) && defined(INCLUDE_SIGNALS)
    sigqueueInit (NUM_SIGNAL_QUEUES); /* initialize queued signals */
#endif

    /* initialize POSIX semaphores */

#ifdef  INCLUDE_POSIX_SEM
    semPxLibInit ();
#ifdef INCLUDE_SHOW_ROUTINES
    semPxShowInit ();
#endif  /* INCLUDE_SHOW_POUTINES */
#endif  /* INCLUDE_POSIX_SEM */

    /* initialize POSIX threads */

#ifdef INCLUDE_POSIX_PTHREADS
    pthreadLibInit ();
#endif  /* INCLUDE_POSIX_PTHREADS */

    /* initialize POSIX message queues */

#ifdef INCLUDE_POSIX_MQ
    mqPxLibInit (MQ_HASH_SIZE);
#ifdef INCLUDE_SHOW_ROUTINES
    mqPxShowInit ();
#endif  /* INCLUDE_SHOW_ROUTINES */
#endif  /* INCLUDE_POSIX_MQ */

    /* initialize POSIX async I/O support */

#ifdef INCLUDE_POSIX_AIO
    aioPxLibInit (MAX_LIO_CALLS);
#ifdef INCLUDE_POSIX_AIO_SYSDRV
    aioSysInit (MAX_AIO_SYS_TASKS, AIO_TASK_PRIORITY, AIO_TASK_STACK_SIZE);
#endif  /* INCLUDE_POSIX_AIO_SYSDRV */
#endif  /* INCLUDE_POSIX_AIO */

#ifdef INCLUDE_CBIO /* init main CBIO module, cbioLib() */
    cbioLibInit();
#endif INCLUDE_CBIO

    /* initialize filesystems and disk drivers */

#ifdef INCLUDE_DOSFS_MAIN  /* dosFs2 file system initialization */

    hashLibInit ();			/* initialize hash table package */

    /* First initialize the main dosFs module */

    dosFsLibInit( 0 );

    /* Initialize sub-modules */

    /* ensure that at least one directory handler is defined */

#   if ((!defined INCLUDE_DOSFS_DIR_VFAT) && \
        (!defined INCLUDE_DOSFS_DIR_FIXED))

#       define INCLUDE_DOSFS_DIR_VFAT  

#   endif 

    /* init VFAT (MS long file names) module */

#   ifdef INCLUDE_DOSFS_DIR_VFAT

    /* Sub-module: VFAT Directory Handler */

    dosVDirLibInit();

#   endif /* INCLUDE_DOSFS_DIR_VFAT */

    /* init strict 8.3 and vxLongNames handler */

#   ifdef INCLUDE_DOSFS_DIR_FIXED

    /* Sub-module: Vintage 8.3 and VxLong Directory Handler */

    dosDirOldLibInit();

#   endif /* INCLUDE_DOSFS_DIR_FIXED */

    /* Sub-module: FAT12/FAT16/FAT32 FAT Handler */

    dosFsFatInit();

#   ifdef INCLUDE_DOSFS_CHKDSK 

    /* Sub-module: Consistency check handler */

    dosChkLibInit();

#   endif /* INCLUDE_DOSFS_CHKDSK */

#   ifdef INCLUDE_DOSFS_FMT

    /* Sub-module: Formatter */

    dosFsFmtLibInit();           /* init dosFs scalable formatter */

#   endif /* INCLUDE_DOSFS_FMT */

#endif /* INCLUDE_DOSFS_MAIN */

    /* dosFs1 legacy code, dosFsInit(), usrDosFsOld.c */

#ifdef	INCLUDE_DOSFS
    hashLibInit ();			/* initialize hash table package */
    dosFsInit (NUM_DOSFS_FILES); 	/* init dosFs filesystem */
#endif	/* INCLUDE_DOSFS */

#ifdef	INCLUDE_RAWFS
    rawFsInit (NUM_RAWFS_FILES); 	/* init rawFs filesystem */
#endif	/* INCLUDE_RAWFS */

#ifdef	INCLUDE_RT11FS
    rt11FsInit (NUM_RT11FS_FILES); 	/* init rt11Fs filesystem */
#endif	/* INCLUDE_RT11FS */

#ifdef	INCLUDE_RAMDRV
    ramDrv ();				/* initialize ram disk driver */
#endif	/* INCLUDE_RAMDRV */

    /* initialize USB components */

#ifdef INCLUDE_USB_INIT
    usbInit (); 		/* USB Host Stack Initialization */
#endif

#ifdef INCLUDE_UHCI_INIT
    usrUsbHcdUhciAttach (); 	/* UHCI Initialization */
#endif

#ifdef INCLUDE_OHCI_INIT
    usrUsbHcdOhciAttach (); 	/* OHCI Initialization */
#endif

#ifdef INCLUDE_USB_MOUSE_INIT
    usrUsbMseInit (); 		/* Mouse Driver Initialization */
#endif

#ifdef INCLUDE_USB_KEYBOARD_INIT
    usrUsbKbdInit (); 		/* Keyboard Driver Initialization */
#endif

#ifdef INCLUDE_USB_PRINTER_INIT
    usrUsbPrnInit (); 		/* Printer Driver Initialization */
#endif

#ifdef INCLUDE_USB_SPEAKER_INIT
    usrUsbSpkrInit (); 		/* Speaker Driver Initialization */
#endif

#ifdef INCDLUE_USB_AUDIO_DEMO
    usrUsbAudioDemo (); 	/* USB Audio Demo */
#endif

#ifdef INCLUDE_USB_MS_BULKONLY_INIT
    usrUsbBulkDevInit(); 	/* Bulk Driver Initialization */
#endif

#ifdef INCLUDE_USB_MS_CBI_INIT
    usrUsbCbiUfiDevInit (); 	/* CBI Driver Initialization */
#endif

#ifdef INCLUDE_USB_PEGASUS_END_INIT
    usrUsbPegasusEndInit (); 	/* Pegasus Driver Initialization */
#endif


#ifdef	INCLUDE_SCSI

    /*
     * initialize either the SCSI1 or SCSI2 interface; initialize SCSI2 when
     * the SCSI2 interface is available.
     */

#ifndef INCLUDE_SCSI2
    scsi1IfInit ();
#else
    scsi2IfInit ();
#endif

    /* initialize SCSI controller */
    if (sysScsiInit () == OK)
	{
	usrScsiConfig ();			/* configure SCSI peripherals */
        }
    else
        {
#ifdef INCLUDE_STDIO
        printf ("sysScsiInit() Failed, SCSI system not initialized\n");
#endif  /* INCLUDE_STDIO */
        }

#endif	/* INCLUDE_SCSI */

#ifdef  INCLUDE_FD     /* initialize floppy disk driver */
    if ((fdDrv (FD_INT_VEC, FD_INT_LVL)) == ERROR)
    	{
#ifdef INCLUDE_STDIO
	printf ("fdDrv returned ERROR from usrRoot.\n");
#endif /* INCLUDE_STDIO */
	}
#endif /* INCLUDE_FD */

#ifdef  INCLUDE_IDE
    /* init IDE disk driver */
    if ((ideDrv (IDE_INT_VEC, IDE_INT_LVL, IDE_CONFIG)) == ERROR)
	{
#ifdef INCLUDE_STDIO
	printf ("ideDrv returned ERROR from usrRoot.\n");
#endif /* INCLUDE_STDIO */
	}

#endif  /* INCLUDE_IDE */
#ifdef  INCLUDE_MMC
  d   /* init IDE disk driver */
    if ((mmcDrv (AT91C_ID_MCI, AT91C_VEC_MCI, IDE_CONFIG)) == ERROR)
	{
#ifdef INCLUDE_STDIO
	printf ("ideDrv returned ERROR from usrRoot.\n");
#endif /* INCLUDE_STDIO */
	}

#endif  /* INCLUDE_MMC */


#ifdef  INCLUDE_ATA
    {                                   /* initialize hard disk driver */
    IMPORT ATA_RESOURCE ataResources[];
    ATA_RESOURCE *pAtaResource;
    for (ix = 0; ix < ATA_MAX_CTRLS; ix++)
        {
        pAtaResource = &ataResources[ix];
        if (pAtaResource->ctrlType == IDE_LOCAL)
            if ((ataDrv (ix, pAtaResource->drives, pAtaResource->intVector,
		   pAtaResource->intLevel, pAtaResource->configType,
                   pAtaResource->semTimeout, pAtaResource->wdgTimeout))
		== ERROR)
		{
#ifdef INCLUDE_STDIO
		printf ("ataDrv returned ERROR from usrRoot.\n");
#endif /* INCLUDE_STDIO */
		}
        }
    }

#ifdef  INCLUDE_SHOW_ROUTINES
    ataShowInit ();                     /* install ATA/IDE show routine */
#endif  /* INCLUDE_SHOW_ROUTINES */
#endif  /* INCLUDE_ATA */

#ifdef  INCLUDE_LPT
    {
    IMPORT LPT_RESOURCE lptResources[];
    lptDrv (LPT_CHANNELS, &lptResources[0]); /* init LPT parallel driver */
    }
#endif  /* INCLUDE_LPT */

#ifdef  INCLUDE_PCMCIA
#ifdef  INCLUDE_SHOW_ROUTINES
    pcmciaShowInit ();			/* install PCMCIA show routines */
#endif  /* INCLUDE_SHOW_ROUTINES */
    pcmciaInit ();			/* init PCMCIA Lib */
#endif  /* INCLUDE_PCMCIA */

#ifdef	INCLUDE_TFFS
    tffsDrv ();				/* it should be after pcmciaInit() */
#endif	/* INCLUDE_TFFS */

#ifdef  INCLUDE_FORMATTED_IO
    fioLibInit ();			/* initialize formatted I/O */
#endif  /* INCLUDE_FORMATTED_IO */

    /* initialize floating point facilities */

#ifdef	INCLUDE_FLOATING_POINT
    floatInit ();			/* initialize floating point I/O */
#endif	/* INCLUDE_FLOATING_POINT */

    /* install software floating point emulation (if applicable) */

#ifdef	INCLUDE_SW_FP
    mathSoftInit ();		/* use software emulation for fp math */
#endif	/* INCLUDE_SW_FP */

    /* install hardware floating point support (if applicable) */

#ifdef	INCLUDE_HW_FP
    mathHardInit (); 		/* do fppInit() & install hw fp math */

#ifdef	INCLUDE_SHOW_ROUTINES
    fppShowInit ();			/* install hardware fp show routine */
#endif	/* INCLUDE_SHOW_ROUTINES */
#endif	/* INCLUDE_HW_FP */

    /* install dsp support (if applicable) */

#ifdef	INCLUDE_DSP
    usrDspInit (); 			/* do dspInit() */
#endif	/* INCLUDE_DSP */

    /* initialize AltiVec library (if applicable) */

#ifdef	INCLUDE_ALTIVEC
    usrAltivecInit ();
#endif	/* INCLUDE_ALTIVEC */

    /* initialize performance monitoring tools */

#ifdef	INCLUDE_SPY
    spyLibInit ();			/* install task cpu utilization tool */
#endif	/* INCLUDE_SPY */

#ifdef	INCLUDE_TIMEX
    timexInit ();			/* install function timing tool */
#endif	/* INCLUDE_TIMEX */

#ifdef  INCLUDE_ENV_VARS
    envLibInit (ENV_VAR_USE_HOOKS);	/* initialize environment variable */
#endif	/* INCLUDE_ENV_VARS */

#ifdef INCLUDE_NTPASSFS
    {
    IMPORT int	    ntPassFsInit();
    IMPORT void *   ntPassFsDevInit();
    IMPORT char	    fullExePath[];
    char	    passName [MAX_FILENAME_LENGTH];
    char *	    defPathEnd;
    
    if (ntPassFsInit(1) == OK)
    	{	
    	if (ntPassFsDevInit("host:") == NULL)
    	    {
#ifdef INCLUDE_STDIO
	    printf ("ntPassFsDevInit failed for host: \n");
#endif /* INCLUDE_STDIO */
	    }
	else
	    {
    	    sprintf (passName, "host:%s", fullExePath);

            /* Remove bootFile name at the end of the string */

    	    defPathEnd = strrchr (passName, '\\');
    	    if (defPathEnd != NULL)
    		*defPathEnd = '\0';

    	    ioDefPathSet (passName);
	    }
	}
    else	
    	{
#ifdef INCLUDE_STDIO
	printf ("ntPassFsInit failed\n");
#endif /* INCLUDE_STDIO */
	}
    }
#endif /* INCLUDE_NTPASSFS */

    /* initialize object module loader */

#ifdef	INCLUDE_LOADER
    moduleLibInit ();			/* initialize module manager */

#if	defined(INCLUDE_AOUT)
    loadAoutInit ();				/* use a.out format */
#else	/* coff or ecoff */
#if	defined(INCLUDE_ECOFF)
    loadEcoffInit ();				/* use ecoff format */
#else	/* ecoff */
#if	defined(INCLUDE_COFF)
    loadCoffInit ();				/* use coff format */
#else   /* coff */
#if	defined(INCLUDE_ELF)
    loadElfInit ();				/* use elf format */
#else
#if	defined(INCLUDE_SOM_COFF)
    loadSomCoffInit ();
#else
#if	defined(INCLUDE_PECOFF)
    {
    extern int loadPecoffInit();

    loadPecoffInit ();
    }
#endif
#endif
#endif
#endif
#endif
#endif

#endif	/* INCLUDE_LOADER */

    /* initialize wtx client to synchronize host and target symbol tables */
#ifdef	INCLUDE_SYM_TBL_SYNC
    symSyncLibInit ();
#endif /* INCLUDE_SYM_TBL_SYNC */

    /* initialize network */

#ifdef  INCLUDE_NET_INIT
    usrBootLineInit (sysStartType);	/* crack the bootline */
# if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
    logMsg ("before usrNetInit()\n", 1,2,3,4,5,6);
    taskDelay (2);	/* allow time for message to be displayed */
# endif	/* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
    usrNetInit (BOOT_LINE_ADRS);	/* initialize network support */
# if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
    logMsg ("after usrNetInit()\n", 1,2,3,4,5,6);
    taskDelay (2);	/* allow time for message to be displayed */
# endif	/* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
#endif	/* INCLUDE_NET_INIT */

#ifdef	INCLUDE_PASSFS
    {
    extern STATUS passFsInit ();
    extern void *passFsDevInit ();
    char passName [256];

    if (passFsInit (1) == OK)
	{
	extern char vxsim_hostname[];
	extern char vxsim_cwd[];

	sprintf (passName, "%s:", vxsim_hostname);
	if (passFsDevInit (passName) == NULL)
	    {
#ifdef INCLUDE_STDIO
	    printf ("passFsDevInit failed for <%s>\n", passName);
#endif /* INCLUDE_STDIO */
	    }
	else
	    {
	    sprintf (passName, "%s:%s", vxsim_hostname, vxsim_cwd);
	    ioDefPathSet (passName);
	    }
	}
    else
#ifdef INCLUDE_STDIO
	printf ("passFsInit failed\n");
#endif /* INCLUDE_STDIO */
    }
#endif	/* INCLUDE_PASSFS */

#ifdef	INCLUDE_DOS_DISK
    {
    char unixName [80];
    extern void unixDrv ();
    extern void unixDiskInit ();
    extern char *u_progname;  /* home of executable */
    char *pLastSlash;

    unixDrv ();

    pLastSlash = strrchr (u_progname, '/');
    pLastSlash = (pLastSlash == NULL) ? u_progname : (pLastSlash + 1);
    sprintf (unixName, "/tmp/%s%d.dos", pLastSlash, sysProcNumGet());
    unixDiskInit (unixName, "A:", 0);
    }
#endif	/* INCLUDE_DOS_DISK */

    /* initialize shared memory objects */

#ifdef INCLUDE_SM_OBJ			/* unbundled shared memory objects */
    usrSmObjInit (BOOT_LINE_ADRS);
#endif /* INCLUDE_SM_OBJ */

   /* initialize WindMP */

#ifdef INCLUDE_VXFUSION			/* unbundled VxFusion (distributed objects) */
    usrVxFusionInit (BOOT_LINE_ADRS);
#ifdef INCLUDE_SHOW_ROUTINES
    {
    extern void msgQDistShowInit();
    extern void distNameShowInit ();
    extern void distIfShowInit ();
    extern void msgQDistGrpShowInit ();

    msgQDistShowInit();
    distNameShowInit ();
    distIfShowInit ();
    msgQDistGrpShowInit ();
    }
#endif /* INCLUDE_SHOW_ROUTINES */
#endif /* INCLUDE_WINDMP */

    /* write protect text segment & vector table only after bpattach () */

#ifdef	INCLUDE_MMU_FULL		/* unbundled mmu product */
#ifdef	INCLUDE_PROTECT_TEXT
    if (vmTextProtect () != OK)
	printf ("\nError protecting text segment. errno = %x\n", errno);
#endif	/* INCLUDE_PROTECT_TEXT */

#ifdef	INCLUDE_PROTECT_VEC_TABLE
    if (intVecTableWriteProtect () != OK)
	printf ("\nError protecting vector table. errno = %x\n", errno);
#endif	/* INCLUDE_PROTECT_VEC_TABLE */
#endif	/* INCLUDE_MMU_FULL */

    /* install select hook only after NFS/RPC for proper delete hook order */

#ifdef	INCLUDE_SELECT
    selTaskDeleteHookAdd ();
#endif	/* INCLUDE_SELECT */

    /* create system and status symbol tables */

#ifdef  INCLUDE_STANDALONE_SYM_TBL
# if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
    logMsg ("before symTblCreate()\n", 1,2,3,4,5,6);
    taskDelay (2);	/* allow time for message to be displayed */
# endif	/* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
    sysSymTbl = symTblCreate (SYM_TBL_HASH_SIZE_LOG2, TRUE, memSysPartId);

#ifdef	INCLUDE_SYM_TBL_SYNC
    /* create a module (group 1) that is not synchronized (SPR# 20301) */

    moduleCreate ("vxWorks.sym",
#if (defined INCLUDE_AOUT)
		  MODULE_A_OUT,
#elif ((defined INCLUDE_COFF) || (defined INCLUDE_ECOFF) || \
       (defined INCLUDE_SOMCOFF))
		  MODULE_ECOFF,
#elif (defined INCLUDE_ELF)
		  MODULE_ELF,
#endif /* INCLUDE_AOUT */
		  HIDDEN_MODULE|LOAD_NO_SYMBOLS);
#endif /* INCLUDE_SYM_TBL_SYNC */

    printf ("\nAdding %ld symbols for standalone.\n", standTblSize);

    /* fill in from built in table*/

    for (ix = 0; (ULONG) ix < standTblSize; ix++)
#if	((CPU_FAMILY == ARM) && ARM_THUMB)
	thumbSymTblAdd (sysSymTbl, &(standTbl[ix]));
#else
	symTblAdd (sysSymTbl, &(standTbl[ix]));
#endif	/* CPU_FAMILY == ARM */
# if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
    logMsg ("sysSymTbl complete.\n", 1,2,3,4,5,6);
    taskDelay (2);	/* allow time for message to be displayed */
# endif	/* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
#endif	/* INCLUDE_STANDALONE_SYM_TBL */

#ifdef  INCLUDE_NET_SYM_TBL
    sysSymTbl = symTblCreate (SYM_TBL_HASH_SIZE_LOG2, TRUE, memSysPartId);

    netLoadSymTbl ();				/* fill in table from host */
#endif	/* INCLUDE_NET_SYM_TBL */

#ifdef  INCLUDE_STAT_SYM_TBL
    statSymTbl = symTblCreate (STAT_TBL_HASH_SIZE_LOG2, FALSE, memSysPartId);

    for (ix = 0; (ULONG)ix < statTblSize; ix ++) /* fill in from builtin table*/
	symTblAdd (statSymTbl, &(statTbl [ix]));
#endif	/* INCLUDE_STAT_SYM_TBL */


    /* initialize C++ support library */

#if	defined (INCLUDE_CPLUS) && defined (INCLUDE_CPLUS_MIN)
#error	Define only one of INCLUDE_CPLUS or INCLUDE_CPLUS_MIN, not both
#endif

#if	defined (INCLUDE_CPLUS) || defined (INCLUDE_CPLUS_MIN)
#ifndef INCLUDE_CTORS_DTORS
#define INCLUDE_CTORS_DTORS
#endif
#endif

#ifdef  INCLUDE_CTORS_DTORS 
  /* 
   * call compiler generated init functions (usually - but not necessarily -
   * C++ related)
   */
   cplusCtorsLink ();
#endif

#ifdef	INCLUDE_CPLUS			/* all standard C++ runtime support */
    cplusLibInit ();
#endif

#ifdef	INCLUDE_CPLUS_MIN		/* minimal C++ runtime support */
    cplusLibMinInit ();
#endif

#ifdef INCLUDE_CPLUS_DEMANGLER
    cplusDemanglerInit ();
#endif

    /* initialize COM/DCOM runtime support */
#ifdef INCLUDE_COM
    comLibInit ();
#endif
#ifdef INCLUDE_DCOM
    dcomLibInit ();
#endif

    /* initialize Wind Web Server */

#ifdef INCLUDE_HTTP
    httpd ();
#endif /* INCLUDE_HTTP */

#ifdef   INCLUDE_RBUFF                  /* install rBuff support */
    rBuffLibInit();
#ifdef  INCLUDE_SHOW_ROUTINES
    rBuffShowInit ();                   /* install rBuff show routine */
#endif  /* INCLUDE_SHOW_ROUTINES */
#endif /* INCLUDE_RBUFF */

#ifdef INCLUDE_WINDVIEW
    windviewConfig ();
#endif /* INCLUDE_WINDVIEW */


    /* initialize the WDB debug agent */

#ifdef  INCLUDE_WDB
# if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
    logMsg ("before wdbConfig()\n", 1,2,3,4,5,6);
    taskDelay (2);	/* allow time for message to be displayed */
# endif	/* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
    wdbConfig();
# if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
    logMsg ("after wdbConfig()\n", 1,2,3,4,5,6);
    taskDelay (2);	/* allow time for message to be displayed */
# endif	/* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */

#ifdef	INCLUDE_WDB_BANNER

#if (WDB_COMM_TYPE == WDB_COMM_NETWORK)
#define WDB_COMM_TYPE_STR "WDB_COMM_NETWORK"
#endif /* WDB_COMM_TYPE == WDB_COMM_NETWORK */

#if (WDB_COMM_TYPE == WDB_COMM_SERIAL)
#define WDB_COMM_TYPE_STR "WDB_COMM_SERIAL"
#endif /* WDB_COMM_TYPE == WDB_COMM_SERIAL */

#if (WDB_COMM_TYPE == WDB_COMM_TYCODRV_5_2)
#define WDB_COMM_TYPE_STR "WDB_COMM_TYCODRV_5_2"
#endif /* WDB_COMM_TYPE == WDB_COMM_TYCODRV_5_2 */

#if (WDB_COMM_TYPE ==  WDB_COMM_NETROM)
#define WDB_COMM_TYPE_STR "WDB_COMM_NETROM"
#endif /* WDB_COMM_TYPE == WDB_COMM_NETROM */

#if (WDB_COMM_TYPE ==  WDB_COMM_VTMD)
#define WDB_COMM_TYPE_STR "WDB_COMM_VTMD"
#endif /* WDB_COMM_TYPE == WDB_COMM_VTMD */

#if (WDB_COMM_TYPE ==  WDB_COMM_END)
#define WDB_COMM_TYPE_STR "WDB_COMM_END"
#endif /* WDB_COMM_TYPE == WDB_COMM_END */

#if (WDB_COMM_TYPE ==  WDB_COMM_CUSTOM)
#define WDB_COMM_TYPE_STR "WDB_COMM_CUSTOM"
#endif /* WDB_COMM_TYPE == WDB_COMM_CUSTOM */

#if (WDB_COMM_TYPE ==  WDB_COMM_PIPE)
#define WDB_COMM_TYPE_STR "WDB_COMM_PIPE"
#endif /* WDB_COMM_TYPE == WDB_COMM_PIPE */

#ifndef WDB_COMM_TYPE_STR
#define WDB_COMM_TYPE_STR "Unknown"
#endif /* WDB_COMM_TYPE_STR */

#ifndef INCLUDE_SHELL
    /* WDB banner same as printed by usrWdbBanner */
    printf ("\n\n");
    printf ("%23s\n\n", runtimeName);
    printf ("Copyright 1984-2002  Wind River Systems, Inc.\n\n");
    printf ("            CPU: %s\n", sysModel ());
    printf ("   Runtime Name: %s\n", runtimeName);
    printf ("Runtime Version: %s\n", runtimeVersion);
    printf ("    BSP version: " BSP_VERSION BSP_REV "\n");
    printf ("        Created: %s\n", creationDate);
    printf ("  WDB Comm Type: %s\n", WDB_COMM_TYPE_STR);
    printf ("            WDB: %s.\n\n",
	    ((wdbRunsExternal () || wdbRunsTasking ()) ?
		 "Ready" : "Agent configuration failed") );
	printf("\n@@@@@line:%d, function:%s, file:%s",__LINE__,__FUNCTION__,__FILE__);
#endif /*INCLUDE_SHELL*/

#endif /*INCLUDE_WDB_BANNER*/

#endif  /* INCLUDE_WDB */

    /* initialize interactive shell */

#ifdef  INCLUDE_SHELL
#ifdef	INCLUDE_SECURITY			/* include shell security */
	printf("\n@@@@@line:%d, function:%s, file:%s",__LINE__,__FUNCTION__,__FILE__);
    if ((sysFlags & SYSFLG_NO_SECURITY) == 0)
	{
		printf("\n@@@@@line:%d, function:%s, file:%s",__LINE__,__FUNCTION__,__FILE__);
        loginInit ();				/* initialize login table */
		printf("\n@@@@@line:%d, function:%s, file:%s",__LINE__,__FUNCTION__,__FILE__);
        shellLoginInstall (loginPrompt, NULL);	/* install security program */
		printf("\n@@@@@line:%d, function:%s, file:%s",__LINE__,__FUNCTION__,__FILE__);

	/* add additional users here as required */

        loginUserAdd (LOGIN_USER_NAME, LOGIN_PASSWORD);
	}
#endif	/* INCLUDE_SECURITY */
printf("\n@@@@@line:%d, function:%s, file:%s",__LINE__,__FUNCTION__,__FILE__);
    printLogo ();				/* print out the banner page */

    printf ("                               ");
    printf ("CPU: %s.  Processor #%d.\n", sysModel (), sysProcNumGet ());
    printf ("                              ");
#ifdef	HITACHI_SH_KERNEL_ON_SDRAM
    printf ("Memory Size: 0x%x.", (UINT)(sysMemTop () - (char *)FREE_RAM_ADRS));
#else	/* HITACHI_SH_KERNEL_ON_SDRAM */
    printf ("Memory Size: 0x%x.", (UINT)(sysMemTop () - (char *)LOCAL_MEM_LOCAL_ADRS));
#endif	/* HITACHI_SH_KERNEL_ON_SDRAM */
    printf ("  BSP version " BSP_VERSION BSP_REV ".");
#if defined(INCLUDE_WDB) && defined(INCLUDE_WDB_BANNER)
    printf ("\n                             ");
    printf ("WDB Comm Type: %s", WDB_COMM_TYPE_STR);
    printf ("\n                            ");
    printf ("WDB: %s.",
	    ((wdbRunsExternal () || wdbRunsTasking ()) ?
		 "Ready" : "Agent configuration failed") );
	printf("\n@@@@@line:%d, function:%s, file:%s",__LINE__,__FUNCTION__,__FILE__);
#endif /*INCLUDE_WDB && INCLUDE_WDB_BANNER*/
    printf ("\n\n");

#ifdef	INCLUDE_STARTUP_SCRIPT			/* run a startup script */
    if (sysBootParams.startupScript [0] != EOS)
	usrStartupScript (sysBootParams.startupScript);
#endif	/* INCLUDE_STARTUP_SCRIPT */

    shellInit (SHELL_STACK_SIZE, TRUE);		/* create the shell */


    /* only include the simple demo if the shell is NOT included */

#else
#if defined(INCLUDE_DEMO)			/* create demo w/o shell */
    taskSpawn ("demo", 20, 0, 2000, (FUNCPTR)usrDemo, 0,0,0,0,0,0,0,0,0,0);
#endif						/* mips cpp no elif */

#endif	/* INCLUDE_SHELL */

#ifdef  INCLUDE_WINDML
    usrWindMlInit ();
#endif  /* INCLUDE_WINDML */

#if defined (INCLUDE_SOUND) && defined(INCLUDE_SB16)
    sb16Drv ();            /* install sound driver SB16 */

    sb16DevCreate ("/sound", 0x220, 5, 1, 5);
#endif /* INCLUDE_SOUND && INCLUDE_SB16 */

#if defined (INCLUDE_SOUND_CODEC)
    sndDac3550Drv ();            /* install sound driver Dac3550a */
    sndDac3550DevCreate ("/sound", 0x220, 5, 1, 5);
#endif

#if defined(INCLUDE_JAVA)
    javaConfig ();
#endif	/* INCLUDE_JAVA */

#ifdef INCLUDE_HTML
    usrHtmlInit ();
#endif /* INCLUDE_HTML */

#if CPU==SIMNT
    win_ReleaseMutex(simUpMutex);
#endif

#ifdef INCLUDE_USER_APPL
    /* Startup the user's application */

    USER_APPL_INIT;	/* must be a valid C statement or block */
#endif

    }
示例#8
0
//todo - get string instead of char!
void PlayFullGame()
{
	isGameBoy = 1;
	char nextMoveAux;
	int lastPlayer = 0;
	
	numOfPlayers = mmap(NULL, sizeof (*numOfPlayers), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
	*numOfPlayers = 0;

	gameHasEnded = mmap(NULL, sizeof (*gameHasEnded), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
	*gameHasEnded = -1; // game will be over if gameHasEnded is != -1
	
	nextMove = mmap(NULL, sizeof(*nextMove), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);

	player = mmap(NULL, sizeof (*player), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
	*player = 100;

	Currentplayer = mmap(NULL, sizeof (*Currentplayer), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
	*Currentplayer = 0;

	a = mmap(NULL, sizeof (*a), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
	b = mmap(NULL, sizeof (*b), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);

	char* moduleName = "/dev/snake17";
	int status;
	int pid1 = fork();
	if(pid1 == 0) {
		char board[BUFFER_SIZE+1];
		board[BUFFER_SIZE] = '\0';
		//player 1 (white)
		*a=open(moduleName, O_RDWR);
		*numOfPlayers = *numOfPlayers +1;
		while(*gameHasEnded == -1)
		{
			if(*player == 1)
			{
				*player = 0;
				*Currentplayer = 1;
				read(*a, board, BUFFER_SIZE); //board before
				printButtonPress(board,nextMove);

				int res = write(*a,nextMove, 1);
				if(res < 0 ) {*gameHasEnded =1;}

				read(*a, board, BUFFER_SIZE);
				printBoard(board);
				*player = 100;
			}
		}
		_exit(0);
	} else {
		int pid2 = fork();
		if(pid2 == 0) {
			char board[BUFFER_SIZE];
			doLongTask();
			//player 2 (black)
			*b=open(moduleName, O_RDWR);
			*Currentplayer = -1;
			read(*b, board, BUFFER_SIZE);
			printBoard(board);
			*numOfPlayers = *numOfPlayers +1;
			while(*gameHasEnded == -1)
			{
				if(*player == -1)
				{
					*player = 0;
					*Currentplayer = -1;
					read(*b, board, BUFFER_SIZE);
					printButtonPress(board,nextMove);
					int res = write(*b,nextMove, 1);
					if(res < 0 ) {*gameHasEnded =1;}

					read(*b, board, BUFFER_SIZE);
					printBoard(board);
					*player = 100;
					*gameHasEnded = ioctl(*b, SNAKE_GET_WINNER);
				}
			}
			_exit(0);
		} else {
			printLogo();
			doLongTask();
			lastPlayer = -1;
			//manager
			while(*gameHasEnded == -1)
			{
				if(*player == 100 && *numOfPlayers==2)
				{
					char nm;
					scanf(" %c", &nm);
					if(nm != 'a' && nm != 'A' 
						&& nm != 's' && nm != 'S'
						&& nm != 'w' && nm != 'W'
						&& nm != 'd' && nm != 'D'

						&& nm != '2' && nm != '4'
						&& nm != '6' && nm != '8')
					{
						continue;
					}

					if (nm == 'w' || nm == 'W' || nm == '8')
					{     
						nextMoveAux = UP;
					}
					else if (nm == 's' || nm == 'S' || nm == '2')
					{
				    	nextMoveAux = DOWN;
					}
					else if (nm == 'a' || nm == 'A' || nm == '4')
					{
				    	nextMoveAux = LEFT;
					}
					else if (nm == 'd' || nm == 'D' || nm == '6')
					{
				    	nextMoveAux = RIGHT;
					}

					*nextMove = nextMoveAux; 
					*player = lastPlayer * (-1);
					lastPlayer = *player;
				}
			}
			printGameOver();
		    close(*a);
    		close(*b);	
			wait(&status);
		}
		wait(&status);
	}
	munmap(numOfPlayers, sizeof (*numOfPlayers));
	munmap(gameHasEnded, sizeof (*gameHasEnded));
	munmap(nextMove, sizeof (*nextMove));
	munmap(player, sizeof (*player));
	munmap(Currentplayer, sizeof (*Currentplayer));
	munmap(a, sizeof (*a));
	munmap(b, sizeof (*b));
}