⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialog.c

📁 用于TM1300/PNX1300系列DSP(主要用于视频处理)的操作系统pSOS。包括全部源码
💻 C
📖 第 1 页 / 共 2 页
字号:
                ErrFlag = TRUE;                }            } while (ErrFlag);        }    }}#endif/***********************************************************************//* SysVarsChange: Interactively lead the user through the system       *//*                variables, allowing the option of changing each that *//*                is relevant.                                         *//*                                                                     *//*        NOTE: Exact sequence of questions depends on the values of   *//*              the parameters.  For example, if they say NO to an     *//*              Ethernet interface, we don't ask them for an IP        *//*              address to use on the Ethernet.                        *//*                                                                     *//***********************************************************************/static void SysVarsChange(void){ULONG OperatingMode, MaxAnswer, baud;UCHAR FirstTime, ErrFlag, ans;char AppName[80];UCHAR GotNodeNumber;GotNodeNumber = 0;#ifdef SC_APP_NAME    copy(AppName, SC_APP_NAME, 80);#else    copy(AppName, "Application", 80);#endifFirstTime = TRUE;for (;;)    {    if (!FirstTime) SysVarsPrint();    FirstTime = FALSE;    /*-----------------------------------------------------------------*/    /* First, see if they even want to go through with this.  If not,  */    /* then we're all done.                                            */    /*-----------------------------------------------------------------*/    do        {        ans = 'M';        ErrFlag = FALSE;        Prompt("(M)odify any of this or (C)ontinue?", CHAR, &ans);        if ((ans == 'C') || (ans == 'c'))            {            Delay100ms();    /* Pause so <CR> echo can finish */            return;            }        if ((ans != 'M') && (ans != 'm'))            {            printf("Please answer with 'M' to modify or 'C' to continue\a\n");            ErrFlag = TRUE;            }        } while (ErrFlag);    printf("\nFor each of the following questions, you can press <Return>"          " to select the\n"          "value shown in braces, or you can enter a new value.\n\n");    /*-----------------------------------------------------------------*/    /* Operating mode                                                  */    /*-----------------------------------------------------------------*/#   if SC_PROBE#       if !SC_PNA           if (SysVars.DebugMode == DBG_AP) SysVars.DebugMode = 3;#       endif        do            {            printf("How should the board boot?\n");            printf("  1. pROBE+ standalone mode\n");            printf("  2. pROBE+ waiting for host debugger via "                  "serial connection\n");            MaxAnswer = 2;#           if SC_PNA                printf("  3. pROBE+ waiting for host debugger via "                      "a network connection\n");                MaxAnswer = 3;#               if (SC_PSOS || SC_PSOSM)                    printf("  4. Run the %s\n", AppName);                    MaxAnswer = 4;#               endif#           elif (SC_PSOS || SC_PSOSM)                printf("  3. Run the %s\n", AppName);                MaxAnswer = 3;#           endif            OperatingMode = (ULONG)SysVars.DebugMode;            Prompt("\nWhich one do you want?", DECIMAL, &OperatingMode);            SysVars.DebugMode = (UCHAR)OperatingMode;            if ((OperatingMode == 0) || (OperatingMode > MaxAnswer))                printf("Please enter a number in the range 1-%d\a\n",                      MaxAnswer);            } while ((OperatingMode == 0) || (OperatingMode > MaxAnswer));#       if !SC_PNA           if (OperatingMode == 3) SysVars.DebugMode = DBG_AP;#       endif#   endif    /*-----------------------------------------------------------------*/    /* Network interface parameters                                    */    /*-----------------------------------------------------------------*/#   if SC_PNA        printf("\nNETWORK INTERFACE PARAMETERS:\n");        GotNodeNumber = 0;#       if BSP_LAN1            GetLan1Params();#       endif#       if BSP_SMEM            GetSmemParams(&GotNodeNumber);#       endif#       if (!BSP_LAN1 && !BSP_SMEM)            printf("  (Board has no network interfaces)\n");#       endif        ans = SysVars.DefGtwyIP ? 'Y' : 'N';        Prompt("Should there be a default gateway for packet routing? ",              CHAR, &ans);        if ((ans == 'Y') || (ans == 'y'))            Prompt("What is its IP address?", IP, &(SysVars.DefGtwyIP));        else            SysVars.DefGtwyIP = 0;#   endif    /*-----------------------------------------------------------------*/    /* Multiprocessing (pSOS+m) parameters                             */    /*-----------------------------------------------------------------*/#if BSP_SMEM    printf("\MULTIPROCESSING PARAMETERS:\n");    ans = SysVars.Kism ? 1 : 0;    Prompt("Do you want to configure a multiprocessing pSOS+m system?",           FLAG, &ans);    if (ans == 0)        SysVars.Kism = 0;    else        {        Prompt("How many pSOS+m nodes will it contain?", DECIMAL,               &(SysVars.Kism));        if (GotNodeNumber && (SysVars.Kism != 0))            {            printf("You made this node %d when configuring the SMNI, "                  "so the SMKI will also use that node number\n",                  SysVars.SmNode);            }        else if (SysVars.Kism != 0)            {            do                {                Prompt("Which node should this CPU be?", DECIMAL,                       &(SysVars.SmNode));                if (SysVars.SmNode == 0)                    printf("0 is not a valid node number!\a\n");                if (SysVars.SmNode > SysVars.Kism)                    printf("Maximum node number is %d\a\n", SysVars.Kism);                } while ((SysVars.SmNode == 0)                  || (SysVars.SmNode > SysVars.Kism));            }        if (SysVars.Kism != 0)            Prompt("Bus address of the SMKI directory", HEX,               &(SysVars.KismDiraddr));        }#endif    /*-----------------------------------------------------------------*/    /* Hardware-related parameters                                     */    /*-----------------------------------------------------------------*/    printf("HARDWARE PARAMETERS:\n");    do        {        Prompt("Baud rate for serial channels", DECIMAL,               &(SysVars.DefBaud));        ErrFlag = TRUE;        baud = BSP_SERIAL_MINBAUD;        for (; baud <= BSP_SERIAL_MAXBAUD; baud <<= 1)            {            if (baud == SysVars.DefBaud)                {                ErrFlag = FALSE;                break;                }            }        if (ErrFlag)            {            printf("Valid baud rates are:");            baud = BSP_SERIAL_MINBAUD;            for (; baud <= BSP_SERIAL_MAXBAUD; baud <<= 1)                printf(" %d", baud);            printf("\a\n");            }        } while (ErrFlag);#   if BSP_VME        Prompt("Bus address of this board's dual-ported memory", HEX,               &(SysVars.VmeBaseAddr));#   endif#   if BSP_PARMS        BspModify(BspVars, (void *)Print, (void *)Prompt);#   endif    /*-----------------------------------------------------------------*/    /* Application-dependent parameters                                */    /*-----------------------------------------------------------------*/#   if SC_APP_PARMS        if (SysVars.DebugMode == DBG_AP)            {            char *ptr = AppName;            while (*ptr)       /* Convert app name to upper case */                {                if ((*ptr >= 'a') && (*ptr <= 'z'))                    *ptr = *ptr - 0x20;                ptr++;                }            printf("%s PARAMETERS:\n", AppName);            AppModify(AppVars, (void *)Print, (void *)Prompt);            }#   endif /* SC_APP_PARMS */    /*-----------------------------------------------------------------*/    /* Reset delay - don't allow 0 because then it would become        */    /* impossible to ever change the configuration parameters again!   */    /*-----------------------------------------------------------------*/    Prompt("How long (in seconds) should CPU delay before starting up?",           DECIMAL, &(SysVars.StartupDelay));    if (SysVars.StartupDelay == 0)        {        printf("Minimum delay is 1 second!\a\n");        SysVars.StartupDelay = 1;        }    printf("\n");    }}/***********************************************************************//*      Dialog: Conduct the startup configuration dialog               *//*                                                                     *//***********************************************************************/void Dialog(void){ULONG timeleft;/*---------------------------------------------------------------------*//* Print out the current values.                                       *//*---------------------------------------------------------------------*/printf("\n\n\npSOSystem V%s\n", VERSION_STRING);printf("Copyright (c) 1991 - 1995, Integrated Systems, Inc.\n");SysVarsPrint();/*---------------------------------------------------------------------*//* Wait for user to enter input - if a character is received, do the   *//* dialog thing.  We check for a character 10 times per second.        *//*---------------------------------------------------------------------*/printf("To change any of this, press any key within %d seconds\n",      SysVars.StartupDelay);timeleft = SysVars.StartupDelay * 10;while (timeleft > 0)    {    if (SerialPollConsts(0))        {        UCHAR db;         /**************************************************************/        /* Because we send a lot of messages out, some hosts may send */        /* XON/XOFF to the board.  We have to filter such characters  */        /* out. Normally, XON is defined as DC3 and XOFF is defined   */        /* as DC1, but the hosts may use other characters for         */        /* XON/XOFF, so we will discard all characters which are      */        /* smaller than 0x20 (space) and not equal to '\t', '\n' and  */        /* '\r'.                                                      */        /**************************************************************/        db = SerialPollConin() & 0x7f;        if(db >= ' ' || db == '\t' || db == '\n' || db == '\r')           {           printf("\n");           SysVarsChange();           break;           }        }    else        {        timeleft--;        Delay100ms();        }    }}/***********************************************************************//* GetSmemParams: Prompt for the SMNI parameters                       *//*                                                                     *//*      INPUTS: *GotNodeNumber = non-zero if node number has already   *//*                               been obtained                         *//*     OUTPUTS: *GotNodeNumber = non-zero if node number has been      *//*                               obtained.                             *//*                                                                     *//***********************************************************************/#if (BSP_SMEM && SC_PNA)static void GetSmemParams(UCHAR *GotNodeNumber){UCHAR ans, ErrFlag;/*---------------------------------------------------------------------*//* Find out if they want a shared memory interface at all              *//*---------------------------------------------------------------------*/Prompt("Do you want a shared memory network interface? ", FLAG,       &(SysVars.Nism));if (SysVars.Nism == 0) return;/*---------------------------------------------------------------------*//* Shared memory IP address                                            *//*---------------------------------------------------------------------*/Prompt("IP address for shared memory?", IP, &(SysVars.NismIP));/*---------------------------------------------------------------------*//* Shared memory subnet mask                                           *//*---------------------------------------------------------------------*/ans = 'N';if (SysVars.NismSubnetMask == 0)    Prompt("Use a subnet mask for the shared memory interface? ", CHAR,           &ans);else    ans = 'Y';if ((ans == 'Y') || (ans == 'y'))    {    do        {        Prompt("Subnet mask for shared memory interface (0 for none)?",               HEX, &(SysVars.NismSubnetMask));        ErrFlag = FALSE;        if (!snmsk_ok(SysVars.Lan1IP, SysVars.Lan1SubnetMask))            {            printf("That is not a valid subnet mask\a\n");            ErrFlag = TRUE;            }        } while (ErrFlag);    }/*---------------------------------------------------------------------*//* Node number                                                         *//*---------------------------------------------------------------------*/if (*GotNodeNumber == 1)    printf("REMINDER: This will be node # %d in the shared memory system\n",       SysVars.SmNode);else    {    while (*GotNodeNumber == 0)        {        Prompt("Which node number in the shared memory system is this? ",               DECIMAL, &(SysVars.SmNode));        if (SysVars.SmNode == 0)            printf("0 is not a valid node number!\a\n");        else if (SysVars.SmNode > SMEM_MAXNODES)            printf("Max allowable node number is %d!\a\n", SMEM_MAXNODES);        else            *GotNodeNumber = 1;        }    }/*---------------------------------------------------------------------*//* Address of directory                                                *//*---------------------------------------------------------------------*/Prompt("Bus address of the SMNI directory? ", HEX, &(SysVars.NismDiraddr));}#endif#elsevoid Dialog(void){}                /* To avoid compiler warnings */#endif /* SC_STARTUP_DIALOG */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -