Forked.

Fork of mbed-dev by mbed official

Committer:
<>
Date:
Fri Sep 02 15:07:44 2016 +0100
Revision:
144:ef7eb2e8f9f7
Parent:
75:245e7931bad6
Child:
149:156823d33999
This updates the lib to the mbed lib v125

Who changed what in which revision?

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