drv_spi.h 994 字节
Newer Older
S
Sherman 已提交
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
/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-08-23     Mr.Tiger   first version
 */

#ifndef __DRV_SPI_H__
#define __DRV_SPI_H__

#include <rtthread.h>
#include <rtdevice.h>
#include "hal_data.h"
#include "board.h"
#include <rthw.h>
#include <drv_common.h>
#include <drv_config.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifdef R_SPI_H
struct ra_spi_handle
{
S
Sherman 已提交
29
    const char bus_name[RT_NAME_MAX];
S
Sherman 已提交
30 31 32 33 34 35 36 37 38 39 40 41 42
    const spi_cfg_t           *spi_cfg_t;
    const spi_instance_ctrl_t *spi_ctrl_t;
};

struct ra_spi
{
    rt_uint32_t                  cs_pin;
    struct ra_spi_handle        *ra_spi_handle_t;
    struct rt_spi_configuration *rt_spi_cfg_t;
    struct rt_spi_bus            bus;
};
#endif

43
rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_base_t cs_pin);
S
Sherman 已提交
44 45 46 47 48 49 50 51

#ifdef __cplusplus
}
#endif

/* stm32 spi dirver class */

#endif /*__DRV_SPI_H__ */