-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathedfb_conf.c
More file actions
49 lines (46 loc) · 1.15 KB
/
edfb_conf.c
File metadata and controls
49 lines (46 loc) · 1.15 KB
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
39
40
41
42
43
44
45
46
47
48
49
/*
* Copyright (c) 2015-2019 OscillatorIMP Digital
* Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
*
*/
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/types.h>
/* memory management */
#include <sys/mman.h>
#include <edfb_core/edfb_config.h>
#define EDFB_POINT_POS_REG 0x01
int edfb_send_conf(char *filename, int position)
{
int edfb = open(filename, O_RDWR);
if (edfb < 0) {
printf("erreur d'ouverture de %s\n", filename);
return edfb;
}
printf("configuration edfb\n");
ioctl(edfb, EDFB_SET_POINT_POS, &position);
close(edfb);
return 0;
}
int edfb_get_conf(char *filename)
{
int position;
int edfb = open(filename, O_RDWR);
if (edfb < 0) {
printf("erreur d'ouverture de %s\n", filename);
return edfb;
}
printf("configuration edfb\n");
ioctl(edfb, EDFB_GET_POINT_POS, &position);
close(edfb);
return 0;
}