diff options
author | Ben Burwell <ben@benburwell.com> | 2015-04-01 20:29:53 -0400 |
---|---|---|
committer | Ben Burwell <ben@benburwell.com> | 2015-04-01 20:29:53 -0400 |
commit | 2b30f30a330ee9bc9feb9ec4e55c8b6f3e6eb8fe (patch) | |
tree | 08d7be1d815e1ae676eab5c734438ba048b854d1 /comdrtsw.c | |
parent | e282a861d5868868940b449681f2ee5da3e439e8 (diff) |
as of 2013-11-182013-11-18
Diffstat (limited to 'comdrtsw.c')
-rw-r--r-- | comdrtsw.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/comdrtsw.c b/comdrtsw.c new file mode 100644 index 0000000..f8a99b3 --- /dev/null +++ b/comdrtsw.c @@ -0,0 +1,73 @@ +/***********************************************************************
+*
+* Name: comdrtsw
+*
+* Purpose: Test program for write portion of comdrive
+*
+* Algorithm: Tests com_open(), com_write(), and com_close()
+*
+************************************************************************/
+
+#include <stdio.h>
+#include <dos.h>;
+
+extern int com_read(char far *buff, int far *len);
+extern int com_write(char far *buff, int far *len);
+
+int main()
+ {
+ int e_flag;
+ int tmp;
+ int rc;
+ char buffer[100];
+ int length;
+
+ /* open com port */
+
+ rc = com_open(&e_flag,1200);
+ if ( rc != 0)
+ {
+ printf("\nrc(open) = %d",rc);
+ exit();
+ }
+
+ /* prepare test string */
+ strcpy(buffer,"This is a test of the com_write procedure .. 1234567890......\015\012");
+ length = 64;
+
+ /* print test string 25 times */
+ for (tmp = 1; tmp <25; tmp++)
+ {
+ e_flag = 0; /* Clear event flag */
+ rc = com_write(buffer,&length); /* Start COM write */
+ if (rc != 0)
+ {
+ printf("\nrc(write) = %d",rc);
+ exit();
+ }
+
+ /* Loop until com write is done. */
+ /* This look like an infinite loop */
+ while (e_flag == 0)
+ printf("waiting %d\n",tmp);
+ }
+
+ e_flag = 0;
+ length = 28;
+ rc = com_write("End of Com Driver Test ...\015\012",&length);
+ if (rc != 0)
+ {
+ printf("\nrc(write) = %d",rc);
+ exit();
+ }
+
+ /* loop until com write is done */
+ while (e_flag == 0);
+
+ com_close();
+ }
+
+int IO_complete(int device, int *stkptr)
+{
+ return 0;
+}
|