summaryrefslogtreecommitdiff
path: root/bsp/gkipc/drivers/drv_ssi.h
blob: 906d5432982263156bf52386e8e5961c90f87c99 (plain)
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
#ifndef SSI_H_
#define SSI_H_

#include "gtypes.h"
#include <rtdevice.h>

#define MAX_SLAVE_DEVICE (2)

struct gk_spi_slave_info
{
    rt_uint32_t id;	
	rt_uint32_t cs_pin;
	GD_HANDLE spihandle;
	
    struct rt_spi_device spi_device;
    struct gk_spi_controller *control;
    struct gk_spi_slave_info *next;
};

struct gk_spi_controller;
struct gk_spi_controller_data
{
    rt_uint32_t id;
    rt_uint32_t total_slave;
    rt_uint32_t slave_cs_pin[MAX_SLAVE_DEVICE];
	struct gk_spi_controller *control;
};

struct gk_spi_controller
{
    rt_uint32_t id;
    struct rt_spi_bus spi_bus;
    struct rt_spi_message *current_message;
    struct rt_completion transfer_completion;
    struct rt_semaphore xfer_lock;
	
	struct gk_spi_slave_info *spi_slave;

};

void rt_hw_spi_init(void);

#endif