4 * @brief Meilhaus PIO 8255 implementation.
5 * @note Copyright (C) 2006 Meilhaus Electronic GmbH (support@meilhaus.de)
6 * @author Guenter Gebhardt
12 #include "mesubdevice.h"
18 * @brief The 8255 subdevice class.
20 typedef struct me8255_subdevice
{
22 me_subdevice_t base
; /**< The subdevice base class. */
25 spinlock_t subdevice_lock
; /**< Spin lock to protect the subdevice from concurrent access. */
27 int *ctrl_reg_mirror
; /**< Pointer to mirror of the control register. */
28 spinlock_t
*ctrl_reg_lock
; /**< Spin lock to protect #ctrl_reg and #ctrl_reg_mirror from concurrent access. */
30 uint32_t device_id
; /**< The PCI device id of the device holding the 8255 chip. */
31 int me8255_idx
; /**< The index of the 8255 chip on the device. */
32 int dio_idx
; /**< The index of the DIO port on the 8255 chip. */
34 unsigned long port_reg
; /**< Register to read or write a value from or to the port respectively. */
35 unsigned long ctrl_reg
; /**< Register to configure the 8255 modes. */
39 * @brief The constructor to generate a 8255 instance.
41 * @param device_id The kind of Meilhaus device holding the 8255.
42 * @param reg_base The register base address of the device as returned by the PCI BIOS.
43 * @param me8255_idx The index of the 8255 chip on the Meilhaus device.
44 * @param dio_idx The index of the counter inside a 8255 chip.
45 * @param ctr_reg_mirror Pointer to mirror of control register.
46 * @param ctrl_reg_lock Pointer to spin lock protecting the 8255 control register and #ctrl_reg_mirror from concurrent access.
48 * @return Pointer to new instance on success.\n
51 me8255_subdevice_t
*me8255_constructor(uint32_t device_id
,
53 unsigned int me8255_idx
,
56 spinlock_t
* ctrl_reg_lock
);