WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::doSpecificEventHandler_cb(OMX_EVENTTYPE _event, OMX_U32 nData1, OMX_U32 nData2, OMX_BOOL &deferredEvent)
//*************************************************************************************************************
{
	IN0("\n");
	switch ((unsigned int)_event)
	{
	case OMX_EventCmdComplete:
		if (nData1 == OMX_CommandStateSet)
		{ //Only idle and executing are trapped!
			MSG3("OMX_EventCmdComplete %s.%s(%s)\n", GetComponentName(), GetStringOmxCommand(nData1), GetStringOmxState(nData2) );
		}
		else // encapsulate OMX_EventPortSettingsChanged & OMX_EventBufferFlag
			MSG3("OMX_EventCmdComplete %s.%s(%d)\n", GetComponentName(), GetStringOmxCommand(nData1), (int)nData2);
		break;
	case OMX_EventError:
		MSG1("OMX_EventError %ld\n", nData1); break;
	case OMX_EventMark:
		MSG0("OMX_EventMark\n"); break;
	case OMX_EventPortSettingsChanged:
		MSG1("OMX_EventPortSettingsChanged(%d)\n", (int)nData1); break;
	case OMX_EventBufferFlag:
		if(nData2 == OMX_BUFFERFLAG_EOS)
		{
			MSG1("OMX_EventBufferFlag('EOS') on port %ld\n", nData1);
		}
		else
			MSG2("OMX_EventBufferFlag(%ld) on port %ld\n", nData2, nData1);
		break;
	case OMX_EventResourcesAcquired:
		MSG0("OMX_EventResourcesAcquired\n"); break;
	case OMX_EventComponentResumed:
		MSG0("OMX_EventComponentResumed\n"); break;
	case OMX_EventDynamicResourcesAvailable:
		MSG0("OMX_EventDynamicResourcesAvailable\n"); break;
	case OMX_EventPortFormatDetected:
		MSG0("OMX_EventPortFormatDetected\n"); break;
	case OMX_EventIndexSettingChanged:
		MSG0("OMX_EventIndexSettingChanged\n"); break;
	case OMX_EventCmdReceived:
		if (nData1 == OMX_CommandStateSet)
		{ //Only idle and executing are trapped!
			MSG3("OMX_EventCmdReceived %s.%s(%s)\n", GetComponentName(), GetStringOmxCommand(nData1), GetStringOmxState(nData2) );
		}
		else 
			MSG3("OMX_EventCmdReceived %s.%s(%ld)\n", GetComponentName(), GetStringOmxCommand(nData1), (long)nData2);
		break;
	default:
		MSG3("unknown OMX_Event(%d, %d, %d)\n", _event, (int)nData1, (int)nData2); break;
	}
	// Don't send any more this command because it duplicate OMX_EventBufferFlag messages
	//((OpenMax_Component*)&mENSComponent)->eventHandler(_event, nData1, nData2) ;
	OUT0("\n");
	return OMX_ErrorNone;
}
//Not arm target --> x86-linux
//Basic implementation without regarding type of buffers
WRAPPER_OPENMAX_API  OMX_ERRORTYPE OpenMax_Proxy::useBuffer(OMX_U32 nPortIndex, OMX_U32 nBufferIndex, OMX_BUFFERHEADERTYPE* pBufferHdr, void **portPrivateInfo)
//*************************************************************************************************************
{
	IN0("\n");
	OMX_ERRORTYPE err = OMX_ErrorNone;
	MSG4("OpenMax_Proxy[%s]::useBuffer[%lu] buffer=%lu Header=%p\n", GetComponentName(), nPortIndex, nBufferIndex, pBufferHdr);
	err = useBufferHeap(nPortIndex, nBufferIndex, pBufferHdr, portPrivateInfo);
	OUTR(" ", (err));
	return err;
}
void openmax_processor::emptyThisBuffer(OMX_BUFFERHEADERTYPE_p buffer, t_uint8 portNb)
//*******************************************************************************
{ //Just wrap to the base component
	IN0("\n");
	Port *pPort=GetPort(portNb);
	WARNING(pPort);
	MSG3("%s->emptyThisBuffer[%lu] Header=%p \n", GetComponentName(), buffer->nInputPortIndex, (void *)buffer);
	WARNING(buffer->nInputPortIndex==portNb);
	Component::deliverBuffer(portNb, buffer);
	OUT0("\n");
}
/**
Call by the ens framework when a command port is sending.
Note that Enable/Disable port does NOT hit this function
*/
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::doSpecificSendCommand(OMX_COMMANDTYPE eCmd, OMX_U32 nData, OMX_BOOL &bDeferredCmd)
//*************************************************************************************************************
{
	switch(eCmd)
	{
	case OMX_CommandStateSet: // only transition from idle -> execute and execute --> idle are visible!!!
		MSG3(" %s.SetState( %s=%lu)\n", GetComponentName(), GetStringOmxState(nData), nData);
		break;
	case OMX_CommandFlush:
		MSG2(" %s.Flush(%lu)\n", GetComponentName(), nData);
		break;
	case OMX_CommandPortDisable:
		MSG2("%s.DisablePort(%lu)\n", GetComponentName(), nData);
		break;
	case OMX_CommandPortEnable:
		MSG2("%s.EnablePort(%lu)\n", GetComponentName(), nData);
		break;
	case OMX_CommandMarkBuffer:
		MSG2("%s.MarkBuffer(%lu)\n", GetComponentName(), nData);
		break;
	default:
		MSG3("%s.Unknow specific command %d- %lu\n", GetComponentName(), eCmd, nData);
		break;
	}
	return OMX_ErrorNone;
}
void openmax_processor::fsmInit(fsmInit_t initFsm)
//*************************************************************************************************************
{ //Make the initialisation of ports
	IN0("\n");
	if (initFsm.traceInfoAddr)
	{
		setTraceInfo(initFsm.traceInfoAddr, initFsm.id1);
	}
	portInformation *pPortInfo;
	Port *pPort;
	NMF::InterfaceReference *pInterfaceRef;
	const size_t NbPorts=GetNbPorts();
	for (size_t portIndex=0; portIndex < NbPorts ; ++portIndex)
	{
		pPort=GetPort(portIndex);
		pPortInfo=GetPortInfo(portIndex);
		pPortInfo->AllocateBufferHeader();

		if (pPortInfo->direction== OMX_DirInput)
		{ // for input
			pInterfaceRef=&mProcessorTemplate.emptybufferdone[portIndex]; // NMF 'return' interface
		}
		else
		{ //for output
			pInterfaceRef=&mProcessorTemplate.fillbufferdone[portIndex]; // NMF 'return' interface
		}

		pPort->init(pPortInfo->direction==OMX_DirInput?InputPort: OutputPort, // Direction
			false /*(bool)pPortInfo->bufferSupplier*/, // Buffer supplier
			true,                        // isHWPort ca fait quoi?
			NULL,                       // sharingPort
			pPortInfo->BufferHeaderList,
			pPortInfo->fifoSize,        // bufferCount (FIFO size )
			pInterfaceRef,              // NMF 'return' interface
			portIndex,                  // port index
			(initFsm.portsDisabled & (1 << portIndex) )?true:false,
			(initFsm.portsTunneled & (1 << portIndex) )?true:false,
			this // owner
		);
		MSG4("%s->InitPort(%d) Direction=%d Fifo=%d \n", GetComponentName(), portIndex, pPortInfo->direction, pPortInfo->fifoSize);
		for (int i=0; i< pPortInfo->fifoSize; ++i)
		{
			MSG2("BufferHeader[i]=%p \n", i, pPortInfo->BufferHeaderList[i]);
		}
		MSG0("\n");
	}
	init(NbPorts, m_pPort, &proxy /* Event Handler */, &me /* Postevent */, false);

	//Now call user init
	UserOpen();
	OUT0("\n");
}
void openmax_processor::fillThisBuffer(OMX_BUFFERHEADERTYPE_p buffer, t_uint8 portNb)
//*******************************************************************************
{ //Just wrap to the base component
	IN0("\n");
	Port *pPort=GetPort(portNb);
	WARNING(pPort);
	MSG3("%s->fillThisBuffer[%lu] Header=%p \n", GetComponentName(), buffer->nOutputPortIndex, buffer);
	if (buffer->nOutputPortIndex!=portNb)
	{ // Should make more stuff
		WARNING(buffer->nOutputPortIndex==portNb);
	}
	Component::deliverBuffer(portNb, buffer);
	OUT0("\n");
}
WRAPPER_OPENMAX_API  OMX_ERRORTYPE OpenMax_Proxy::useBufferHeader(OMX_DIRTYPE dir, OMX_BUFFERHEADERTYPE* pBufferHdr)
//*************************************************************************************************************
{
	IN0("\n");
	OMX_ERRORTYPE err = OMX_ErrorNone;
	int portNb;
	if (dir == OMX_DirInput)
		portNb=pBufferHdr->nInputPortIndex;
	else
		portNb=pBufferHdr->nOutputPortIndex;

	MSG4("OpenMax_Proxy[%s]::useBufferHeader port %d dir=%u Header=%p\n", GetComponentName(), portNb, dir, pBufferHdr);
	err = useBufferHeaderHeap(dir, pBufferHdr);
	OUTR(" ", (err));
	return err;
}
Exemplo n.º 8
0
EDA_SchComponentStruct * WinEDA_SchematicFrame::Load_Component(wxDC * DC, 
					const wxString & libname, wxArrayString & HistoryList,
					bool UseLibBrowser)
