|
Resumen del manual
You can access it through the WIN32 API. TPC-1261H provides a WDT driver to allow users to enable/disable the watchdog timer. The driver name is “WDT1:”. Programmers must open this driver before using the resources. Then programmers can use DeviceIOControl functions to enable/disable the watchdog timer. The introduction below includes DeviceIOControl, the definition of the parameter and an example. C.1 DeviceIOControl This function sends a control code directly to a specified device driver, causing the corresponding device to perform the specified operation. BOOL DeviceIoControl( HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped ); TPC-1261H User Manual 58 C.1.1 Parameters • hDevice [in] Handle to the device that is to perform the operation. Call the CreateFile function to obtain a device handle. • dwIoControlCode [in] Specifies the control code for the operation. This value identifies the specific operation to be performed and the type of device on which the operation is to be performed. No specific values are defined for the dwIoControlCode parameter. However, the writer of a custom device driver can define IOCTL_XXXX control codes, per the CTL_CODE macro. These control codes can then be advertised, and an application can use these control codes with DeviceIoControl to perform driver- specific functions. • lpInBuffer [in] Long pointer to a buffer that contains the data required to perform the operation. This parameter can be NULL if the dwIoControlCode parameter specifies an operation that does not require input data. • nInBufferSize [in] Size, in bytes, of the buffer pointed to by lpInBuffer. • lpOutBuffer [out] Long pointer to a buffer that receives the operation.s output data. This parameter can be NULL if the dwIoControlCode parameter specifies an operation that does not produce output data. • nOutBufferSize [in] Size, in bytes, of the buffer pointed to by lpOutBuffer. • lpBytesReturned [out] Long pointer to a variable that receives the size, in bytes, of the data stored into the buffer pointed to by lpOutBuffer. The lpBytesReturned parameter cannot be NULL. Even when an operation produces no output data, and lpOutBuffer can be NULL, the DeviceIoControl function makes use of the variable pointed to bylpBytesReturned. After such an operation, the value of the variable is without meaning. • lpOverlapped [in] Ignored; set to NULL. • Return Values Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError. 59 Appendix C C.2 How to Use the Control Code There are 6 control codes for the operation codes in the WDT driver. C.2.1 IOCTL _WDT_ENABLE: Enables the watchdog timer of your application. By default, if the watchdog timer is enabled, the WDT driver will automatically trigger itself after the specified period and your application does not need to trigger the watchdog timer. lpInBuffer: unused. nInBufferSize: unused. lpOutBuffer: unused. nOutBufferSize: unused. C.2.2 IOCTL _WDT_DISABLE: Disables the watchdog time of your application. lpInBuffer : unsed. nInBufferSize: unused. lpOutBuffer: unused. nOutBufferSize: unused. C.2.3 IOCTL_WDT_STROBE: Triggers the watchdog. If your application uses IOCTL_WDT_ENABLE to enable the watchdog first and then sends IOCTL_WDT_REBOOT to the WDT driver, your application must trigger the watchdog once during the watchdog timer period. If your application has not triggered at the specified period, the device will reboot automatically. lpInBuffer: unused. nInBufferSize: unused. lpOutBuffer: unused. nOutBufferSize: unused. TPC-1261H User Manual 60 C.2.4 IOCTL_WDT_GETTIMEOUT: Gets the Watchdog time setting. lpInBuffer: unused. nInBufferSize: unused. lpOutBuffer: The DWORD points to your watchdog time setting. The Watchdog time setting is just a number. 0 means 2 seconds, 1 means 5 seconds, 2 means 10 seconds, 3 means 15 seconds, 4 means 30 seconds, 5 means 45 seconds and 6 means 60 seconds. The default setting is 5 seconds. nOutBufferSize: unused. C.2.5 IOCTL_WDT_SETTIMEOUT: Sets the watchdog time setting. lpInBuffer : The DWORD points to your watchdog time setting. The watchdog time setting is just a number. 0 means 2 seconds, 1 means 5 seconds, 2 means 10 seconds, 3 means 15 seconds, 4 means 30 seconds, 5 means 45 seconds and 6 means 60 seconds. The default setting is 5 seconds. nInBufferSize:.unused. lpOutBuffer: unused. nOutBufferSize: unused. C.2.6 IOCTL_WDT_REBOOT: If you want your application to trigger the watchdog by itself, please use IOCTL_WDT_REBOOT to notify the watchdog driver timer (WDT). Otherwise, the WDT will trigger itself automatically. lpInBuffer :unused. nInBufferSize: unused. lpOutBuffer: unused. nOutBufferSize: unused. 61 Appendix C C.3 Examples #define WDT_CODE(ID) CTL_CODE(FILE_DEVICE_UNKNOWN,ID, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_WDT_ENABLE WDT_CODE (0x900) #define IOCTL_WDT...
Otros modelos de este manual:Monitores - TPC-1261H (10.37 mb)
Monitores - TPC-1261H (10.37 mb)
Monitores - TPC-1261H (10.37 mb)
Monitores - TPC-1261H (10.37 mb)