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

📄 pocketanalyzer.c

📁 可编程器件厂商Xilinx的手持式逻辑分析仪的逻辑设计
💻 C
📖 第 1 页 / 共 3 页
字号:
/* Description of Change:  ?                                                  */
/*                                                                            */
/*============================================================================*/
static Err RomVersionCompatible(UInt32 ulRequiredVersion, UInt16 uiLaunchFlags)
{
    /*========================================================================*/
    /* Declare all local variables.                                           */
    /*========================================================================*/
    UInt32 ulRomVersion;

    /*========================================================================*/
    /* Get the ROM version currently running on the device.                   */
    /*========================================================================*/
    FtrGet(sysFtrCreator, sysFtrNumROMVersion, &ulRomVersion);

    /*========================================================================*/
    /* If the current ROM version is earlier than the required ROM version    */
    /* the return an error.  If the application was going to launch the UI,   */
    /* then also alert the user to error before returning.                    */
    /*========================================================================*/
    if (ulRomVersion < ulRequiredVersion)
    {
        if ((uiLaunchFlags &
             (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) ==
             (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp))
        {
            FrmAlert (RomIncompatibleAlert);

            /*================================================================*/
            /* Palm OS 1.0 will continuously relaunch this app unless we      */
            /* switch to another safe one.                                    */
            /*================================================================*/
            AppLaunchWithCommand(sysFileCDefaultApp,
                                 sysAppLaunchCmdNormalLaunch, NULL);
        }

        return sysErrRomIncompatible;
    }

    /*========================================================================*/
    /* Return No Error since the ROM version is compatible.                   */
    /*========================================================================*/
    return(errNone);
}




/*============================================================================*/
/* Function:            AppStart                                              */
/* Description:         This routine gets the application's preferences and   */
/*                      sets the signals to turn the SpringBoard Module on.   */
/*                                                                            */
/* Arguments:           None                                                  */
/* Returns:             ErrCode = Error code of startup operations.  0 if     */
/*                                there are no errors.                        */
/* Globals affected:    None                                                  */
/* Hardware affected:   None                                                  */
/*                                                                            */
/*============================================================================*/
/* Change History:                                                            */
/*                                                                            */
/* ECO#:  ?                                                                   */
/* Change Date:  dd-mmm-yyyy                                                  */
/* Changed By:   ?                                                            */
/* Description of Change:  ?                                                  */
/*                                                                            */
/*============================================================================*/
static Err AppStart(void)
{
    /*========================================================================*/
    /* Declare all local variables.                                           */
    /*========================================================================*/
    UInt16 uiPrefsSize;
    Int16  iGetPrefsResult;
    Err    Error = errNone;
    UInt16 index;

    /*========================================================================*/
    // Read the saved preferences / saved-state information.
    /*========================================================================*/
    uiPrefsSize = sizeof(AppPrefsType);

    /*========================================================================*/
    /* Get the applications saved preferences.                                */
    /*========================================================================*/
    iGetPrefsResult = PrefGetAppPreferences (appFileCreator,
                                             appPrefID,
                                             &AppPrefs,
                                             &uiPrefsSize,
                                             true);

    /*========================================================================*/
    /* If there was not a preferences record to retrieve or if the size of    */
    /* the preferences structure is not equal to the size of the returned     */
    /* record size, then notify the user that there  was an error and set the */
    /* default values to be used.                                             */
    /*========================================================================*/
    if ((iGetPrefsResult == noPreferenceFound) ||
        (uiPrefsSize <= iGetPrefsResult))
    {
        FrmAlert (InvalidPrefsRecordAlert);

        AppPrefs.bAutoSweepMode = true;
        AppPrefs.bGotoTrigOnRun = true;
        StrCopy (AppPrefs.ChnlLabel[0], "Ch0");
        StrCopy (AppPrefs.ChnlLabel[1], "Ch1");
        StrCopy (AppPrefs.ChnlLabel[2], "Ch2");
        StrCopy (AppPrefs.ChnlLabel[3], "Ch3");
        StrCopy (AppPrefs.ChnlLabel[4], "Ch4");
        StrCopy (AppPrefs.ChnlLabel[5], "Ch5");
        StrCopy (AppPrefs.ChnlLabel[6], "Ch6");
        StrCopy (AppPrefs.ChnlLabel[7], "Ch7");
        AppPrefs.PreTrigger = preTrigger10Percent;
        AppPrefs.ChnlTriggers[7] = trigwordDontCare;
        AppPrefs.ChnlTriggers[6] = trigwordDontCare;
        AppPrefs.ChnlTriggers[5] = trigwordDontCare;
        AppPrefs.ChnlTriggers[4] = trigwordDontCare;
        AppPrefs.ChnlTriggers[3] = trigwordDontCare;
        AppPrefs.ChnlTriggers[2] = trigwordDontCare;
        AppPrefs.ChnlTriggers[1] = trigwordDontCare;
        AppPrefs.ChnlTriggers[0] = trigwordDontCare;
        AppPrefs.Timebase = Timebase50nsec;
        AppPrefs.bChnlOn[0] = true;
        AppPrefs.bChnlOn[1] = true;
        AppPrefs.bChnlOn[2] = true;
        AppPrefs.bChnlOn[3] = true;
        AppPrefs.bChnlOn[4] = true;
        AppPrefs.bChnlOn[5] = true;
        AppPrefs.bChnlOn[6] = true;
        AppPrefs.bChnlOn[7] = true;
        AppPrefs.ActiveChnlCnt = 8;
    }

    /*========================================================================*/
    /* Initialize the Plot Data.                                              */
    /*========================================================================*/
    PlotData.TrigDataBuffOffset = PreTrigSmpls(AppPrefs.Timebase);
    PlotData.bTrigInHiByte = false;
    for (index = 0; index < DataBuffSize; index++)
        PlotData.SmplData[index] = 0;
    PlotData.PlotFromSmplIdx = 0;
    PlotData.PlotToSmplIdx = 5 * TimebaseInNSec(AppPrefs.Timebase) /
                                 SampleRateInNSec(AppPrefs.Timebase);
    PlotData.AcquisitionInProcess = false;

    /*========================================================================*/
    /* Set the timeout for the event loop query for a new event to 1 sec.     */
    /*========================================================================*/
    EventLoopTimeout = SysTicksPerSecond();

    return(Error);
}




/*============================================================================*/
/* Function:            AppStop                                               */
/* Description:         This routine saves the current application's current  */
/*                      preferences and does any final cleanup including      */
/*                      closing all of the open forms before the application  */
/*                      exits.                                                */
/*                                                                            */
/* Arguments:           None                                                  */
/* Returns:             None                                                  */
/* Globals affected:    None                                                  */
/* Hardware affected:   None                                                  */
/*                                                                            */
/*============================================================================*/
/* Change History:                                                            */
/*                                                                            */
/* ECO#:  ?                                                                   */
/* Change Date:  dd-mmm-yyyy                                                  */
/* Changed By:   ?                                                            */
/* Description of Change:  ?                                                  */
/*                                                                            */
/*============================================================================*/
static void AppStop (void)
{

⌨️ 快捷键说明

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