By my recent experience of configuring RS232 ports
Members of the BITRECORD must be declared in reverse order, like this:
BITRECORD RECORD fDummy2:17,fAbortOnError:1,fRtsControl:2,fNull:1,fErrorChar:1,fInX:1,fOutX:1,fTXContinueOnXoff:1,fDsrSensitivity:1,fDtrControl:2,fOutxDsrFlow:1,fOutxCtsFlow:1,fParity:1,fBinary:1
Do you have any reference material, I cannot find it in MSDN.
Hello,
This bits appears in WinBase.h
Following are the definitions
ToutEnMasm
a possible translation for masm
MASMBITRECORD RECORD fBinary: 1 , \ ; Binary Mode (skip EOF check)
fParity: 1 , \ ; Enable parity checking
fOutxCtsFlow:1 , \ ; CTS handshaking on output
fOutxDsrFlow:1 , \ ; DSR handshaking on output
fDtrControl:2 , \ ; DTR Flow control
fDsrSensitivity:1 , \ ; DSR Sensitivity
fTXContinueOnXoff: 1 , \ ; Continue TX when Xoff sent
fOutX: 1 , \ ; Enable output X-ON/X-OFF
fInX: 1 , \ ; Enable input X-ON/X-OFF
fErrorChar: 1 , \ ; Enable Err Replacement
fNull: 1 , \ ; Enable Null stripping
fRtsControl:2 , \ ; Rts Flow control
fAbortOnError:1 , \ ; Abort all reads and writes on Error
fDummy2:17
; Reserved
DCB STRUCT
DCBlength DWORD ? ; sizeof(DCB)
BaudRate DWORD ? ; Baudrate at which running
MASMBITRECORD <>
; Binary Mode (skip EOF check)
; Enable parity checking
; CTS handshaking on output
; DSR handshaking on output
; DTR Flow control
; DSR Sensitivity
; Continue TX when Xoff sent
; Enable output X-ON/X-OFF
; Enable input X-ON/X-OFF
; Enable Err Replacement
; Enable Null stripping
; Rts Flow control
; Abort all reads and writes on Error
; Reserved
wReserved WORD ? ; Not currently used
XonLim WORD ? ; Transmit X-ON threshold
XoffLim WORD ? ; Transmit X-OFF threshold
ByteSize BYTE ? ; Number of bits/byte, 4-8
Parity BYTE ? ; 0-4=None,Odd,Even,Mark,Space
StopBits BYTE ? ; 0,1,2 = 1, 1.5, 2
XonChar BYTE ? ; Tx and Rx X-ON character
XoffChar BYTE ? ; Tx and Rx X-OFF character
ErrorChar BYTE ? ; Error replacement char
EofChar BYTE ? ; End of Input character
EvtChar BYTE ? ; Received Event character
wReserved1 WORD ? ; Fill for now.
DCB ENDS
;----------------------------------------- SDK ---------------------------------------------------------------------------------------
typedef struct _DCB {
DWORD DCBlength; /* sizeof(DCB) */
DWORD BaudRate; /* Baudrate at which running */
DWORD fBinary: 1; /* Binary Mode (skip EOF check) */
DWORD fParity: 1; /* Enable parity checking */
DWORD fOutxCtsFlow:1; /* CTS handshaking on output */
DWORD fOutxDsrFlow:1; /* DSR handshaking on output */
DWORD fDtrControl:2; /* DTR Flow control */
DWORD fDsrSensitivity:1; /* DSR Sensitivity */
DWORD fTXContinueOnXoff: 1; /* Continue TX when Xoff sent */
DWORD fOutX: 1; /* Enable output X-ON/X-OFF */
DWORD fInX: 1; /* Enable input X-ON/X-OFF */
DWORD fErrorChar: 1; /* Enable Err Replacement */
DWORD fNull: 1; /* Enable Null stripping */
DWORD fRtsControl:2; /* Rts Flow control */
DWORD fAbortOnError:1; /* Abort all reads and writes on Error */
DWORD fDummy2:17; /* Reserved */
WORD wReserved; /* Not currently used */
WORD XonLim; /* Transmit X-ON threshold */
WORD XoffLim; /* Transmit X-OFF threshold */
BYTE ByteSize; /* Number of bits/byte, 4-8 */
BYTE Parity; /* 0-4=None,Odd,Even,Mark,Space */
BYTE StopBits; /* 0,1,2 = 1, 1.5, 2 */
char XonChar; /* Tx and Rx X-ON character */
char XoffChar; /* Tx and Rx X-OFF character */
char ErrorChar; /* Error replacement char */
char EofChar; /* End of Input character */
char EvtChar; /* Received Event character */
WORD wReserved1; /* Fill for now. */
} DCB, *LPDCB;
ToutEnMasm,
The record and structure you have posted are identical to those in the WINDOWS.INCl. The actual record does not appear to exist in winbase.h but there is a different structure, the one you posted below. I am not sure what to do with it as it appears that the structure in winbase.h may have superceded the record and earlier structure.
That is unknown is the mother board and the processor used.
The RS232 as changed , so they would be an old structure and a new.The one I have posted is the new.
Information can be found on MSDN with "serial port".
The Old structure can be surely found searching samples code in the internet.
ToutEnMasm
I can see no functional differences between the definition in the MASM32 windows.inc, the winbase.h from the February 2003 PSDK, and the one on MSDN (but admittedly I did not do a side by side comparison).
MSDN: DCB (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/dcb_str.asp).
MSDN: Configuring a Communications Resource (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/configuring_a_communications_resource.asp)
I have doubts that Microsoft would have reversed the order of a record between C and MASM. I can see
how a reversal might be required for a different platform, but how is that relevant to MASM32?