summaryrefslogtreecommitdiffstats
path: root/meif.h
blob: ded67f3f3d612b2aef6582502a00a94cffa7fc4f (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
 * This file is part of BCM4751 gpsd
 *
 * Copyright (C) 2011 Paul Kocialkowski <contact@oaulk.fr>
 *
 * BCM4751 gpsd 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 3 of the License, or
 * (at your option) any later version.
 *
 * BCM4751 gpsd is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with BCM4751 gpsd.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#ifndef _MEIF_H_
#define _MEIF_H_

#define MEIF_START	0xA5 + (0x93 << 8)
#define MEIF_END	0xA5 + (0x68 << 8)

/*
 * Commands
 */

#define MEIF_ACK_MSG		0x0000
#define MEIF_NACK_MSG		0x0001
//#define MEIF_ERROR_MSG	0x0002 or 0x0003
#define MEIF_STATE_REPORT_MSG	0x0004
#define MEIF_CONFIG_VALUES_MSG	0x0008

/*
 * Data
 */

/*
 * Structures
 */

struct meif_header {
	uint16_t marker;
	uint16_t command;
	uint16_t length;
} __attribute__((__packed__));

struct meif_message {
	uint16_t command;
	uint16_t length;
	void *data;
} __attribute__((__packed__));

struct meif_config_values {
	uint8_t unknown1[36];
	char vendor[16];
	char product[16];
	uint8_t unknown2[2];
} __attribute__((__packed__));

/*
 * Functions
 */

void meif_read_loop(int fd);

#endif