Esempio n. 1
0
//! resets the device/JTAG logic
void openocd_reset(int trst, int srst)
{
	if(srst && trst)
	{
		// we need to drive TST from low to high at
		// the same time as the RST
		SETTST;
		SETRST;
		msdelay(100);
		CLRTST;
		CLRRST;
		msdelay(100);
		SETTST;
		SETRST;
		msdelay(100);
	}
	else if (!srst && trst)
	{
		openocd_reset_test_logic();
	}
	else if(srst && !trst)
	{
		openocd_reset_cpu();
	}
}
Esempio n. 2
0
void main()
{
while(1) {
P1=0xff;
msdelay(200);
P1=0x00;
msdelay(200);
}
}
Esempio n. 3
0
//! reset the cpu
static void openocd_reset_cpu(void)
{
	SETRST;
	msdelay(100);
	CLRRST;
	msdelay(100);
	SETRST;
	msdelay(100);
}
Esempio n. 4
0
void lcdini()
{
 
    mPORTESetPinsDigitalOut(BIT_0 | BIT_1 | BIT_2 | BIT_3 | BIT_4 | BIT_5 | BIT_6 | BIT_7);
    PORTSetPinsDigitalOut(IOPORT_D,BIT_5 | BIT_4);
    lcdcmd(0x38);
    msdelay(10);
    lcdcmd(0x0E);
    msdelay(10);
    lcdcmd(0x01);
    msdelay(10);
    lcdcmd(0x06);
    msdelay(10);
    lcdcmd(0x80);
    return;
}
interrupt void port1ISR(){
	_disable_interrupts();
	msdelay(20); // delay for 20 ms
	ISRc = getC();
	P1IFG &= ~(ALLROWS); // clears the interrupt flag
	_enable_interrupts();
}
Esempio n. 6
0
//! Set up the pins for JTAG mode.
void openocd_setup()
{
	P5DIR|=MOSI+SCK+TMS;
	P5DIR&=~MISO;
	P4DIR|=TST;
	P2DIR|=RST;
	msdelay(100);
}
Esempio n. 7
0
int show_message(char* string, int time)
{
	if(time < 1)
	    time = 1;
	int len = strlen(string);
	if(len < 1)
	    return 0;
	int count = (int)(len-1)/MAXLENGTH+1;
	pixmap_t *statusbar ;
	statusbar = statusbar_show(pfbscreen, count);
	statusbar_text(pfbscreen, statusbar, string, count);
	msdelay(400);
	statusbar_flash(pfbscreen, statusbar, 1, 800, 1, count);
	msdelay(time*1000);
	statusbar_hide(pfbscreen, statusbar, count);
	return 0;
}
Esempio n. 8
0
File: gui.c Progetto: McIkye/frogga
void
gui_init()
{
	ks_lcd(100);
#ifdef DEBUG1
PORTB &= ~_BV(PORTB5);
msdelay(200);
PORTB |= _BV(PORTB5);
msdelay(500);
PORTB ^= _BV(PORTB5);
msdelay(200);
PORTB |= _BV(PORTB5);
msdelay(200);
PORTB ^= _BV(PORTB5);
msdelay(200);
	ks_putchar(8, 6, '0', 0);
#endif
}
void HBM2X1M_reset()
{
	//P1OUT |= (1<<5);
	//msdelay(100);
	//P1OUT &= ~(1<<5);
	
	SET_PORT_HIGH_BTRST_PIN();
	msdelay(100);
	SET_PORT_LOW_BTRST_PIN();
}
Esempio n. 10
0
static void eth_reset (void)
{
	int i;

	/* reset NIC */
	put_reg (PP_SelfCTL, get_reg (PP_SelfCTL) | PP_SelfCTL_Reset);

	/* wait for 200ms */
	msdelay(200);
        /* Wait until the chip is reset */
	//tmo = get_timer (0) + 1 * CONFIG_SYS_HZ;
	for (i=0; i<5; i++)
        {
            if( ((get_reg_init_bus (PP_SelfSTAT)) & PP_SelfSTAT_InitD) == 0 )
                msdelay(200);
            else
                break;
        }
}
Esempio n. 11
0
void
hx8347_init(void)
{
    const char *p, *ep;
    int i;

    DSEL;
    PORTH &= ~_BV(PORTH5);
    msdelay(50);
    PORTH |= _BV(PORTH5);
    msdelay(50);

    for (p = hx8347_idata, ep = p + sizeof hx8347_idata; p < ep; p += 2) {
        char c = pgm_read_byte(p), d = pgm_read_byte(p+1);
        if (c == NOP)
            msdelay(d);
        else
            hx8347_cmd(c, d);
    }

    /* clear screen */

    CSEL;
    spi_wrb(0x70);
    spi_wrb(SRAMWC);
    DSEL;

    CSEL;
    spi_wrb(0x72);
    for (i = 320 / 8 * 240; i--; ) {
        spi_wrw(0xe718);
        spi_wrw(0xe718);
        spi_wrw(0xe718);
        spi_wrw(0xe718);
        spi_wrw(0xe718);
        spi_wrw(0xe718);
        spi_wrw(0xe718);
        spi_wrw(0xe718);
    }
    DSEL;

    PORTH |= _BV(PORTH6);	/* turn on backlight */
}
Esempio n. 12
0
 void lcddata(unsigned char value)
{
    PORTE = value;                                                               // write whole port E
    //mPORTEWrite = value;
    //PORTWrite(IOPORT_E,BIT_0|BIT_1|BIT_2|BIT_3|BIT_4|BIT_5|BIT_6|BIT_7) = value1;
    PORTSetBits(IOPORT_D, BIT_5);
    PORTSetBits(IOPORT_D, BIT_4);
    msdelay(100);
    PORTClearBits(IOPORT_D,BIT_4);
    return;
 }
