static int get_value(struct gpio_chip *gc, unsigned offset){ DEBUG_OUT("<1>%s: GET_VALUE of pin%d ",MOD_NAME,offset); writeToBuffer(offset); writeToBuffer(CMD_READ); down(&read_sema); return pin_status[0]; } static void set_value(struct gpio_chip *chip, unsigned offset, int value){ DEBUG_OUT("<1>%s: SET_VALUE of pin%d to %d",MOD_NAME,offset,value); writeToBuffer(offset); if(value){ writeToBuffer(CMD_H); }else{ writeToBuffer(CMD_L); } } static int set_in(struct gpio_chip *chip, unsigned offset){ int ret=0; DEBUG_OUT("<1>%s: SET_INPUT of pin%d ",MOD_NAME,offset); ret=writeToBuffer(offset); ret|=writeToBuffer(CMD_IN); return -ret; } static int set_out(struct gpio_chip *chip, unsigned offset, int value){ int ret; DEBUG_OUT("<1>%s: SET_OUTPUT of pin%d to %d",MOD_NAME,offset,value); ret=writeToBuffer(offset); if(value){ ret|=writeToBuffer(CMD_OUTH); }else{ ret|=writeToBuffer(CMD_OUTL); } return -ret; }