master/master.h
branchstable-1.4
changeset 1700 86648ba63030
parent 1686 e206f4485f60
equal deleted inserted replaced
1699:89ba41136b21 1700:86648ba63030
    32 /*****************************************************************************/
    32 /*****************************************************************************/
    33 
    33 
    34 #ifndef __EC_MASTER_H__
    34 #ifndef __EC_MASTER_H__
    35 #define __EC_MASTER_H__
    35 #define __EC_MASTER_H__
    36 
    36 
       
    37 #include <linux/version.h>
    37 #include <linux/list.h>
    38 #include <linux/list.h>
    38 #include <linux/timer.h>
    39 #include <linux/timer.h>
    39 #include <linux/wait.h>
    40 #include <linux/wait.h>
    40 #include <linux/kthread.h>
    41 #include <linux/kthread.h>
       
    42 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
       
    43 #include <linux/semaphore.h>
       
    44 #else
    41 #include <asm/semaphore.h>
    45 #include <asm/semaphore.h>
       
    46 #endif
    42 
    47 
    43 #include "device.h"
    48 #include "device.h"
    44 #include "domain.h"
    49 #include "domain.h"
    45 #include "fsm_master.h"
    50 #include "fsm_master.h"
    46 #include "cdev.h"
    51 #include "cdev.h"
    79 struct ec_master {
    84 struct ec_master {
    80     unsigned int index; /**< Index. */
    85     unsigned int index; /**< Index. */
    81     unsigned int reserved; /**< \a True, if the master is in use. */
    86     unsigned int reserved; /**< \a True, if the master is in use. */
    82 
    87 
    83     ec_cdev_t cdev; /**< Master character device. */
    88     ec_cdev_t cdev; /**< Master character device. */
       
    89 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
       
    90     struct device *class_device; /**< Master class device. */
       
    91 #else
    84     struct class_device *class_device; /**< Master class device. */
    92     struct class_device *class_device; /**< Master class device. */
       
    93 #endif
    85     struct semaphore master_sem; /**< Master semaphore. */
    94     struct semaphore master_sem; /**< Master semaphore. */
    86 
    95 
    87     ec_device_t main_device; /**< EtherCAT main device. */
    96     ec_device_t main_device; /**< EtherCAT main device. */
    88     const uint8_t *main_mac; /**< MAC address of main device. */
    97     const uint8_t *main_mac; /**< MAC address of main device. */
    89     ec_device_t backup_device; /**< EtherCAT backup device. */
    98     ec_device_t backup_device; /**< EtherCAT backup device. */