void lcd_ctrl_init(void *lcdbase)
{
	__lcd_close_backlight();
	__lcd_display_pin_init();
#if defined(CONFIG_ANDROID_LCD_PROBE)
	__gpio_disable_pull(GPIO_LCD_PWR_N);
	__gpio_clear_pin(GPIO_LCD_PWR_N);
	__gpio_as_output(GPIO_LCD_PWR_N);
	msdelay(50);
	__gpio_set_pin(LCD_RESET_PIN);
	msdelay(1);
	__gpio_clear_pin(LCD_RESET_PIN);
	msdelay(10);
	__gpio_set_pin(LCD_RESET_PIN);
	msdelay(100);
	Jz_LcdProbe();

//	__gpio_clear_pin(LCD_RESET_PIN);
//	mdelay(10);
//	__gpio_set_pin(LCD_RESET_PIN);
//	mdelay(100);
#endif
	
	jz_lcd_init_mem(lcdbase, &panel_info);
	jz_lcd_desc_init(&panel_info);
	jz_lcd_hw_init(&panel_info);
	board_lcd_board_init();
//	__lcd_display_on();
//	lcd_enable();

#ifdef DEBUG
	serial_puts_info("***************************LCDC INFO****************************\n");
	serial_puts_msg("lcdbase = ");
	dump_uint(lcdbase);
	serial_puts_msg("  vl_bpix =  ");
	dump_uint(panel_info.vl_bpix);
	serial_puts_msg(" \n");
	print_lcdc_desc(&panel_info);
#endif
}
void InitBTUart(void)
{
	msdelay(1);

	//P3.1 P3.3 I2C pin not select
	P3SEL &= ~((1<<1) | (1<<3));
	
	P3SEL |= (1<<4) | (1<<5); //UART0 RX TX

	U0CTL = 0;//R-Configuring the USART Module for UART(uart <= i2c or spi)

	//msp430 UART0 init. 9600 bps 8n1
	/*U0CTL = CHAR + SWRST; // 8-bit data, S/W Reset
	ME1 = UTXE0 + URXE0; //UTXE0, URXE0 module enable
	U0TCTL = SSEL_ACLK; //9600 bps / ACLK (32 kHz)
	U0BR1 = 0x00;
	U0BR0 = 0x03;
	U0MCTL = 0x4A;
	U0CTL &= ~SWRST; // Start USART*/


	//msp430 uart0 init. 57600bps 8n1
	UCTL0 = CHAR + SWRST; // 8-bit data, S/W Reset
	ME1 = UTXE0 + URXE0; //UTXE1, URXE1 module enable
	U0TCTL = SSEL0 | SSEL1; // SMCLK
	U0BR1 = 0x00;
	U0BR0 = 0x12; //57600 bps
	U0MCTL = 0x84;
	U0CTL &= ~SWRST; // Start USART
	
	IFG1 &= ~(UTXIFG0);
	IFG1 &= ~(URXIFG0);

	IFG1 &= ~URXIFG0; IE1 |= URXIE0; //UART0RX interrupt ENABLE
	//IFG1 &= ~UTXIFG0;	IE1 |= UTXIE0; //UART0TX interrupt ENABLE
	
	//IFG1 &= ~URXIFG0; IE1 &= ~URXIE0; //UART0RX interrupt DISABLE
	//IFG1 &= ~UTXIFG0; IE1 &= ~UTXIE0; //UART0TX interrupt DISABLE


}
Esempio n. 15
0
int main(void)
{
    // Set up Timer2 (normal mode), freq ~55 Hz
    TCCR2B = (1 << CS22) | (1 << CS21) | (1 << CS20);   // Fcpu/1024
    TIMSK2 = (1 << TOIE2);      // Enable timer overflow interrupt

    DDRB |= (1 << PB5);         // LED
    led_off();

    uart_init(UART_BAUD_SELECT_DOUBLE_SPEED(BAUD, F_CPU));

    /*
     * now enable interrupts...
     */
    sei();

    msdelay(10);


    byte min = 0;
    byte packet[4];
    byte i = 0;

    while (1) {

        unsigned int data = uart_rx();

        // flush packet if data is invalid
        if (data & 0xff00) {
            if (i >= min) {
                txhead(JTAG430X2, NOK, 0);
                min = 1;
            }
            i = 0;
            continue;
        }

        packet[i++] = data;

        if (i < 4) {
            continue;           // keep looking for further bytes
        }

        byte app = packet[0];
        byte verb = packet[1];
        int len = packet[2] + 256 * packet[3];

        byte ok = 1;

        // read the data
        for (i = 0; i < len; i++) {
            data = uart_rx();

            if (data & 0xff00) {
                ok = 0;
                break;
            }
            if (i < CMDDATALEN) {
                cmddata[i] = data & 0xff;
            } else {
                ok = 0;         // just ignore the extra bytes
            }
        }

        if (ok && app == JTAG430X2) {
            // start processing
            jtag430x2_app.handle(app, verb, len);
        } else {
            txhead(JTAG430X2, NOK, 0);
        }

        i = 0;
    }

}
Esempio n. 16
0
void delay(long int ms){
    volatile int i = 0;
    for(i=0;i<ms;i++){
        msdelay();
    }
}
Esempio n. 17
0
void main()
{
	auto int dacslot, adcslot, inputnum, outputnum, i, msgcode;
	static float curout, cur1, cur2, curin;
	
	brdInit();
	
	printf("Please enter DAC board slot position, 0 thru 6....");
	do
	{
		dacslot = getchar();
	} while ((dacslot < '0') || (dacslot > '6'));
	printf("Slot %d chosen.\n", dacslot-=0x30);

	printf("Please enter an output channel, 0 thru 7....");
	do
	{
		outputnum = getchar();
	} while (!((outputnum >= '0') && (outputnum <= '7')));
	printf("channel %d chosen.\n", outputnum-=0x30);

	///// configure all outputs to 4 mA and enable output
	for (i=0; i<=7; i++)
	{
		if (msgcode = anaOutEERd(ChanAddr(dacslot, outputnum)))
		{
			printf("Error %d: eeprom unreadable or empty slot; channel %d\n", msgcode,outputnum);
			exit(0);
		}
		else
			anaOutmAmps(ChanAddr(dacslot, outputnum), 0.0);
	}
	anaOutEnable();
	
	printf("Please enter ADC board slot position, 0 thru 6....");
	do {
		adcslot = getchar();
		} while ((adcslot < '0') || (adcslot > '6'));
	printf("Slot %d chosen.\n", adcslot-=0x30);

	printf("Please enter an input channel, 0 thru A (10)....");
	do {
		inputnum = getchar();
		} while (!((inputnum >= '0') && (inputnum <= '9')) && (inputnum != 'a') && (inputnum != 'A'));
	if ((inputnum == 'a') || (inputnum == 'A'))
	{
		printf("channel 10 chosen.\n");
		inputnum=10;
	}
	else
		printf("channel %d chosen.\n", inputnum-=0x30);

	/////read coefficients from adc eeprom
	printf("Read coefficients from adc eeprom\n");
	if (msgcode = anaInEERd(ChanAddr(adcslot, inputnum)))
	{
		printf("Error %d: eeprom unreadable or empty slot; channel %d\n", msgcode,inputnum);
		exit(0);
	}
	
	/////get currents from two known raw data
	anaOut(ChanAddr(dacslot, outputnum), HICOUNT);
	msdelay(10);			
	cur1 = anaInmAmps(ChanAddr(adcslot, inputnum));
	
	anaOut(ChanAddr(dacslot, outputnum), LOCOUNT);
	msdelay(10);			
	cur2 = anaInmAmps(ChanAddr(adcslot, inputnum));

	if (anaOutCalib(ChanAddr(dacslot, outputnum), HICOUNT, cur1, LOCOUNT, cur2))
		printf("Cannot make coefficients\n");
	else
	{
		/////store coefficients into eeprom
		while (anaOutEEWr(ChanAddr(dacslot, outputnum)));
		printf("Wrote coefficients to dac eeprom\n");
		
		printf("Read coefficients from dac eeprom\n");
		if (msgcode = anaOutEERd(ChanAddr(dacslot, outputnum)))
		{
			printf("Error %d: eeprom unreadable; channel %d\n", msgcode,outputnum);
			exit(0);
		}
		
		if (cur1 < 1.0)
		{
			curout = 0.004;
			cur1 = 0.020;
			cur2 = 0.0015;
		}
		else
		{
			curout = 4.00;
			cur1 = 20.0;
			cur2 = 1.5;
		}
		
		for (curout; curout <= cur1; curout+=cur2)
		{
			anaOutmAmps(ChanAddr(dacslot, outputnum), curout);
			msdelay(10);						// variable delay needed for large voltage change
			curin = anaInmAmps(ChanAddr(adcslot, inputnum));
			if (curin < 1.0)
				printf("DAC channel %d output %.5f A, ADC channel %d input %.5f A\n", outputnum,
					curout, inputnum, curin);
			else
				printf("DAC channel %d output %.4f mA, ADC channel %d input %.4f mA\n", outputnum,
					curout, inputnum, curin);
		}
	}
}
Esempio n. 18
0
void delay(int ms){
    int i = 0;
    for(i=0;i<ms;i++){
        msdelay();
    }
}