📄 sn15test.c
字号:
temp = Uint16T(TestsnimGetKBnumber("Enter ZL10312 Crystal in kHz (0 to skip)",4000,21000,TRUE ));
if (temp) ((PSSNIMCTL)g_hTheSnim)->XtalkHz = temp;
temp = Uint16T(TestsnimGetKBnumber("Enter Tuner Crystal in kHz (0 to skip)",4000,21000,TRUE ));
if (temp) pTuner->XtalkHz= temp;
#else
printSn15Console ("\nCrystal frequency is set in build defaults");
#endif
}
/************************Zarlink Semiconductor*********************************
* Name:TestsnimGetChannelFromList()
* Purpose:returns a pointer the channel at the requested index number
* Remarks:
*
* Inputs:
*
* Outputs:
*
********************************************************************************/
PSSNIMCHANNEL TestsnimGetChannelFromList(int index)
{
Uint16T count=1;
pScanItem pNext = g_pScanListHead;
while (pNext!=NULL)
{
if (count++==index) return &(pNext->Channel);
pNext=pNext->pNext;
}
return NULL;
}
/************************Zarlink Semiconductor*********************************
* Name:TestsnimGetKBfloat()
* Purpose:prompts the operator for a +ve number in the form 27.500
* Remarks:typically used to input symbol rate
* Note +ve number only!
* Inputs:
*
* Outputs:return value = number *1000
*
********************************************************************************/
long TestsnimGetKBfloat(char* pPrompt,long iMin_x1000,long iMax_x1000)
{
char buf[10]={0};
int result;
long ret;
int temp, dig1,dig2,dig3;
printSn15Console("\n");
do
{
printSn15Console("\r%*c\r%s >",strlen(pPrompt)+strlen(buf)+2,' ',pPrompt);
TestsnimGets(buf,sizeof(buf));
dig1=dig2=dig3=0;
result = sscanf(buf," %d.%1d%1d%1d",&temp,&dig1,&dig2,&dig3);
ret = (long)temp*1000 +dig1*100 + dig2*10 +dig3;
}until (result>=1 && ret>=iMin_x1000 && ret<=iMax_x1000 );
return ret;
}
/************************Zarlink Semiconductor*********************************
* Name:TestsnimGetKBnumber()
* Purpose:prompts the operator for a number
* Remarks:number must be in range iMin to Imax inclusive
* 0 will be accepted if in this range or if bAccept is true
*
* Inputs:
*
* Outputs:
*
********************************************************************************/
int TestsnimGetKBnumber(char* pPrompt,long iMin,long iMax,BOOL bAcceptZero)
{
char buf[10]={0};
int result;
int ret;
printSn15Console("\n");
do
{
printSn15Console("\r%*c\r%s >",strlen(pPrompt)+strlen(buf)+2,' ',pPrompt);
TestsnimGets(buf,sizeof(buf));
result=sscanf(buf," %d",&ret);
}until (result==1 && ((ret>=iMin && ret<= iMax)||(bAcceptZero && ret==0)) );
return ret;
}
/************************Zarlink Semiconductor*********************************
* Name:TestsnimGetKBletter()
* Purpose:prompts operator for a single character (+\n)
* Remarks:if character is in pValid, character is returned (optionally
* converted to upper case) if pValid is NULL, any character is
* accepted.
*
* Inputs:
*
* Outputs:
*
********************************************************************************/
char TestsnimGetKBletter(char* pPrompt,char* pValid,BOOL bMakeUpper)
{
BOOL found=FALSE;
char buf[2]={0};
int x;
printSn15Console("\n");
do
{
printSn15Console("\r%*c\r%s >",strlen(pPrompt)+3,' ',pPrompt);
TestsnimGets(buf,sizeof(buf));
if (pValid==NULL)
found=TRUE;
else
{
for (x=0;x<(int)strlen(pValid);x++)
if (buf[0]==pValid[x]) found=TRUE;
}
}until (found);
if (bMakeUpper && buf[0]>='a' && buf[0]<='z') buf[0]-=0x20;
return buf[0];
}
void TestsnimSplash(void)
{
puts("\r\n ZZZZZZ A RRRR L I NN N K K"
"\r\n Z A A R R L I N N N K K"
"\r\n Z A A R R L I N N N KK"
"\r\n Z AAAAAA RRRR L I N N N K K"
"\r\n Z A A R R L I N N N K K"
"\r\n ZZZZZZ A A R R LLLLL I N NN K K"
"\r\n"
"\r\n S e m i c o n d u c t o r s Ltd."
"\r\n"
"\r\n ZL10036 + ZL10312"
"\r\n Satellite receiver/demodulator system");
}
/* Form Feed*/
/************************Zarlink Semiconductor*********************************
* Name:TestsnimRR(),TestsnimRW(),TestsnimSA(),TestsnimE()
* Purpose:Intercept calls to the 2wire bus, and catch any errors
* Remarks:
*
* Inputs:
*
* Outputs:
*
********************************************************************************/
BOOL TestsnimRR(unsigned long unitId, Uint8T byID,Uint8T byReg, Uint8T *pBuffer,Uint8T byCount)
{
//thomson
int ErrCode;
//printSn15((" TestsnimRR ++byID:%x byReg: %x \n\r",byID, byReg);
if (byID==SNIM_DEFAULT_ADDRESS) //
{
ErrCode = drv_ch_i2c_DEMODReadBytes(unitId, byReg,pBuffer,byCount);
//printSn15((" TestsnimRR --> drv_ch_i2c_DEMODRead byCount : %d Error : %x\n",byCount,ErrCode);
}
else //ZL1003X_ADDRESS=0xC0
{
ErrCode = drv_ch_i2c_NTunerRead(unitId,pBuffer,byCount);
//printSn15((" TestsnimRR --> drv_ch_i2c_TUNERRead : byCount : %d Error : %x\n",byCount,ErrCode);
}
//printSn15((" TestsnimRR -- %x\n",ErrCode);
if(ErrCode)
{
printSn15((">> TestsnimRR ERR(0x%x) byID:%x byReg: %x \n\r",ErrCode,byID, byReg));
return FALSE;
}
else
return TRUE;
}
BOOL TestsnimRW(unsigned long unitId, Uint8T byID,Uint8T byReg, Uint8T *pBuffer,Uint8T byCount)
{
int ErrCode;
unsigned char cBuf[100];
int i;
//printSn15((" TestsnimRW ++ byID:%x byReg: %x \n\r",byID, byReg);
if (byID==SNIM_DEFAULT_ADDRESS)
{
if (byCount>=100-1) printSn15((">> ERROR Byte!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n"));
cBuf[0] = byReg;
for(i=0;i<byCount;i++) cBuf[i+1] = pBuffer[i];
ErrCode = drv_ch_i2c_DEMODWriteBytes(unitId, byReg, cBuf, (byCount+1) );
}
else //ZL1003X_ADDRESS=0xC0
{
ErrCode = drv_ch_i2c_TUNERWrite(unitId, pBuffer,byCount);
}
if(ErrCode)
{
printSn15Error((">> TestsnimRW --(0x%x) byID:%x byReg: %x \n\r",ErrCode,byID, byReg));
return FALSE;
}
else
{
//printSn15((">> TestsnimRW --(0x%x) byID:%x byReg: %x \n\r",ErrCode,byID, byReg);
return TRUE;
}
}
BOOL TestsnimSA(unsigned long unitId, Uint8T byID,Uint8T bySlaveID,Uint8T byReg,Uint8T byOpen,Uint8T byClose,Uint8T * pBuffer,Sint8T cCount)
{
BOOL results;
//Uint8T cBuffer[12];
//printSn15((" TestsnimSA ++ byID : %x bySlaveID : %x byReg: %x \n\r",byID,bySlaveID,byReg);
results = TestsnimRW(unitId, byID, byReg, &byOpen,1);
if(!results)
{
printSn15Error(("[FE] TestsnimSA() is failed !Open!! ErrCode = 0x%02x, byID=0x%02x,,byCount=%d \n\r", results, byID,cCount ));
return FALSE;
}
if (cCount>=0)
{
results = TestsnimRW(unitId, bySlaveID, 0, &pBuffer[0],cCount);
}
else
{
results = TestsnimRR(unitId, bySlaveID, 0, &pBuffer[0],-cCount);
}
if(!results)
{
printSn15Error(("[FE] TUNER WIRTE() is failed !Close!! ErrCode = 0x%02x, byID=0x%02x,,byCount=%d \n\r", results, byID,cCount ));
return FALSE;
}
results = TestsnimRW(unitId, byID, byReg, &byClose,1);
if(!results)
{
printSn15Error(("[FE] TestsnimRW() is failed !Close!! ErrCode = 0x%02x, byID=0x%02x,,byCount=%d \n\r", results, byID,cCount ));
return FALSE;
}
//printSn15((" TestsnimSA --\n\r");
return TRUE;
}
BOOL TestsnimE(BOOL bWantOn, Uint8T byEnableNo)
{
return TRUE;
}
/* Form Feed*/
/******************************************************************************
*******************************************************************************
*******************************************************************************
The routines below require modification to suit the target platform.
*******************************************************************************
*******************************************************************************
*******************************************************************************/
/************************Zarlink Semiconductor*********************************
* Name:SnimnKBHit()
* Purpose:Checks to see if a key is pressed (does not wait)
* Remarks: Removes pressed key and discards it (so that you cant press it again)
*
*
* Inputs: none
*
* Outputs: TRUE if a key has been pressed
*
********************************************************************************/
BOOL TestsnimKBHit(void)
{
//thomson
return TRUE;
}
/************************Zarlink Semiconductor*********************************
* Name:TestsnimGets()
* Purpose:reads string from keyboard, like gets(),only better!
* Remarks:reads all characters to newline (\n or \r). Echoes and returns
* first MaxCount characters terminated with a null. Newline discarded
* uses getch() and putch()
* Inputs:pointer to buffer, max m=number of characters to read
*
* Outputs:
*
********************************************************************************/
void TestsnimGets(char *pBuffer,int MaxCount)
{
//thomsom
}
/************************Zarlink Semiconductor*********************************
* Name:TestsnimPlatformInitialise
* Purpose:Intiailises the system clock
* Remarks:for windows console does nothing
* otherwise I don't know what it does
*
* Inputs:
*
* Outputs:
*
********************************************************************************/
void TestsnimPlatformInitialise()
{
//VK_DelayTime(500);//thomson
#if 0//thomson
TestsnimSplash();
#if defined(_CONSOLE)
Sleep(2000);/* delay for splach screen*/
/* No hardware needs setting up for Windows console*/
#elif defined(DOS)
delay(1000); /* splash screen delay */
getSysTime();/* start clock (displays banner)*/
delay(1000); /* delay for splash with banner*/
#elif defined(__arm)
/*TEMPFIX ERROR no clock intitialisation routine*/
#else
/* your platform start up code here if any*/
ERROR no clock intitialisation routine!
/* Set up the interrupt for the millisecond clock etc*/
#endif
#endif
}
/************************Zarlink Semiconductor*********************************
* Name:TestsnimUpdateClock()
* Purpose:Refreshes the millisecond counter
* Remarks:
* Windows Console: Reads multimedia timers
* DOS Reads time from Zarlink library
* ARM Not implemented yet
* Other: Sample "Interrupt safe" code for 8080 style processsors
* Inputs:
*
* Outputs: Updates the value of g_dwClock
*
********************************************************************************/
Uint32T TestsnimUpdateClock(Uint32T *_Clock)
{
/*TEMPFIX ERROR no clock update routine */ /* flag an error until we know how to get the time on GAP board*/
*_Clock = (Uint32T)VK_TIMER_GetSystemTick()/g_ClocksPerMilllisecond; /* Get time from windows multimedia timer */
return *_Clock;
}
/************************Zarlink Semiconductor*********************************
* Name:TestsnimPlatformRelease()()
* Purpose:restore platform to pre entry state
* Remarks:removes I/O hooks etc
*
* Inputs:
*
* Outputs:
*
********************************************************************************/
void TestsnimPlatformRelease()
{
}
/************************Zarlink Semiconductor*********************************
* Name: TestsnimOpenPort()
* Purpose:Opens com port for 2 wire bus
* Remarks: Its recursive!
*
* Inputs: name of port (LPT1 etc). if no name, offers menu
*
* Outputs:
*
********************************************************************************/
BOOL TestsnimOpenPort(Uint8T * pName)
{
return TRUE; /* dont'need to open port */
}
int blind_test(void)
{
/*****************************Variables****************************************/
Sint16T ExitCode =0; /* termination return value */
SSnimLnb lnb;
SSnimConfig SnimCreateStruct
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -