esc_device.h 1.64 KB
Newer Older
Jeroen Vreeken's avatar
Jeroen Vreeken committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
	Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2013
	Copyright Stichting C.A. Muller Radioastronomiestation, 2013

	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 3 of the License, or
	(at your option) any later version.

	This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.

 */

#ifndef _INCLUDE_EC_ESC_DEVICE_H_
#define _INCLUDE_EC_ESC_DEVICE_H_

#include <stdbool.h>

Jeroen Vreeken's avatar
Jeroen Vreeken committed
25
26
27
28
#include <ec/ec.h>
#include <ec/esc.h>
#include <ec/esc_sm.h>
#include <ec/esc_dc.h>
Jeroen Vreeken's avatar
Jeroen Vreeken committed
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

struct esc_device {
	struct ec_dgram_addr addr;
	
	struct esc_esi_category *categories;
	
	struct esc_syncmanager_info sm[ESC_SYNCMANAGER_MAX];
	bool rx_pdo;
	bool tx_pdo;
	int rx_pdo_sm;
	int tx_pdo_sm;
	bool tx_pdo_watchdog;
	int mbox_rd_sm;
	int mbox_wr_sm;
	
	unsigned char *tx_data;
	unsigned char *rx_data;
	
	struct esc_mailbox *mailbox;
	struct esc_dc_sync dc_sync;

	char *name;
	
	enum esc_al_state state;
	enum esc_al_status status;
	
	bool auto_recover;
};


struct esc_device *esc_device_create(struct ec_dgram_addr *ec_addr, char *name);
void esc_device_destroy(struct esc_device *);
int esc_device_poll_start(struct esc_device *dev);

int esc_device_initialize_pre_operational(struct esc_device *dev);

#endif /* _INCLUDE_EC_ESC_DEVICE_H_ */