hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
 * @note Copyright (C) 2016 Philippe Gerum <rpm@xenomai.org>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
#ifndef _RTDM_SPI_DEVICE_H
#define _RTDM_SPI_DEVICE_H
 
#include <linux/list.h>
#include <linux/atomic.h>
#include <linux/mutex.h>
#include <rtdm/driver.h>
#include <rtdm/uapi/spi.h>
 
struct class;
struct rtdm_spi_master;
 
struct rtdm_spi_remote_slave {
   u8 chip_select;
   struct gpio_desc *cs_gpiod;
   struct rtdm_device dev;
   struct list_head next;
   struct rtdm_spi_config config;
   struct rtdm_spi_master *master;
   atomic_t mmap_refs;
   struct mutex ctl_lock;
};
 
static inline struct device *
slave_to_kdev(struct rtdm_spi_remote_slave *slave)
{
   return rtdm_dev_to_kdev(&slave->dev);
}
 
int rtdm_spi_add_remote_slave(struct rtdm_spi_remote_slave *slave,
                 struct rtdm_spi_master *spim,
                 struct spi_device *spi);
 
void rtdm_spi_remove_remote_slave(struct rtdm_spi_remote_slave *slave);
 
#endif /* !_RTDM_SPI_DEVICE_H */