/* * Free the hub CRB "crbnum" which encountered an error. * Assumption is, error handling was successfully done, * and we now want to return the CRB back to Hub for normal usage. * * In order to free the CRB, all that's needed is to de-allocate it * * Assumption: * No other processor is mucking around with the hub control register. * So, upper layer has to single thread this. */ void hubiio_crb_free(hubinfo_t hinfo, int crbnum) { ii_icrb0_b_u_t icrbb; /* * The hardware does NOT clear the mark bit, so it must get cleared * here to be sure the error is not processed twice. */ icrbb.ii_icrb0_b_regval = REMOTE_HUB_L(hinfo->h_nasid, IIO_ICRB_B(crbnum)); icrbb.b_mark = 0; REMOTE_HUB_S(hinfo->h_nasid, IIO_ICRB_B(crbnum), icrbb.ii_icrb0_b_regval); /* * Deallocate the register. */ REMOTE_HUB_S(hinfo->h_nasid, IIO_ICDR, (IIO_ICDR_PND | crbnum)); /* * Wait till hub indicates it's done. */ while (REMOTE_HUB_L(hinfo->h_nasid, IIO_ICDR) & IIO_ICDR_PND) us_delay(1); }
void en_pulse(void){ EN_3 = 0x08; us_delay(20); EN_3 = 0x00; }
void lcd_init(void){ int delay; SYSCTL_RCGC2_R |= 0x03; delay = 0; GPIO_PORTB_LOCK_R = 0x4C4F434B; GPIO_PORTB_CR_R |= 0x3C; GPIO_PORTB_AMSEL_R &= ~0x3C; GPIO_PORTB_AFSEL_R &= ~0x3C; GPIO_PORTB_PCTL_R &= ~0xFFFF00; GPIO_PORTB_DIR_R |= 0x3C; GPIO_PORTB_DEN_R |= 0x3C; GPIO_PORTA_LOCK_R = 0x4C4F434B; GPIO_PORTA_CR_R |= 0x0C; GPIO_PORTA_AMSEL_R &= ~0x0C; GPIO_PORTA_AFSEL_R &= ~0x0C; GPIO_PORTA_PCTL_R &= ~0xFF00; GPIO_PORTA_DIR_R |= 0x0C; GPIO_PORTA_DEN_R |= 0x0C; ms_delay(15); RS_2 = 0; EN_3 = 0; GPIO_PORTB_DATA_R = 0x0C; en_pulse(); ms_delay(5); GPIO_PORTB_DATA_R =0x0C; en_pulse(); us_delay(100); //3 GPIO_PORTB_DATA_R = 0x0C; en_pulse(); ms_delay(100); GPIO_PORTB_DATA_R = 0x8; en_pulse(); ms_delay(100); lcd_write_com(0x28);//Function Set lcd_write_com(0x0F);//Display on/off lcd_write_com(0x06);//Entry mode: Incremental lcd_write_com(0x01); //lcd_write_char(0x48); //lcd_write_char(0x48); }
void ms_delay(uint16_t ms) { while (ms > 0) { wdt_reset(); us_delay(1000); // XXX approximate ms--; } wdt_reset(); }