Describes predefine macros for mbed online compiler (armcc)

Committer:
MACRUM
Date:
Thu Mar 16 21:58:09 2017 +0900
Revision:
6:40e873bbc5f7
Add licence header info

Who changed what in which revision?

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