1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 
5 #include "aos/hal/can.h"
6 
7 
8 /**
9  * Initialises a CAN interface
10  *
11  * @param[in]  can  the interface which should be initialised
12  *
13  * @return  0 : on success, EINVAL : if an error occurred with any step
14  */
hal_can_init(can_dev_t * can)15 int32_t hal_can_init(can_dev_t *can)
16 {
17 	return 0;
18 }
19 
20 /**
21  * config a CAN fliter
22  *
23  * @param[in]  can             the interface which should be initialised
24  * @param[in]  filter_grp_cnt  0 will make all id pass. This value must be <=10
25  * @param[in]  filter_config   point to a filter config
26  *
27  * @return  0 : on success, EIO : if an error occurred with any step
28  */
hal_can_filter_init(can_dev_t * can,const uint8_t filter_grp_cnt,can_filter_item_t * filter_config)29 int32_t hal_can_filter_init(can_dev_t *can, const uint8_t filter_grp_cnt, can_filter_item_t *filter_config)
30 {
31 	return 0;
32 }
33 
34 /**
35  * Transmit data by CAN
36  *
37  * @param[in]  can        the can interface
38  * @param[in]  tx_header  frame head
39  * @param[in]  data       pointer to the start of data
40  * @param[in]  timeout    timeout in milisecond, set this value to HAL_WAIT_FOREVER
41  *                        if you want to wait forever
42  *
43  * @return  0 : on success, EIO : if an error occurred with any step
44  */
hal_can_send(can_dev_t * can,can_frameheader_t * tx_header,const void * data,const uint32_t timeout)45 int32_t hal_can_send(can_dev_t *can, can_frameheader_t *tx_header, const void *data, const uint32_t timeout)
46 {
47 	return 0;
48 }
49 
50 /**
51  * Receive data by CAN
52  *
53  * @param[in]   can        the can interface
54  * @param[out]  rx_header  frame head
55  * @param[out]  data       pointer to the start of data
56  * @param[in]   timeout    timeout in milisecond, set this value to HAL_WAIT_FOREVER
57  *                         if you want to wait forever
58  *
59  * @return  0 : on success, EIO : if an error occurred with any step
60  */
hal_can_recv(can_dev_t * can,can_frameheader_t * rx_header,void * data,const uint32_t timeout)61 int32_t hal_can_recv(can_dev_t *can, can_frameheader_t *rx_header, void *data, const uint32_t timeout)
62 {
63 	return 0;
64 }
65 
66 
67 /**
68  * Deinitialises a CAN interface
69  *
70  * @param[in]  can  the interface which should be deinitialised
71  *
72  * @return  0 : on success, EIO : if an error occurred with any step
73  */
hal_can_finalize(can_dev_t * can)74 int32_t hal_can_finalize(can_dev_t *can)
75 {
76 	return 0;
77 }
78 
79