Changeset 65fb232 in mainline for genarch/src/ofw/ofw.c


Ignore:
Timestamp:
2005-12-30T22:38:23Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6ccb238
Parents:
80bff342
Message:

sparc64 work.
kconsole support.
Add non-blocking ofw_getchar().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • genarch/src/ofw/ofw.c

    r80bff342 r65fb232  
    3636
    3737phandle ofw_chosen;
     38ihandle ofw_stdin;
    3839ihandle ofw_stdout;
    3940
     
    4445                ofw_done();
    4546       
     47        if (ofw_get_property(ofw_chosen, "stdin",  &ofw_stdin, sizeof(ofw_stdin)) <= 0)
     48                ofw_stdin = 0;
     49               
    4650        if (ofw_get_property(ofw_chosen, "stdout",  &ofw_stdout, sizeof(ofw_stdout)) <= 0)
    47                 ofw_stdout = 0;
     51                ofw_stdout = 0; 
    4852}
    4953
     
    8589}
    8690
     91/** Read character from OFW's input.
     92 *
     93 * This call is non-blocking.
     94 *
     95 * @return 0 if no character was read, character read otherwise.
     96 */
     97char ofw_getchar(void)
     98{
     99        char ch;
     100
     101        if (ofw_stdin == 0)
     102                return 0;
     103       
     104        if (ofw_call("read", 3, 1, ofw_stdin, &ch, 1) == 1)
     105                return ch;
     106        else
     107                return 0;
     108}
     109
    87110phandle ofw_find_device(const char *name)
    88111{
Note: See TracChangeset for help on using the changeset viewer.