source: asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/hal/can_api.h@ 374

Last change on this file since 374 was 374, checked in by coas-nagasima, 5 years ago

mbed関連を更新
シリアルドライバをmbedのHALを使うよう変更
ファイルディスクリプタの処理を更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 2.2 KB
Line 
1
2/** \addtogroup hal */
3/** @{*/
4/* mbed Microcontroller Library
5 * Copyright (c) 2006-2016 ARM Limited
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19#ifndef MBED_CAN_API_H
20#define MBED_CAN_API_H
21
22#include "device.h"
23
24#if DEVICE_CAN
25
26#include "PinNames.h"
27#include "PeripheralNames.h"
28#include "hal/can_helper.h"
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34typedef enum {
35 IRQ_RX,
36 IRQ_TX,
37 IRQ_ERROR,
38 IRQ_OVERRUN,
39 IRQ_WAKEUP,
40 IRQ_PASSIVE,
41 IRQ_ARB,
42 IRQ_BUS,
43 IRQ_READY
44} CanIrqType;
45
46
47typedef enum {
48 MODE_RESET,
49 MODE_NORMAL,
50 MODE_SILENT,
51 MODE_TEST_LOCAL,
52 MODE_TEST_GLOBAL,
53 MODE_TEST_SILENT
54} CanMode;
55
56typedef void (*can_irq_handler)(uint32_t id, CanIrqType type);
57
58typedef struct can_s can_t;
59
60void can_init (can_t *obj, PinName rd, PinName td);
61void can_init_freq(can_t *obj, PinName rd, PinName td, int hz);
62void can_free (can_t *obj);
63int can_frequency(can_t *obj, int hz);
64
65void can_irq_init (can_t *obj, can_irq_handler handler, uint32_t id);
66void can_irq_free (can_t *obj);
67void can_irq_set (can_t *obj, CanIrqType irq, uint32_t enable);
68
69int can_write (can_t *obj, CAN_Message, int cc);
70int can_read (can_t *obj, CAN_Message *msg, int handle);
71int can_mode (can_t *obj, CanMode mode);
72int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle);
73void can_reset (can_t *obj);
74unsigned char can_rderror (can_t *obj);
75unsigned char can_tderror (can_t *obj);
76void can_monitor (can_t *obj, int silent);
77
78#ifdef __cplusplus
79};
80#endif
81
82#endif // MBED_CAN_API_H
83
84#endif
85
86/** @}*/
Note: See TracBrowser for help on using the repository browser.