summaryrefslogtreecommitdiffstats
path: root/led.c
blob: 0297a771124462ebeaa2337bddfa6891278f6364 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>

#define CM_LED_BLINK                    127
#define CM_nLED                         101

main (int argc, char *argv[])
{
  int fd;
  fd = open ("/dev/ntx_io", O_RDWR);

  if (argc != 2) {
      printf ("Usage:\n%s {0|1}\n", argv[0]);
      exit (1);
  }

  switch (atoi (argv[1])) {
    case 0:
      ioctl (fd, CM_LED_BLINK, 0);
      ioctl (fd, CM_nLED, 0);
      break;
    case 1:
      ioctl (fd, CM_LED_BLINK, 0);
      sleep (1);
      ioctl (fd, CM_nLED, 1);
      break;
    case 2:
      ioctl (fd, CM_LED_BLINK, 1);
      break;
    case 3:
      ioctl (fd, CM_LED_BLINK, 2);
      break;
  }
  exit (0);

}