blob: 9b72a04701c0b202c6b8c09c3a39ed246eed63f9 [file] [log] [blame]
David Kiliani3fedd142008-11-01 00:39:12 +01001/**
2 * @file me1400_ext_irq.h
3 *
4 * @brief ME-1400 external interrupt implementation.
5 * @note Copyright (C) 2006 Meilhaus Electronic GmbH (support@meilhaus.de)
6 * @author Guenter Gebhardt
7 */
8
9#ifndef _ME1400_EXT_IRQ_H_
10#define _ME1400_EXT_IRQ_H_
11
12#include <linux/sched.h>
13
14#include "mesubdevice.h"
15#include "meslock.h"
16
17#ifdef __KERNEL__
18
19/**
20 * @brief The ME-1400 external interrupt subdevice class.
21 */
22typedef struct me1400_ext_irq_subdevice {
23 /* Inheritance */
24 me_subdevice_t base; /**< The subdevice base class. */
25
26 /* Attributes */
27 spinlock_t subdevice_lock; /**< Spin lock to protect the subdevice from concurrent access. */
28 spinlock_t *clk_src_reg_lock; /**< Lock protecting the clock control register. */
29
30 wait_queue_head_t wait_queue; /**< Queue to put on threads waiting for an interrupt. */
31
32 uint32_t device_id; /**< The device id of the device holding the subdevice. */
33 int irq; /**< The irq number assigned by PCI BIOS. */
34 int rised; /**< If true an interrupt has occured. */
35 unsigned int n; /**< The number of interrupt since the driver was loaded. */
36
37 unsigned long plx_intcs_reg; /**< The PLX interrupt control and status register. */
38 unsigned long ctrl_reg; /**< The control register. */
39#ifdef MEDEBUG_DEBUG_REG
40 unsigned long reg_base;
41#endif
42} me1400_ext_irq_subdevice_t;
43
44/**
45 * @brief The constructor to generate a ME-1400 external interrupt instance.
46 *
47 * @param plx_reg_base The register base address of the PLX chip as returned by the PCI BIOS.
48 * @param me1400_reg_base The register base address of the ME-1400 device as returned by the PCI BIOS.
49 * @param irq The irq assigned by the PCI BIOS.
50 *
51 * @return Pointer to new instance on success.\n
52 * NULL on error.
53 */
54me1400_ext_irq_subdevice_t *me1400_ext_irq_constructor(uint32_t device_id,
55 uint32_t plx_reg_base,
56 uint32_t me1400_reg_base,
57 spinlock_t *
58 clk_src_reg_lock,
59 int irq);
60
61#endif
62#endif