Beispiel #1
0
//set operation mode of adc
	void Vflyspi_adc::configure( std::bitset<3> test_pattern ) {
	    // Testpatterns are:
	    // 000 Normal operation - <D13:D0> = ADC output
	    // 001 All zeros - <D13:D0> = 0x0000
	    // 010 All ones - <D13:D0> = 0x3FFF
	    // 011 Toggle pattern - <D13:D0> toggles between 0x2AAA and 0x1555
	    // 100 Digital ramp - <D13:D0> increments from 0x0000 to 0x3FFF by one code every cycle
	    // 101 Custom pattern - <D13:D0> = contents of CUSTOM PATTERN registers
	    // 110 Unused
	    // 111 Unused

	    Logger& log = Logger::instance();
	    log(Logger::DEBUG0) << "Setting ADC input to: " << test_pattern.to_string();

	    sp6data* buf = writeBlock(0,18);//just a large one
	    *(buf++) = ocpwrite | 0x3008; *(buf++) = 0x08; //start clock
	    *(buf++) = ocpwrite | 0x3008; *(buf++) = 0xe8; //release pdn and reset for adc, no start signal yet
	    *(buf++) = ocpwrite | 0x1c00; *(buf++) = 0x10; //software reset
	    *(buf++) = ocpwrite | 0x1c01; *(buf++) = 0x4; //enable lvds interface, disable clock
	//  ocp.write(0x1c00|(0xe<<3)|2,0x81); //7mA, 100Ohm
	    *(buf++) = ocpwrite | 0x1c00|(0xe<<3); *(buf++) = 0xc; //lowest power lvds is 0xc
	    *(buf++) = ocpwrite | 0x1c00|(0x4<<3)|0; *(buf++) = 0x0; //clock edge
	    *(buf++) = ocpwrite | 0x1c00|(0xb<<3)|1; *(buf++) = 0x54; //custom pattern 0x555 ->datablatt wrong!!!
	    *(buf++) = ocpwrite | 0x1c00|(0xc<<3)|0; *(buf++) = 0x05; //custom pattern 0x555 ->datablatt wrong!!!
	    *(buf++) = ocpwrite | 0x1c00|(0xa<<3)|4; *buf =test_pattern.to_ulong()<<5; //enable ramp test pattern with 0x80, custom with 0xa0
	    doWB();
	}
Beispiel #2
0
void Vocpfifo::write(uint adr, uint data)
{
	adr |= 0x80000000; //since adr goes directly into buffer, have to do all processing here
	sp6data *b=writeBlock(0,2); //adr field has no meaning, 2 entries
	*b++=(adr);
	*b=(data);
	doWB();
}
Beispiel #3
0
//trigger recording manually
	void Vflyspi_adc::manual_trigger() {
		sp6data *buf=writeBlock(0,4);
	//tell to start recording
		writeBuf(buf, startstop,start_val);
	//tell to end recording	
		writeBuf(buf, startstop,0);
	//tell ocp
		doWB();
	}
Beispiel #4
0
	void Vflyspi_adc::setup_controller(uint32_t startaddr, uint32_t endaddr, bool single_mode, bool trigger_enabled, bool trigger_channel) {
//write configuration
		sp6data *buf=writeBlock(0,18);
        set_addr(buf, startaddr, endaddr);
// set enable and single shot bit, set start and stop bit to zero
		writeBuf(buf, startstop,static_cast<sp6data>((trigger_channel<<4) | (trigger_enabled<<3) | (single_mode<<2) | 0x00 ));
		
		doWB();
	}
Beispiel #5
0
//switch off triggered recording
	void Vflyspi_adc::set_off_trigger(){
	//check the state
		sp6data state = read(startstop);
                bool trigger_channel = (state >> 4) & 0x1;
	//reset
                sp6data *buf=writeBlock(0,2);
                bool trigger_enabled = 0;
                bool single_mode = 0;
                writeBuf(buf, startstop,static_cast<sp6data>((trigger_channel<<4) | (trigger_enabled<<3) | (single_mode<<2) | 0x00 ));
	//tell ocp
		doWB();
	}