1 Reply Latest reply on Jan 18, 2012 8:07 AM by Felix_M

    error ERROR_INVALID_PARAMETER when using DeviceIoControL

    Community Member

      I am working now to develop a driver to access GPIO of EG20T chipset

      I can open the device for,returning a positive value of openness:
      typedef struct tagGPIO_Device{
      HANDLE        hGPIODevice;
         ioh_gpio_reqt    gpio_reqt;
      } GPIO_Device;
      device->hGPIODevice = CreateFileA(path,GENERIC_WRITE |GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
      , but when I call the DeviceIoControl, as below:
      mode = INPUT_SEL;     and           port is do it for a while to get the right.
      BOOL  GPIO_config(GPIO_Device *device,DWORD port,DWORD mode){
        DWORD dwSize;
        BOOL status;
      device->gpio_reqt.port  = port;
      device->gpio_reqt.pins  = 0xff;
      device->gpio_reqt.mode  = mode;
      device->gpio_reqt.enable = 1;
      status = (DeviceIoControl(device->hGPIODevice,IOCTL_GPIO_INT_ENABLE,&(device->gpio_reqt),NULL,0,&dwSize, NULL));
      return status;
      displays the following error: ERROR_INVALID_PARAMETER for GetLastError().
      Thank you.