summaryrefslogtreecommitdiff
path: root/tdm/xivo_tdm_api.h
blob: 7b57b4e68217da35efdbb7dc58f8592f22aea78a (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
74
75
76
77
78
79
80
81
/*
 * Copyright (C) 2010,2012  Avencall
 * Author: Guillaume Knispel <gknispel@proformatique.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, 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 XIVO_TDM_API_H
#define XIVO_TDM_API_H

/* XXX matches with ICP_HSSDRV_PORT_XHFC_MEGREZ_PROTO_XIVO_CONFIG */
#define XHFC_MEGREZ_PROTO_XIVO_CONFIG		(4)

/* XXX matches with ICP_HSSDRV_PORT_LE89316_MEGREZ_PROTO_XIVO_CONFIG */
#define LE89316_MEGREZ_PROTO_XIVO_CONFIG	(5)

#define LE89316_ASYNC_MEGREZ_PROTO_XIVO_CONFIG	(6)

/* fixed: */
#define XIVO_TDM_TS_NUM		(32)

#define XIVO_TDM_VOICE_CHUNK_SZ	(8)


struct xivo_tdm_port;


/* TDM port allocation
 * Returns a xivo_tdm_port pointer if available, else NULL. */
/* hardirq: no -- softirq: no -- user: yes */
struct xivo_tdm_port *xivo_tdm_get_port(int tdm_port_num);

/* TDM port release */
/* hardirq: no -- softirq: no -- user: yes */
void xivo_tdm_put_port(struct xivo_tdm_port *);

/* TDM port config + startup */
/* hardirq: no -- softirq: no -- user: yes */
int xivo_tdm_config_port(
	struct xivo_tdm_port* xtp,
	unsigned int port_config,
	u8 __iomem *leb_cs_debug);

/* will be called back after port 0 has been configured */
void xivo_tdm_register_port0_configured(
	struct xivo_tdm_port* xtp,
	void (*port0_configured)(void *),
	void *port0_configured_data);

/* hardirq: no -- softirq: no -- user: yes */
void xivo_tdm_register_port0_started(
	struct xivo_tdm_port* xtp,
	void (*port0_started)(void *),
	void *port0_started_data);

/* hardirq: no -- softirq: no -- user: yes */
int xivo_tdm_start_chans(
	struct xivo_tdm_port* xtp,
	u8 ** const readchunk_ptrs[XIVO_TDM_TS_NUM],
	u8 ** const writechunk_ptrs[XIVO_TDM_TS_NUM],
	void (*txrx)(void *),
	void *txrx_data);

/* hardirq: no -- softirq: no -- user: yes */
void xivo_tdm_stop_chans(
	struct xivo_tdm_port* xtp);

/* hardirq: no -- softirq: no -- user: yes */
void xivo_tdm_shutdown(void);

#endif /* XIVO_TDM_API_H */