source: multiio/pcmmio/original/flash.c @ da59d43

Last change on this file since da59d43 was c99627b, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 8, 2009 at 7:09:54 PM

2009-06-08 Joel Sherrill <joel.sherrill@…>

  • Makefile, flash.c, mio_io.h: All programs now compile with the copied RTEMS specific porting layer file.
  • .cvsignore, mio_io_rtems.c: New files.
  • Property mode set to 100644
File size: 1.3 KB
Line 
1/* Flash.c WinSystems PCM-MIO driver Demonstration Program
2*
3*  $Header$
4*
5*  $Id$
6*
7*  $Log$
8*  Revision 1.1.1.1  2009/06/08 14:52:43  joel
9*  Initial import.
10*
11*
12*
13*  Compile with :
14*
15*
16*       gcc flash.c kbhit.c mio_io.o -o flash
17*
18*   This very simple program, toggles each of the 48  DIO lines in succession, holding it low
19*   for 250ms and then releasing it.
20*
21*/
22
23
24/* These function prototypes are for the keyboard support function kbhit() */
25
26void init_keyboard(void);
27void close_keyboard(void);
28int kbhit(void);
29int readch(void);
30
31
32#include <stdio.h>
33#include <stdlib.h>
34#include <unistd.h>
35#include "mio_io.h"
36
37main(int argc, char *argv[])
38{
39int x;
40
41        x = dio_read_bit(1);    /* Just a test for availability */
42        if(mio_error_code)
43        {
44
45                /* Print the error and exit, if one occurs */
46
47                printf("\n%s\n",mio_error_string);
48                exit(1);
49        }
50
51
52        printf("Flashing - Press any key to exit\n");
53
54        init_keyboard();
55        while(!kbhit())
56        {
57                for(x=1; x<=48; x++)
58                {
59                        dio_set_bit(x); /* Turn on the LED */
60
61                        /* Ideally, we should check mio_error_code after all calls. Practically, there's little to
62                           go wrong once we've validated the driver presence.
63                    */
64
65
66                        /* Got to sleep for 250ms */
67
68                        usleep(25000);
69
70                        dio_clr_bit(x); /* Turn off the LED */
71                }
72        }
73        readch();
74        close_keyboard();
75        printf("\n");
76}
77
78
Note: See TracBrowser for help on using the repository browser.