CANMSP432E4.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
49 #ifndef ti_drivers_can_CANMSP432E4__include
50 #define ti_drivers_can_CANMSP432E4__include
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 #include <stdbool.h>
57 #include <stddef.h>
58 #include <stdint.h>
59 
60 #include <ti/devices/msp432e4/inc/msp432.h>
61 
62 #include <ti/devices/msp432e4/driverlib/gpio.h>
63 #include <ti/devices/msp432e4/driverlib/pin_map.h>
64 
65 #include <ti/drivers/dpl/ClockP.h>
66 #include <ti/drivers/dpl/HwiP.h>
67 #include <ti/drivers/dpl/SemaphoreP.h>
68 
70 #include <ti/drivers/CAN.h>
71 #include <ti/drivers/utils/List.h>
73 
77 #define CANMSP432E4_PA0_CAN0RX GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 0, GPIO_PA0_CAN0RX)
78 
82 #define CANMSP432E4_PA1_CAN0TX GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 1, GPIO_PA1_CAN0TX)
83 
87 #define CANMSP432E4_PB0_CAN1RX GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTB, 0, GPIO_PB0_CAN1RX)
88 
92 #define CANMSP432E4_PB1_CAN1TX GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTB, 1, GPIO_PB1_CAN1TX)
93 
94 /* CAN function table pointer */
96 
109 typedef void (*CANMSP432E4_ErrorCallback) (CAN_Handle handle,
110  uint32_t error);
111 
160 typedef struct CANMSP432E4_HWAttrs {
162  uint32_t baseAddr;
164  uint32_t intNum;
166  uint32_t intPriority;
168  uint32_t rxPin;
170  uint32_t txPin;
172  uint32_t baudRate;
176 
182 typedef struct CANMSP432E4_Object {
188  SemaphoreP_Handle readSem;
189  SemaphoreP_Handle writeSem;
193  uint32_t writeTimeout;
194  uint32_t readTimeout;
196  uint32_t rxInUseMask;
197  uint32_t txInUseMask;
199  uint32_t overrunCount;
201  bool opened : 1;
202  bool txPending : 1;
204 
205 #ifdef __cplusplus
206 }
207 #endif
208 
209 #endif /* ti_drivers_can_CANMSP432E4__include */
PRELIMINARY CAN driver interface
struct CANMSP432E4_Object CANMSP432E4_Object
CANMSP432E4 Object.
CANMSP432E4 Hardware attributes.
Definition: CANMSP432E4.h:160
CAN_Direction direction
Definition: CANMSP432E4.h:192
SemaphoreP_Handle writeSem
Definition: CANMSP432E4.h:189
uint32_t intNum
Definition: CANMSP432E4.h:164
uint32_t rxInUseMask
Definition: CANMSP432E4.h:196
SemaphoreP_Handle readSem
Definition: CANMSP432E4.h:188
StructRingBuf_Object rxBuffer
Definition: CANMSP432E4.h:186
enum CAN_Direction_ CAN_Direction
CAN communication mode.
CAN Global configuration.
Definition: CAN.h:458
Definition: List.h:126
uint32_t intPriority
Definition: CANMSP432E4.h:166
uint32_t readTimeout
Definition: CANMSP432E4.h:194
struct CANMSP432E4_HWAttrs CANMSP432E4_HWAttrs
CANMSP432E4 Hardware attributes.
uint32_t overrunCount
Definition: CANMSP432E4.h:199
Definition: StructRingBuf.h:45
CAN_Mode mode
Definition: CANMSP432E4.h:191
MSP432E4 GPIO driver.
enum CAN_Mode_ CAN_Mode
CAN mode settings.
uint32_t baudRate
Definition: CANMSP432E4.h:172
uint32_t baseAddr
Definition: CANMSP432E4.h:162
StructRingBuf_Object txBuffer
Definition: CANMSP432E4.h:185
struct CANMSP432E4_Object * CANMSP432E4_Handle
uint32_t txInUseMask
Definition: CANMSP432E4.h:197
CANMSP432E4 Object.
Definition: CANMSP432E4.h:182
uint32_t rxPin
Definition: CANMSP432E4.h:168
CANMSP432E4_ErrorCallback errorFxn
Definition: CANMSP432E4.h:174
uint32_t txPin
Definition: CANMSP432E4.h:170
void(* CANMSP432E4_ErrorCallback)(CAN_Handle handle, uint32_t error)
The definition of an optional callback function used by the CAN driver to notify the application when...
Definition: CANMSP432E4.h:109
uint32_t writeTimeout
Definition: CANMSP432E4.h:193
List_Elem elem
Definition: CANMSP432E4.h:183
The definition of a CAN function table that contains the required set of functions to control a speci...
Definition: CAN.h:424
Linked List interface for use in drivers.
const CAN_FxnTable CANMSP432E4_fxnTable
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale