int radio_setup_2g() { gpio_pin_output(RADIO_GPIO_BB_MUX_SEL, OFF); gpio_pulldown_configure(RADIO_BB_PULLDOWN, GPIOPDDown); gpio_pin_output(RADIO_GPIO_BB_ON, OFF); udelay(100000); gpio_pin_output(RADIO_GPIO_RADIO_ON, ON); udelay(100000); gpio_pin_output(RADIO_GPIO_BB_RESET, ON); udelay(100000); gpio_pin_output(RADIO_GPIO_BB_RESET, OFF); udelay(100000); gpio_pin_use_as_input(RADIO_GPIO_BB_DETECT); if(gpio_pin_state(RADIO_GPIO_BB_DETECT) != 0) { bufferPrintf("radio: comm board not present, powered on, or at+xdrv=10,2 had been issued.\r\n"); return -1; } bufferPrintf("radio: comm board detected.\r\n"); if(!radio_wait_for_ok(10)) { bufferPrintf("radio: no response from baseband!\r\n"); return -1; } bufferPrintf("radio: setting speed to 750000 baud.\r\n"); radio_write("at+ipr=750000\r\n"); // wait a millisecond for the command to totally clear uart // I wasn't able to detect this condition with uart registers (looking at FIFO count, transmitter empty) udelay(1000); uart_set_baud_rate(RADIO_UART, 750000); if(!radio_wait_for_ok(10)) { bufferPrintf("radio: no response from baseband!\r\n"); return -1; } RadioAvailable = TRUE; bufferPrintf("radio: ready.\r\n"); speaker_setup(); return 0; }
void multitouch_on() { if(!MultitouchOn) { bufferPrintf("multitouch: powering on\r\n"); gpio_pin_output(MT_GPIO_POWER, 0); udelay(200000); gpio_pin_output(MT_GPIO_POWER, 1); udelay(15000); MultitouchOn = TRUE; } }
void user_init(void) { #else void app_main(void) { #endif _sys_init(); #if LED_ACT // Init leds gpio_pin_output(LED_ACT); gpio_pin_clr(LED_ACT); #endif pthread_attr_t attr; pthread_t thread; int res; debug_free_mem_begin(lua_main_thread); pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, luaTaskStack); res = pthread_create(&thread, &attr, lua_start, NULL); if (res) { panic("Cannot start lua"); } debug_free_mem_end(lua_main_thread, NULL); }
void cmd_gpio_out(int argc, char** argv) { if(argc < 3) { bufferPrintf("Usage: %s <port> [0|1]\r\n", argv[0]); return; } uint32_t port = parseNumber(argv[1]); uint32_t value = parseNumber(argv[2]); bufferPrintf("Pin 0x%x value: %d\r\n", port, value); gpio_pin_output(port,value); }
/* * Control an LED to show cfi activity */ static inline void cfi_led(int val) { #ifdef SD_LED gpio_pin_output(CFI_LED); if (val) { activity = 1; gpio_pin_set(CFI_LED); } else { gpio_pin_clr(CFI_LED); activity = 0; } #endif }
int radio_setup_3g() { gpio_pulldown_configure(RADIO_BB_PULLDOWN, GPIOPDDown); pmu_gpio(RADIO_GPIO_BB_ON, TRUE, OFF); udelay(100000); gpio_pin_output(RADIO_GPIO_RADIO_ON, ON); udelay(100000); gpio_pin_output(RADIO_GPIO_BB_RESET, ON); udelay(100000); gpio_pin_output(RADIO_GPIO_BB_RESET, OFF); udelay(100000); gpio_pin_use_as_input(RADIO_GPIO_RESET_DETECT); if(gpio_pin_state(RADIO_GPIO_RESET_DETECT) != 1) { bufferPrintf("radio: comm board not present, powered on, or at+xdrv=10,2 had been issued.\r\n"); return -1; } bufferPrintf("radio: comm board detected.\r\n"); if(!radio_wait_for_ok(10)) { bufferPrintf("radio: no response from baseband!\r\n"); return -1; } RadioAvailable = TRUE; bufferPrintf("radio: ready.\r\n"); speaker_setup(); return 0; }