Exemple #1
0
int ProgramSi5324(void)
{
	XIIC_LIB I2cLibInstance;
	int Index;
	int Status;
	u8 WrBuffer[2];

	Status = I2cSetupHardware(&I2cLibInstance);
	if (Status != XST_SUCCESS) {
		xil_printf("Si5324: Configuring HW failed\n\r");
		return XST_FAILURE;
	}

	Status = MuxInit(&I2cLibInstance);
	if (Status != XST_SUCCESS) {
		xil_printf("Si5324: Mux Init failed\n\r");
		return XST_FAILURE;
	}

	for (Index = 0; Index < sizeof(InitTable)/8; Index++) {
		WrBuffer[0] = InitTable[Index].RegIndex;
		WrBuffer[1] = InitTable[Index].Value;

		Status = I2cWriteData(&I2cLibInstance, WrBuffer, 2, IIC_SLAVE_ADDR);
		if (Status != XST_SUCCESS) {
			xil_printf("Si5324: Writing failed\n\r");
			return XST_FAILURE;
		}
	}
	return XST_SUCCESS;
}
Exemple #2
0
WebPMux* WebPNewInternal(int version) {
  if (WEBP_ABI_IS_INCOMPATIBLE(version, WEBP_MUX_ABI_VERSION)) {
    return NULL;
  } else {
    WebPMux* const mux = (WebPMux*)WebPSafeMalloc(1ULL, sizeof(WebPMux));
    if (mux != NULL) MuxInit(mux);
    return mux;
  }
}
Exemple #3
0
WebPMux* WebPNewInternal(int version) {
  if (WEBP_ABI_IS_INCOMPATIBLE(version, WEBP_MUX_ABI_VERSION)) {
    return NULL;
  } else {
    WebPMux* const mux = (WebPMux*)malloc(sizeof(WebPMux));
    // If mux is NULL MuxInit is a noop.
    MuxInit(mux);
    return mux;
  }
}
Exemple #4
0
DWORD CBaseMuxerFilter::ThreadProc()
{
	SetThreadPriority(m_hThread, THREAD_PRIORITY_ABOVE_NORMAL);

	POSITION pos;

	while (1) {
		DWORD cmd = GetRequest();

		switch (cmd) {
			default:
			case CMD_EXIT:
				CAMThread::m_hThread = NULL;
				Reply(S_OK);
				return 0;

			case CMD_RUN:
				m_pActivePins.RemoveAll();
				m_pPins.RemoveAll();

				pos = m_pInputs.GetHeadPosition();
				while (pos) {
					CBaseMuxerInputPin* pPin = m_pInputs.GetNext(pos);
					if (pPin->IsConnected()) {
						m_pActivePins.AddTail(pPin);
						m_pPins.AddTail(pPin);
					}
				}

				m_rtCurrent = 0;

				Reply(S_OK);

				MuxInit();

				try {
					MuxHeaderInternal();

					while (!CheckRequest(NULL) && m_pActivePins.GetCount()) {
						if (m_State == State_Paused) {
							Sleep(10);
							continue;
						}

						CAutoPtr<MuxerPacket> pPacket = GetPacket();
						if (!pPacket) {
							Sleep(1);
							continue;
						}

						if (pPacket->IsTimeValid()) {
							m_rtCurrent = pPacket->rtStart;
						}

						if (pPacket->IsEOS()) {
							m_pActivePins.RemoveAt(m_pActivePins.Find(pPacket->pPin));
						}

						MuxPacketInternal(pPacket);
					}

					MuxFooterInternal();
				} catch (HRESULT hr) {
					CComQIPtr<IMediaEventSink>(m_pGraph)->Notify(EC_ERRORABORT, hr, 0);
				}

				m_pOutput->DeliverEndOfStream();

				pos = m_pRawOutputs.GetHeadPosition();
				while (pos) {
					m_pRawOutputs.GetNext(pos)->DeliverEndOfStream();
				}

				m_pActivePins.RemoveAll();
				m_pPins.RemoveAll();

				break;
		}
	}

	ASSERT(0); // this function should only return via CMD_EXIT

	CAMThread::m_hThread = NULL;
	return 0;
}