You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
FTDI_kernel_space_gpio_driver/gpio_callbacks.c

49 lines
946 B

static int get_value(struct gpio_chip *gc, unsigned offset){
int ret;
DEBUG_OUT("<1>%s: GET_VALUE of pin%d ",MOD_NAME,offset);
ret=writeToBuffer(offset);
ret|=writeToBuffer(CMD_READ);
return -ret;
}
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;
}