FreeCalypso > hg > freecalypso-sw
annotate target-utils/helloapp/mygetchar.c @ 988:0654212e5c53
doc/Compal-unlock: documented safe flashing of newer fw versions and
cisversion unlocking
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sat, 12 Dec 2015 18:40:56 +0000 |
parents | 40f607bb0a2c |
children |
rev | line source |
---|---|
11
40f607bb0a2c
target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
1
diff
changeset
|
1 /* |
40f607bb0a2c
target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
1
diff
changeset
|
2 * The interactive command entry (editing) function in libcommon |
40f607bb0a2c
target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
1
diff
changeset
|
3 * will call mygetchar() for its character input. It is supposed |
40f607bb0a2c
target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
1
diff
changeset
|
4 * to be a blocking wait for input, but in some programs other |
40f607bb0a2c
target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
1
diff
changeset
|
5 * processing can be done while waiting - for example, check for |
40f607bb0a2c
target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
1
diff
changeset
|
6 * keypad presses as well. This is the basic version which waits |
40f607bb0a2c
target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
1
diff
changeset
|
7 * for serial input and nothing else. |
40f607bb0a2c
target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
1
diff
changeset
|
8 */ |
1
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 extern int serial_in_poll(); |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 |
11
40f607bb0a2c
target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
1
diff
changeset
|
12 int |
40f607bb0a2c
target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
1
diff
changeset
|
13 mygetchar() |
1
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 { |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 register int c; |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 do |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 c = serial_in_poll(); |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 while (c < 0); |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 return c; |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 } |