Project

General

Profile

Revision 147

changed things

View differences:

proj/proj.c
2 2
#include <lcom/proj.h>
3 3
#include <lcom/liblm.h>
4 4

  
5
#include <stdbool.h>
5 6
#include <stdint.h>
6 7

  
8

  
7 9
int main(int argc, char* argv[]) {
8 10

  
9 11
    lcf_set_language("EN-US");
......
18 20

  
19 21
    return 0;
20 22
}
23

  
24
static int print_usage() {
25
  printf("Usage: <mode - hex>\n");
26

  
27
  return 1;
28
}
29

  
30
int(proj_main_loop)(int argc, char *argv[]) {
31
    /// cycle
32
    int good = 1;
33
    while (good) {
34
        /* Get a request message. */
35
        if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) {
36
            printf("driver_receive failed with %d", r);
37
            continue;
38
        }
39
        if (is_ipc_notify(ipc_status)) { /* received notification */
40
            switch (_ENDPOINT_P(msg.m_source)) {
41
                case HARDWARE: /* hardware interrupt notification */
42
                    if (msg.m_notify.interrupts & kbc_irq) { /* subscribed interrupt */
43
                        kbc_ih();
44
                        if (scancode[0] == ESC_BREAK_CODE) good = 0;
45
                    }
46
                    break;
47
                default:
48
                    break; /* no other notifications expected: do nothing */
49
            }
50
        } else { /* received standart message, not a notification */
51
            /* no standart message expected: do nothing */
52
        }
53
    }
54
}

Also available in: Unified diff