Пример #1
0
static int GetBER(unsigned int argc, unsigned char *argv[])
{
    INT32 ret;  
    UINT32 ber;

    if (argc != 1)
    {
        SH_PRINTF("Usage: GetBER\n");
        return -1;
    }
	
    struct nim_device *nim_dev = dev_get_by_id(HLD_DEV_TYPE_NIM, nim_id);

    if ((ret = nim_get_BER(nim_dev, &ber)) != SUCCESS)
    {
        SH_PRINTF("api_nim_get_BER: operation error! %d\n", ret);
        return -1;
    }

    //LIB_ASH_OC('\r'); 
    //LIB_ASH_OC('\n'); 		

    IntPrintf(ber);

    LIB_ASH_OC('\r'); 
    LIB_ASH_OC('\n'); 		
}
Пример #2
0
static int GetPER(unsigned int argc, unsigned char *argv[])
{
    INT32 ret;  
    UINT32 per;

    if (argc != 1)
    {
        SH_PRINTF("Usage: GetPER\n");
        return -1;
    }
	
    struct nim_device *nim_dev = dev_get_by_id(HLD_DEV_TYPE_NIM, nim_id);

    if ((ret = nim_io_control(nim_dev, NIM_DRIVER_READ_RSUB, &per)) != SUCCESS)
    {
        if(ret != ERR_TIME_OUT)
        {
            SH_PRINTF("api_nim_get_PER: operation error! %d\n", ret);
            return -1;
        }
        else
        {
            per = 0;
        }
    }
    //LIB_ASH_OC('\r'); 
    //LIB_ASH_OC('\n'); 		 
	
    IntPrintf(per);

    LIB_ASH_OC('\r'); 
    LIB_ASH_OC('\n'); 		
}
Пример #3
0
static int SetNim(unsigned int argc, unsigned char *argv[])
{
	unsigned char cmd[16];

	if (argc != 2)
	{
	    SH_PRINTF("Usage: SetPara <nim_id> \n");
	    return -1;
	}	

	if(!strcasecmp("2",argv[1]))
		nim_id  = 1;
	else
		nim_id = 0;

	LIB_ASH_OC('N');
	LIB_ASH_OC('I');        
	LIB_ASH_OC('M');
	LIB_ASH_OC((nim_id+'0'));        
	LIB_ASH_OC(' ');        
	LIB_ASH_OC('O');        	
	LIB_ASH_OC('K');        		

	LIB_ASH_OC('\r'); 
	LIB_ASH_OC('\n'); 	

	reset_perflag();
	return 0;    
}
Пример #4
0
static int GetLock(unsigned int argc, unsigned char *argv[])
{
    INT32 ret;
    UINT8 lock;

    if (argc != 1)
    {
        SH_PRINTF("Usage: GetLock\n");
        return -1;
    }	
	
    struct nim_device *nim_dev = dev_get_by_id(HLD_DEV_TYPE_NIM, nim_id);

    if ((ret = nim_get_lock(nim_dev, &lock)) != SUCCESS)
    {
        SH_PRINTF("api_nim_get_lock: operation error! %d\n", ret);
        return -1;
    }

    //LIB_ASH_OC('\r'); 
    //LIB_ASH_OC('\n'); 	
	
    if(!lock)
    {
         LIB_ASH_OC('U');
         LIB_ASH_OC('N');        
    }
         LIB_ASH_OC('L');
         LIB_ASH_OC('O');        
         LIB_ASH_OC('C');
         LIB_ASH_OC('K');       

    LIB_ASH_OC('\r'); 
    LIB_ASH_OC('\n'); 			 
}
Пример #5
0
static int cmd_comtest(unsigned int argc, unsigned char *argv[])
{
    unsigned int data_len;
#ifdef UPGRADE_ONCE
	if(receive_comtest_falg == FALSE)
		return -1;
#endif

#ifdef PANEL_DISPLAY
#if (SYS_SDRAM_SIZE != 2)
    pan_display(panel_dev,  "conn", 4);
#else
    pan_display(panel_dev,  "UP9", 4);
#endif
#endif

    if (argc != 2)
    {
#ifdef PANEL_DISPLAY
        pan_display(panel_dev,  "r101", 4);
#endif
        SH_PRINTF("Usage: comtest <data_num>\n");
        SH_PRINTF("       Then begin loopback <data_num> charactor to host.\n");
        return -1;
    }

    data_len = ATOI(argv[1]);

    while (data_len--)
        LIB_ASH_OC(LIB_ASH_IC());

    return 0;
}
Пример #6
0
static int SetTP(unsigned int argc, unsigned char *argv[])
{
    UINT32 freq;	
    UINT32 sym;	
    UINT16 channel;

    T_NODE t_node;	
    P_NODE p_node;		

    if (argc != 3)
    {
        SH_PRINTF("Usage: SetPara <freq> <sym>\n");
        return -1;
    }	
    
    freq = ATOI(argv[1]);
    sym = ATOI(argv[2]);
    
    reset_group();
    channel = sys_data_get_cur_group_cur_mode_channel();
    get_prog_at(channel,&p_node);
    get_tp_by_id(p_node.tp_id, &t_node);
    recreate_tp_view(VIEW_SINGLE_SAT, t_node.sat_id);

    t_node.frq = freq;
    t_node.sym = sym;

    modify_tp(t_node.tp_id,&t_node);    
    api_play_channel(p_node.prog_id, TRUE, FALSE, TRUE); 
    //UIChChgPlayProg(0,p_node.prog_id);
    //UIChChgPlayProg(0,CC_CMD_RESET_CRNT_CH);//for 3501D sfu test
    //UIChChgPlayProg(0,p_node.prog_id);
    
    //LIB_ASH_OC('\r'); 
    //LIB_ASH_OC('\n'); 	

    LIB_ASH_OC('S');
    LIB_ASH_OC('U');        
    LIB_ASH_OC('C');
    LIB_ASH_OC('C');        
    LIB_ASH_OC('E');        
    LIB_ASH_OC('S');        	
    LIB_ASH_OC('S');        		

    LIB_ASH_OC('\r'); 
    LIB_ASH_OC('\n'); 	
	reset_perflag();
    return 0;    
}
Пример #7
0
static int SetSPISSISelect(unsigned int argc, unsigned char * argv[])
{
    extern UINT32 nim_s3501_set_ts_output_mode(struct nim_device *dev,UINT32 ts_output_mode);

    struct dmx_device *dmx_dev = dev_get_by_id(HLD_DEV_TYPE_DMX, nim_id);    

    if (argc != 2)
	{
	    SH_PRINTF("Usage: SetPara <nim_id> \n");
	    return -1;
	}
    if(strcasecmp("SSI",argv[1]))
    {
		//nim_id  = 0;
		nim_s3501_set_ts_output_mode(dmx_dev,1);

        *((volatile UINT32 *)0xb8000088) = *((volatile UINT32 *)0xb8000088)& (~(0x40000000));
        osal_task_sleep(10);
        tsi_select(TSI_DMX_0, TSI_SSI_0);
        tsi_select(TSI_DMX_1, TSI_SSI_0);	          
        
    }
	else
	{
		//nim_id = 1;
		nim_s3501_set_ts_output_mode(dmx_dev,0);
        
        *((volatile UINT32 *)0xb8000088) = *((volatile UINT32 *)0xb8000088)& (~(0x60000000));
        osal_task_sleep(10);        
        tsi_select(TSI_DMX_0, TSI_SPI_1);
        tsi_select(TSI_DMX_1, TSI_SPI_1);
	}
    //SH_PRINTF("%s ",argv[1]);      
	LIB_ASH_OC('O');        	
	LIB_ASH_OC('K');        		

	LIB_ASH_OC('\r'); 
	LIB_ASH_OC('\n');
    
    
}
Пример #8
0
static int GetDmxPER(unsigned int argc, unsigned char * argv [ ])
{
	INT32 ret=0;  
	UINT32 per;
#if 0
	if (argc != 1)
	{
		SH_PRINTF("Usage: GetDmxPER\n");
		return -1;
	}
	struct dmx_device *dmx_dev = dev_get_by_id(HLD_DEV_TYPE_DMX, nim_id);
	if(NULL != dmx_dev)
	{
		//struct dmx_private *prv = (struct dmx_private *)dmx_dev->priv;

		if(0 != bperflag)
		{
			dmx_io_control(dmx_dev,IO_GET_DISCONTINUE_COUNT,(UINT32)&per);//prv->disconti_counter;
		}
		else
		{
			per = 0;
			bperflag = 1;
		}
		//prv->disconti_counter = 0;
		dmx_io_control(dmx_dev,IO_ClEAR_DISCONTINUE_COUNT,0);
		
	}
	else
	{
		SH_PRINTF("GetDmxPER: operation error! %d\n", ret);
		return -1;
	}

	IntPrintf(per);
	LIB_ASH_OC('\r'); 
	LIB_ASH_OC('\n'); 
	#endif
	return ret;
}
Пример #9
0
static int IntPrintf(unsigned int src)
{
    UINT8 NumStack[10];
    UINT8 pos = 0;
    INT32 i;

    do{
        NumStack[pos] = src%10;
	 src = src /10;
	 pos++;        
    } while(src);

    for(i = 0; i < pos; i++)
        LIB_ASH_OC((NumStack[pos - i -1] + '0'));        
}
Пример #10
0
static int cmd_version(unsigned int argc, unsigned char *argv[])
{
    unsigned int i, j;
    unsigned long of;
    unsigned int n;
    unsigned int data_len;
    unsigned long crc;
    unsigned long chid;
    unsigned long len;
    unsigned long crc1;
    unsigned char buf[CHUNK_HEADER_SIZE];
    unsigned int nVersion = 0xb722;

    //LIB_ASH_OC(argc & 0xFF);
    //LIB_ASH_OC(argv[1][0]);
    //LIB_ASH_OC(argv[1][1]);
    if( argc >= 2 && argv[1][0] == 0x2d && argv[1][1] == 0x72)//"-r"
    {
#ifdef TRANSFER_FORMAT2_SUPPORT
        LIB_ASH_OC((nVersion >> 8) & 0xFF);
        LIB_ASH_OC( nVersion & 0xFF);
#endif
    }
Пример #11
0
static int SetSSIGap(unsigned int argc, unsigned char *argv[])
{
	UINT32 gap;
	struct nim_device *nim_dev = dev_get_by_id(HLD_DEV_TYPE_NIM, nim_id);
	
	if (argc != 2)
	{
	    SH_PRINTF("Usage: SetPara <clk>\n");
	    return -1;
	}
	else if(nim_dev == NULL)
	{
	    SH_PRINTF("Nim1 status error\n");
	    return -1;
	}

	if(strcasecmp("gap",argv[1]))
	{
		gap = ATOI(&(argv[1][3]));
		nim_io_control(nim_dev, NIM_DRIVER_CHANGE_TS_GAP, gap);
	}
	else
	{
		SH_PRINTF("parameter error\n");
		return -3;
	}

#if 1//path for lock delay
	UINT8	lock;
	UINT32 pre_tick = osal_get_tick();

	while((osal_get_tick()-pre_tick)>=SSI_GAP_TIMEOUT)
	{
		nim_get_lock(nim_dev,&lock);
		if(lock)
			break;

		osal_delay(30);
	}
#endif
	
	LIB_ASH_OC('S');
	LIB_ASH_OC('e');        
	LIB_ASH_OC('t');
	LIB_ASH_OC(' ');        
	LIB_ASH_OC('S');        
	LIB_ASH_OC('S');        	
	LIB_ASH_OC('I');       
	LIB_ASH_OC(' ');           	
	LIB_ASH_OC('G');          	
	LIB_ASH_OC('a');          	
	LIB_ASH_OC('p');          	
	LIB_ASH_OC(' ');          	
	LIB_ASH_OC('t');          	
	LIB_ASH_OC('o');          	
	LIB_ASH_OC(' ');          	
	LIB_ASH_OC('g');          	
	LIB_ASH_OC('a');          	
	LIB_ASH_OC('p');
	if(gap<10)
	{
		LIB_ASH_OC((gap + '0'));	
	}
	else
	{
		LIB_ASH_OC(((UINT8)gap/10 + '0'));	
		LIB_ASH_OC(((UINT8)gap%10 + '0'));	
	}

	LIB_ASH_OC('\r'); 
	LIB_ASH_OC('\n'); 	

	reset_perflag();
	return 0;    
}
Пример #12
0
static int SetSSIClk(unsigned int argc, unsigned char *argv[])
{
	UINT32 clk;
	struct nim_device *nim_dev = dev_get_by_id(HLD_DEV_TYPE_NIM, nim_id);
	
	if (argc != 2)
	{
	    SH_PRINTF("Usage: SetPara <gap%d>\n");
	    return -1;
	}
	else if(nim_dev == NULL)
	{
	    SH_PRINTF("Nim1 status error\n");
	    return -2;
	}
	
	clk = ATOI(argv[1]);
	nim_io_control(nim_dev, NIM_DRIVER_SET_SSI_CLK, clk);

	LIB_ASH_OC('S');
	LIB_ASH_OC('e');        
	LIB_ASH_OC('t');
	LIB_ASH_OC(' ');        
	LIB_ASH_OC('S');        
	LIB_ASH_OC('S');        	
	LIB_ASH_OC('I');       
	LIB_ASH_OC(' ');           	
	LIB_ASH_OC('C');          	
	LIB_ASH_OC('l');          	
	LIB_ASH_OC('o');          	
	LIB_ASH_OC('c');          	
	LIB_ASH_OC('k');          	
	LIB_ASH_OC(' ');          	
	LIB_ASH_OC('t');          	
	LIB_ASH_OC('o');          	
	LIB_ASH_OC(' ');          	
	LIB_ASH_OC(((UINT8)(clk/10)+'0'));          	
	LIB_ASH_OC(((UINT8)(clk%10)+'0'));        	
	LIB_ASH_OC('M');        		

	LIB_ASH_OC('\r'); 
	LIB_ASH_OC('\n'); 	

	reset_perflag();
	return 0;    
}
Пример #13
0
static int cmd_diag_entry(unsigned int argc, unsigned char *argv[])
{
	LIB_ASH_OC('@');
	return 0;
}
Пример #14
0
void cmd_diag_hw_number(unsigned int argc, unsigned char *argv[])
{
	LIB_ASH_OC('6');
	LIB_ASH_OC('8');
	LIB_ASH_OC('0');
	LIB_ASH_OC('1');
	LIB_ASH_OC(0x0a);
	LIB_ASH_OC(0x0d);
	LIB_ASH_OC('0');
	LIB_ASH_OC('x');
	LIB_ASH_OC('0');
	LIB_ASH_OC(sVer[4]);
	LIB_ASH_OC('0');
	LIB_ASH_OC(sVer[5]);
	LIB_ASH_OC(' ');
	LIB_ASH_OC('0');
	LIB_ASH_OC('x');
	LIB_ASH_OC('0');
	LIB_ASH_OC(sVer[6]);
	LIB_ASH_OC('0');
	LIB_ASH_OC(sVer[7]);
	LIB_ASH_OC(' ');
	LIB_ASH_OC('>');
	LIB_ASH_OC('0');
	LIB_ASH_OC('0');
	LIB_ASH_OC('0');
	LIB_ASH_OC('0');
	LIB_ASH_OC(' ');
	LIB_ASH_OC('@');
	LIB_ASH_OC(0x0a);
	LIB_ASH_OC(0x0d);
}
Пример #15
0
void cmd_diag_sw_number(unsigned int argc, unsigned char *argv[])
{
#if 1
	LIB_ASH_OC(0x0a);
	LIB_ASH_OC(0x0d);
	LIB_ASH_OC('6');
	LIB_ASH_OC('3');
	LIB_ASH_OC('0');
	LIB_ASH_OC('1');
	LIB_ASH_OC(0x0a);
	LIB_ASH_OC(0x0d);
	LIB_ASH_OC('0');
	LIB_ASH_OC('x');
	
	LIB_ASH_OC('0');
	LIB_ASH_OC(sVer[0]);
	LIB_ASH_OC('0');
	LIB_ASH_OC(sVer[1]);
	LIB_ASH_OC(' ');
	LIB_ASH_OC('0');
	LIB_ASH_OC('x');
	LIB_ASH_OC('0');
	LIB_ASH_OC(sVer[2]);
	LIB_ASH_OC('0');
	LIB_ASH_OC(sVer[3]);
	LIB_ASH_OC(' ');
	LIB_ASH_OC('0');
	LIB_ASH_OC('x');
	LIB_ASH_OC('0');
	LIB_ASH_OC(sVer[4]);
	LIB_ASH_OC('0');
	LIB_ASH_OC(sVer[5]);
	LIB_ASH_OC(' ');
	LIB_ASH_OC('0');
	LIB_ASH_OC('x');
	LIB_ASH_OC('0');
	LIB_ASH_OC(sVer[6]);
	LIB_ASH_OC('0');
	LIB_ASH_OC(sVer[7]);
	LIB_ASH_OC(' ');
	LIB_ASH_OC('I');
	LIB_ASH_OC('B');
	LIB_ASH_OC('O');
	LIB_ASH_OC('Z');
	LIB_ASH_OC('-');
	LIB_ASH_OC('-');
	LIB_ASH_OC('-');
	LIB_ASH_OC('-');	
	LIB_ASH_OC(' ');
	LIB_ASH_OC('>');
	LIB_ASH_OC('0');
	LIB_ASH_OC('0');
	LIB_ASH_OC('0');
	LIB_ASH_OC('0');
	LIB_ASH_OC(' ');
	LIB_ASH_OC('@');
	LIB_ASH_OC(0x0a);
	LIB_ASH_OC(0x0d);

#else
	LIB_ASH_OC(0x0a);
	LIB_ASH_OC(0x0d);
	LIB_ASH_OC('6');
	LIB_ASH_OC('3');
	LIB_ASH_OC('0');
	LIB_ASH_OC('1');
	LIB_ASH_OC(0x0a);
	LIB_ASH_OC(0x0d);
	LIB_ASH_OC('0');
	LIB_ASH_OC('x');
	LIB_ASH_OC('0');
	LIB_ASH_OC('0');
	LIB_ASH_OC('0');
	LIB_ASH_OC('4');
	LIB_ASH_OC(' ');
	LIB_ASH_OC('0');
	LIB_ASH_OC('x');
	LIB_ASH_OC('0');
	LIB_ASH_OC('2');
	LIB_ASH_OC('0');
	LIB_ASH_OC('3');
	LIB_ASH_OC(' ');
	LIB_ASH_OC('0');
	LIB_ASH_OC('x');
	LIB_ASH_OC('0');
	LIB_ASH_OC('1');
	LIB_ASH_OC('0');
	LIB_ASH_OC('2');
	LIB_ASH_OC(' ');
	LIB_ASH_OC('0');
	LIB_ASH_OC('x');
	LIB_ASH_OC('0');
	LIB_ASH_OC('1');
	LIB_ASH_OC('0');
	LIB_ASH_OC('2');
	LIB_ASH_OC(' ');
	LIB_ASH_OC('I');
	LIB_ASH_OC('B');
	LIB_ASH_OC('O');
	LIB_ASH_OC('Z');
	LIB_ASH_OC('-');
	LIB_ASH_OC('-');
	LIB_ASH_OC('-');
	LIB_ASH_OC('-');	
	LIB_ASH_OC(' ');
	LIB_ASH_OC('>');
	LIB_ASH_OC('0');
	LIB_ASH_OC('0');
	LIB_ASH_OC('0');
	LIB_ASH_OC('0');
	LIB_ASH_OC(' ');
	LIB_ASH_OC('@');
	LIB_ASH_OC(0x0a);
	LIB_ASH_OC(0x0d);
#endif	
}
Пример #16
0
/****************************************************************************
 *
 *  Name:		packet_receive
 *	Function:	receive a packet
 *	variable:	pPacket 	-- packet information point
 *				nTimeOut	-- time out   
 *  
 ****************************************************************************/
UINT32 packet_receive(PPACKET pPacket, UINT32 nTimeOut)
{
	//receive and compare packet head flag
	unsigned char c = 0;
	BOOL bPacketHead = FALSE;
	BOOL bComtest = FALSE;
	UINT32 i = 0;
	int n = 0;
	UINT32 nLength = 0;
	MEMSET(pPacket, 0, sizeof(PACKET));
	for(i = 0; i < nTimeOut;)
	{
		if( c == 'H')
		{
			// judge if packet head
			for(n = 0; n < 3; n++)
			{
				if(SUCCESS != com_read_tm(&c, 1, 1))
				{
					c = 0;
					break;
				}
				if(c != l_packet_head_flag[n + 1])
					break;
			}

			if(n == 3)
			{
				bPacketHead = TRUE;
				break;
			}
		}
		else if(c == 'c')
		{
			pPacket->data_buffer[0] = 'c';
			LIB_ASH_OC(c);
			//judge if comtest
			for(n = 0; n < 6; n++)
			{
		//		c = LIB_ASH_IC();
				if(SUCCESS != com_read_tm(&c, 1, 100))
				{
					c = 0;
					SH_PRINTF("comtest not all : %d\n", n);
					break;
				}
				if(c != l_packet_comtest[n + 1])
					break;
				LIB_ASH_OC(c);
				
			}

			if(n == 6)
			{
				SH_PRINTF("RECEIVE comtest\n");
				bComtest = TRUE;
				break;
			}

		}
		else if(SUCCESS != com_read(&c, 1))
		{
			Sleep(1);
			i++;
		}	
		
	}

	
	if(bPacketHead)
	{
		//receive packet head
		unsigned char packet_head[PACKET_HEAD_LEN];
		if(SUCCESS != com_read_tm(packet_head + PACKET_TYPE_OFFSET, PACKET_HEAD_LEN - 4, 1000))
		{
			SH_PRINTF("ERROR:receive head error");
			return ERROR_PACKET_RECEIVEHEAD;
		}
		
		//compare CRC about packet head
		UINT32 nCRC = MG_Table_Driven_CRC(0xFFFFFFFF, packet_head + PACKET_TYPE_OFFSET, PACKET_HEAD_LEN - 8);
		if(nCRC != fetch_long(packet_head + PACKET_HEAD_CRC_OFFSET))
			return ERROR_PACKET_HEADCRC;
		
		MakePacketHead(packet_head, pPacket);

		//Receive data and CRC
		nLength = pPacket->packet_length;
	
		// if blank packet receive 4B packet number only
		if(0 != pPacket->blank_flag && PACKET_DATA == pPacket->packet_type)
			nLength = 4;
		
		if(SUCCESS != com_read_tm(pPacket->data_buffer, nLength + 4, 1000))
			return ERROR_PACKET_RECEIVEDATA;

		nCRC = MG_Table_Driven_CRC(0xFFFFFFFF, pPacket->data_buffer, nLength);
		if(nCRC != fetch_long(pPacket->data_buffer + nLength))
			return ERROR_PACKET_DATACRC;
		if(PACKET_DATA == pPacket->packet_type)
		{
			if(1 == pPacket->blank_flag)
				memset(pPacket->data_buffer + 4, 0xFF, pPacket->packet_length - 4);
			else if(2 == pPacket->blank_flag)
				memset(pPacket->data_buffer + 4, 0x00, pPacket->packet_length - 4);
		}
	}
	else if(bComtest)
	{
		pPacket->packet_type = PACKET_COMMAND;
		MEMCPY(pPacket->data_buffer, l_packet_comtest, 7);
		i = 7;
		while(i < 128)
		{
			pPacket->data_buffer[i] = LIB_ASH_IC();
			c = pPacket->data_buffer[i];
			LIB_ASH_OC(c);
			if (c == 0x0D || c == 0x0A)
		            break;			
			i++;
		}

		pPacket->packet_length = STRLEN(pPacket->data_buffer);
//		for(i = 0; i < pPacket->packet_length; i++)
//			LIB_ASH_OC(pPacket->data_buffer[i]);
	
       	SH_PRINTF(pPacket->data_buffer);
		
		g_packet_index = 0;
		g_packet_repeat = 0;
		
	}	
	else
		return ERROR_NOPACKETRECEIVE;
	
	return SUCCESS;
}
Пример #17
0
static void dump_str(unsigned char *p)
{
    while (*p)
        LIB_ASH_OC(*p++);
}