/**************************************************************************/
/* Fonction de chargement et placement d'un composant
*/
{
int ii;
LibDrawField * Field;
EDA_LibComponentStruct *Entry = NULL;
EDA_SchComponentStruct * DrawLibItem;
LibraryStruct *Library = NULL;
wxString Name, keys, msg;
	
	g_ItemToRepeat = NULL;
	DrawPanel->m_IgnoreMouseEvents = TRUE;
	
	/* Ask for a component name or key words */
	Name = GetComponentName(this, HistoryList, _("Component selection:"),
			UseLibBrowser ? SelectFromLibBrowser : NULL);
	Name.MakeUpper();
	if( Name == "" )
	{
		DrawPanel->m_IgnoreMouseEvents = FALSE;
		DrawPanel->MouseToCursorSchema();
		return NULL;	/* annulation de commande */
	}

	if ( libname != ""  )
	{
		Library = g_LibraryList;
		while (Library)
		{
			if( Library->m_Name == libname ) break;
			Library = Library->m_Pnext; 
		}
	}
	
	if( Name[0] == '=' )
	{
		keys = Name.AfterFirst('=');
		if( DataBaseGetName(this, keys, Name) == 0 )
		{
			DrawPanel->m_IgnoreMouseEvents = FALSE;
			DrawPanel->MouseToCursorSchema();
			return NULL;
		}
	}

	else if( Name == "*" )
	{
		if( GetNameOfPartToLoad(this, Library, Name) == 0 )
		{
			DrawPanel->m_IgnoreMouseEvents = FALSE;
			DrawPanel->MouseToCursorSchema();
			return NULL;
		}
	}

	else if( (Name.Contains("?")) || (Name.Contains("*")) )
	{
		if( DataBaseGetName(this, keys, Name) == 0 )
		{
			DrawPanel->m_IgnoreMouseEvents = FALSE;
			DrawPanel->MouseToCursorSchema();
			return NULL;
		}
	}

	DrawPanel->m_IgnoreMouseEvents = FALSE;
	DrawPanel->MouseToCursorSchema();
	Entry = FindLibPart(Name.GetData(), libname, FIND_ROOT);

	if( Entry == NULL)
	{
		msg = _("Failed to find part ") + Name + _(" in library");
		DisplayError(this, msg, 10);
		DrawLibItem = NULL;
		return NULL;
	}

	AddHistoryComponentName(HistoryList, Name);

	m_CurrentScreen->ManageCurseur = ShowWhileMoving ;
	m_CurrentScreen->ForceCloseManageCurseur = ExitPlaceCmp;

	DrawLibItem = new EDA_SchComponentStruct(m_CurrentScreen->m_Curseur);
	DrawLibItem->m_Multi = 1;  /* Selection de l'unite 1 dans le boitier */
	DrawLibItem->m_Convert = 1;
	DrawLibItem->m_ChipName = strdup(Name);
	DrawLibItem->m_TimeStamp = GetTimeStamp();
	DrawLibItem->m_Flags = IS_NEW | IS_MOVED;

	/* Init champ Valeur */
	DrawLibItem->m_Field[VALUE].m_Pos.x =
				Entry->m_Name.m_Pos.x + DrawLibItem->m_Pos.x;
	DrawLibItem->m_Field[VALUE].m_Pos.y =
				Entry->m_Name.m_Pos.y + DrawLibItem->m_Pos.y;
	DrawLibItem->m_Field[VALUE].m_Orient = Entry->m_Name.m_Orient;
	DrawLibItem->m_Field[VALUE].m_Size = Entry->m_Name.m_Size;
	DrawLibItem->m_Field[VALUE].m_Text = DrawLibItem->m_ChipName;
	DrawLibItem->m_Field[VALUE].m_Attributs = Entry->m_Name.m_Attributs;
	DrawLibItem->m_Field[VALUE].m_HJustify = Entry->m_Name.m_HJustify;
	DrawLibItem->m_Field[VALUE].m_VJustify = Entry->m_Name.m_VJustify;

	msg = Entry->m_Prefix.m_Text;
	if ( msg == "" ) msg = "U";
	msg += "?";

	/* Init champ Reference */
	DrawLibItem->m_Field[REFERENCE].m_Pos.x =
			Entry->m_Prefix.m_Pos.x + DrawLibItem->m_Pos.x;
	DrawLibItem->m_Field[REFERENCE].m_Pos.y =
			Entry->m_Prefix.m_Pos.y + DrawLibItem->m_Pos.y;
	DrawLibItem->m_Field[REFERENCE].m_Orient = Entry->m_Prefix.m_Orient;
	DrawLibItem->m_Field[REFERENCE].m_Size = Entry->m_Prefix.m_Size;
	DrawLibItem->m_Field[REFERENCE].m_Text = msg;
	DrawLibItem->m_Field[REFERENCE].m_Attributs = Entry->m_Prefix.m_Attributs;
	DrawLibItem->m_Field[REFERENCE].m_HJustify = Entry->m_Prefix.m_HJustify;
	DrawLibItem->m_Field[REFERENCE].m_VJustify = Entry->m_Prefix.m_VJustify;

	/* Init des autres champs si predefinis dans la librairie */
	for( Field = Entry->Fields; Field != NULL; Field = (LibDrawField*)Field->Pnext )
	{
		if( Field->m_Text == "" ) continue;
		ii = Field->m_FieldId;
		if( ii < 2 ) continue;
		if( ii >= NUMBER_OF_FIELDS ) continue;
		DrawLibItem->m_Field[ii].m_Pos.x += Field->m_Pos.x;
		DrawLibItem->m_Field[ii].m_Pos.y += Field->m_Pos.y;
		DrawLibItem->m_Field[ii].m_Size = Field->m_Size;
		DrawLibItem->m_Field[ii].m_Attributs = Field->m_Attributs;
		DrawLibItem->m_Field[ii].m_Orient = Field->m_Orient;
		DrawLibItem->m_Field[ii].m_Text = Field->m_Text;
		DrawLibItem->m_Field[ii].m_HJustify = Field->m_HJustify;
		DrawLibItem->m_Field[ii].m_VJustify = Field->m_VJustify;
	}

	/* Trace du composant */
	DrawStructsInGhost(DrawPanel, DC, DrawLibItem, 0, 0 );
	MsgPanel->EraseMsgBox();
	DrawLibItem->Display_Infos(this);

	return DrawLibItem;
}
Exemplo n.º 9
0
EDA_SchComponentStruct * WinEDA_SchematicFrame::Load_Component(wxDC * DC, 
					const wxString & libname, wxArrayString & HistoryList,
					bool UseLibBrowser)
