Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 /**
  2  * @file me0600_device.h
  3  *
  4  * @brief ME-630 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 _ME0600_DEVICE_H
 28 #define _ME0600_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-630 device capabilities.
 39  */
 40 typedef struct me0600_version {
 41         uint16_t device_id;
 42         unsigned int relay_subdevices;
 43         unsigned int ttli_subdevices;
 44         unsigned int optoi_subdevices;
 45         unsigned int dio_subdevices;
 46         unsigned int ext_irq_subdevices;
 47 } me0600_version_t;
 48 
 49 /**
 50  * @brief Device capabilities.
 51  */
 52 static me0600_version_t me0600_versions[] = {
 53         {PCI_DEVICE_ID_MEILHAUS_ME0630, 1, 1, 1, 2, 2},
 54         {0},
 55 };
 56 
 57 #define ME0600_DEVICE_VERSIONS (sizeof(me0600_versions) / sizeof(me0600_version_t) - 1) /**< Returns the number of entries in #me0600_versions. */
 58 
 59 /**
 60  * @brief Returns the index of the device entry in #me0600_versions.
 61  *
 62  * @param device_id The PCI device id of the device to query.
 63  * @return The index of the device in #me0600_versions.
 64  */
 65 static inline unsigned int me0600_versions_get_device_index(uint16_t device_id)
 66 {
 67         unsigned int i;
 68         for (i = 0; i < ME0600_DEVICE_VERSIONS; i++)
 69                 if (me0600_versions[i].device_id == device_id)
 70                         break;
 71         return i;
 72 }
 73 
 74 /**
 75  * @brief The ME-630 device class structure.
 76  */
 77 typedef struct me0600_device {
 78         me_device_t base;                       /**< The Meilhaus device base class. */
 79 
 80         /* Child class attributes. */
 81         spinlock_t dio_ctrl_reg_lock;
 82         spinlock_t intcsr_lock;
 83 } me0600_device_t;
 84 
 85 /**
 86  * @brief The ME-630 device class constructor.
 87  *
 88  * @param pci_device The pci device structure given by the PCI subsystem.
 89  *
 90  * @return On succes a new ME-630 device instance. \n
 91  *         NULL on error.
 92  */
 93 me_device_t *me0600_pci_constructor(struct pci_dev *pci_device)
 94     __attribute__ ((weak));
 95 
 96 #endif
 97 #endif
 98 
  This page was automatically generated by the LXR engine.