unsigned char PROTONfp_RD(void) { int i; unsigned char val = 0, data = 0; #ifdef VFD_RW_SEM down_read(&vfd_rws); #endif PROTONfp_Set_PIO_Mode(PIO_In); for (i = 0; i < 8; i++) { val >>= 1; VFD_CLK_CLR(); udelay(1); data = stpio_get_pin(cfg.data); VFD_CLK_SET(); if(data) { val |= 0x80; } VFD_CLK_SET(); udelay(1); } udelay(1); PROTONfp_Set_PIO_Mode(PIO_Out); #ifdef VFD_RW_SEM up_read(&vfd_rws); #endif return val; }
unsigned char PROTONfp_RD(void) { int i; unsigned char val = 0, data = 0; down_read(&vfd_rws); PROTONfp_Set_PIO_Mode(PIO_In); for (i = 0; i < 8; i++) { val >>= 1; stpio_set_pin(cfg.clk, 0); udelay(1); data = stpio_get_pin(cfg.data); stpio_set_pin(cfg.clk, 1); if(data) val |= 0x80; stpio_set_pin(cfg.clk, 1); udelay(1); } udelay(1); PROTONfp_Set_PIO_Mode(PIO_Out); up_read(&vfd_rws); return val; }