// In SMDK6410 Eval. Board, Button is mapped to this GPIOs // Reset Button -> GPN[11] : EINT11 // Power Button -> GPN[9] : EINT9 / ADDR_CF[1] // void Button_pwrbtn_port_initialize(void) { RETAILMSG(PWR_ZONE_ENTER, (_T("[BTN] %s()\n\r"), _T(__FUNCTION__))); // GPN[0] to EINT0 SET_GPIO(g_pGPIOReg, GPNCON, 0, GPNCON_EXTINT); // GPN[0] set Pull-up Enable SET_GPIO(g_pGPIOReg, GPNPUD, 0, GPNPUD_PULLUP); }
static void palmtt3_udc_command (int cmd){ switch (cmd) { case PXA2XX_UDC_CMD_DISCONNECT: SET_GPIO(GPIO_NR_PALMTT3_PUC_USB_POWER, 0); SET_GPIO(GPIO_NR_PALMTT3_USB_POWER, 1); printk(KERN_INFO "palmtt3_udc: got command PXA2XX_UDC_CMD_DISCONNECT\n"); break; case PXA2XX_UDC_CMD_CONNECT: SET_GPIO(GPIO_NR_PALMTT3_USB_POWER, 0); SET_GPIO(GPIO_NR_PALMTT3_PUC_USB_POWER, 1); printk(KERN_INFO "palmtt3_udc: got command PXA2XX_UDC_CMD_CONNECT\n"); break; default: printk("palmtt3_udc: unknown command '%d'\n", cmd); } }
void Button_port_initialize(void) { RETAILMSG(PWR_ZONE_ENTER, (_T("[BTN] %s()\n\r"), _T(__FUNCTION__))); // GPN[9] to EINT9, GPN[11] to EINT11 SET_GPIO(g_pGPIOReg, GPNCON, 9, GPNCON_EXTINT); #ifndef OMNIBOOK_VER SET_GPIO(g_pGPIOReg, GPNCON, 11, GPNCON_EXTINT); #endif /!OMNIBOOK_VER #ifdef OMNIBOOK_VER // GPN[9], GPN[11] set Pull-down Enable SET_GPIO(g_pGPIOReg, GPNPUD, 9, GPNPUD_PULLDOWN); #else //!OMNIBOOK_VER // GPN[9], GPN[11] set Pull-up Enable SET_GPIO(g_pGPIOReg, GPNPUD, 9, GPNPUD_PULLUP); SET_GPIO(g_pGPIOReg, GPNPUD, 11, GPNPUD_PULLUP); #endif OMNIBOOK_VER }
void palmtt3_hwuart_configure(int state) { switch (state) { case PXA_UART_CFG_PRE_STARTUP: break; case PXA_UART_CFG_POST_STARTUP: SET_GPIO(35,0); SET_GPIO(35,1); palmtt3_hwuart_state = 1; break; case PXA_UART_CFG_PRE_SHUTDOWN: SET_GPIO(35,0); palmtt3_hwuart_state = 0; break; case PXA_UART_CFG_POST_SHUTDOWN: break; default: printk("palmtt3_hwuart_configure: bad request %d\n",state); break; } }
/*** IRDA ***/ static void palmtt3_irda_transceiver_mode(struct device *dev, int mode) { unsigned long flags; local_irq_save(flags); if (mode & IR_SIRMODE){ printk ("IrDA: setting mode to SIR\n"); } else if (mode & IR_FIRMODE){ printk ("IrDA: setting mode to FIR\n"); } if (mode & IR_OFF){ printk ("IrDA: turning OFF\n"); SET_GPIO(GPIO_NR_PALMTT3_IR_DISABLE, 1); } else { printk (KERN_INFO "IrDA: turning ON\n"); SET_GPIO(GPIO_NR_PALMTT3_IR_DISABLE, 0); } local_irq_restore(flags); }
static void set_gpio(uint8_t n, uint8_t v) { switch (n) { SET_GPIO(0, 0, v); SET_GPIO(0, 1, v); SET_GPIO(0, 2, v); SET_GPIO(0, 3, v); SET_GPIO(0, 4, v); SET_GPIO(0, 5, v); SET_GPIO(0, 6, v); SET_GPIO(0, 7, v); SET_GPIO(2, 0, v); SET_GPIO(2, 1, v); SET_GPIO(2, 2, v); SET_GPIO(2, 3, v); SET_GPIO(2, 4, v); SET_GPIO(2, 5, v); /* * P0_0 ... P0_7: bits 0 ... 7 * P2_0 ... P2_5: bits 8 ... 13 * P3_0: bit 14 */ case 14: P3_0 = v; } }
/** * Turn display backlight on or off. * \param p Pointer to driver's private data structure. * \param state New backlight status. */ void lcdrpi_HD44780_backlight(PrivateData *p, unsigned char state) { if (p->backlight_bit > -1 && p->backlight_bit < 32) SET_GPIO(p->backlight_bit, (state == BACKLIGHT_ON) ? 1 : 0); }
/** * Send data or commands to the display. * \param p Pointer to driver's private data structure. * \param displayID ID of the display (or 0 for all) to send data to. * \param flags Defines whether to end a command or data. * \param ch The value to send. */ void lcdrpi_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch) { /* Safeguard: This should never happen */ if (gpio_map == NULL) { return; } if (flags == RS_INSTR) { SET_GPIO(p->rpi_gpio->rs, 0); } else { /* flags == RS_DATA */ SET_GPIO(p->rpi_gpio->rs, 1); } /* Clear data lines ready for nibbles */ SET_GPIO(p->rpi_gpio->d7, 0); SET_GPIO(p->rpi_gpio->d6, 0); SET_GPIO(p->rpi_gpio->d5, 0); SET_GPIO(p->rpi_gpio->d4, 0); p->hd44780_functions->uPause(p, 50); /* Output upper nibble first */ SET_GPIO(p->rpi_gpio->d7, (ch & 0x80)); SET_GPIO(p->rpi_gpio->d6, (ch & 0x40)); SET_GPIO(p->rpi_gpio->d5, (ch & 0x20)); SET_GPIO(p->rpi_gpio->d4, (ch & 0x10)); p->hd44780_functions->uPause(p, 50); /* Data is clocked on the falling edge of EN */ if (displayID == 1 || displayID == 0) SET_GPIO(p->rpi_gpio->en, 1); if (displayID == 2 || (p->numDisplays > 1 && displayID == 0)) SET_GPIO(p->rpi_gpio->en2, 1); p->hd44780_functions->uPause(p, 50); if (displayID == 1 || displayID == 0) SET_GPIO(p->rpi_gpio->en, 0); if (displayID == 2 || (p->numDisplays > 1 && displayID == 0)) SET_GPIO(p->rpi_gpio->en2, 0); p->hd44780_functions->uPause(p, 50); /* Do same for lower nibble */ SET_GPIO(p->rpi_gpio->d7, 0); SET_GPIO(p->rpi_gpio->d6, 0); SET_GPIO(p->rpi_gpio->d5, 0); SET_GPIO(p->rpi_gpio->d4, 0); p->hd44780_functions->uPause(p, 50); SET_GPIO(p->rpi_gpio->d7, (ch & 0x08)); SET_GPIO(p->rpi_gpio->d6, (ch & 0x04)); SET_GPIO(p->rpi_gpio->d5, (ch & 0x02)); SET_GPIO(p->rpi_gpio->d4, (ch & 0x01)); p->hd44780_functions->uPause(p, 50); if (displayID == 1 || displayID == 0) SET_GPIO(p->rpi_gpio->en, 1); if (displayID == 2 || (p->numDisplays > 1 && displayID == 0)) SET_GPIO(p->rpi_gpio->en2, 1); p->hd44780_functions->uPause(p, 50); if (displayID == 1 || displayID == 0) SET_GPIO(p->rpi_gpio->en, 0); if (displayID == 2 || (p->numDisplays > 1 && displayID == 0)) SET_GPIO(p->rpi_gpio->en2, 0); p->hd44780_functions->uPause(p, 50); }