/**************************************************************************/
/* load from a library and place a component
	if libname != "", search in lib "libname"
	else search in all loaded libs
*/
{
int ii, CmpCount = 0;
LibDrawField * Field;
EDA_LibComponentStruct *Entry = NULL;
EDA_SchComponentStruct * DrawLibItem = NULL;
LibraryStruct *Library = NULL;
wxString Name, keys, msg;
bool AllowWildSeach = TRUE;
	
	g_ItemToRepeat = NULL;
	DrawPanel->m_IgnoreMouseEvents = TRUE;
	
	if ( ! libname.IsEmpty()  )
	{
		Library = g_LibraryList;
		while (Library)
		{
			if( Library->m_Name == libname )
			{
				CmpCount = Library->m_NumOfParts;
				break;
			}
			Library = Library->m_Pnext; 
		}
	}
	else
	{
		LibraryStruct * lib = g_LibraryList;
		while (lib)
		{
			CmpCount += lib->m_NumOfParts;
			lib = lib->m_Pnext; 
		}
	}

	/* Ask for a component name or key words */
	msg.Printf (_("component selection (%d items loaded):"), CmpCount);
 
	Name = GetComponentName(this, HistoryList, msg,
			UseLibBrowser ? SelectFromLibBrowser : NULL);
	Name.MakeUpper();
	if( Name.IsEmpty() )
	{
		DrawPanel->m_IgnoreMouseEvents = FALSE;
		DrawPanel->MouseToCursorSchema();
		return NULL;	/* annulation de commande */
	}
	
	if( Name.GetChar(0) == '=' )
	{
		AllowWildSeach = FALSE;
		keys = Name.AfterFirst('=');
		if( DataBaseGetName(this, keys, Name) == 0 )
		{
			DrawPanel->m_IgnoreMouseEvents = FALSE;
			DrawPanel->MouseToCursorSchema();
			return NULL;
		}
	}

	else if( Name == wxT("*") )
	{
		AllowWildSeach = FALSE;
		if( GetNameOfPartToLoad(this, Library, Name) == 0 )
		{
			DrawPanel->m_IgnoreMouseEvents = FALSE;
			DrawPanel->MouseToCursorSchema();
			return NULL;
		}
	}

	else if( Name.Contains( wxT("?")) || Name.Contains( wxT("*")) )
	{
		AllowWildSeach = FALSE;
		if( DataBaseGetName(this, keys, Name) == 0 )
		{
			DrawPanel->m_IgnoreMouseEvents = FALSE;
			DrawPanel->MouseToCursorSchema();
			return NULL;
		}
	}

	Entry = FindLibPart(Name.GetData(), libname, FIND_ROOT);
	if( (Entry == NULL) && AllowWildSeach )	/* Attemp to search with wildcard */
	{
		AllowWildSeach = FALSE;
		wxString wildname = wxChar('*') + Name + wxChar('*');
		Name = wildname;
		if( DataBaseGetName(this, keys, Name) )
			Entry = FindLibPart(Name.GetData(), libname, FIND_ROOT);
		if( Entry == NULL)
		{
			DrawPanel->m_IgnoreMouseEvents = FALSE;
			DrawPanel->MouseToCursorSchema();
			return NULL;
		}
	}


	DrawPanel->m_IgnoreMouseEvents = FALSE;
	DrawPanel->MouseToCursorSchema();
	if( Entry == NULL)
	{
		msg = _("Failed to find part ") + Name + _(" in library");
		DisplayError(this, msg, 10);
		return NULL;
	}

	AddHistoryComponentName(HistoryList, Name);

	m_CurrentScreen->ManageCurseur = ShowWhileMoving ;
	m_CurrentScreen->ForceCloseManageCurseur = ExitPlaceCmp;

	DrawLibItem = new EDA_SchComponentStruct(m_CurrentScreen->m_Curseur);
	DrawLibItem->m_Multi = 1;  /* Selection de l'unite 1 dans le boitier */
	DrawLibItem->m_Convert = 1;
	DrawLibItem->m_ChipName = Name;
	DrawLibItem->m_TimeStamp = GetTimeStamp();
	DrawLibItem->m_Flags = IS_NEW | IS_MOVED;

	/* Init champ Valeur */
	DrawLibItem->m_Field[VALUE].m_Pos.x =
				Entry->m_Name.m_Pos.x + DrawLibItem->m_Pos.x;
	DrawLibItem->m_Field[VALUE].m_Pos.y =
				Entry->m_Name.m_Pos.y + DrawLibItem->m_Pos.y;
	DrawLibItem->m_Field[VALUE].m_Orient = Entry->m_Name.m_Orient;
	DrawLibItem->m_Field[VALUE].m_Size = Entry->m_Name.m_Size;
	DrawLibItem->m_Field[VALUE].m_Text = DrawLibItem->m_ChipName;
	DrawLibItem->m_Field[VALUE].m_Attributs = Entry->m_Name.m_Attributs;
	DrawLibItem->m_Field[VALUE].m_HJustify = Entry->m_Name.m_HJustify;
	DrawLibItem->m_Field[VALUE].m_VJustify = Entry->m_Name.m_VJustify;

	msg = Entry->m_Prefix.m_Text;
	if ( msg.IsEmpty() ) msg = wxT("U");
	msg += wxT("?");

	/* Init champ Reference */
	DrawLibItem->m_Field[REFERENCE].m_Pos.x =
			Entry->m_Prefix.m_Pos.x + DrawLibItem->m_Pos.x;
	DrawLibItem->m_Field[REFERENCE].m_Pos.y =
			Entry->m_Prefix.m_Pos.y + DrawLibItem->m_Pos.y;
	DrawLibItem->m_Field[REFERENCE].m_Orient = Entry->m_Prefix.m_Orient;
	DrawLibItem->m_Field[REFERENCE].m_Size = Entry->m_Prefix.m_Size;
	DrawLibItem->m_Field[REFERENCE].m_Text = msg;
	DrawLibItem->m_Field[REFERENCE].m_Attributs = Entry->m_Prefix.m_Attributs;
	DrawLibItem->m_Field[REFERENCE].m_HJustify = Entry->m_Prefix.m_HJustify;
	DrawLibItem->m_Field[REFERENCE].m_VJustify = Entry->m_Prefix.m_VJustify;

	/* Init des autres champs si predefinis dans la librairie */
	for( Field = Entry->Fields; Field != NULL; Field = (LibDrawField*)Field->Pnext )
	{
		if( Field->m_Text.IsEmpty() ) continue;
		ii = Field->m_FieldId;
		if( ii < 2 ) continue;
		if( ii >= NUMBER_OF_FIELDS ) continue;
		DrawLibItem->m_Field[ii].m_Pos.x += Field->m_Pos.x;
		DrawLibItem->m_Field[ii].m_Pos.y += Field->m_Pos.y;
		DrawLibItem->m_Field[ii].m_Size = Field->m_Size;
		DrawLibItem->m_Field[ii].m_Attributs = Field->m_Attributs;
		DrawLibItem->m_Field[ii].m_Orient = Field->m_Orient;
		DrawLibItem->m_Field[ii].m_Text = Field->m_Text;
		DrawLibItem->m_Field[ii].m_HJustify = Field->m_HJustify;
		DrawLibItem->m_Field[ii].m_VJustify = Field->m_VJustify;
	}

	/* Trace du composant */
	DrawStructsInGhost(DrawPanel, DC, DrawLibItem, 0, 0 );
	MsgPanel->EraseMsgBox();
	DrawLibItem->Display_Infos(this);

	return DrawLibItem;
}
Exemplo n.º 10
0
MODULE * WinEDA_BasePcbFrame::Load_Module_From_Library(const wxString & library,
			wxDC * DC)
