1 /**
2 * @file me0900_device.h
3 *
4 * @brief ME-0900 (ME-9x) device class.
5 * @note Copyright (C) 2007 Meilhaus Electronic GmbH (support@meilhaus.de)
6 * @author Guenter Gebhardt
7 */
8
9 /*
10 * Copyright (C) 2007 Meilhaus Electronic GmbH (support@meilhaus.de)
11 *
12 * This file is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27 #ifndef _ME0900_DEVICE_H
28 #define _ME0900_DEVICE_H
29
30 #include <linux/pci.h>
31 #include <linux/spinlock.h>
32
33 #include "medevice.h"
34
35 #ifdef __KERNEL__
36
37 /**
38 * @brief Structure holding ME-0900 (ME-9x) device capabilities.
39 */
40 typedef struct me0900_version {
41 uint16_t device_id;
42 unsigned int di_subdevices;
43 unsigned int do_subdevices;
44 } me0900_version_t;
45
46 /**
47 * @brief Device capabilities.
48 */
49 static me0900_version_t me0900_versions[] = {
50 {PCI_DEVICE_ID_MEILHAUS_ME0940, 2, 0},
51 {PCI_DEVICE_ID_MEILHAUS_ME0950, 0, 2},
52 {PCI_DEVICE_ID_MEILHAUS_ME0960, 1, 1},
53 {0},
54 };
55
56 #define ME0900_DEVICE_VERSIONS (sizeof(me0900_versions) / sizeof(me0900_version_t) - 1) /**< Returns the number of entries in #me0900_versions. */
57
58 /**
59 * @brief Returns the index of the device entry in #me0900_versions.
60 *
61 * @param device_id The PCI device id of the device to query.
62 * @return The index of the device in #me0900_versions.
63 */
64 static inline unsigned int me0900_versions_get_device_index(uint16_t device_id)
65 {
66 unsigned int i;
67 for (i = 0; i < ME0900_DEVICE_VERSIONS; i++)
68 if (me0900_versions[i].device_id == device_id)
69 break;
70 return i;
71 }
72
73 /**
74 * @brief The ME-0900 (ME-9x) device class structure.
75 */
76 typedef struct me0900_device {
77 me_device_t base; /**< The Meilhaus device base class. */
78 } me0900_device_t;
79
80 /**
81 * @brief The ME-9x device class constructor.
82 *
83 * @param pci_device The pci device structure given by the PCI subsystem.
84 *
85 * @return On succes a new ME-0900 (ME-9x) device instance. \n
86 * NULL on error.
87 */
88 me_device_t *me0900_pci_constructor(struct pci_dev *pci_device)
89 __attribute__ ((weak));
90
91 #endif
92 #endif
93
|
This page was automatically generated by the
LXR engine.
|