Exemplo n.º 1
0
void vdoa_test(void)
{
    uint8_t *buffer = malloc(IMG_WIDTH * IMG_HEIGHT * 1.5 + 0x1000);
	/*the VDOA file is extracted from VPU decoder in tiled frame mode*/
	uint8_t readfile[] = "vdoa_in.yuv";
    int count, err;
    int fin = 0;

    if (buffer == NULL)
        return;

    hdmi_1080P60_video_output(1, 0);
    if (FSInit(NULL, bufy, maxdevices, maxhandles, maxcaches) != SUCCESS) {
        err = -1;
        return;
    }

    FSDriveInit(DeviceNum);
    SetCWDHandle(DeviceNum);

    print_media_fat_info(DeviceNum);

    if ((fin = Fopen(readfile, (uint8_t *) "r")) < 0) {
        printf("cannot open file %s!\n", readfile);
        return;
    }

    buffer = (uint8_t *) (((uint32_t) buffer + 0xFFF) & 0xFFFFF000);

    set_card_access_mode(1, 0);
    
    count = Fread(fin, (uint8_t *) buffer, IMG_WIDTH * IMG_HEIGHT * 1.5);

    vdoa_clear_interrupt();
    vdoa_setup(IMG_WIDTH, IMG_HEIGHT, IMG_WIDTH, IMG_WIDTH, 0, 0, 16, 0);
    vdoa_start((uint32_t) buffer, IMG_WIDTH * IMG_HEIGHT, IPU2_CH23_EBA0, IMG_WIDTH * 1088);

    while (!vdoa_check_tx_eot()) ;
    Fclose(fin);
}
///////////////////////////////////////////////////////////////////////////////
//
//>  Name:          MtpCheckExternalMedia
//
//   Type:          Function
//
//   Description:   Called by system task
//
//   Inputs:        none
//
//   Outputs:       none 
//
//   Notes:         MTP gets one chance to properly initialize an inserted external media card
//                  After usb has been initialized, if media is present, initialize it. Then StorInit() can run
//<
////////////////////////////////////////////////////////////////////////////////
void _reentrant MtpCheckExternalMedia(void)
{
    BOOL bExternalMediaChanged = FALSE;
    BOOL bMMCPresent = FALSE;
    WORD retCode = !SUCCESS;
    WORD i;

    // Find out if media presence has changed
    DriveGetInfo(MMC_DRIVE_NUM,DriveInfoMediaChange,&bExternalMediaChanged);
    
    // bExternalMediaChanged should be yes if it's started up inserted

    if(bMMCInit || bExternalMediaChanged)
    {
       // Debounce media insertion/removal
        SysDelayMs(MEDIA_INSERTION_DELAY);    

        // Is the media connected or disconnected?
        retCode = DriveGetInfo(MMC_DRIVE_NUM,DriveInfoMediaPresent,&bMMCPresent);
    }

    if(bMMCInit)
    {
        if((retCode == SUCCESS) && g_MtpArbitrationDone)
        {
            if((g_iHighPwrPeriphInitMode == USB_HIGH_CURRENT_GRANTED) && (bMMCPresent))
            {
                // Conditions are okay for MMC initialization to complete.
                // Initialize the MMC media, drive, and filesystem

                // Complete the final phase of MMC media init
                MediaInit(MMC_MEDIA_NUM);

                // Init filesystem for the MMC data drive
                FSDriveInit(MMC_DRIVE_NUM);

                // Load freecluster code resource
                SysLoadMtpBootInit();
                
                // Needed to complete MMC filesystem initialization
                Computefreeluster(MMC_DRIVE_NUM);

                // Reload the FS write resource
                SysLoadWrite();
            
                // Firmware can poll this global to check external media presence
                g_bExternalMediaConnected = TRUE;                        
            }
          
            else
            {
                g_bExternalMediaConnected = FALSE;
            }
        
            // StorInit() watches bMMCInit, and waits for it to become FALSE before carrying out its initialization
            bMMCInit = FALSE;
       }
    }
    else if(bExternalMediaChanged)
    {
        if((retCode == SUCCESS) && (bMMCPresent))
        {   
            // If, after the system has started and been initialized in MTP mode, external media is inserted, 
            // we can't notify the host, so do nothing.
            ; // Do nothing...
        }
        else
        {   
            // Signal firmware that media has been removed
            g_bExternalMediaConnected = FALSE;
        }
    }
}