/****************************************************************************/
/* Permet de charger un module directement a partir de la librairie */
{
MODULE * module;
wxPoint curspos = m_CurrentScreen->m_Curseur;
wxString ModuleName, keys;
static wxArrayString HistoryList;
bool AllowWildSeach = TRUE;

	/* Ask for a component name or key words */
	ModuleName = GetComponentName(this, HistoryList, _("Module name:"), NULL);
	ModuleName.MakeUpper();
	if( ModuleName.IsEmpty() )	/* Cancel command */
	{
		DrawPanel->MouseToCursorSchema();
		return NULL;
	}


	if( ModuleName[0] == '=' )	// Selection by keywords
	{
		AllowWildSeach = FALSE;
		keys = ModuleName.AfterFirst('=');
		ModuleName = Select_1_Module_From_List(this, library, wxEmptyString, keys);
		if( ModuleName.IsEmpty() )	/* Cancel command */
		{
			DrawPanel->MouseToCursorSchema();
			return NULL;
		}
	}

	else if( (ModuleName.Contains(wxT("?"))) || (ModuleName.Contains(wxT("*"))) ) // Selection wild card
	{
		AllowWildSeach = FALSE;
		ModuleName = Select_1_Module_From_List(this, library, ModuleName, wxEmptyString);
		if( ModuleName.IsEmpty() )
		{
			DrawPanel->MouseToCursorSchema();
			return NULL;	/* annulation de commande */
		}
	}

	module = Get_Librairie_Module(this, library, ModuleName, FALSE);

	if( (module == NULL) && AllowWildSeach )	/* Attemp to search with wildcard */
	{
		AllowWildSeach = FALSE;
		wxString wildname = wxChar('*') + ModuleName + wxChar('*');
		ModuleName = wildname;
		ModuleName = Select_1_Module_From_List(this, library, ModuleName, wxEmptyString);
		if( ModuleName.IsEmpty() )
		{
			DrawPanel->MouseToCursorSchema();
			return NULL;	/* annulation de commande */
		}
		else module = Get_Librairie_Module(this, library, ModuleName, TRUE);
	}

	m_CurrentScreen->m_Curseur = curspos;
	DrawPanel->MouseToCursorSchema();

	if( module )
	{
		AddHistoryComponentName(HistoryList, ModuleName);

		module->m_Flags = IS_NEW;
		module->m_Link = 0;
		module->m_TimeStamp = GetTimeStamp();
		m_Pcb->m_Status_Pcb = 0 ;
		module->SetPosition(curspos);
		build_liste_pads();

		module->Draw(DrawPanel, DC, wxPoint(0,0), GR_OR);
	}

	return module;
}
void womDemoCpt_processor::process()
//*************************************************************************************************************
{ // Process IMG to Metadata
	IN0("\n");
	const int InputIndex  = eInputPort_Img;
	const int OutputIndex = eOutputPort_Img;
	_tConvertionConfig Config;
	int res;
	int inBufCount;
	int outBufCount;

	if (m_bUseBufferSharing==false)
	{ // No buffer sharing 
		//Check that there are at least on input and one ouptut buffer
		inBufCount  = GetPort(InputIndex)->queuedBufferCount();
		outBufCount = GetPort(OutputIndex)->queuedBufferCount();
		MSG3("%s inBufCount %d, outBufCount %d\n", GetComponentName(), inBufCount, outBufCount);
		if ((inBufCount==0)  || (outBufCount==0))
		{
			OUT0("\n");
			return; //No buffer to process
		}

		// Input and output buffers are available: can do the processing
		res=InitProcessingInfo(Config, true, InputIndex, OutputIndex, -1);
		
		// Uncomment following lines if you want to get some extradata
		//OMX_EXTRADATATYPE *pData;
		//if (GetExtraData(Config.Input.pBufferHdr, OMX_SYMBIAN_CameraExtraDataCaptureParameters, (char*&)pData )==S_OK)
		//{
		//}

		Config.Output.pBufferHdr->nFilledLen = Config.Input .pBufferHdr->nFilledLen; //Update output size
		Config.Output.pBufferHdr->nOffset    = 0;
		Config.Output.pBufferHdr->nFlags     = Config.Input .pBufferHdr->nFlags;     //Update output flags

		//Now we can call our processing function
		res= m_fn_UserProcessBuffer(Config); // Call specific processing
		if (res!=0)
		{ // should implement error handling
		}

		if((Config.Input.pBufferHdr->nFlags & WOM_BUFFERFLAG_CALLBACK_MASK)!=0)
		{ //Input buffer is marked with End of stream flag, recopy of the flag is needed
			portInformation *pPortInfo;
			/* Uncomment this code if the component sink and don't produce output buffer
			pPortInfo=GetPortInfo(InputIndex);
			if (pPortInfo)
			{
				m_pIProcessorCB->OmxEventFeedback(OMX_EventBufferFlag, pPortInfo->omxPortIndex, Config.Input.pBufferHdr->nFlags);
			} */
			pPortInfo=GetPortInfo(OutputIndex);
			if (pPortInfo)
			{
				m_pIProcessorCB->OmxEventFeedback(OMX_EventBufferFlag, pPortInfo->omxPortIndex, (Config.Input.pBufferHdr->nFlags & WOM_BUFFERFLAG_CALLBACK_MASK));
			}
		}
		else
		{
		}
		

		MSG0("Copy ExtraData\n");
		//CopyExtraData(Config);

		Config.Input .pBufferHdr->nFilledLen = 0; // reset processed buffer
		//release processed buffer
		GetPort(InputIndex) ->returnBuffer(Config.Input .pBufferHdr);
		GetPort(OutputIndex)->returnBuffer(Config.Output.pBufferHdr);
		// Must add metadata release
	}
	else
	{ //Buffer sharing case 
		//Check that there are at least on input and one ouptut buffer
		inBufCount  = GetPort(InputIndex)      ->queuedBufferCount();
		MSG1("Buffer count: In0 %d\n", inBufCount);

		if (inBufCount==0)
		{
			OUT0("\n");
			return; //No buffer to process
		}

		// Input 0 and 1  and output buffers are available: can do the processing
		//No extradata to process
		res=InitProcessingInfo(Config, true, InputIndex, -1, -1);


		InitBufferInfo(Config.Output, InputIndex, false);
		Config.Output.pBufferHdr=Config.Input.pBufferHdr; //Set output buffer header ptr = to input one
		//Now we can call our processing function
		res= m_fn_UserProcessBuffer(Config); // Call specific processing
		if (res!=0)
		{ // should implement error handling
		}

		if((Config.Input.pBufferHdr->nFlags & WOM_BUFFERFLAG_CALLBACK_MASK)!=0)
		{ //Input buffer is marked with End of stream flag
			portInformation *pPortInfo=GetPortInfo(OutputIndex);
			if (pPortInfo)
			{
				MSG2(" womDemoCpt[d] flags=0x%x. Send it to %d\n", (int)pPortInfo->omxPortIndex, (int)Config.Input.pBufferHdr->nFlags);
				m_pIProcessorCB->OmxEventFeedback(OMX_EventBufferFlag, pPortInfo->omxPortIndex, (Config.Input.pBufferHdr->nFlags & WOM_BUFFERFLAG_CALLBACK_MASK));
			}
		}

		MSG2("Buffer count: Img0 %p, Out=%p\n", Config.Input .pBufferHdr, Config.Output.pBufferHdr);
		GetPort(InputIndex)     ->returnBuffer(Config.Input .pBufferHdr);
	}
	OUT0("\n");
}
/**
@brief Called when the processing is ready to be stopped
*/
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::stop()
//*************************************************************************************************************
{// Call Deinstantiation of component
	IN0("\n");
	m_pNmfProcWrp->stop();
#if 0
	//ER355733 Try to fix ens bug that doesn't reset bufferSupplier type 
	PortVideo* pPort;
	for (unsigned int Index=0; Index< mENSComponent.getPortCount(); ++Index)
	{
		pPort = (PortVideo*)mENSComponent.getPort(Index);
		if (pPort->getBufferSupplier() !=OMX_BufferSupplyUnspecified)
		{
			MSG3("wwwwwwwwwwwwwwwwwwwwwwwwwwww    %s.port[%d] reset state(%d) to OMX_BufferSupplyUnspecified\n", GetComponentName(), Index, pPort->getBufferSupplier());
			pPort->setBufferSupplier(OMX_BufferSupplyUnspecified);
		}
	}
#endif
	OUT0("\n");
	return OMX_ErrorNone;
}
/** 
brief Instantiate the nmf component and bind interfaces
Called during Loaded to Idle transition
*/
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::instantiate()
//*************************************************************************************************************
{ //binding all interfaces
	OMX_ERRORTYPE omx_error=OMX_ErrorNone;
	IN0("\n");
	// Init Components
	// Bind of arm nmf components
	MSG1("OpenMax_Proxy(%s) Instantiating arm nmf component\n", GetComponentName());
	openmax_processor *pProcessor=NULL;
	if (m_pProcessor != NULL)
		pProcessor = m_pProcessor;
	else if (m_fnCreateNmfComponent !=NULL)
	{ 
		m_pProcessor= m_fnCreateNmfComponent();
		pProcessor  = m_pProcessor;
	}

	m_pNmfProcWrp = openmax_processor_wrpCreate(pProcessor);

	m_pNmfProcWrp->priority = m_nmfPriority;

	if (m_pNmfProcWrp->construct() != NMF_OK)
		NMF_PANIC("PANIC - Construct Error\n") ;

	t_nmf_error error ;
	// bindFromUser --> Asynchronous
	// getInterface --> Synchronous

	error = m_pNmfProcWrp->bindFromUser("sendcommand", 2, &mIsendCommand) ;
	if (error != NMF_OK)
		NMF_PANIC("PANIC - bindFromUser sendCommand\n") ;
#if (SYNCHRONOUS ==0)
	error = m_pNmfProcWrp->bindFromUser("Param", 2*mENSComponent.getPortCount()+1, &m_IParam) ; // One setparam per port + 1
	if (error != NMF_OK)
		NMF_PANIC("PANIC - bindFromUser Param\n") ;

	error = m_pNmfProcWrp->bindFromUser("Config", 2*mENSComponent.getPortCount()+1, &m_IConfig) ; // One setparam per port + 1
	if (error != NMF_OK)
		NMF_PANIC("PANIC - bindFromUser Config\n") ;
#else //Bind synchronous interfaces
	//interfaces are binded in a synchronous way
	error = m_pNmfProcWrp->getInterface("Param", &m_IParam);
	if (error != NMF_OK)
		NMF_PANIC("PANIC - getInterface Param\n") ;

	error = m_pNmfProcWrp->getInterface("Config", &m_IConfig);
	if (error != NMF_OK)
		NMF_PANIC("PANIC - getInterface Config\n") ;
#endif
	error = m_pNmfProcWrp->bindFromUser("fsminit", 1 , &mIfsmInit);
	if (error != NMF_OK)
		NMF_PANIC("Error: unable to bind fsminit!...\n");

	error = EnsWrapper_bindToUser(mENSComponent.getOMXHandle(), m_pNmfProcWrp, "proxy", getEventHandlerCB(), 8);
	if (error != NMF_OK)
		NMF_PANIC("Error: unable to bind proxy!...\n");

	error = EnsWrapper_bindToUser(mENSComponent.getOMXHandle(), m_pNmfProcWrp, "ToOMXComponent", mConfigCB, 1);
	if (error != NMF_OK)
		NMF_PANIC("Error: unable to bind ToOMXComponent!...\n");

	char name[20]; //reserve some char for formatting callback name
	size_t iNbInput =0;
	size_t iNbOutput=0;
	PortVideo* pPort;
	for (unsigned int Index=0; Index< mENSComponent.getPortCount(); ++Index)
	{
		pPort = (PortVideo*)mENSComponent.getPort(Index);
		MSG3("\n %s Port %d : direction =%d\n", GetComponentName(), Index, pPort->getDirection());
		//reset port info at this point 
		//NO it's too late!
#if 0
		if (pPort->getBufferSupplier() !=OMX_BufferSupplyUnspecified)
		{
			printf("wwwwwwwwwwwwwwwwwwwwwwwwwwww    %s.port[%d] reset state(%d) to OMX_BufferSupplyUnspecified\n", GetComponentName(), Index, pPort->getBufferSupplier());
			pPort->setBufferSupplier(OMX_BufferSupplyUnspecified);
		}
#endif
		switch(pPort->getDirection())
		{
		case OMX_DirInput: //bind emptythisbuffer, emptybufferdone for each input port
			if (iNbInput < MAX_PORTS_COUNT)
			{
				sprintf(name, "emptythisbuffer[%d]", Index);
				error = m_pNmfProcWrp->bindFromUser(name, pPort->getBufferCountActual(), &mIemptyThisBuffer[Index]);
				if (error != NMF_OK)
					NMF_PANIC("PANIC %s->bindFromUser %s\n", GetComponentName(), name) ;

				sprintf(name, "emptybufferdone[%d]", Index);
				error = EnsWrapper_bindToUser(mENSComponent.getOMXHandle(),
					m_pNmfProcWrp,
					name ,
					this->getEmptyBufferDoneCB(),
					pPort->getBufferCountActual());

				if (error != NMF_OK)
					NMF_PANIC("PANIC %s->bindToUser %s\n", GetComponentName(), name) ;

				++iNbInput;
			}
			else
			{
				// ReportError(
			}
			break;
		case OMX_DirOutput://bind fillthisbuffer, fillbufferdone for each output port
			if (iNbOutput < MAX_PORTS_COUNT)
			{
				sprintf(name, "fillthisbuffer[%d]", Index);
				error = m_pNmfProcWrp->bindFromUser(name, pPort->getBufferCountActual(), &mIfillThisBuffer[Index]);
				if (error != NMF_OK)
					NMF_PANIC("PANIC %s->bindFromUser %s\n", GetComponentName(), name) ;

				sprintf(name, "fillbufferdone[%d]", Index);
				error = EnsWrapper_bindToUser(mENSComponent.getOMXHandle(),
					m_pNmfProcWrp,
					name,
					this->getFillBufferDoneCB(),
					pPort->getBufferCountActual());
				if (error != NMF_OK)
					NMF_PANIC("PANIC %s->bindToUser %s\n", GetComponentName(), name) ;
				++iNbOutput;
			}
			else
			{
				// ReportError(
			}

			break;
		default:
			break;
		}
	}
	// Configure the number of ports
	m_IConfig.setTargetComponent(mENSComponent.getPortCount() , &mENSComponent);
	OUTR(" ", (omx_error));
	return omx_error;
}
Exemplo n.º 14
0
EFI_STATUS
EFIAPI
UpdateBindingDriverSelectPage (
    IN EFI_CALLBACK_INFO                *Private,
    IN UINT16                           KeyValue,
    IN EFI_IFR_DATA_ARRAY               *Data
)
/*++

Routine Description:
  Prepare to let user select the drivers which need mapping with the device controller selected in first page

Arguments:

  KeyValue - The callback key value of device controller item in first page
  Data -         EFI_IFR_DATA_ARRAY data.
  Packet-       No use here.

  Returns -    Always successful

--*/
{
    EFI_HII_UPDATE_DATA                       *UpdateData;
    EFI_STATUS                                Status;
    UINTN                                     Index;
    UINT8                                     *Location;

    CHAR16                                    *NewString;
    STRING_REF                                NewStringToken;
    STRING_REF                                NewStringHelpToken;
    UINTN                                     DriverImageHandleCount;

    EFI_DRIVER_BINDING_PROTOCOL               *DriverBindingInterface;
    EFI_LOADED_IMAGE_PROTOCOL                 *LoadedImage;
    CHAR16                                    *DriverName;
    BOOLEAN                                   FreeDriverName;

    EFI_DEVICE_PATH_PROTOCOL                  *LoadedImageHandleDevicePath;
    EFI_DEVICE_PATH_PROTOCOL                  *TatalFilePath;
    EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride;
    EFI_HANDLE                                DriverBindingHandle;
    //
    // If user select a controller item in the first page  the following code will be run.
    // During second page, user will see all currnet driver bind protocol driver, the driver name and its device path will be shown
    //
    //First acquire the list of Loaded Image Protocols, and then when  want the name of the driver, look up all the Driver Binding Protocols
    // and find the first one whose ImageHandle field matches the image handle of the Loaded Image Protocol.
    // then use the Component Name Protocol on the same handle as the first matching Driver Binding Protocol to look up the name of the driver.
    //


    mCurrentPage = 0x02;
    //
    // Switch the item callback key value to its NO. in mDevicePathHandleBuffer
    //
    mSelectedCtrIndex = KeyValue - 0x100;
    ASSERT (0 <= mSelectedCtrIndex < MAX_CHOICE_NUM);
    mLastSavedDriverImageNum = 0;
    //
    // Clear all the content in dynamic page
    //
    UpdateData = NULL;
    UpdateData = EfiLibAllocateZeroPool (UPDATE_DATA_SIZE);
    ASSERT (UpdateData != NULL);

    UpdateData->FormSetUpdate       = FALSE;
    UpdateData->FormCallbackHandle  = 0;
    UpdateData->FormUpdate          = FALSE;
    UpdateData->FormTitle           = 0;
    UpdateData->DataCount           = 0xff;
    UpdateData->Data                = NULL;

    Private->Hii->UpdateForm (
        Private->Hii,
        Private->RegisteredHandle,
        (EFI_FORM_LABEL) 0x1200,  // Label 0x1234
        FALSE,                    // Remove Op-codes (will never remove form/endform)
        UpdateData                // Significant value is UpdateData->DataCount
    );

    //
    // Show all driver which support loaded image protocol in second page
    //
    DriverImageHandleCount  = 0;
    Status = gBS->LocateHandleBuffer (
                 ByProtocol,
                 &gEfiLoadedImageProtocolGuid,
                 NULL,
                 &DriverImageHandleCount,
                 &mDriverImageHandleBuffer
             );
    if (EFI_ERROR (Status) || (DriverImageHandleCount == 0)) {
        return EFI_NOT_FOUND;
    }

    mDriverImageHandleCount = DriverImageHandleCount;
    for (Index = 0; Index < DriverImageHandleCount; Index++) {
        //
        // Step1: Get the driver image total file path for help string and the driver name.
        //

        //
        // Find driver's Loaded Image protocol
        //
        LoadedImage =NULL;
        Status = gBS->OpenProtocol (
                     mDriverImageHandleBuffer[Index],
                     &gEfiLoadedImageProtocolGuid,
                     (VOID **) &LoadedImage,
                     NULL,
                     NULL,
                     EFI_OPEN_PROTOCOL_GET_PROTOCOL
                 );
        if (EFI_ERROR (Status)) {
            ((MyIfrNVData *) Data->NvRamMap)->DriSelection[Index] = 0;
            continue;
        }
        mDriverImageProtocol[Index] = LoadedImage;
        //
        // Find its related driver binding protocol
        //
        DriverBindingInterface = NULL;
        DriverBindingHandle = NULL;
        DriverBindingInterface = LibGetBindingProtocolFromImageHandle (
                                     mDriverImageHandleBuffer[Index],
                                     &DriverBindingHandle
                                 );
        if (DriverBindingInterface == NULL) {
            ((MyIfrNVData *) Data->NvRamMap)->DriSelection[Index] = 0;
            continue;
        }

        //
        // Get the driver image total file path for help string
        //
        LoadedImageHandleDevicePath = NULL;
        Status = gBS->HandleProtocol (
                     LoadedImage->DeviceHandle,
                     &gEfiDevicePathProtocolGuid,
                     &LoadedImageHandleDevicePath
                 );
        if (EFI_ERROR (Status)) {
            ((MyIfrNVData *) Data->NvRamMap)->DriSelection[Index] = 0;
            continue;
        }

        if (((MyIfrNVData *) Data->NvRamMap)->PciDeviceFilter == 0x01) {
            //
            // only care the driver which is in a Pci device option rom,
            // and the driver's LoadedImage->DeviceHandle must point to a pci device which has efi option rom
            //
            if (!EFI_ERROR (Status)) {
                Status = gBS->HandleProtocol(
                             LoadedImage->DeviceHandle,
                             &gEfiBusSpecificDriverOverrideProtocolGuid,
                             &BusSpecificDriverOverride
                         );
                if (EFI_ERROR (Status) || BusSpecificDriverOverride == NULL) {
                    ((MyIfrNVData *) Data->NvRamMap)->DriSelection[Index] = 0;
                    continue;
                }
            } else {
                ((MyIfrNVData *) Data->NvRamMap)->DriSelection[Index] = 0;
                continue;
            }
        }

        TatalFilePath = NULL;
        TatalFilePath = EfiAppendDevicePath (LoadedImageHandleDevicePath, LoadedImage->FilePath);

        //
        // For driver name, try to get its component name, if fail, get its image name,
        // if also fail, give a default name.
        //
        FreeDriverName = FALSE;
        DriverName = GetComponentName (DriverBindingHandle);
        if (DriverName == NULL) {
            //
            // get its image name
            //
            DriverName = GetImageName (LoadedImage);
        }
        if (DriverName == NULL) {
            //
            // give a default name
            //
            DriverName = GetString (Private, (STRING_REF) STR_DRIVER_DEFAULT_NAME);
            ASSERT (DriverName != NULL);
            FreeDriverName = TRUE;  // the DriverName string need to free pool
        }


        //
        // Step2 Export the driver name string and create check box item in second page
        //

        //
        // Clear the Update buffer
        //
        UpdateData->FormSetUpdate       = FALSE;
        UpdateData->FormCallbackHandle  = 0;
        UpdateData->FormUpdate          = FALSE;
        UpdateData->FormTitle           = 0;
        UpdateData->DataCount           = 0;
        Location = (UINT8 *) &UpdateData->Data;
        //
        // First create the driver image name
        //
        NewString = EfiLibAllocateZeroPool (EfiStrSize (DriverName));
        if (EFI_ERROR (LibCheckMapping (mControllerDevicePathProtocol[mSelectedCtrIndex], TatalFilePath, &mMappingDataBase, NULL, NULL))) {
            ((MyIfrNVData *) Data->NvRamMap)->DriSelection[Index] = 0x00;
        } else {
            ((MyIfrNVData *) Data->NvRamMap)->DriSelection[Index] = 0x01;
            mLastSavedDriverImageNum++;
        }
        EfiStrCat (NewString, DriverName);
        NewStringToken = mDriverImageToken[Index];
        Status = Private->Hii->NewString (Private->Hii, NULL, Private->RegisteredHandle, &NewStringToken, NewString);
        mDriverImageToken[Index] = NewStringToken;
        ASSERT_EFI_ERROR (Status);
        gBS->FreePool (NewString);
        if (FreeDriverName) {
            gBS->FreePool (DriverName);
        }

        //
        // Second create the driver image device path as item help string
        //
        if (TatalFilePath == NULL) {
            DriverName = EfiLibAllocateZeroPool (EfiStrSize (L"This driver device path and file path are both NULL! Maybe it is a Option Rom driver. Can not save it!"));
            EfiStrCat (DriverName, L"This driver device path and file path are both NULL! Maybe it is a Option Rom driver. Can not save it!");
        } else {
            DriverName = DevicePathToStr (TatalFilePath);
        }
        NewString = EfiLibAllocateZeroPool (EfiStrSize (DriverName));
        EfiStrCat (NewString, DriverName);
        NewStringHelpToken = mDriverImageFilePathToken[Index];
        Status = Private->Hii->NewString (Private->Hii, NULL, Private->RegisteredHandle, &NewStringHelpToken, NewString);
        mDriverImageFilePathToken[Index] = NewStringHelpToken;
        ASSERT_EFI_ERROR (Status);
        gBS->FreePool (NewString);
        gBS->FreePool (DriverName);

        CreateCheckBoxOpCode (
            (UINT16) (DRIVER_SELECTION_QUESTION_ID + Index),
            (UINT8) 1,
            NewStringToken,                               // Description String Token
            NewStringHelpToken,                           // Description Help String Token
            EFI_IFR_FLAG_INTERACTIVE,                     // Flag designating callback is active
            (UINT16) Index + 0x500,                       // Callback key value
            Location                                      // Buffer to fill with op-code
        );

        UpdateData->DataCount +=1 ;
        Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;

        //
        // Update second page form
        //
        Private->Hii->UpdateForm (
            Private->Hii,
            Private->RegisteredHandle,
            (EFI_FORM_LABEL) 0x1200,
            TRUE,
            UpdateData
        );
    }
    gBS->FreePool (UpdateData);
    return EFI_SUCCESS;
}
Exemplo n.º 15
0
proIComponent * proComponentManager::AddComponent(proEngineObj *pEngineObj, eComponentType type)
{	
	if(proIComponent *pComponent = pEngineObj->GetComponentHandler().GetComponent(type))
	{
		return pComponent;
	}

	//check to see if components are full
	if(m_aCompSet[type].m_compActiveTotal == m_aCompSet[type].m_compMax)
	{
		proDebug::Log(proDebug::kLog_Resource, proDebug::kDefcon_2, "proComponentManager::AddComponentA(%i, %s) %i - Out of components", type, GetComponentName(type), m_aCompSet[type].m_compMax);
		return NULL;
	}

	proIComponent *pComponent = m_aCompSet[type].m_pGetFreeComp();
	assert(!pComponent->GetOwner());
	pEngineObj->GetComponentHandler().AddComponent(pComponent);
	if(!pEngineObj->IsExplicitUpdate())
	{
		m_aCompSet[type].m_updateTotal++;
	}
	m_aCompSet[type].m_compActiveTotal++;
	return pComponent;

	proDebug::Log(proDebug::kLog_Component, proDebug::kDefcon_2, "proComponentManager::AddComponentB(%i, %s) - OUT OF COMPONENTS", type, m_aCompSet[type].m_aName);
	return 0;
}