static MME_ERROR initTransformer(MME_UINT paramsSize, MME_GenericParams_t params, void **context)
{
	Mpeg2HardHandle_t      Context;
	Mpeg2HardInitParams_t*  InitParams = 0;
	Mpeg2HardStatus_t status;
	status = Mpeg2HardInit("wibble", InitParams, &Context);
	intraQuantizerMatrix    = (unsigned char*)OSDEV_Malloc(sizeof(unsigned char) * 64);
	nonIntraQuantizerMatrix = (unsigned char*)OSDEV_Malloc(sizeof(unsigned char) * 64);
	Context = OSDEV_Malloc(sizeof(Mpeg2HardCodecContext_t));
	*context = (void*)Context;
	return MME_SUCCESS;
}
Exemplo n.º 2
0
static OSDEV_OpenEntrypoint(  AllocatorOpen )
{
AllocatorContext_t      *AllocatorContext;

    //
    // Entry
    //

    OSDEV_OpenEntry();

    //
    // Allocate and initialize the private data structure.
    //

    AllocatorContext    = (AllocatorContext_t *)OSDEV_Malloc( sizeof(AllocatorContext_t) );
    OSDEV_PrivateData   = (void *)AllocatorContext;

    if( AllocatorContext == NULL )
    {
	OSDEV_Print( "AllocatorOpen - Unable to allocate memory for open context.\n" );
	OSDEV_OpenExit( OSDEV_Error );
    }

//

    memset( AllocatorContext, 0x00, sizeof(AllocatorContext_t) );

    AllocatorContext->Size      = 0;
    AllocatorContext->Memory    = NULL;

//

    OSDEV_OpenExit( OSDEV_NoError );
}
Exemplo n.º 3
0
// -----------------------------------------------------------------------------------------------
// The event functions
OS_Status_t OS_InitializeEvent(OS_Event_t *Event)
{
	*Event = (OS_Event_t)OSDEV_Malloc(sizeof(struct OS_Event_s));
	if (*Event != NULL)
	{
		OS_InitializeMutex(&((*Event)->Mutex));
		if (OSDEV_InitializeWaitQueue(&((*Event)->Queue)) == OSDEV_NoError)
		{
			(*Event)->Valid = false;
			return OS_NO_ERROR;
		}
		else
			OSDEV_Free(*Event);
	}
	return OS_ERROR;
}
Exemplo n.º 4
0
void *OS_Malloc(unsigned int Size)
{
	return OSDEV_Malloc(Size);
}
Exemplo n.º 5
0
static OSDEV_OpenEntrypoint(  H264ppOpen )
{
unsigned int      i,j;
H264ppContext_t  *H264ppContext;
int               Status;
unsigned int      N;

    //
    // Entry
    //

    OSDEV_OpenEntry();

    //
    // Is there a set of PPs to get.
    //

    OSDEV_ClaimSemaphore( &Lock );
    if( OpenMask == ((1 << H264_PP_NUMBER_OF_PRE_PROCESSORS) - 1) )
    {
	OSDEV_Print( "H264ppOpen - Too many opens.\n" );
	OSDEV_ReleaseSemaphore( &Lock );
	OSDEV_OpenExit( OSDEV_Error );
    }

    //
    // Allocate and initialize the private data structure.
    //

    H264ppContext    = (H264ppContext_t *)OSDEV_Malloc( sizeof(H264ppContext_t) );
    OSDEV_PrivateData   = (void *)H264ppContext;

    if( H264ppContext == NULL )
    {
	OSDEV_Print( "H264ppOpen - Unable to allocate memory for open context.\n" );
	OSDEV_ReleaseSemaphore( &Lock );
	OSDEV_OpenExit( OSDEV_Error );
    }

//

    memset( H264ppContext, 0x00, sizeof(H264ppContext_t) );

    H264ppContext->Closing              = false;

    //
    // Find a free pair of PPs
    //

    for( H264ppContext->Index   = 0;
	 ((OpenMask & (H264_PP_PER_INSTANCE_MASK<<H264ppContext->Index)) != 0);
	 H264ppContext->Index += H264_PP_PER_INSTANCE );

    OpenMask    |= (H264_PP_PER_INSTANCE_MASK<<H264ppContext->Index);

    //
    // Initialize the processed buffer list indices
    //

    H264ppContext->BufferProcessedInsert	= 0;
    H264ppContext->BufferProcessedExtract	= 0;

    //
    // Initialize the semaphores
    //

    OSDEV_InitializeSemaphore( &H264ppContext->PreProcessor, H264_PP_PER_INSTANCE ); 				// No one currently using the pre-processors - so they are free
    OSDEV_InitializeSemaphore( &H264ppContext->ProcessedBufferListEntry, H264_PP_MAX_SUPPORTED_BUFFERS );	// The table contains this many entries
    OSDEV_InitializeSemaphore( &H264ppContext->ProcessedBuffer, 0 );                    			// There are no processed buffers to signal

    //
    // Ensure we will have no interrupt surprises and install the interrupt handler
    //

    for( i=0; i<H264_PP_PER_INSTANCE; i++ )
    {
	N = H264ppContext->Index + i;

	OSDEV_WriteLong( PP_ITS(N),                     0xffffffff );           // Clear interrupt status
	OSDEV_WriteLong( PP_ITM(N),                     0x00000000 );

	//
	// Initialize subcontect data
	//

	H264ppContext->SubContext[i].ForceWorkAroundGNBvd42331		= 1;
	H264ppContext->SubContext[i].last_mb_adaptive_frame_field_flag	= 0;	// Doesn't matter, will be initialized on first frame

	//
	// Perform soft reset
	//

	OSDEV_WriteLong( PP_SRS(N),			1 );			// Perform a soft reset
	for( j=0; j<H264_PP_RESET_TIME_LIMIT; j++ )
	{
	    if( (OSDEV_ReadLong(PP_ITS(N)) & PP_ITM__SRS_COMP) != 0 )
		break;

	    OSDEV_SleepMilliSeconds( 1 );
	}

	if( j == H264_PP_RESET_TIME_LIMIT )
	    OSDEV_Print( "H264ppOpen - Failed to soft reset PP %d.\n", N );

	OSDEV_WriteLong( PP_ITS(N),                     0xffffffff );           // Clear interrupt status

//

	OSDEV_WriteLong( PP_MAX_OPC_SIZE(N),            5 );                    // Setup the ST bus parameters
	OSDEV_WriteLong( PP_MAX_CHUNK_SIZE(N),          0 );
	OSDEV_WriteLong( PP_MAX_MESSAGE_SIZE(N),        3 );

//

	Status  = request_irq( H264_PP_INTERRUPT(N), H264ppInterruptHandler, 0, "H264 PP", (void *)((unsigned int)H264ppContext + i) );
	if( Status != 0 )
	{
	    OSDEV_Print( "H264ppOpen - Unable to request an IRQ for PP %d.\n", N );

	    OSDEV_DeInitializeSemaphore( &H264ppContext->PreProcessor );
	    OSDEV_DeInitializeSemaphore( &H264ppContext->ProcessedBufferListEntry );
	    OSDEV_DeInitializeSemaphore( &H264ppContext->ProcessedBuffer );

	    for( j=0; j<i; j++ )
		free_irq( H264_PP_INTERRUPT((H264ppContext->Index + j)), (void *)((unsigned int)H264ppContext+j) );

	    OpenMask    ^= (H264_PP_PER_INSTANCE_MASK<<H264ppContext->Index);

	    OSDEV_ReleaseSemaphore( &Lock );
	    OSDEV_OpenExit( OSDEV_Error );
	}
    }

//

    OSDEV_ReleaseSemaphore( &Lock );
    OSDEV_OpenExit( OSDEV_NoError );
}