bool fgEPO_Get_One_Pkt(int u2EpoSeq, int pEpoFile,unsigned char *szData)
{
        u32   loopi = 0;
        u32  act_len = 0;
        u32 result;
	char checksum = 0;

	unsigned char buf[6+2+72*3+1+2]={0};
	
	unsigned char framehead[6]={0x04,0x24,0xE3,0x00,0xD3,0x02};
	unsigned char frametail[2]={0x0D,0x0A};
	int pos=0;
      	u16 wSeq = u2EpoSeq;
    
	Ql_memcpy(buf,framehead,sizeof(framehead));
	pos=6;
	
	buf[pos++]=(u8)wSeq ;	
	buf[pos++] = (u8)((wSeq >> 8 ) & 0xff);

	Ql_FS_Seek(pEpoFile,u2EpoSeq * 3 *MTK_EPO_SAT_LNG,QL_FS_FILE_CURRENT);	
        result = Ql_FS_Read(pEpoFile,&buf[pos],MTK_EPO_SAT_LNG*3,&act_len);
           
	pos = MTKBIN_3EPO_PKT_LNG - 2;

	Ql_memcpy(&buf[pos],frametail,sizeof(frametail));

	for(loopi=2;loopi<MTKBIN_3EPO_PKT_LNG-3;loopi++)
	{
		checksum = checksum^buf[loopi];
	}
		
	buf[MTKBIN_3EPO_PKT_LNG - 3] = checksum;


	for(loopi=0;loopi<MTKBIN_3EPO_PKT_LNG;loopi++)
	{		
		*(szData+loopi) = *(buf+loopi);
	}

	return TRUE;
}
Пример #2
0
s32 readFromDbFile(char *fileName, void *outData, u16 len, s32 offset)
{
    OUT_DEBUG_2("readFromDbFile(\"%s\")\r\n", fileName);

	u32 read_bytes = 0;
	s32 ret = QL_RET_OK;


    s32 fh = Ql_FS_Open(fileName, QL_FS_READ_ONLY);
	if (QL_RET_OK > fh) {
		OUT_DEBUG_1("Error %d occured while opening file \"%s\".\r\n", fh, fileName);
		return fh;
	}

    if (offset) {
        ret = Ql_FS_Seek(fh, offset, QL_FS_FILE_BEGIN);
		if (ret < QL_RET_OK) {
            Ql_FS_Close(fh);
			OUT_DEBUG_1("Error %d occured while seeking file \"%s\".\r\n", ret, fileName);
			return ret;
		}
	}

    ret = Ql_FS_Read(fh, (u8 *)outData, len, &read_bytes);
	if (QL_RET_OK != ret) {
        Ql_FS_Close(fh);
		OUT_DEBUG_1("Error %d occured while reading file \"%s\".\r\n", ret, fileName);
		return ret;
	}

//	*(outData + read_bytes) = '\0';
    Ql_FS_Close(fh);
	OUT_DEBUG_3("%d bytes read from file \"%s\".\r\n", read_bytes, fileName);

    return read_bytes;
}