aa620a1e024d3b43aba7730211175397eb956eaa
[openwrt.git] / package / lqtapi / src / mps / vmmc-port.c
1 #include <linux/kernel.h>
2 #include <linux/slab.h>
3
4 #include <linux/tapi/tapi.h>
5
6 #include "vmmc.h"
7 #include "vmmc-port.h"
8 #include "vmmc-alm.h"
9 #include "vmmc-sig.h"
10
11 int vmmc_port_ring(struct tapi_device *tdev, struct tapi_port *port, bool ring)
12 {
13 struct vmmc *vmmc = tdev_to_vmmc(tdev);
14
15 return vmmc_alm_set_state(&vmmc->ports[port->id].alm,
16 ring ? VMMC_ALM_STATE_RING : VMMC_ALM_STATE_ONHOOK);
17 }
18
19 int vmmc_port_send_dtmf_event(struct tapi_device *tdev,
20 struct tapi_port *port, struct tapi_dtmf_event *event)
21 {
22 return 0;
23 }
24
25 struct vmmc_port *vmmc_port_init(struct vmmc *vmmc, struct vmmc_port *port,
26 struct tapi_port *tport, unsigned int id)
27 {
28 vmmc_alm_init(&port->alm, vmmc, id);
29 vmmc_sig_init(&port->sig, vmmc, id);
30
31 port->sig_pin = vmmc_module_get_pin(&port->sig.module);
32 vmmc_module_set_pin_input(&port->sig.module, port->sig_pin,
33 &port->alm.module);
34
35 vmmc_module_sync(&port->sig.module);
36
37 vmmc_alm_set_state(&port->alm, VMMC_ALM_STATE_ONHOOK);
38
39 tport->id = id;
40 tapi_endpoint_set_data(&tport->ep, &port->alm.module);
41
42 return port;
43 }
44
45 void vmmc_port_put(struct vmmc *vmmc, struct vmmc_port *port)
46 {
47 vmmc_module_put_pin(&port->sig.module, port->sig_pin);
48 }
This page took 0.043702 seconds and 3 git commands to generate.