FreeCalypso > hg > freecalypso-sw
annotate target-utils/c139explore/mygetchar.c @ 1025:4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Tue, 03 May 2016 23:46:54 +0000 |
parents | 845c2e420069 |
children |
rev | line source |
---|---|
946
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * The interactive command entry (editing) function in libcommon |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * will call mygetchar() for its character input. It is supposed |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 * to be a blocking wait for input, but in some programs other |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 * processing can be done while waiting - for example, check for |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 * keypad presses as well. This is the basic version which waits |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 * for serial input and nothing else. |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 */ |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 extern int serial_in_poll(); |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 int |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 mygetchar() |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 { |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 register int c; |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 do |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 c = serial_in_poll(); |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 while (c < 0); |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 return c; |
845c2e420069
target-utils/c139explore utility started
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 } |