#ifndef __LINUX_TAPI_H__
#define __LINUX_TAPI_H__
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/mutex.h>
#include <linux/input.h>
#include <asm/atomic.h>
#include <linux/list.h>
#include <linux/cdev.h>
#include <linux/skbuff.h>
#include <linux/wait.h>
#include <linux/tapi/tapi-event.h>
struct tapi_device;
struct tapi_char_device {
struct tapi_device *tdev;
struct device dev;
struct cdev cdev;
};
static inline struct tapi_char_device *cdev_to_tapi_char_device(struct cdev *cdev)
{
return container_of(cdev, struct tapi_char_device, cdev);
}
int tapi_char_device_register(struct tapi_device *tdev,
struct tapi_char_device *tchrdev, const struct file_operations *fops);
struct tapi_endpoint {
unsigned int id;
void *data;
};
static inline void tapi_endpoint_set_data(struct tapi_endpoint *ep, void *data)
{
ep->data = data;
}
static inline void *tapi_endpoint_get_data(struct tapi_endpoint *ep)
{
return ep->data;
}
struct tapi_port {
unsigned int id;
struct tapi_endpoint ep;
struct input_dev *input;
struct tapi_char_device chrdev;
};
struct tapi_stream {
unsigned int id;
struct list_head head;
struct tapi_endpoint ep;
struct sk_buff_head recv_queue;
wait_queue_head_t recv_wait;
struct sk_buff_head send_queue;
};
struct tapi_link {
unsigned int id;
struct list_head head;
};
enum tapi_codec {
TAPI_CODEC_L16,
};
struct tapi_stream_config {
enum tapi_codec codec;
unsigned int buffer_size;
};
struct tapi_ops {
int (*send_dtmf_events)(struct tapi_device *, struct tapi_port *port,
struct tapi_dtmf_event *, size_t num_events, unsigned int dealy);
int (*send_dtmf_event)(struct tapi_device *, struct tapi_port *port,
struct tapi_dtmf_event *);
int (*ring)(struct tapi_device *, struct tapi_port *port, bool ring);
struct tapi_stream *(*stream_alloc)(struct tapi_device *);
void (*stream_free)(struct tapi_device *, struct tapi_stream *);
int (*stream_configure)(struct tapi_device *, struct tapi_stream *,
struct tapi_stream_config *);
int (*stream_start)(struct tapi_device *, struct tapi_stream *);
int (*stream_stop)(struct tapi_device *, struct tapi_stream *);
int (*stream_send)(struct tapi_device *, struct tapi_stream *,
struct sk_buff *);
struct tapi_link *(*link_alloc)(struct tapi_device *,
struct tapi_endpoint *ep1, struct tapi_endpoint *ep2);
void (*link_free)(struct tapi_device *, struct tapi_link *);
int (*link_enable)(struct tapi_device *, struct tapi_link *);
int (*link_disable)(struct tapi_device *, struct tapi_link *);
int (*sync)(struct tapi_device *);
};
int tapi_stream_recv(struct tapi_device *, struct tapi_stream *, struct sk_buff *);
struct tapi_device {
unsigned int id;
const struct tapi_ops *ops;
unsigned int num_ports;
struct device dev;
struct mutex lock;
struct tapi_port *ports;
struct list_head streams;
struct list_head links;
atomic_t stream_id;
atomic_t link_id;
struct tapi_char_device stream_dev;
struct tapi_char_device control_dev;
};
static inline struct tapi_device *dev_to_tapi(struct device *dev)
{
return container_of(dev, struct tapi_device, dev);
}
static inline struct tapi_stream *tapi_stream_from_id(struct tapi_device *tdev,
unsigned int id)
{
struct tapi_stream *stream;
mutex_lock(&tdev->lock);
list_for_each_entry(stream, &tdev->streams, head) {
if (stream->id == id)
goto out;
}
stream = NULL;
out:
mutex_unlock(&tdev->lock);
return stream;
}
struct tapi_link *tapi_link_alloc(struct tapi_device *, struct tapi_endpoint *,
struct tapi_endpoint *);
void tapi_link_free(struct tapi_device *, struct tapi_link *);
struct tapi_stream *tapi_stream_alloc(struct tapi_device *tdev);
void tapi_stream_free(struct tapi_device *tdev, struct tapi_stream *stream);
static inline int tapi_sync(struct tapi_device *tdev)
{
if (!tdev->ops || !tdev->ops->sync)
return 0;
return tdev->ops->sync(tdev);
}
static inline int tapi_link_enable(struct tapi_device *tdev,
struct tapi_link *link)
{
if (!tdev->ops || !tdev->ops->link_enable)
return 0;
return tdev->ops->link_enable(tdev, link);
}
static inline int tapi_link_disable(struct tapi_device *tdev,
struct tapi_link *link)
{
if (!tdev->ops || !tdev->ops->link_disable)
return 0;
return tdev->ops->link_disable(tdev, link);
}pre { line-height: 125%; margin: 0; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #ffffff; }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */#
# Copyright (C) 2006-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
NETWORK_SUPPORT_MENU:=Network Support
define KernelPackage/atm
SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=ATM support
KCONFIG:= \
CONFIG_ATM \
CONFIG_ATM_BR2684
FILES:= \
$(LINUX_DIR)/net/atm/atm.ko \
$(LINUX_DIR)/net/atm/br2684.ko
AUTOLOAD:=$(call AutoLoad,30,atm br2684)
endef
define KernelPackage/atm/description
Kernel modules for ATM support
endef
$(eval $(call KernelPackage,atm))
define KernelPackage/atmtcp
SUBMENU:=$(NETWORK_SUPPORT_MENU)
TITLE:=ATM over TCP
DEPENDS:=kmod-atm
KCONFIG: