~ubuntu-branches/ubuntu/saucy/dahdi-tools/saucy-proposed

« back to all changes in this revision

Viewing changes to xpp/xtalk/xusb.h

  • Committer: Package Import Robot
  • Author(s): Jackson Doak
  • Date: 2013-08-25 12:48:37 UTC
  • mfrom: (2.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20130825124837-wtefi7f9dsihg8is
Tags: 1:2.7.0-1ubuntu1
* Merge from debian. Remaining changes:
  - debian/control: Added gawk as dependency for dkms build
  - debian/control: Package dahdi Depends on dahdi-dkms | dahdi-source
  - debian/control: Set ubuntu maintainer    
  - added debian/dahdi.postinst
  - debian/control: Removed Uploaders field.
  - added debian/dahdi.postinst
  - added --error-handler=init_failed to debian/rules
  

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef XUSB_H
 
2
#define XUSB_H
 
3
/*
 
4
 * Written by Oron Peled <oron@actcom.co.il>
 
5
 * Copyright (C) 2008, Xorcom
 
6
 *
 
7
 * All rights reserved.
 
8
 *
 
9
 * This program is free software; you can redistribute it and/or modify
 
10
 * it under the terms of the GNU General Public License as published by
 
11
 * the Free Software Foundation; either version 2 of the License, or
 
12
 * (at your option) any later version.
 
13
 *
 
14
 * This program is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 * GNU General Public License for more details.
 
18
 *
 
19
 * You should have received a copy of the GNU General Public License
 
20
 * along with this program; if not, write to the Free Software
 
21
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
22
 *
 
23
 */
 
24
 
 
25
#include <stdio.h>
 
26
#include <stdint.h>
 
27
#include <usb.h>
 
28
#include <xlist.h>
 
29
 
 
30
#ifdef __cplusplus
 
31
extern "C"
 
32
{
 
33
#endif /* __cplusplus */
 
34
 
 
35
/*
 
36
 * Xorcom usb handling
 
37
 */
 
38
 
 
39
#define PACKET_SIZE     512
 
40
 
 
41
/*
 
42
 * Specify the wanted interface
 
43
 */
 
44
struct xusb_spec {
 
45
        /* Sanity checks so we know it is our device indeed */
 
46
        int     num_interfaces;
 
47
        int     num_endpoints;
 
48
        char    *name;  /* For debug/output purpose */
 
49
        /* What we will actually use */
 
50
        uint16_t        my_vendor_id;
 
51
        uint16_t        my_product_id;
 
52
        int             my_interface_num;
 
53
        int             my_ep_out;
 
54
        int             my_ep_in;
 
55
};
 
56
 
 
57
void xusb_init_spec(struct xusb_spec *xusb_spec, char *name,
 
58
                uint16_t vendor_id, uint16_t product_id,
 
59
                int nifaces, int iface, int nep, int ep_out, int ep_in);
 
60
 
 
61
struct xusb;
 
62
 
 
63
/*
 
64
 * Prototypes
 
65
 */
 
66
typedef int (*xusb_filter_t)(const struct xusb *xusb, void *data);
 
67
struct xlist_node *xusb_find_byproduct(const struct xusb_spec *specs,
 
68
                int numspecs, xusb_filter_t filterfunc, void *data);
 
69
struct xusb *xusb_find_bypath(const struct xusb_spec *specs, int numspecs,
 
70
                const char *path);
 
71
struct xusb *xusb_open_one(const struct xusb_spec *specs, int numspecs,
 
72
                xusb_filter_t filterfunc, void *data);
 
73
struct xusb *xusb_find_iface(const char *devpath, int iface_num,
 
74
                int ep_out, int ep_in, struct xusb_spec *dummy);
 
75
 
 
76
/*
 
77
 * A convenience filter
 
78
 */
 
79
int xusb_filter_bypath(const struct xusb *xusb, void *data);
 
80
 
 
81
int xusb_interface(struct xusb *xusb);
 
82
int xusb_claim_interface(struct xusb *xusb);
 
83
void xusb_destroy(struct xusb *xusb);
 
84
int xusb_close(struct xusb *xusb);
 
85
size_t xusb_packet_size(const struct xusb *xusb);
 
86
void xusb_showinfo(const struct xusb *xusb);
 
87
const char *xusb_serial(const struct xusb *xusb);
 
88
const char *xusb_manufacturer(const struct xusb *xusb);
 
89
const char *xusb_product(const struct xusb *xusb);
 
90
uint16_t xusb_vendor_id(const struct xusb *xusb);
 
91
uint16_t xusb_product_id(const struct xusb *xusb);
 
92
const char *xusb_devpath(const struct xusb *xusb);
 
93
const struct xusb_spec *xusb_spec(const struct xusb *xusb);
 
94
int xusb_send(struct xusb *xusb, char *buf, int len, int timeout);
 
95
int xusb_recv(struct xusb *xusb, char *buf, size_t len, int timeout);
 
96
int xusb_flushread(struct xusb *xusb);
 
97
 
 
98
#ifdef __cplusplus
 
99
}
 
100
#endif /* __cplusplus */
 
101
 
 
102
#endif  /* XUSB_H */