summaryrefslogtreecommitdiff
path: root/bsp/novosns/ns800/libraries/HAL_Drivers/drivers/drv_spi.h
blob: 56bf9489bf66a631a0b2c6f96eec263fd046452f (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
44
45
46
47
48
49
50
/*
 * Copyright (c) 2006-2026, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2026-05-12     lugl         first version
 */

#ifndef __DRV_SPI_H__
#define __DRV_SPI_H__

#include <rtthread.h>
#include "rtdevice.h"
#include <rthw.h>
#include <drv_common.h>

#ifdef RT_USING_SPI

struct ns800_spi_config
{
    const char *name;
    SPI_TypeDef *Instance;
    IRQn_Type rx_irq_type;
    IRQn_Type tx_irq_type;
    GPIO_TypeDef *sck_port;
    GPIO_PinNum sck_pin;
    GPIO_AltFunc sck_mux;
    GPIO_TypeDef *mosi_port;
    GPIO_PinNum mosi_pin;
    GPIO_AltFunc mosi_mux;
    GPIO_TypeDef *miso_port;
    GPIO_PinNum miso_pin;
    GPIO_AltFunc miso_mux;
};

struct ns800_spi
{
    SPI_TypeDef *Instance;
    struct rt_spi_bus spi_bus;
    struct ns800_spi_config *config;
};

int rt_hw_spi_init(void);

#endif

#endif /* __DRV_SPI_H__ */