[1/6] fd passing: move interface code from daemon.
[platform/core/api/peripheral-io.git] / src / interface / include / spi.h
1 /*
2  * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __SPI_H__
18 #define __SPI_H__
19
20 int spi_open(int bus, int cs, int *fd);
21 int spi_close(int fd);
22 int spi_set_mode(int fd, unsigned char mode);
23 int spi_set_bit_order(int fd, unsigned char lsb);
24 int spi_set_bits_per_word(int fd, unsigned char bits);
25 int spi_set_frequency(int fd, unsigned int freq);
26 int spi_get_buffer_size(int *bufsiz);
27 int spi_read(int fd, unsigned char *rxbuf, int length);
28 int spi_write(int fd, unsigned char *txbuf, int length);
29 int spi_transfer(int fd, unsigned char *txbuf, unsigned char *rxbuf, int length);
30
31 #endif /* __SPI_H__ */