⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cs_operation.c

📁 QPSK Tuner details, for conexant chipset.
💻 C
字号:
//#include "cs_osp.h"
#include "cs_i2c.h"
#include "CSHDI_typedef.h"
#include "cs_typedef.h"

#ifdef LSI_PLATFORM
#include "osp.h"
#include "cs_gpio.h"

CSI2C_Error_t CSI2COpen(CSHDII2CIndex enmIndex , unsigned long wSlaveAddress, HCSHANDLE *phI2CHandle)
{
	*phI2CHandle=(HCSHANDLE)wSlaveAddress ;
	return CSI2C_SUCCESS;
}
CSI2C_Error_t CSI2CClose(HCSHANDLE hI2CHandle)
{
	return CSI2C_SUCCESS;
}


HCSHANDLE	CSCreateThread (const char* pstrName,int nPriority,int nStackSize, void * pThreadEntry,PVOID pvArg, DWORD *pdwThreadID)
{	
	DWORD  dwTaskID;
	OSPTaskCreate(pstrName, 0x2000, pThreadEntry,nPriority, 0, 0, &dwTaskID);
	return dwTaskID;
}
DWORD	CSDestroyThread (HCSHANDLE hThread)
{
	 return OSPTaskDelete(hThread);
} 
DWORD CSGetTickCount(void)
{
	UINT32 tickshi, tickslow;

	//return 0;
	OSPGetTicks(&tickshi, &tickslow);
	return tickslow;
}
	
	
HCSHANDLE	CSCreateMsgQueue (const char* pstrName,int nMaxMsgs,int nMsgLen, DWORD dwOptions)
{
	DWORD  CSDMDQueueID;
	OSPQueueCreate(pstrName, nMsgLen, WAIT_PRIO, &CSDMDQueueID);
	return  CSDMDQueueID;
}
DWORD		CSReceiveMsg(HCSHANDLE hMsgQueue,PVOID pvMsg,int nMaxMsgBytes,DWORD dwTimeout)
{
	if (dwTimeout == 0)
	{
		OSPQueueGetMessage(hMsgQueue, (QUEUE_MESSAGE *)pvMsg, TASK_NOWAIT, 0);
	}
	else
	{
		return OSPQueueGetMessage(hMsgQueue, (QUEUE_MESSAGE *)pvMsg, TASK_WAIT, dwTimeout);
	}
}
DWORD		CSSendMsg(HCSHANDLE hMsgQueue, const PVOID pvMsg, int nMsgBytes, DWORD dwTimeout)
{
	return OSPQueueSendMessage(hMsgQueue, (QUEUE_MESSAGE *)pvMsg);
}
HCSHANDLE CSCreateSemaphore(const char* pstrName,int nInitialCount,int nMaxCount)
{
	DWORD SemaphoreID;
	OSPSemaphoreCreate(pstrName, 1, WAIT_PRIO, &SemaphoreID);
	return SemaphoreID;
}
DWORD CSWaitForSemaphore(HCSHANDLE hSemaphore,DWORD dwTimeout)
{
	if (dwTimeout == 0)
	{
		return OSPSemaphoreGetToken(hSemaphore,TASK_NOWAIT,0);
	}
	else
	{
		return OSPSemaphoreGetToken(hSemaphore,TASK_WAIT,dwTimeout);
	}
}
DWORD CSReleaseSemaphore(HCSHANDLE hSemaphore, int nReleaseCount)
{
	return OSPSemaphoreReturnToken(hSemaphore);
}


T_CSGPIOStatus CSGPIOOpen(BYTE ucGPIOIndex, T_CSPinIOMode enmPinIOMode)
{
	return  CSGPISetMode(ucGPIOIndex, GPIO_SECONDARY_Mode);
}
T_CSGPIOStatus CSGPIOWrite(BYTE ucGPIOIndex, BYTE ucGPIOValue)
{	
	GPIO_VALUE eGPIOValue=GPIO_LOW;
	if(ucGPIOValue==1)
	{
		eGPIOValue=GPIO_HIGH;
	}
	return CSGPIWrite(ucGPIOIndex,eGPIOValue);
}
T_CSGPIOStatus CSGPIORead(BYTE ucGPIOIndex, BYTE *pucGPIOValue)
{	
	GPIO_VALUE eGPIOValue;
	int ren;
	ren=CSGPIRead(ucGPIOIndex,&eGPIOValue);
	if(eGPIOValue==GPIO_LOW)
	{
		*pucGPIOValue=0;
	}	
	if(eGPIOValue==GPIO_HIGH)
	{
		*pucGPIOValue=1;
	}	
	return ren;
}	

void CSSleep(DWORD dwMilliSeconds)
{
	OSPTaskTemporarySleep(dwMilliSeconds);
}

CSI2C_Error_t CSI2CRequestBus_inner(CSHDII2CIndex enmIndex, DWORD dwMilliseconds)
{
	return CSI2CRequestBus(TASK_WAIT, 0);
}

CSI2C_Error_t CSI2CReleaseBus_inner(CSHDII2CIndex enmIndex)
{
	return CSI2CReleaseBus();
}
#else

CSI2C_Error_t CSI2CRequestBus_inner(CSHDII2CIndex enmIndex, DWORD dwMilliseconds)
{
	return CSI2CRequestBus(enmIndex, dwMilliseconds);
}

CSI2C_Error_t CSI2CReleaseBus_inner(CSHDII2CIndex enmIndex)
{
	return CSI2CReleaseBus(enmIndex);
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -