mirror of
https://github.com/reactos/reactos.git
synced 2024-09-09 20:30:04 +00:00
some un-important modifications to my serial coms test program.
not of interest for now until I get something commitable for the simple serial driver. svn path=/trunk/; revision=3728
This commit is contained in:
parent
73eb67f51b
commit
ba7265a614
|
@ -17,6 +17,8 @@ int main(int argc, char *argv[])
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
HANDLE hPort;
|
HANDLE hPort;
|
||||||
int i;
|
int i;
|
||||||
|
int j;
|
||||||
|
int k;
|
||||||
int nPortNum = 1;
|
int nPortNum = 1;
|
||||||
|
|
||||||
TCHAR szPortName[MAX_PORTNAME_LEN];
|
TCHAR szPortName[MAX_PORTNAME_LEN];
|
||||||
|
@ -44,6 +46,7 @@ int main(int argc, char *argv[])
|
||||||
printf("CreateFile() returned: %lx\n", hPort);
|
printf("CreateFile() returned: %lx\n", hPort);
|
||||||
|
|
||||||
printf("Fiddling with DTR and RTS control lines...\n");
|
printf("Fiddling with DTR and RTS control lines...\n");
|
||||||
|
for (i = 0; i < 100; i++) {
|
||||||
bResult = EscapeCommFunction(hPort, SETDTR);
|
bResult = EscapeCommFunction(hPort, SETDTR);
|
||||||
if (!bResult) {
|
if (!bResult) {
|
||||||
printf("WARNING: EscapeCommFunction(SETDTR) failed: %lx\n", bResult);
|
printf("WARNING: EscapeCommFunction(SETDTR) failed: %lx\n", bResult);
|
||||||
|
@ -52,7 +55,28 @@ int main(int argc, char *argv[])
|
||||||
if (!bResult) {
|
if (!bResult) {
|
||||||
printf("WARNING: EscapeCommFunction(SETRTS) failed: %lx\n", bResult);
|
printf("WARNING: EscapeCommFunction(SETRTS) failed: %lx\n", bResult);
|
||||||
}
|
}
|
||||||
|
for (j = 0; j < 1000; j++) {
|
||||||
|
k *= j;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
#define CLRDTR (6)
|
||||||
|
#define CLRRTS (4)
|
||||||
|
#define SETDTR (5)
|
||||||
|
#define SETRTS (3)
|
||||||
|
#define SETXOFF (1)
|
||||||
|
#define SETXON (2)
|
||||||
|
#define SETBREAK (8)
|
||||||
|
#define CLRBREAK (9)
|
||||||
|
*/
|
||||||
|
bResult = EscapeCommFunction(hPort, CLRDTR);
|
||||||
|
if (!bResult) {
|
||||||
|
printf("WARNING: EscapeCommFunction(CLRDTR) failed: %lx\n", bResult);
|
||||||
|
}
|
||||||
|
bResult = EscapeCommFunction(hPort, CLRRTS);
|
||||||
|
if (!bResult) {
|
||||||
|
printf("WARNING: EscapeCommFunction(CLRRTS) failed: %lx\n", bResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
printf("Getting the default line characteristics...\n");
|
printf("Getting the default line characteristics...\n");
|
||||||
dcb.DCBlength = sizeof(DCB);
|
dcb.DCBlength = sizeof(DCB);
|
||||||
if (!GetCommState(hPort, &dcb)) {
|
if (!GetCommState(hPort, &dcb)) {
|
||||||
|
@ -70,14 +94,9 @@ int main(int argc, char *argv[])
|
||||||
printf("ERROR: failed to set the comm state: %lx\n", bResult);
|
printf("ERROR: failed to set the comm state: %lx\n", bResult);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
printf("INFO: preparing the transmit buffer: %lx\n", bResult);
|
|
||||||
for (i = 0; i < BUFSIZE; i++) {
|
for (i = 0; i < BUFSIZE; i++) {
|
||||||
txBuffer[i] = (CHAR)i;
|
txBuffer[i] = (CHAR)i;
|
||||||
}
|
//printf(" %d ", txBuffer[i]);
|
||||||
for (i = 0; i < BUFSIZE; i++) {
|
|
||||||
printf(" %d ", txBuffer[i]);
|
|
||||||
}
|
|
||||||
for (i = 0; i < BUFSIZE; i++) {
|
|
||||||
rxBuffer[i] = 0xFF;
|
rxBuffer[i] = 0xFF;
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
Loading…
Reference in a new issue