Home
TPMC821-SW-65 - powerbridge.de
Contents
1. include TPMC821 h HANDLE hDevice BOOLEAN success success DevicelIoControl hDevice TPMC821 handle IOCTL TP821 RESET HOST FAIL control code NULL 0 NULL 0 amp NumBytes not used NUL if success 1 ErrorHandler Device I O control error process error TPMC821 SW 65 Windows WDM Device Driver Page 26 of 27 TEWS S TECHNOLOGIES 3 1 3 9 lOCTL TP821 RESET HARDWARE FAIL This control function resets the hardware failure flag in the device driver The hardware failure flag was set after reception of a service interrupt request from the TPMC821 No parameters are needed for execution of this control function Additional information about the service interrupt request can be found in the TPCM821 User Manual and User Manuals for the INTERBUS Generation 4 Master Board which is part of the TPMC821 Engineering Manual Example include TPMC821 h HANDLE hDevice BOOLEAN success success DeviceIoControl hDevice TPMC821 handle OCTL TP821 RESET HARDWARE FAIL control code ULL I N 0 NULL 0 amp N NumBytes not used U if success ErrorHandler Device I O control error process error TPMC821 SW 65 Windows WDM Device Driver Page 27 of 27
2. 01 0 02 0x03 0x04 OxAA 0x55 OxBB 0x66 40x08 X X X X X X X X See Also Win32 documentation DeviceloControl TPMC821 SW 65 Windows WDM Device Driver Page 18 of 27 TEWS S TECHNOLOGIES 3 1 3 3 lOCTL TP821 This control function allows the execution of various frequently used commands and command sequences without using mailbox commands A pointer to the caller s parameter buffer is passed by the parameters p nBuffer to driver Usually this kind of command execution is used on bit oriented host system The TP821 BITCMD structure has the following layout typedef struct USHORT FunctionBit USHORT FunctionParam 821 BITCMD PTP821 BITCMD Members FunctionBit Specifies the bit number 0 6 of the standard function to execute FunctionParam Specifies an optional parameter for the standard function Additional information about standard function bits and parameter values can be found in the User Manual NTERBUS Generation 4 Master Board which is part of the TPMC821 Engineering Manual Example finclude TPMC821 h HANDLE hDevice BOOLEAN success TP821 BITCMD BitCmd BitCmd FunctionBit 1 lt lt 0 Start Data Transfer Req BitCmd FunctionParam O none success DevicelIoControl hDevice TPMC821 handle IOCTL_TP821_BIT_CMD control code amp BitCmd Sizeof TP821 BITCMD NULL 0 amp NumBytes not used NULL
3. TPMC821 SW 65 Windows WDM Device Driver Page 19 of 27 TEWS S TECHNOLOGIES 3 1 3 4 TP821 MBX CMD lIOCTL 821 NOWAIT This control function is used to transmit messages from the host system to the IBS master SSGI box 0 If an answer message is expected the received message SSGI box 1 is copied direct to the user receive buffer A pointer to the users transmit buffer is passed by the parameter p nBuffer to driver The parameter pOutBuffer contains a pointer to the user receive buffer Transmit and receive buffer are organized as follows valid for all services Word 1 Service Code Word 2 Parameter Count Word 3 Parameter Word 4 Parameter Parameter The control function JOCTL TP821 MBX CMD NOWAIT returns immediately to the caller without waiting for an answer This control function is used only for reset and unconfirmed PCP services Additional information about supported services can be found in the IBS User Manuals which are part of the TPMC821 Engineering Manual Example include TPMC821 h define MAX NUM WORDS 100 HANDLE hDevice BOOLEAN success USHORT RequestPar MAX NUM WORDS USHORT ResultPar MAX NUM WORDS RequestPar 0 0x0710 Create Configuration Service RequestPar 1 1 one parameter follow RequestPar 2 1 number of frames to generate success DeviceIoControl hDevice TPMC821 handle IOCTL TP821 MBX C
4. WDM Device Driver Page 21 of 27 TEWS S TECHNOLOGIES Example include TPMC821 h HANDLE hDevice BOOLEAN success TP821 DIAG DiagInfo success DevicelIoControl hDevice TPMC821 handle IOCTL TP821 GET DIAG control code NULL 0 amp DiagInfo sizeof TP821 DIAG amp NumBytes number of bytes returned NULL if success printf nRead Diagnostic Information successful n printf Status Sysfail Register 04Xhex Mn DiagInfo SysfailReg printf Configuration Register 04Xhex n DiagInfo ConfigReg printf Master Diagnostic Register 04Xhex n DiagInfo DiagReg printf Hardware Failure s n DiagInfo HardwareFailure TRUE FALSE printf Initialization done s n DiagInfo InitComplete TRUE FALSE else ErrorHandler Device I O control error process error TPMC821 SW 65 Windows WDM Device Driver Page 22 of 27 TEWS S TECHNOLOGIES 3 1 3 6 lOCTL TP821 CONFIG This control function announces a new operating mode to the driver and change timeout values for mailbox and data transfer functions Every time the host changes the operating mode SetValue mailbox message the driver must be introduced about that so he can handle following data transfer message in the right manner see also Automatic Configuration in the example application A pointer to the callers configuration structure is passed by the parameters
5. p nBuffer to driver The TP821 CONFIG structure has the following layout typedef struct USHORT OperatingMode ULONG DataTimeout ULONG MailboxTimeout TP821_CONFIG PTP821 CONFIG Members OperationMode Specifies the new operating mode Valid operating modes are TP821 ASYNC In asynchronous operating mode the process data is updated by the INTERBUS firmware synchronously with the INTERBUS data cycles but asynchronously with hosts access to the process image This operating mode is default after RESET TP821 ASYNC this asynchronous operating mode the hosts access to the process data is locked for reading and writing consistent data TP821 BUS SYNC Bus synchronous operating mode TP821 PROG SYNC Program synchronous operating mode Additional information about operating modes can be found in the User Manual INTERBUS Generation 4 Master Board which is part of the TPMC821 Engineering Manual DataTimeout Specifies a new timeout value for all following read and write commands from and to the DTA IN and DTA OUT area The default timeout value is 2 seconds MailboxTimeout Specifies a new timeout value for all following mailbox and function bit commands The default timeout value is 10 seconds TPMC821 SW 65 Windows WDM Device Driver Page 23 of 27 TEWS S TECHNOLOGIES Example include TPMC821 h HANDLE hDevice BOOLEAN success TP821 CONFIG ConfigPar Setup new operating mod
6. part lword will be used and all long words will be byte swapped DataOffset Specifies a byte offset from the beginning of the DTA OUT area where the new data should be written The union contains three arrays The size of these dynamic expandable arrays depends the number of data items to write Because the size of this arrays is only well known at run time you should never use the sizeof function to determine the size of the segment structure TPMC821 SW 65 Windows WDM Device Driver Page 15 of 27 TEWS S TECHNOLOGIES The macro SEGMENT SIZE pSeg defined in tpmc821 h delivers the correct structure size The macro NEXT SEGMENT pSeg also defined in tpmc821 h calculates a pointer to the begin of the following segment in the buffer Both macros in combination should be used to assemble a write data buffer for the desired write request The end of the write buffer is specified by a segment with type of TP821 END Please refer to the next example to see how to assemble a correct write buffer Example include TPMC821 h HANDLE hDevice BOOLEAN success ULONG NumBytes size UCHAR SegmentBuffer 100 PT821 SEGMENT pSeg EL size 0 pseg PTP821 SEGMENT amp SegmentBuffer 2 pSeg gt ItemTyp TP821_BYTE pseg gt ItemNumber 4 pSeg DataOffset 0s pSeg u byte 0 1 pSeg u byte 1 2 pSeg u byte 2 3 pseg gt u byte 3 4 size SEGMENT SI
7. 21 SEGMENT Each segment holds an exact description of the embedded data like data type number of data items and offset in the DTA IN area On entrance of this control function every segment contains a description of the data items to read on exit the driver fills the data union with the desired process data This relative complex mechanism has two advantages First you can pick up occasional placed data items without copying the whole DAT buffer and second word and long word organized data items can be automatically byte swapped by the driver Remember Intel x86 CPU s use little endian and Motorola respective the INTERBUS use big endian alignment of data words The TP821 SEGMENT structure has the following layout typedef struct USHORT ItemNumber USHORT ItemType USHORT DataOffset union UCHAR byte 1 USHORT word 1 ULONG lword 1 u TP821_SEGMENT PTP821_SEGMENT Members ItemNumber Specifies the number of items of the specified type in the data array In other words it specifies the size of the array u byte u word or u lword ItemType Specifies the data type of the embedded process data Note every data item in the segment must have the same type TP821 END Specifies the last segment in the list No data follows TP821 BYTE Specifies a segment with byte data The union part byte will be used TP821 WORD Specifies a segment with word data The union part word will be used and all words of the a
8. CreateFile LPCTSTR DWORD dwbDesiredAccess DWORD dwShareMode LPSECURITY ATTRIBUTES IpSecurityAttributes DWORD dwCreationDistribution DWORD dwFlagsAndAttributes HANDLE hTemplateFile Parameters LPCTSTR pFileName Points to a null terminated string which specifies the name of the TPMC821 to open The string should be of the form TPMC821_ x to open the device x The ending x is a one based number The first device found by the driver is TPMC821 1 the second WATPMC821 2 and so on DWORD dwbDesiredAccess Specifies the type of access to the TPMC821 For the TPMC821 this parameter must be set to read write access GENERIC READ GENERIC WRITE DWORD dwShareMode Set of bit flags that specify how the object can be shared Set to 0 LPSECURITY ATTRIBUTES 1 IpSecurityAttributes Pointer to a security structure Set to NULL for TPMC821 devices TPMC821 SW 65 Windows WDM Device Driver Page 7 of 27 TEWS S TECHNOLOGIES DWORD dwCreationDistribution Specifies which action to take on files that exist and which action to take when files do not exist TPMC821 devices must be always opened OPEN EXISTING DWORD dwFlagsAndAttributes Specifies the file attributes and flags for the file This value must be set to 0 no overlapped I O HANDLE hTemplateFile This value must be NULL for TPMC821 devices Return Value If the function succeeds the return value is an open handle t
9. LFEU ECKE FRIa EU FEE EXER E GU EVE QEON FERE AK 5 2 1 Software Installation inc einer aito Ya nac co sn m M 5 2 1 1 Windows 2000 22 000400000000000 5 2 1 2 Confirming Windows 2000 XP Installation 5 21 3 Windows ME 98 6 2 6 2 1 4 Confirming Windows ME 98 SE 6 3 TPMC821 DEVICE DRIVER PROGRAMMING eene nnn nnn 7 3 1 821 Files and Functions nnn munnn anna nana na 7 3 1 1 X Opening a TPMC821 7 3 1 2 Closing a TPMC821 9 3 1 3 TPMC821 Device I O Control Functions eese nnns 10 3 3 1 NOCTLETP 821 READ incite ri coit niri acre aras ava cava cavo ra eod cda vac pri ke ien 12 3 1 9 2 821 WRITE icis ivi et eicere ette avt iva ed rat dta taro rara LE cda varo i b 15 3 1 9 3 IOGTL TP821 BIT CM D cibis edi rate tata ta 2v de aba idea tare dva Dd coto 19 3 1 3 4 TP821 MBX CMD lOCTL TP821 NOWAIT 20 3 1 3 5 IOGTL TPB21 GET DAIQsus i 21 313 6 JOCTL TP821 CONFIG ep ata tor aate n
10. MD control code RequestPar 6 size in bytes not words ResultPar MAX NUM WORDS sizeof USHORT amp NumBytes number of bytes returned NULL TPMC821 SW 65 Windows WDM Device Driver Page 20 of 27 TEWS 22 3 1 3 5 TP821 GET DAIG This control function returns a structure with various diagnostic information to the caller A pointer to the callers diagnostic structure is passed by the parameters pOutBuffer to driver The TP821 DIAG structure has the following layout typedef struct USHORT SysfailReg USHORT ConfigReg USHORT DiagReg BOOLEAN HardwareFailure BOOLEAN InitComplete TP821 DIAG PTP821_DIAG Members SysfailReg ConfigReg DiagReg Returns the actual values of the corresponding hardware register in the coupling memory Status Sysfail Register Configuration Register and Master Diagnostic Status Register The meaning of every bit in these registers is described in the User Manual NTERBUS Generation 4 Master Board HardwareFailure If the content is TRUE the IBS master has detected a hardware error In this case the driver will not accept data transfer or message box commands until this state is left by the IOCTL TP821 RESET HARDWARE FAIL command Note A hardware failure could also occur after execution of the mailbox command Reset Controller Board InitComplete This parameter is TRUE if the INTERBUS firmware has completed initialization TPMC821 SW 65 Windows
11. TEWS 2 The Embedded Company TECHNOLOGIES TPMC821 SW 65 Windows WDM Device Driver INTERBUS Master G4 Version 1 0 x User Manual Issue 1 1 December 2002 TEWS TECHNOLOGIES GmbH TEWS TECHNOLOGIES LLC Am Bahnhof 7 25469 Halstenbek Germany 1 E Liberty Street Sixth Floor Reno Nevada 89504 USA Phone 49 0 4101 4058 0 Fax 49 0 4101 4058 19 Phone 1 775 686 6077 Fax 1 775 686 6024 e mail info tews com www tews com e mail usasales tews com www tews com TEWS S TECHNOLOGIES TPMC821 SW 65 This document contains information which is INTERBUS Master G4 proprietary to TEWS TECHNOLOGIES GmbH Any Windows WDM Device Driver reproduction without written permission is forbidden TEWS TECHNOLOGIES GmbH has made any effort to ensure that this manual is accurate and complete However TEWS TECHNOLOGIES GmbH reserves the right to change the product described in this document at any time without notice TEWS TECHNOLOGIES GmbH is not liable for any damage arising out of the application or use of the device described herein 2002 by TEWS TECHNOLOGIES GmbH Issue Description Date 1 0 First Issue November 25 2002 1 1 Slips of the pen rectified December 13 2002 TPMC821 SW 65 Windows WDM Device Driver Page 2 of 27 TEWS S TECHNOLOGIES Table of Contents 1 INTHODUCTION iiis ind and R DA RR MR Us alo NR Vd Rt Rn E tina UE 4 2 INSTAELATIDN UE FEE
12. ZE pSeg add size of this segment 3 pSeg PNEXT SEGMENT pSeg calculate next pointer pSeg ItemTyp TP821 LWORD pSeg ItemNumber pSeg DataOffset 4 pSeg u lword 0 55 66 size SEGMENT SIZE pSeg 4 pSeg PNEXT SEGMENT pSeg End segment pSeg ItemTyp TP821 END pSeg ItemNumber 0 pSeg DataOffset 0 Size SEGMENT SIZE pSeg 5 success DeviceIoControl TPMC821 SW 65 Windows WDM Device Driver Page 16 of 27 TEWS S TECHNOLOGIES hDevice TPMC821 handle IOCTL TP821 WRITE control code amp SegmentBuffer data segments to write size size of data segments NULL 0 amp NumBytes not used NULL if success ErrorHandler Device I O control error process error This example does the following see also example c 1 The variable size is initialized with 0 and the segment pointer is set to the beginning of the segment buffer Be sure that the size of the buffer is large enough to hold all segments 2 The first segment contains 4 bytes to write from offset 0 of the OUT area After initializing of the segment we update the buffer size using the SEGMENT SIZE macro Do not use sizeof instead 3 Before initializing the next segment we calculate a new segment pointer using the PNEXT SEGMENT macro This macro simply adds the size of the previous segment to the previous segment pointe
13. contains variable length segments of data type 821 SEGMENT Each segment holds an exact description of the embedded data like data type number of data items offset in the DTA OUT area and the data items to write This relative complex mechanism has two advantages First you can write occasional placed data items without writing data in the whole DAT OUT buffer and second word and long word organized data items can be automatically byte swapped by the driver Remember Intel x86 CPU s use little endian and Motorola respective the INTERBUS use big endian alignment of data words The TP821 SEGMENT structure has the following layout typedef struct USHORT ItemNumber USHORT ItemType USHORT DataOffset union UCHAR byte 1 USHORT word 1 ULONG Iword 1 u 821 SEGMENT PTP821 SEGMENT Members ItemNumber Specifies the number of items of the specified type in the data array In other words it specifies the size of the array u byte u word or u lword ItemType Specifies the data type of the embedded process data Note every data item in the segment must have the same type TP821 END Specifies the last segment in the list No data follows TP821 BYTE Specifies a segment with byte data The union part byte will be used TP821 WORD Specifies a segment with word data The union part word will be used and all words of the array will be byte swapped TP821_LWORD Specifies a segment with long word data The union
14. e in the IBS firmware TP821 ASYNC LOCK ConfigPar DataTimeout 1 20 ConfigPar OperatingMode ConfigPar MailBoxTimeout success DeviceIoControl hDevice TPMC821 handle IOCTL TP821 CONFIG control code amp ConfigPar Sizeof TP821 CONFIG NULL 0 amp NumBytes not used NULL if success 1 ErrorHandler Device I O control error process error TPMC821 SW 65 Windows WDM Device Driver Page 24 of 27 3 1 3 7 TP821 SET HOST FAIL TEWS S TECHNOLOGIES This control function signals a serious host system failure to the TPMC821 On assertion of this host fail interrupt the TPMC821 resets all INTERBUS outputs and switch on the HF LED on the TPMC821 control panel If the driver was terminated the host system failure is automatically set by the driver Example finclude TPMC821 h HANDLE hDevice BOOLEAN success success DevicelIoControl hDevice OCTL TP821 SET HOST FAIL ULL I N 0 NULL 0 amp N NumBytes ULL if success 1 ErrorHandler Device I O TPMC821 handle control code not used control error process error TPMC821 SW 65 Windows WDM Device Driver Page 25 of 27 TEWS S TECHNOLOGIES 3 1 3 8 TP821 RESET HOST FAIL This control function resets the host system failure state in the TPMC821 No parameters are needed for execution of this control function Example
15. ffer pointed to by p nBuffer LPVOID IpOutBuffer Pointer to a buffer that receives the operation s output data TPMC821 SW 65 Windows WDM Device Driver Page 10 of 27 TEWS S TECHNOLOGIES DWORD nOutBufferSize Specifies the size in bytes of the buffer pointed to by oOutBuffer LPDWORD IpBytesReturned Pointer to a variable that receives the size in bytes of the data stored into the buffer pointed to by oOutBuffer A valid pointer is required LPOVERLAPPED Pointer to an Overlapped structure This value must be set to NULL no overlapped To use these TPMC821 specific control codes the header file TPMC821 h must be included Return Value If the function succeeds the return value is nonzero If the function fails the return value is zero To get extended error information call GetLastError Note The TPMC821 driver returns always standard Win32 error codes on failure please refer to the Windows Platform SDK Documentation for a detailed description of returned error codes See Also Win32 documentation DeviceloControl TPMC821 SW 65 Windows WDM Device Driver Page 11 of 27 TEWS S TECHNOLOGIES 3 1 3 1 lOCTL TP821 READ This 821 control function read actual process data out of the DTA IN area A pointer to the callers data buffer is passed by the parameters p nBuffer and lpOutBuffer to driver This buffer contains variable length segments of data type 8
16. ick the System icon and choose the Hardware tab and then click the Device Manager button 3 Click the in front of Other Devices The driver TPMC821 INTERBUS Master G4 should appear TPMC821 SW 65 Windows WDM Device Driver Page 5 of 27 TEWS S TECHNOLOGIES 2 1 3 Windows 98 SE This section describes how to install the TPMC821 Device Driver on a Windows 98 Second Edition SE or Windows ME operating system After installing the TPMC821 card s and boot up your system Windows 98 SE setup will show a New hardware found dialog box 1 3 4 5 6 T The Add New Hardware Wizard dialog box will appear on your screen informing you that it has found a new PCI device Click Next button to continue In the following dialog box choose Search for a better driver than the one your device is using now Click Next button to continue In the following dialog box select Specify a location Type A TPMC821 SW 65 in the text box that appears Insert the TPMC821 SW 65 driver diskette into drive A Click on Next button and then on Finish to complete installation Now copy all needed files tpmc821 h TPMC821 SW 65 pdf to the desired target directories After successful installation the TPMC821 device driver will start immediately and creates devices TPMC821 1 TPMC821 2 for all recognized TPMC821 modules 2 1 4 Confirming Windows ME 98 SE Installation To confirm that the dri
17. ita soda nda peii eii 23 3 1 3 7 TP821 SET HOST 25 3 1 3 8 IOCTL TP821 RESET HOST 26 3 1 3 9 IOCTL TP821 RESET HARDWARE 2 27 TPMC821 SW 65 Windows WDM Device Driver Page 3 of 27 TEWS S TECHNOLOGIES 1 Introduction The TPMC821 SW 65 Windows WDM Windows Driver Model device driver is a kernel mode driver which allows the operation of the TPMC821 on an Intel or Intel compatible x86 Windows 2000 Windows XP Windows 98 SE or Windows ME operating systems The standard file and device I O functions CreateFile CloseHandle and DeviceloControl provide the basic interface for opening and closing a resource handle and for performing device I O control operations The 821 device driver supports the following features gt All possible operating modes are supported Asynchronous mode with consistency locking Asynchronous mode without consistency locking Bus synchronous mode Program synchronous mode Standard function bit commands Mailbox commands Reading and writing process data Reading diagnostic information VVVV TPMC821 SW 65 Windows WDM Device Driver Page 4 of 27 TEWS S TECHNOLOGIES 2 Installation The software is delivered on a 31 HD diskette Following files are located on the diskette 821 5 5 Windows NT driver binary TPMC821 h Header file with IOCTL code definitions TPMC821 i
18. nf Windows NT installation script TPMC821 SW 65 pdf This document Example Example c Microsoft Visual C example application 2 1 Software Installation 2 1 1 Windows 2000 XP This section describes how to install the TPMC821 Device Driver on a Windows 2000 XP operating system After installing the TPMC821 card s and boot up your system Windows 2000 XP setup will show a New hardware found dialog box 1 The Upgrade Device Driver Wizard dialog box will appear on your screen Click Next button to continue 2 Inthe following dialog box choose Search for a suitable driver for my device Click Next button to continue 3 In Drive A insert the TPMC821 driver disk select Disk Drive in the dialog box Click Next button to continue 4 Now the driver wizard should find a suitable device driver on the diskette Click Next button to continue 5 Complete the upgrade device driver and click Finish to take all the changes effect 6 Now copy all needed files tpmc821 h TPMC821 SW 65 pdf to the desired target directories After successful installation the TPMC821 device driver will start immediately and creates devices TPMC821 1 821 2 for all recognized TPMC821 modules 2 1 2 Confirming Windows 2000 XP Installation To confirm that the driver has been properly loaded in Windows 2000 XP perform the following steps 1 From Windows 2000 XP open the Control Panel from My Computer 2 Cl
19. o the specified TPMC821 device If the function fails the return value is INVALID HANDLE VALUE To get extended error information call GetLastError Example HANDLE hDevice hDevice CreateFile W TPMC821_1 GENERIC_READ GENERIC_WRITE 0 NULL no security attrs OPEN EXISTING TPMC821 device always open existing 0 no overlapped I O NULL if hDevice INVALID HANDLE VALUE ErrorHandler Could not open device process error See Also CloseHandle Win32 documentation CreateFile TPMC821 SW 65 Windows WDM Device Driver Page 8 of 27 TEWS S TECHNOLOGIES 3 1 2 Closing a TPMC821 Device The CloseHandle function closes an open TPMC821 handle BOOL CloseHandle HANDLE hDevice Parameters HANDLE hDevice Identifies an open TPMC821 handle Return Value If the function succeeds the return value is nonzero If the function fails the return value is zero To get extended error information call GetLastError Example HANDLE hDevice if CloseHandle hDevice ErrorHandler Could not close device process error See Also CreateFile Win32 documentation CloseHandle TPMC821 SW 65 Windows WDM Device Driver Page 9 of 27 TEWS S TECHNOLOGIES 3 1 3 TPMC821 Device Control Functions The DeviceloControl function sends a control code directly to a specified device driver causing the corresponding device to perf
20. orm the specified operation BOOL DeviceloControl HANDLE hDevice DWORD dwloControlCode LPVOID IpinBuffer DWORD nlnBufferSize LPVOID IpOutBuffer DWORD nOutBufferSize LPDWORD IpBytesReturned LPOVERLAPPED IpOverlapped Parameters HANDLE hDevice Handle to the TPMC821 that is to perform the operation DWORD dwloControlCode Specifies the control code for the desired operation This value identifies the specific operation to be performed The following values are defined in TPMC821 h Value IOCTL_TP821_READ IOCTL_TP821_WRITE IOCTL TP821 BIT CMD IOCTL TP821 MBX CMD IOCTL TP821 MBX CMD NOWAIT IOCTL TP821 GET DIAG IOCTL TP821 CONFIG IOCTL TP821 SET HOST FAIL IOCTL TP821 RESET HOST FAIL Meaning Read process data out of the DTA IN area Write new process data to the OUT area Execute a standard function bit command Execute a mailbox command and wait for confirmation Execute a mailbox command without waiting for confirmation Get diagnostic information from the device Configure the device driver Set a serious host system failure interrupt Reset the host system failure interrupt IOCTL TP821 RESET HARDWARE FAIL Reset the device hardware failure flag See behind for more detailed information on each control code LPVOID Pointer to a buffer that contains the data required to perform the operation DWORD ninBufferSize Specifies the size in bytes of the bu
21. r and returns the new segment pointer The new segment starts without a gap direct after the previous segment The long word data item will be byte swapped before writing to the OUT area 4 The end of the segment list is specified by a segment with item type 7P821 END If this segment is missing the read request fails Be sure that the size of the end segment is included in the total size of the segment list 5 The DeviceloControl call transfers the request to the driver The driver interprets the segment list and writes the contents of the data array to the specified locations in the DTA OUT area The following example displays the memory layout of the segment buffer and the DTA OUT area after a successful write operation Segment values 1 segment ItemNumber 4 ItemType TP821 BYTE ItemOffset 0 0 data 0x01 0x02 0x03 0x04 274 segment ItemNumber 1 ItemType TP821 LWORD ItemOffset 0 0 data OxAA55BB66 End segment ItemNumber 0 ItemType TP821 END ItemOffset 0 0 data none TPMC821 SW 65 Windows WDM Device Driver Page 17 of 27 TEWS S TECHNOLOGIES The segment buffer has the following layout Offset 40 1 2 3 4 5 6 7 40x00 0 04 0 00 0x01 0 00 0 00 0x00 0x01 0x02 40x08 0x03 0x04 0 01 0 00 0x04 0x00 0x04 0 00 40x10 0x66 OxBB 0x55 40x18 x x x x X X The DTA OUT area of the TPMC821 after writing Offset 40 1 2 3 4 5 6 7 0x00 0
22. rray will be byte swapped TP821_LWORD Specifies a segment with long word data The union part Iword will be used and all long words will be byte swapped DataOffset Specifies a byte offset from the beginning of the DTA IN area The driver start reading data items from this offset and stores the requested number of items in the data union of the segment structure TPMC821 SW 65 Windows WDM Device Driver Page 12 of 27 TEWS S TECHNOLOGIES The union u contains three arrays The size of these dynamic expandable arrays depends on the number of data items to read Because the size of this arrays is only well known at run time you should never use the sizeof function to determine the size of the segment structure The macro SEGMENT SIZE pSeg defined in tpmc821 h delivers the correct structure size The macro NEXT SEGMENT pSeg also defined in tpmc821 h calculates a pointer to the begin of the following segment in the buffer Both macros in combination should be used to assemble a read data buffer for the desired read request The end of the read buffer is specified by a segment with type of 821 END Please refer to the next example to see how to assemble a correct read buffer Example finclude TPMC821 h HANDLE hDevice BOOLEAN success ULONG NumBytes size UCHAR SegmentBuffer 100 PT821 SEGMENT pSeg 1 size 0 pseg 821 SEGMENT amp SegmentBuffer 2 pSeg ItemT
23. see also example c 1 2 3 4 After opening the device the variable size is initialized with 0 and the segment pointer is set to begin of the segment buffer Be sure that the size of the buffer is large enough to hold all segments The first segment contains 4 bytes read from offset 0 of the DTA IN area After initializing of the segment we update the buffer size using the SEGMENT SIZE macro Do not use sizeof instead Before initializing the next segment we calculate a new segment pointer using the PNEXT SEGMENT macro This macro simply adds the size of the previous segment to the previous segment pointer and returns the new segment pointer The new segment starts without a gap direct after the previous segment The end of the segment list is specified by a segment with item type 7P821 END If this segment is missing the read request fails Be sure that the size of the end segment is included in the total size of the segment list 5 The DeviceloControl call transfers the request to the driver The driver interprets the segment list and fills the corresponding data arrays with new process data See Also Win32 documentation DeviceloControl TPMC821 SW 65 Windows WDM Device Driver Page 14 of 27 TEWS S TECHNOLOGIES 3 1 3 2 lOCTL TP821 WRITE This TPCM821 control function writes new data to the DTA OUT area A pointer to the callers data buffer is passed by the parameters p nBuffer to driver This buffer
24. ver has been properly loaded in Windows perform the following steps 1 2 3 Choose Settings from the Start menu Choose Control Panel and then double click on the System icon Choose the Device Manager tab and then click the in front of Other Devices The driver TPMC821 INTERBUS Master G4 should appear TPMC821 SW 65 Windows WDM Device Driver Page 6 of 27 TEWS S TECHNOLOGIES 3 TPMC821 Device Driver Programming The TPMC821 SW 65 Windows WDM device driver is a kernel mode device driver The standard file and device I O functions CreateFile CloseHandle and DeviceloControl provide the basic interface for opening and closing a resource handle and for performing device I O control operations All of these standard Win32 functions are described in detail in the Windows Platform SDK Documentation Windows base services Hardware Device Input and Output For details refer to the Win32 Programmers Reference of your used programming tools C Visual Basic etc TPMC821 Files and I O Functions The following section doesn t contain a full description of the Win32 functions for interaction with the TPMC821 device driver Only the required parameters are described in detail 3 1 1 Opening a TPMC821 Device Before you can perform any the TPMC821 device must be opened by invoking the CreateFile function CreateFile returns a handle that can be used to access the 821 device HANDLE
25. yp TP821 BYTE pSeg ItemNumber 4 pSeg DataOffset 0 size SEGMENT SIZE pSeg add size of this segment 3 pseg PNEXT SEGMENT pSeg pSeg gt ItemTyp TP821_WORD same data read as word pseg gt ItemNumber 2 pSeg DataOffset 0 Size SEGMENT SIZE pSeg pSeg PNEXT SEGMENT pSeg same data read as longword pSeg ItemTyp TP821 LWORD pSeg ItemNumber 1 pSeg DataOffset 0 Size SEGMENT SIZE pSeg 4 pSeg SEGMENT pSeg End segment pSeg ItemTyp TP821 END pSeg ItemNumber 0 pSeg DataOffset 0 size SEGMENT SIZE pSeg TPMC821 SW 65 Windows WDM Device Driver Page 13 of 27 TEWS S TECHNOLOGIES 5 success DeviceIloControl hDevice TPMC821 handle IOCTL TP821 READ control code amp SegmentBuffer template of data segments to read size size of data segments amp SegmentBuffer filled data segments size same size as the template buffer amp NumBytes number of bytes transferred NULL if success Process data else ErrorHandler Device I O control error process error This example read the first four bytes of the DTA IN area within three segments with different types byte word and longword If the first 4 bytes of the DTA IN area contains significant values you can realize the effect of byte swapping words and longwords
Download Pdf Manuals
Related Search
Related Contents
Samsung 3D Blu-ray Player SBIF.cl - Carta Circular N° 4 n - SEW Eurodrive Samsung SGH-L600 User Manual RT_100_1S_2S G-BH1_Bedienungsanleitung_de Problema presentado por el Radio Panasonic DVD-S48 Copyright © All rights reserved.
Failed to retrieve file