Пример #1
0
/**
    Pause all modules which will affect the stability of system clock change.
*/
static void SysClk_PauseAll(void)
{
    // Ask file system to pause any read/write
    FilesysPause();
    FilesysWaitPaused();

    // Pause audio
    bIsAudioBusy = aud_isBusy();
    if (bIsAudioBusy == TRUE)
    {
        debug_ind(("Pause Audio\r\n"));
        aud_pause();
    }

    // Pause image pipeline
    IPL_Stop2Dram();

    // Pause IDE
    // Although do ide_wait_frame_end() without disable IDE seems work in most cases,
    // Chances are that it may be interrupted between ide_wait_frame_end and the following
    // clk_changeDMA() in some implementation with different tasks configuration.
    // So it is safe to always disable IDE before calling to clk_changeDMA().
    // However, it will have LCD display to be freezing or flashing for two frames time, so
    // care must be taken in switching clock frequency.
    bIDEIsEnabled = ide_get_en();

    if (bIDEIsEnabled)
    {
#if   (CHANGE_DMA_CLOCK_IDE_OPT == WAIT_IDE_VD)
        ide_wait_frame_end();
#elif (CHANGE_DMA_CLOCK_IDE_OPT == WAIT_IDE_WIN)
        uiIDEWinEN = ide_get_window_en();
        ide_set_allwindow_dis();
        ide_set_load();
        ide_wait_frame_end();
#elif (CHANGE_DMA_CLOCK_IDE_OPT == WAIT_IDE_IDE)
        ide_wait_frame_end();
        ide_set_en(FALSE);
#endif
    }
}
Пример #2
0
enum boolean_e korpus_aud_isBusy(korpus_t * self, int numb)
{
    if (numb < 0 || numb >= self->audCount)
        return FALSE;
    return aud_isBusy(self->auds[numb]);
}
Пример #3
0
void PlaySoundTsk(void)
{
    FLGPTN              uiFlag;
    AUDIO_DEVICE_OBJ    AudioDevice;
    AUDIO_BUF_QUEUE     AudioBufQueue;
    //#NT#2010/01/20#JustinLee -begin
    //#Add wav header parsing before playing sound data
    WAV_FILEINFO        WAVFileInfo;
    //#NT#2010/01/20#JustinLee -end

    while (1)
    {
        wai_flg(&uiFlag, FLG_ID_SOUND, FLGSOUND_STOP | FLGSOUND_PLAY, TWF_ORW | TWF_CLR);

        if (uiFlag & FLGSOUND_STOP)
        {
            if (g_uiPlaySoundStatus == PLAYSOUND_STS_PLAYING)
            {
                aud_stop();
                aud_close();
                g_uiPlaySoundStatus = PLAYSOUND_STS_STOPPED;

                set_flg(FLG_ID_SOUND, FLGSOUND_STOPPED);
            }
        }

        if (uiFlag & FLGSOUND_PLAY)
        {
            //#NT#2009/06/24#Chris Chung -begin
            //#NT#avoid re-entry to audio driver.
            if(aud_isBusy())
                continue;
            //#NT#2009/06/24#Chris Chung -end

            g_uiPlaySoundStatus = PLAYSOUND_STS_PLAYING;
            clr_flg(FLG_ID_SOUND, FLGSOUND_STOPPED);

            // Open audio driver
            aud_getDeviceObject(&AudioDevice);
            AudioDevice.pEventHandler = PlaySound_AudioHdl;
            aud_open(&AudioDevice);

            switch (g_uiPlaySoundSound)
            {
            case PLAYSOUND_SOUND_STARTUP:
            case PLAYSOUND_SOUND_SHUTDOWN:
                // Parse header before playing
                if(PlaySound_ParseWAVHeader((UINT32)g_PowerOn_SoundKey.puiData, &WAVFileInfo) == TRUE)
                {
                    // Set sampling rate and channel based on parameter
                    aud_setSamplingRate(WAVFileInfo.AudioSamplingRate);
                    aud_setChannel(WAVFileInfo.AudioChannel);

                    // Set audio buffer queue addr and size
                    AudioBufQueue.uiAddress = ((UINT32)g_PowerOn_SoundKey.puiData) + (sizeof(WAV_PCMHEADER));
                    AudioBufQueue.uiSize    = WAVFileInfo.uiDataSize;
                }
                else
                {
                    // Set sampling rate and channel manually
                    aud_setSamplingRate(AUDIO_SR_32000);
                    aud_setChannel(AUDIO_CH_LEFT);

                    // Set audio buffer queue addr and size
                    AudioBufQueue.uiAddress = (UINT32)g_PowerOn_SoundKey.puiData;
                    AudioBufQueue.uiSize    = g_PowerOn_SoundKey.uiSize;
                }
                break;
            case PLAYSOUND_SOUND_KEY_SHUTTER2:
                // Parse header before playing
                if(PlaySound_ParseWAVHeader((UINT32)g_Shutter_SoundKey.puiData, &WAVFileInfo) == TRUE)
                {
                    // Set sampling rate and channel based on parameter
                    aud_setSamplingRate(WAVFileInfo.AudioSamplingRate);
                    aud_setChannel(WAVFileInfo.AudioChannel);

                    // Set audio buffer queue addr and size
                    AudioBufQueue.uiAddress = ((UINT32)g_Shutter_SoundKey.puiData) + (sizeof(WAV_PCMHEADER));
                    AudioBufQueue.uiSize    = WAVFileInfo.uiDataSize;
                }
                else
                {
                    // Set sampling rate and channel manually
                    aud_setSamplingRate(AUDIO_SR_32000);
                    aud_setChannel(AUDIO_CH_LEFT);

                    // Set audio buffer queue addr and size
                    AudioBufQueue.uiAddress = (UINT32)g_Shutter_SoundKey.puiData;
                    AudioBufQueue.uiSize    = g_Shutter_SoundKey.uiSize;
                }
                break;

            case PLAYSOUND_SOUND_KEY_OTHERS:
                // Parse header before playing
                if(PlaySound_ParseWAVHeader((UINT32)g_SoundKey.puiData, &WAVFileInfo) == TRUE)
                {
                    // Set sampling rate and channel based on parameter
                    aud_setSamplingRate(WAVFileInfo.AudioSamplingRate);
                    aud_setChannel(WAVFileInfo.AudioChannel);

                    // Set audio buffer queue addr and size
                    AudioBufQueue.uiAddress = ((UINT32)g_SoundKey.puiData) + (sizeof(WAV_PCMHEADER));
                    AudioBufQueue.uiSize    = WAVFileInfo.uiDataSize;
                }
                else
                {
                    // Set sampling rate and channel manually
                    aud_setSamplingRate(AUDIO_SR_32000);
                    aud_setChannel(AUDIO_CH_LEFT);

                    // Set audio buffer queue addr and size
                    AudioBufQueue.uiAddress = (UINT32)g_SoundKey.puiData;
                    AudioBufQueue.uiSize    = g_SoundKey.uiSize;
                }
                break;

            default:
                aud_close();
                continue;
            }

            // Set time code offset and first time code trigger value
            aud_setTimecodeOffset(0);
            aud_setTimecodeTrigger(AudioBufQueue.uiSize >> 1);

            // Reset audio buffer queue and add buffer to queue
            aud_resetBufferQueue();
            aud_addBufferToQueue(&AudioBufQueue);

            // Start to play
            aud_playback(FALSE, TRUE);
        }
    }
}
Пример #4
0
/**
    Reset and run

    Reset and run

    @param uiStorage    Read FW from what storage, refer to PrimaryTsk.h
        - @bPRIMARY_STGTYPE_NAND:   NAND
        - @bPRIMARY_STGTYPE_SD:     SD Card
    @return void
*/
void UpdateNand_Reset(UINT32 uiAddress, UINT32 uiFileLen)
{
#if (_LOADFW_INMAIN_ == ENABLE)
    UINT32 i;

    // Close file system
    FilesysClose(FST_TIME_INFINITE);

    // Stop audio
    if (aud_isBusy() == TRUE)
    {
        aud_stop();
        aud_close();
    }

    // Disable image pipeline
    if (sie_isEnabled() == TRUE &&
        sie_CheckFunction_Enable(SIE_CROP_EN) == TRUE &&
        pll_isClockEnabled(SIE_PXCLK) == TRUE &&
        // We have to check CCD's clock too.
        // Since demo board's CCD clock is an external OSC,
        // we don't check the clock is enabled or disabled now.
        /*
        GPIOMap_IsCCDClockOn() == TRUE &&
        */
        GPIOMap_IsCCDPowerOn() == TRUE)

    {
        StopPreviewDramData();
    }

    // Turn off CCD power
    GPIOMap_TurnOffCCDPower();

    // Turn off LCD backlight
    GPIOMap_TurnOffLCDBacklight();

    // Turn off lens motor power
    gpio_setPin(GPIO_LENS_RST);

    // Disable IDE
    ide_wait_frame_end();
    ide_set_en(FALSE);

    // Disable all interrupts
    int_disable_multi(_INT_ALL);

    // Disable all modules' clock except some (UPDNAND_CLK_MODULE_MASK1, UPDNAND_CLK_MODULE_MASK2)
    pll_setClockEnableRegister1(pll_getClockEnableRegister1() & UPDNAND_CLK_MODULE_MASK1);
    pll_setClockEnableRegister2(pll_getClockEnableRegister2() & UPDNAND_CLK_MODULE_MASK2);

    //#NT#2008/05/30#Stephen Wang -begin
    // Reset all modules except some (UPDNAND_RESET_MODULE_MASK)
    pll_enableSystemReset1(0xFFFFFFFF & ~UPDNAND_RESET_MODULE_MASK);
    pll_disableSystemReset1(0xFFFFFFFF & ~UPDNAND_RESET_MODULE_MASK);
    //#NT#2008/05/30#Stephen Wang -end

    // Copy FW code to 0x00000000
    // Since original main code will be overwriten by new main code,
    // we can't call ANSI C memcpy() API to copy data.
    for (i=0; i<uiFileLen; i+=4)
    {
        *(UINT32 *)i = *(UINT32 *)(uiAddress + i);
    }

    // Handle I/D Cache
    // Since original main code will be overwriten by new main code,
    // we can't call APIs in Cache.h to handle cache.
    __asm
    {
        MOV     r0, #0

        // Clear and invalidate data cache
        MCR     p15, 0, r0, c7, c14, 0

        // Drain write buffer
        MCR     p15, 0, r0, c7, c10, 4

        // Invalidate instruction cache
        MCR     p15, 0, r0, c7, c5, 0

        // Disable instruction / data cache and MPU
        // FA510 CFGR default value is 0x00000078
        MOV     r0, #0x00000078
        MCR     p15, 0, r0, c1, c0, 0
    }

    // Branch to new main code reset vector and run new main code
    start();
#endif
}
Пример #5
0
/**
    Pause all modules which will affect the stability of system clock change.
*/
static void SysClk_PauseAll(void)
{
    //IPL_OBJ IplObj;

    debug_ind(("SysClk_PauseAll enter\r\n"));

    // Ask file system to pause any read/write
    FilesysPause();
    FilesysWaitPaused();

    // Pause audio
    bIsAudioBusy = aud_isBusy();
    if (bIsAudioBusy == TRUE)
    {
        //debug_ind(("Pause Audio\r\n"));

        aud_pause();
    }

    // Pause image pipeline
    if (sie_isEnabled() == TRUE &&                          // SIE is enabled
        pll_isClockEnabled(SIE_PXCLK) == TRUE &&            // Pixel clock is enabled
    #if (SYSINIT_OUTPUT_MCLK == ENABLE)
        //pinmux_get_mclk() == PINMUX_MCLK &&                 // CCD clock is on
        pll_isClockEnabled(SIE_MCLK) == TRUE &&
    #endif
        GPIOMap_IsSensorPowerOn() == TRUE)

    {
        //debug_ind(("Pause SIE\r\n"));

        bIsCropEnabled = TRUE;
        //#NT#2007/08/09Adrian Jiang -begin
        //#Stop ImagePipeline properly.
        //StopPreviewDramData();
        //IplObj.uiCmd = IPL_CMD_CHG_MODE;
        //IplObj.Mode = IPL_MODE_OFF;
        //IPL_SetCmd(&IplObj);
        IPP_PauseEng_SysclkTest();
        //#NT#2007/08/09#Adrian Jiang -end
    }
    else
    {
        bIsCropEnabled = FALSE;
    }

    // Pause IDE
    // Although do ide_wait_frame_end() without disable IDE seems work in most cases,
    // Chances are that it may be interrupted between ide_wait_frame_end and the following
    // clk_changeDMA() in some implementation with different tasks configuration.
    // So it is safe to always disable IDE before calling to clk_changeDMA().
    // However, it will have LCD display to be freezing or flashing for two frames time, so
    // care must be taken in switching clock frequency.
    bIDEIsEnabled = ide_get_en();
    if (bIDEIsEnabled)
    {
        //debug_ind(("Pause IDE\r\n"));

#if CHANGE_DMA_CLOCK_IDE_OPT == WAIT_IDE_VD
        ide_wait_frame_end();
#elif CHANGE_DMA_CLOCK_IDE_OPT == WAIT_IDE_WIN
        uiIDEWinEN = ide_get_window_en();
        ide_set_allwindow_dis();
        ide_set_load();
        ide_wait_frame_end();
#elif CHANGE_DMA_CLOCK_IDE_OPT == WAIT_IDE_IDE
        ide_wait_frame_end();
        ide_set_en(FALSE);
#endif
    }

    debug_ind(("SysClk_PauseAll leave\r\n"));
}