Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Fw: DEC 2000 Playback



Hello,
    I've been playing back small PVA files using Jungo software driver under Windows.
 
I've determined what needs to be done to play  a PVA file back from loading the DEC2000 Firmware and a  reset:-
1)Change Interface 0 to alternate setting 1
2)Reset of Pipe 3
3)Reset of pipe 0x84
4)Reset of pipe 7
5)Send 0xAA 0x01 0xB0 0x02 0x00 0x01 to the command pipe (3)
6)Send 0xAA 0x02 0xB0 0x02 0x00 0x01 again
7)Send 0xAA 0x03 0x08 0x00 to the command pipe
8)Send 0xAA 0x04 0x82 0x01 0x05 to the command pipe
 
Then Send the PVA file using:-
int SendPVA(unsigned char *pvabuff,unsigned int len,struct ttusb_dec* dec,WORD shortpacknum)
{
 DWORD iso_buff_size=0;
 DWORD bytes_transferred;
 DWORD retval;
 
 unsigned int i;
 WORD csum ;
 WORD packet_id;
 BYTE isobuff[65536];
 
 isobuff[0]=0xaa;
 isobuff[1]=0xaa;
 isobuff[2]=0xaa;
 isobuff[3]=0x00;
 memcpy(&isobuff[4],pvabuff,len);
 
 shortpacknum=htons(shortpacknum);
 memcpy(&isobuff[len+4],&shortpacknum,2);
 
 csum=0;
 memcpy(&isobuff[len+6],&csum,2);
 for (i = 4; i < len+8; i += 2)csum ^= ((isobuff[i] << 8) + isobuff[i + 1]);
 //csum^=0xcdcd;
 
 //csum=htons(csum);
 isobuff[len+6]=csum/256;
 isobuff[len+7]=csum%256;
 
 csum=0;
 for (i = 4; i < len+8; i += 2)csum ^= ((isobuff[i] << 8) + isobuff[i + 1]);
 
 swap_bytes(isobuff, len+8);
 
 //retval=0;
 //ttusb_dec_process_urb_frame(dec,isobuff,len+8);
 retval=WDU_TransferIsoch(dec->hDevice, OUT_PIPE,
   FALSE, USB_ISOCH_ASAP|USB_ISOCH_RESET , isobuff, len+8,
   &bytes_transferred, 1000000);
 return retval;
}
 
 FILE *pIn=fopen("E:\\c4_18mar04_00.pva","rb");
 BYTE buff[6144];
 unsigned short size;
 WORD shortpacknum=0;
 while(!feof(pIn))
 {
  fread(buff,8,1,pIn);
  if(buff[0]!='A'||buff[1]!='V')TRACE("No AV\n");
  memcpy(&size,&buff[6],2);
  size=ntohs(size);
  fread(&buff[8],size,1,pIn);
  SendPVA(buff,size+8,pdec,shortpacknum++);
 }
 
The quality is't to good (probably because  this is a user space program and hence rather slow) - this will hopefully be improved when this is moved to the kernel.
In the kernel how do you reset a pipe ( is it necessary??)
 
Thanks
 
Philip Simons
 
 

Home | Main Index | Thread Index