drv_can.h 915 字节
Newer Older
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
/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-03-11     shelton      first version
 */

#ifndef __DRV_CAN_H__
#define __DRV_CAN_H__

#ifdef __cplusplus
extern "C" {
#endif

#include <rtdevice.h>
#include <rtthread.h>
#include "board.h"

struct at32_baud_rate
{
    rt_uint32_t baud_rate;
    can_baudrate_type baud_struct;
};

struct can_config
{
    can_type *can_x;
    can_base_type base_init_struct;
    can_baudrate_type baudrate_init_struct;
    can_filter_init_type filter_init_struct;
};

/* at32 can device */
struct at32_can
{
    char *name;
    struct can_config config;
    struct rt_can_device device;     /* inherit from can device */
};

int rt_hw_can_init(void);

#ifdef __cplusplus
}
#endif

#endif /*__DRV_CAN_H__ */

/************************** end of file ******************/