Esempio n. 1
0
void HwRunRisc(PBT878_VIDEOCHIP pChip)
{
	SetVideo(pChip);

	ULONG dma=ReadReg(pChip, REG_GPIO_DMA_CTL);
	char dma_bits[16+100]; Dec2Bin(16, dma_bits, dma);

	
	// set start address
	WriteReg(pChip, REG_RISC_STRT_ADD, pChip->Scr.pCodePhy);	
	
	// risc enable, fifo enable
	SetBin(dma_bits, 1, "1"); // risc enable
	SetBin(dma_bits, 0, "1"); // fifo enable
	WriteReg(pChip, REG_GPIO_DMA_CTL, Bin2Dec(dma_bits));

	// capture control
	WriteReg(pChip, REG_CAP_CTL, 
		SetBin( 1, "1")  |// capture odd
		SetBin( 0, "1")   // capture even
		);

	// interrupt mask
	WriteReg(pChip,REG_INT_MASK,   
	BIT_RISCI		| // RISCI
	BIT_VSYNC 
	); 
	  
    
	

	
}
Esempio n. 2
0
int main(int argc, const char * argv[]) {

    unsigned int input;
    int binary[8];
    
    printf("Please enter a decimal integer: ");
    scanf("%d", &input);
    
    Dec2Bin(input, binary);
    PrintBin(binary);
    
    return 0;
}
Esempio n. 3
0
struct nxt_state next_state(int current_state,int input,struct nxt_state nextstate)
{   	
    int binary_state[K - 1];              /* binary value of current state */
    int next_state_binary[K - 1];         /* binary value of next state */
    int next_state;                       /* decimal value of next state */
    int i;                                /* loop variable */
    int memory_contents[K];
    
    for(i=0;i<K;i++)
    memory_contents[i]=0;

    for(i=0;i<K-1;i++)     
    binary_state[i]=0;
   
    /* convert the decimal value of the current state number to binary */
    Dec2Bin(current_state, binary_state);
    /* given the input and current state number, compute the next state number */
    next_state_binary[0] = input;
    for(i=1;i<K-1;i++)
    next_state_binary[i] = binary_state[i-1];
	
     /*convert the binary value of the next state number to decimal */
     if (next_state_binary[1]==0 && next_state_binary[0]==0)
	nextstate.state=0;
     else
	if(next_state_binary[1]==0 && next_state_binary[0]==1)
	nextstate.state=1;
	else
		if(next_state_binary[1]==1 && next_state_binary[0]==0)
		nextstate.state=2;
		else
		nextstate.state=3;
	
        memory_contents[0] = input;
	
       for (i = 1; i < K; i++)
        memory_contents[i] = binary_state[i - 1];
    	nextstate.output[1]=(double)(memory_contents[0]^(memory_contents[1]^memory_contents[2]));   /*([0...n] -> MSB ...LSB)*/
	nextstate.output[0]=(double)(memory_contents[0]^memory_contents[2]);
	
        
	 /*printf("\n the output  of the %d state %f %f \n",nextstate.state,nextstate.output[1],nextstate.output[0]);   */
    	nextstate.inp=input;
 return(nextstate);
}
Esempio n. 4
0
void HwStopRisc(PBT878_VIDEOCHIP pChip)
{
	

	// interrupt mask disable
	WriteReg(pChip, REG_INT_MASK, 0x0);

	ULONG dma=ReadReg(pChip, REG_GPIO_DMA_CTL);
	char dma_bits[16+100]; Dec2Bin(16, dma_bits, dma);

		
	SetBin(dma_bits, 1, "0"); // risc disable
	SetBin(dma_bits, 0, "0"); // fifo disable
	WriteReg(pChip, REG_GPIO_DMA_CTL, Bin2Dec(dma_bits));

	
	// disable capture
	WriteReg(pChip, REG_CAP_CTL, 0 ); 
	

	

}
Esempio n. 5
0
// total resolution 780 x 525
// output resolution   640 x 480 
void SetCropScale(PBT878_VIDEOCHIP pChip)
{
	ULONG a;
	// set scale
	// 640 x 480
	char hscale[256];
	char hdelay[256];
	char hactive[256];
	char vscale[256];
	char vdelay[256];
	char vactive[256];
	
	/*
	Dec2Bin(16, hscale, 682); // 16 bits
	Dec2Bin(13, vscale, 0); // 13 bits

	Dec2Bin(10, hdelay, 134);
	Dec2Bin(10, hactive, 640);    

	Dec2Bin(10,	vdelay, 32);      
	Dec2Bin(10, vactive, 480);    
  */

	Dec2Bin(16, hscale, 732); // 16 bits
	Dec2Bin(13, vscale, 0); // 13 bits

	Dec2Bin(10, hdelay, 114);
	Dec2Bin(10, hactive, 640);  
  
	Dec2Bin(10,	vdelay, 26);  
	Dec2Bin(10, vactive, 480);  
  	    
    
  
	  
	// msb..
	ULONG crop=
	SetBin(7, vdelay, 9, 8) |
	SetBin(5, vactive, 9, 8) |
	SetBin(3, hdelay, 9, 8) |
	SetBin(1, hactive, 9, 8) ;
	WriteReg(pChip, REG_E_CROP, crop);
	WriteReg(pChip, REG_O_CROP, crop);
	
	ULONG vdelay_lo= SetBin(7, vdelay, 7, 0);
	WriteReg(pChip, REG_E_VDELAY_LO, vdelay_lo);
	WriteReg(pChip, REG_O_VDELAY_LO, vdelay_lo);

	ULONG vactive_lo= SetBin(7, vactive, 7, 0);
	WriteReg(pChip, REG_E_VACTIVE_LO, vactive_lo);
	WriteReg(pChip, REG_O_VACTIVE_LO, vactive_lo);  

	ULONG hdelay_lo= SetBin(7, hdelay, 7, 0);
	WriteReg(pChip, REG_E_HDELAY_LO, hdelay_lo);
	WriteReg(pChip, REG_O_HDELAY_LO, hdelay_lo);

	ULONG hactive_lo= SetBin(7, hactive, 7, 0);  
	WriteReg(pChip, REG_E_HACTIVE_LO, hactive_lo);
	WriteReg(pChip, REG_O_HACTIVE_LO, hactive_lo);

	// horizontal scale    
	WriteReg(pChip, REG_E_HSCALE_LO, SetBin(7, hscale, 7, 0));
	WriteReg(pChip, REG_O_HSCALE_LO, SetBin(7, hscale, 7,0));
	WriteReg(pChip, REG_E_HSCALE_HI, SetBin(7, hscale, 15,8));
	WriteReg(pChip, REG_O_HSCALE_HI, SetBin(7, hscale, 15,8));

	// vertical scale upper bytes
	a=ReadReg(pChip, REG_E_VSCALE_HI);
	SetBin(a, 4, vscale, 12, 8);
	WriteReg(pChip, REG_E_VSCALE_HI, a);

	a=ReadReg(pChip, REG_O_VSCALE_HI);
	SetBin(a, 4, vscale, 12, 8);
	WriteReg(pChip, REG_O_VSCALE_HI, a);

	// vertical scale low bytes
	WriteReg(pChip, REG_E_VSCALE_LO, SetBin(7, vscale, 7, 0));
	WriteReg(pChip, REG_O_VSCALE_LO, SetBin(7, vscale, 7, 0));  


	
}