iLLD_TC27xD
1.0
IfxSent_Sent.h
Go to the documentation of this file.
1
/**
2
* \file IfxSent_Sent.h
3
* \brief SENT SENT details
4
* \ingroup IfxLld_Sent
5
*
6
* \version iLLD_1_0_0_11_0
7
* \copyright Copyright (c) 2013 Infineon Technologies AG. All rights reserved.
8
*
9
*
10
* IMPORTANT NOTICE
11
*
12
*
13
* Infineon Technologies AG (Infineon) is supplying this file for use
14
* exclusively with Infineon's microcontroller products. This file can be freely
15
* distributed within development tools that are supporting such microcontroller
16
* products.
17
*
18
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
19
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
20
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
21
* INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
22
* OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
23
*
24
*
25
* \defgroup IfxLld_Sent_Sent_Usage How to use the SENT Interface driver?
26
* \ingroup IfxLld_Sent
27
*
28
* This SENT interface driver provides functions to communicate with external sensors.
29
*
30
* \section IfxLld_Sent_Sent_Preparation Preparation
31
* \subsection IfxLld_Sent_Sent_Include Include Files
32
*
33
* Include following header file into your C code:
34
* \code
35
* #include <Sent/Sent/IfxSent_Sent.h>
36
*
37
* \endcode
38
*
39
* \subsection IfxLld_Sent_Sent_Variables Variables
40
*
41
* Declare SENT module and channel handles as global variables in your C code.
42
* If multiple SENT channels should be serviced, it makes sense to declare the SENT channel handle as an array:
43
* \code
44
* #define TESTED_SENT_CHANNELS 3
45
*
46
* static IfxSent_Sent sent;
47
* static IfxSent_Sent_Channel sentChannel[TESTED_SENT_CHANNELS];
48
* \endcode
49
*
50
* \subsection IfxLld_Sent_Sent_Interrupt Interrupt Handler Installation
51
*
52
* See also \ref IfxLld_Cpu_Irq_Usage
53
*
54
* Define priorities for the Interrrupt handler. This is normally done in the Ifx_IntPrioDef.h file:
55
* \code
56
* #define IFX_INTPRIO_SENT_CHANNEL 1
57
* \endcode
58
*
59
* Add the interrupt service routine to your C code. It has to call the SENT interrupt handler by passing the SENT channel handle:
60
* \code
61
* void SentInterruptHandler(IfxSent_Sent_Channel *channel);
62
*
63
* IFX_INTERRUPT(sentChannelISR, 0, IFX_INTPRIO_SENT_CHANNEL)
64
* {
65
* int i;
66
*
67
* for(i=0; i<TESTED_SENT_CHANNELS; ++i)
68
* {
69
* SentInterruptHandler(&sentChannel[i]);
70
* }
71
* }
72
* \endcode
73
*
74
* Note: the SentInterruptHandler function is not part of the interface driver, but has to be
75
* implemented in the application. A template can be found below under \ref IfxLld_Sent_Sent_ISR
76
*
77
* Finally install the interrupt handlers in your initialisation function:
78
* \code
79
* // install interrupt handler
80
* IfxCpu_Irq_installInterruptHandler(&sentChannelISR, IFX_INTPRIO_SENT_CHANNEL);
81
* IfxCpu_enableInterrupts();
82
* \endcode
83
*
84
*
85
* \subsection IfxLld_Sent_Sent_Init Module Initialisation
86
*
87
* The module initialisation can be done in the same function.
88
* Here an example for SENT and SPC mode:
89
*
90
* \code
91
* // create module config
92
* IfxSent_Sent_Config sentConfig;
93
* IfxSent_Sent_initModuleConfig(&sentConfig, &MODULE_SENT);
94
*
95
* // initialize module
96
* //IfxSent_Sent sent; // defined globally
97
* IfxSent_Sent_initModule(&sent, &sentConfig);
98
* \endcode
99
*
100
* \subsection IfxLld_Sent_Sent_InitChannel Channel Initialisation
101
* After the module has been initialized, one or more SENT channels can be configured.
102
*
103
* Here an example for three SENT channels in SENT and SPC mode:
104
* \code
105
* // create channel config
106
* IfxSent_Sent_ChannelConfig sentChannelConfig;
107
* IfxSent_Sent_initChannelConfig(&sentChannelConfig, &sent);
108
*
109
* // define tUnit of the external sensor
110
* sentChannelConfig.tUnit = 3.0E-6;
111
*
112
* // ISR priorities and interrupt target
113
* sentChannelConfig.interrupt.priority = IFX_INTPRIO_SENT_CHANNEL;
114
* sentChannelConfig.interrupt.isrProvider = IfxCpu_Irq_getTos(IfxCpu_getCoreIndex());
115
*
116
* int i;
117
* for(i=0; i<TESTED_SENT_CHANNELS; ++i)
118
* {
119
* // pin configuration
120
* const IfxSent_Sent_Pins sentPins[TESTED_SENT_CHANNELS] =
121
* {
122
* { // Channel 0
123
* &IfxSent_SENT0C_P02_8_IN, IfxPort_InputMode_noPullDevice, // SENT input
124
* &IfxSent_SPC0_P00_1_OUT, IfxPort_OutputMode_openDrain, // SENT output
125
* IfxPort_PadDriver_cmosAutomotiveSpeed1
126
* },
127
*
128
* { // Channel 1
129
* &IfxSent_SENT1C_P02_7_IN, IfxPort_InputMode_noPullDevice, // SENT input
130
* &IfxSent_SPC1_P02_7_OUT, IfxPort_OutputMode_openDrain, // SENT output
131
* IfxPort_PadDriver_cmosAutomotiveSpeed1
132
* },
133
*
134
* { // Channel 2
135
* &IfxSent_SENT2C_P02_6_IN, IfxPort_InputMode_noPullDevice, // SENT input
136
* &IfxSent_SPC2_P00_3_OUT, IfxPort_OutputMode_openDrain, // SENT output
137
* IfxPort_PadDriver_cmosAutomotiveSpeed1
138
* },
139
* };
140
*
141
* sentChannelConfig.pins = &sentPins[i];
142
*
143
* // set channel
144
* sentChannelConfig.channelId = (IfxSent_ChannelId)i;
145
*
146
* // initialize channel
147
* IfxSent_Sent_initChannel(&sentChannel[i], &sentChannelConfig);
148
* }
149
* \endcode
150
*
151
* \subsection IfxLld_Sent_Sent_ISR Interrupt Service Handler
152
* The ISR has to be implemented in the application. Following template can be used
153
* to react on the events:
154
*
155
* \code
156
* void SentInterruptHandler(IfxSent_Sent_Channel *channel)
157
* {
158
* Ifx_SENT_CH_INTSTAT interruptStatus = IfxSent_Sent_getAndClearInterruptStatus(channel);
159
*
160
* if( interruptStatus.U )
161
* {
162
* // check for error conditions
163
* if (interruptStatus.U & IFXSENT_INTERRUPT_STATUS_ERROR_FLAGS)
164
* {
165
* // * Receive Buffer Overflow
166
* // * This bit is set after a frame has been received while the old one was
167
* // * not read from RDRx. I.e. the kernel wants to set any of the two
168
* // * interrupts RSI and RDI and finds any of these two interrupts already
169
* // * set. The old data is overwritten by the new data.
170
* // *
171
* if (interruptStatus.B.RBI)
172
* {
173
* // insert your error handling code here
174
* __debug();
175
* }
176
*
177
* // * Transmit Buffer Underflow
178
* // * This bit is set after data has been completely transferred (PLEN
179
* // * exceeded) and no new data was written to SCRx.
180
* // *
181
* if (interruptStatus.B.TBI)
182
* {
183
* // insert your error handling code here
184
* __debug();
185
* }
186
*
187
* // * Frequency Range Error
188
* // * This bit is set after a Synchronization / Calibration pulse was
189
* // * received that deviates more than +- 25% from the nominal value.
190
* // * The referring data is ignored.
191
* // *
192
* if (interruptStatus.B.FRI)
193
* {
194
* // insert your error handling code here
195
* __debug();
196
* }
197
*
198
* // * Frequency Drift Error
199
* // * This bit is set after a subsequent Synchronization / Calibration
200
* // * pulse was received that deviates more than 1.5625% (1/64) from its
201
* // * predecessor.
202
* // *
203
* if (interruptStatus.B.FDI)
204
* {
205
* // insert your error handling code here
206
* __debug();
207
* }
208
*
209
* // * Wrong Number of Nibbles
210
* // * This bit is set after a more nibbles have been received than expected
211
* // * or a Synchronization / Calibration Pulse is received too early thus
212
* // * too few nibbles have been received
213
* // *
214
* if (interruptStatus.B.NNI)
215
* {
216
* // insert your error handling code here
217
* __debug();
218
* }
219
*
220
* // * Nibbles Value out of Range
221
* // * This bit is set after a too long or too short nibble pulse has been
222
* // * received. I.e. value < 0 or value > 15.
223
* // *
224
* if (interruptStatus.B.NVI)
225
* {
226
* // insert your error handling code here
227
* __debug();
228
* }
229
*
230
* // * CRC Error
231
* // * This bit is set if the CRC check fails.
232
* // *
233
* if (interruptStatus.B.CRCI)
234
* {
235
* // insert your error handling code here
236
* __debug();
237
* }
238
*
239
* // * Wrong Status and Communication Nibble Error
240
* // * In standard Serial Frame Mode (RCR.ESF is cleared), this bit is set
241
* // * if the Status and Communication nibble shows a start bit in a frame
242
* // * other than frame number n x 16.
243
* // * In Extended Serial Frame Mode this bit is without function.
244
* // *
245
* if (interruptStatus.B.WSI)
246
* {
247
* // insert your error handling code here
248
* __debug();
249
* }
250
*
251
* // * Serial Data CRC Error
252
* // * This bit is set if the CRC of the serial message fails.
253
* // * In Extended Serial Message Format, this includes a check of the Serial
254
* // * Communication Nibble for correct 0 values of bit 3 in frames 7, 13 and 18.
255
* // *
256
* if (interruptStatus.B.SCRI)
257
* {
258
* // insert your error handling code here
259
* __debug();
260
* }
261
*
262
* // * Watch Dog Error
263
* // * This bit is set if the Watch Dog Timer of the channel expires.
264
* // *
265
* if (interruptStatus.B.WDI)
266
* {
267
* // insert your error handling code here
268
* __debug();
269
* }
270
* }
271
*
272
* // transaction events
273
*
274
* // * Receive Data
275
* // * RDI is activated when a received frame is moved to a Receive Data
276
* // * Register RDR. Both RDI and RSI will be issued together in normal use
277
* // * cases where the frame size is not bigger than 8 nibbles and CRC is
278
* // * correct or not checked (if RCRx.CDIS is cleared).
279
* // *
280
* if (interruptStatus.B.RDI)
281
* {
282
* // * Ignore RDI bit, useful only when Frame Length is greater than
283
* // * 8 nibbles since it can indicate that end of frame
284
* // *
285
* }
286
*
287
* // * Receive Success
288
* // * This bit is set at the successfully received end of a frame.
289
* // * Depending on bit RCRx.CDIS this indicates a successful check of the CRC.
290
* // *
291
* if (interruptStatus.B.RSI)
292
* {
293
* // here you could handle the incoming frame:
294
* IfxSent_Sent_Frame frame;
295
* IfxSent_Sent_readChannelSerialDataFrame(channel, &frame);
296
*
297
* // do something with the incoming data
298
* }
299
*
300
* // * Transfer Data
301
* // * This bit is set after the trigger condition was detected. Data to be
302
* // * transferred has been moved internally. Thus a new value can be written
303
* // * to SCRx. This can be used for back to back transfers.
304
* // *
305
* if (interruptStatus.B.TDI)
306
* {
307
* }
308
*
309
* // * Serial Data Received
310
* // * This bit is set after all serial data bits have been received via the
311
* // * Status and Communication nibble. Depending on bit RCRx.SCDIS this
312
* // * indicates a successful check of the CRC.
313
* // *
314
* if (interruptStatus.B.SDI)
315
* {
316
* // here you could handle the incoming message:
317
*
318
* // decode incoming message
319
* IfxSent_Sent_SerialMessageFrame message;
320
* IfxSent_Sent_readChannelSerialMessageFrame(channel, &message);
321
*
322
* // do something with the incoming message
323
* }
324
* }
325
* }
326
* \endcode
327
*
328
* \subsection IfxLld_Sent_Sent_Frame Frame Decoding
329
* Following code snippet shows, how incoming data of a TLE4998S device can be decoded:
330
*
331
* \code
332
* static void parseSensorData(IfxSent_Sent_Frame *frame)
333
* {
334
* uint32 data = frame->data;
335
* uint8 statusNibble = frame->statusNibble;
336
*
337
* // select B range [mT]
338
* const uint8 rangeValTable[4] = { 200, 100, 50, 0 };
339
* uint8 rangeVal = rangeValTable[statusNibble & 3];
340
*
341
* uint16 hallVal = (short)((((data & 0xFFFF) * rangeVal) / 0x7FFF) - rangeVal);
342
* uint16 temperature = ((short)((data >> 16) & 0x00FF) - 55);
343
*
344
* // do something with the values here...
345
* }
346
* \endcode
347
*
348
* \defgroup IfxLld_Sent_Sent Interface Driver
349
* \ingroup IfxLld_Sent
350
* \defgroup IfxLld_Sent_Sent_Structures Data Structures
351
* \ingroup IfxLld_Sent_Sent
352
* \defgroup IfxLld_Sent_Sent_Module Module Functions
353
* \ingroup IfxLld_Sent_Sent
354
* \defgroup IfxLld_Sent_Sent_Channel Channel Functions
355
* \ingroup IfxLld_Sent_Sent
356
*/
357
358
#ifndef IFXSENT_SENT_H
359
#define IFXSENT_SENT_H 1
360
361
/******************************************************************************/
362
/*----------------------------------Includes----------------------------------*/
363
/******************************************************************************/
364
365
#include "
Scu/Std/IfxScuWdt.h
"
366
#include "
Sent/Std/IfxSent.h
"
367
#include "
Cpu/Irq/IfxCpu_Irq.h
"
368
369
/******************************************************************************/
370
/*-----------------------------Data Structures--------------------------------*/
371
/******************************************************************************/
372
373
/** \addtogroup IfxLld_Sent_Sent_Structures
374
* \{ */
375
/** \brief Specifies the Interrupt type enables structure
376
*/
377
typedef
struct
378
{
379
uint8
receiveDataInterrupt
;
/**< \brief Specifies receive data interrupt enable */
380
uint8
receiveSuccessInterrupt
;
/**< \brief Specifies receive success interrupt enable */
381
uint8
receiveBufferOverflowInterrupt
;
/**< \brief Specifies receive buffer overflow interrupt enable */
382
uint8
transferDataInterrupt
;
/**< \brief Specifies transfer data interrupt enable */
383
uint8
transferBufferUnderflowInterrupt
;
/**< \brief Specifies transfer buffer underflow interrupt enable */
384
uint8
serialDataReceiveInterrupt
;
/**< \brief Specifies serial data interrupt enable */
385
uint8
watchdogErrorInterrupt
;
/**< \brief Specifies watchdog error interrupt enable */
386
uint8
serialDataCrcErrorInterrupt
;
/**< \brief Specifies serial data CRC error interrupt enable */
387
uint8
wrongStatusNibbleErrorInterrupt
;
/**< \brief Specifies wrong status nibble error interrupt enable */
388
uint8
crcErrorInterrupt
;
/**< \brief Specifies CRC error interrupt enable */
389
uint8
nibblesValueOutOfRangeErrorInterrupt
;
/**< \brief Specifies nibble value out of range error interrupt enable */
390
uint8
nibblesWrongErrorInterrupt
;
/**< \brief Specifies nibbles wrong error interrupt enable */
391
uint8
frequencyDriftErrorInterrupt
;
/**< \brief Specifies frequency drift error interrupt enable */
392
uint8
frequencyRangeErrorInterrupt
;
/**< \brief Specifies frequency not in the range error interrupt enable */
393
}
IfxSent_Sent_Enable
;
394
395
/** \} */
396
397
/** \addtogroup IfxLld_Sent_Sent_Structures
398
* \{ */
399
/** \brief Specifies SENT handle structure
400
*/
401
typedef
struct
402
{
403
Ifx_SENT *
sent
;
/**< \brief Specifies pointer to SENT registers */
404
}
IfxSent_Sent
;
405
406
/** \brief Specifies interrupt flags union . In addition it allows to write and read to/from all flags as once via the ALL member.
407
*/
408
typedef
union
409
{
410
uint32
ALL
;
/**< \brief Specifies to write and read to/from all flags as once via the ALL member. */
411
IfxSent_Sent_Enable
enable
;
/**< \brief Structure contains the interrupt flags */
412
}
IfxSent_Sent_EnabledInterrupts
;
413
414
/** \brief Specifies the input output control properties
415
*/
416
typedef
struct
417
{
418
boolean
inputPulsePolarityHigh
;
/**< \brief Specifies the polarity of input of each channel */
419
boolean
outputPulsePolarityHigh
;
/**< \brief Specifies the polarity of input of each channel */
420
boolean
edgeCounterCleared
;
/**< \brief Specifies the edge counter reset */
421
boolean
glitchFallingCleared
;
/**< \brief Specifies the glitch falling edge clear */
422
boolean
glitchRisingCleared
;
/**< \brief Specifies the glitch rising edge clear */
423
boolean
triggerMonitorCleared
;
/**< \brief Specifies the trigger monitor reset */
424
IfxSent_DigitalGlitchesLength
digitalGlitchFilterDepth
;
/**< \brief Specifies the Digital Glitch Filter depth for input signal delay */
425
IfxSent_ExternalTrigger
externalTrigger
;
/**< \brief Specifies the external trigger line source */
426
}
IfxSent_Sent_InputOutputControl
;
427
428
/** \brief Specifies the interrupt control properties
429
*/
430
typedef
struct
431
{
432
uint16
priority
;
/**< \brief Specifies the interrupt priority. Always 1 since all interrupts are handled at a time */
433
IfxSrc_Tos
isrProvider
;
/**< \brief Specifies the interrupt service provider. CPU or DMA. */
434
}
IfxSent_Sent_Interrupt
;
435
436
/** \brief Specifies the interrupt control properties structure
437
*/
438
typedef
struct
439
{
440
IfxSent_InterruptNodePointer
receiveSuccessInterruptNode
;
/**< \brief Specifies the interrupt node for rsi request */
441
IfxSent_InterruptNodePointer
receiveDataInterruptNode
;
/**< \brief Specifies the interrupt node for rdi request */
442
IfxSent_InterruptNodePointer
receiveBufferOverflowInterruptNode
;
/**< \brief Specifies the interrupt node for rbi request */
443
IfxSent_InterruptNodePointer
transferDataInterruptNode
;
/**< \brief Specifies the interrupt node for tdi request */
444
IfxSent_InterruptNodePointer
transferBufferUnderflowInterruptNode
;
/**< \brief Specifies the interrupt node for tbi request */
445
IfxSent_InterruptNodePointer
errorInterruptNode
;
/**< \brief Specifies the interrupt node for erri request */
446
IfxSent_InterruptNodePointer
serialDataReceiveInterruptNode
;
/**< \brief Specifies the interrupt node for sdi request */
447
IfxSent_InterruptNodePointer
watchdogErrorInterruptNode
;
/**< \brief Specifies the interrupt node for wdi request */
448
}
IfxSent_Sent_InterruptNodeControl
;
449
450
/** \brief Specifies the received nibbles control properties
451
*/
452
typedef
struct
453
{
454
IfxSent_Nibble
nibblePointer0
;
/**< \brief Specifies the received nibble0 control */
455
IfxSent_Nibble
nibblePointer1
;
/**< \brief Specifies the received nibble1 control */
456
IfxSent_Nibble
nibblePointer2
;
/**< \brief Specifies the received nibble2 control */
457
IfxSent_Nibble
nibblePointer3
;
/**< \brief Specifies the received nibble3 control */
458
IfxSent_Nibble
nibblePointer4
;
/**< \brief Specifies the received nibble4 control */
459
IfxSent_Nibble
nibblePointer5
;
/**< \brief Specifies the received nibble5 control */
460
IfxSent_Nibble
nibblePointer6
;
/**< \brief Specifies the received nibble6 control */
461
IfxSent_Nibble
nibblePointer7
;
/**< \brief Specifies the received nibble7 control */
462
}
IfxSent_Sent_NibbleControl
;
463
464
/** \brief Specifies the pins configuration for SENT channel
465
*/
466
typedef
struct
467
{
468
const
IfxSent_Sent_In
*
in
;
/**< \brief Specifies input pin configuration */
469
IfxPort_InputMode
inMode
;
/**< \brief Specifies input pin mode */
470
const
IfxSent_Spc_Out
*
out
;
/**< \brief Specifies output pin configuration */
471
IfxPort_OutputMode
outMode
;
/**< \brief Specifies output pin mode */
472
IfxPort_PadDriver
pinDriver
;
/**< \brief Pad driver mode definition */
473
}
IfxSent_Sent_Pins
;
474
475
/** \brief Specifies the receive control properties
476
*/
477
typedef
struct
478
{
479
boolean
crcModeDisabled
;
/**< \brief Specifies the CRC mode disabled mode */
480
boolean
crcMethodDisabled
;
/**< \brief Specifies the CRC with zero nibbles disabled or enabled */
481
boolean
alternateCrcSelected
;
/**< \brief Specifies the CRC is calculated for both fast and serial messages */
482
boolean
serialDataProcessingEnabled
;
/**< \brief Specifies the serial data processing mode */
483
boolean
serialDataDisabledCrcDisabled
;
/**< \brief Specifies the CRC disable for serial data disabled mode */
484
boolean
statusNibbleEnabled
;
/**< \brief Specifies the status nibble to include in CRC */
485
boolean
driftErrorsDisabled
;
/**< \brief Specifies the drift errors enabled or disabled */
486
boolean
endPulseIgnored
;
/**< \brief Specifies the pause pulse during synchronization */
487
boolean
suspendTriggered
;
/**< \brief Specifies the suspend trigger disables the channel or not */
488
uint8
frameLength
;
/**< \brief Specifies frame length in nibbles */
489
IfxSent_FrameCheckMode
frameCheckMode
;
/**< \brief Specifies the frame check mode for valid frame */
490
IfxSent_ExtendedSerialFrameMode
extendedSerialFrameMode
;
/**< \brief Specifies the extended serial frame mode */
491
}
IfxSent_Sent_ReceiveControl
;
492
493
/** \brief Specifies the SPC channel properties structure
494
*/
495
typedef
struct
496
{
497
uint8
pulseLength
;
/**< \brief Specifies the pulse length in ticktimes */
498
uint8
pulseDelayLength
;
/**< \brief Specifies the pulse delay length */
499
IfxSent_TriggerSource
triggerSource
;
/**< \brief Specifies the trigger source and mode */
500
IfxSent_TimeBase
timeBase
;
/**< \brief Specifies the pulse time base */
501
IfxSent_SpcMode
spcMode
;
/**< \brief Specifies the SENT SPC operational mode */
502
}
IfxSent_Sent_TransmitControl
;
503
504
/** \} */
505
506
/** \addtogroup IfxLld_Sent_Sent_Structures
507
* \{ */
508
/** \brief Specifies the SENT Channel handle structure
509
*/
510
typedef
struct
511
{
512
IfxSent_Sent
*
driver
;
/**< \brief Specifies the pointer to SENT module handler */
513
Ifx_SENT_CH *
channel
;
/**< \brief Specifies the pointer SENT channel registers */
514
IfxSent_ChannelId
channelId
;
/**< \brief Specifies the SENT channel number */
515
}
IfxSent_Sent_Channel
;
516
517
/** \brief Specifies the SENT Channel configuration structure
518
*/
519
typedef
struct
520
{
521
IfxSent_Sent
*
driver
;
/**< \brief Specifies the pointer to SENT module handler */
522
uint16
watchDogTimerLimit
;
/**< \brief Speciifes the enabled interrupts for each Channel */
523
IfxSent_ChannelId
channelId
;
/**< \brief Specifies the SENT channel number */
524
IfxSent_Sent_InputOutputControl
inputOutputControl
;
/**< \brief Specifies the input output controllable properties */
525
IfxSent_Sent_ReceiveControl
receiveControl
;
/**< \brief Specifies the receive control properties */
526
IfxSent_Sent_TransmitControl
transmitControl
;
/**< \brief Specifies the transmit control properties */
527
IfxSent_Sent_InterruptNodeControl
interuptNodeControl
;
/**< \brief Specifies the interrupt control properties structure */
528
const
IfxSent_Sent_Pins
*
pins
;
/**< \brief Specifies the pins configuration for SENT channel */
529
float32
tUnit
;
/**< \brief desired unit time (f_tick), e.g. 3E-6 for 3 uS */
530
IfxSent_Sent_NibbleControl
nibbleControl
;
/**< \brief Specifies the received nibbles control properties */
531
IfxSent_Sent_Interrupt
interrupt
;
/**< \brief Specifies the interrupt control properties structure */
532
boolean
spcModeOn
;
/**< \brief Specifies the SENT SPC mode enable/disable */
533
IfxSent_Sent_EnabledInterrupts
enabledInterrupts
;
534
}
IfxSent_Sent_ChannelConfig
;
535
536
/** \brief Specifies the SENT module configuration structure
537
*/
538
typedef
struct
539
{
540
Ifx_SENT *
module
;
/**< \brief Specifies pointer to SENT registers */
541
boolean
sleepModeEnabled
;
/**< \brief Specifies SENT enable/disable */
542
uint32
timeStampPreDivider
;
/**< \brief Specifies the pre-divider to get clock in time stamp */
543
}
IfxSent_Sent_Config
;
544
545
/** \brief Specifies the frame configuration structure for a channel
546
*/
547
typedef
struct
548
{
549
uint32
data
;
/**< \brief Contains the data from last received frame */
550
uint32
timeStamp
;
/**< \brief Contains the timestamp of last received frame */
551
uint8
statusNibble
;
/**< \brief Contains the status and communication Nibble of last received frame */
552
}
IfxSent_Sent_Frame
;
553
554
/** \brief Specifies received message frame
555
*/
556
typedef
struct
557
{
558
uint8
crc
;
/**< \brief Contains the received CRC value */
559
uint8
messageId
;
/**< \brief Contains the received message ID value */
560
uint16
serialData
;
/**< \brief Contains the received serial data value */
561
IfxSent_ConfigBit
configBit
;
/**< \brief Contains the received configuration bit value */
562
}
IfxSent_Sent_SerialMessageFrame
;
563
564
/** \} */
565
566
/** \addtogroup IfxLld_Sent_Sent_Module
567
* \{ */
568
569
/******************************************************************************/
570
/*-------------------------Global Function Prototypes-------------------------*/
571
/******************************************************************************/
572
573
/** \brief Reset the SENT module
574
* \param driver pointer to the SENT module handler
575
* \return None
576
*/
577
IFX_EXTERN
void
IfxSent_Sent_deInitModule
(
IfxSent_Sent
*driver);
578
579
/** \brief Initialise the SENT with the supplied configureation
580
* \param driver pointer to the SENT module handler
581
* \param config pointer to the SENT module configuration
582
* \return TRUE if valid configuration otherwise FALSE
583
*
584
* Usage example: see \ref IfxLld_Sent_Sent_Usage
585
*
586
*/
587
IFX_EXTERN
boolean
IfxSent_Sent_initModule
(
IfxSent_Sent
*driver,
const
IfxSent_Sent_Config
*config);
588
589
/** \brief Initialise buffer with default SENT configuration
590
* \param config pointer to the SENT module configuration
591
* \param sent base address of the SENT register space
592
* \return None
593
*
594
* Usage example: see \ref IfxLld_Sent_Sent_Usage
595
*
596
*/
597
IFX_EXTERN
void
IfxSent_Sent_initModuleConfig
(
IfxSent_Sent_Config
*config, Ifx_SENT *sent);
598
599
/** \} */
600
601
/** \addtogroup IfxLld_Sent_Sent_Channel
602
* \{ */
603
604
/******************************************************************************/
605
/*-------------------------Inline Function Prototypes-------------------------*/
606
/******************************************************************************/
607
608
/** \brief Copies the current interrupt flags into the Ifx_SENT_CH_INTSTAT structure, and clears the flags in hardware.
609
*
610
* This function should be used in an ISR to retrieve the events which triggered the interrupt.
611
* \param channel Specifies the SENT Channel handle structure
612
* \return Interrupt flags which have been cleared.
613
*
614
* Usage example: see \ref IfxLld_Sent_Sent_Usage
615
*
616
*/
617
IFX_INLINE
Ifx_SENT_CH_INTSTAT
IfxSent_Sent_getAndClearInterruptStatus
(
IfxSent_Sent_Channel
*channel);
618
619
/******************************************************************************/
620
/*-------------------------Global Function Prototypes-------------------------*/
621
/******************************************************************************/
622
623
/** \brief Initialize the channel with the supplied configuration
624
* \param channel pointer to the SENT channel
625
* \param config pointer to the SENT channel configuration
626
* \return TRUE if valid configuration otherwise FALSE
627
*
628
* Usage example: see \ref IfxLld_Sent_Sent_Usage
629
*
630
*/
631
IFX_EXTERN
boolean
IfxSent_Sent_initChannel
(
IfxSent_Sent_Channel
*channel,
const
IfxSent_Sent_ChannelConfig
*config);
632
633
/** \brief Initialise channel buffer with default SENT channel configuration
634
* \param config pointer to the SENT channel configuration
635
* \param driver pointer to the SENT module handler
636
* \return None
637
*
638
* Usage example: see \ref IfxLld_Sent_Sent_Usage
639
*
640
*/
641
IFX_EXTERN
void
IfxSent_Sent_initChannelConfig
(
IfxSent_Sent_ChannelConfig
*config,
IfxSent_Sent
*driver);
642
643
/** \brief Reads the nibbles recieved in the Data register
644
* \param channel SENT Channel whose data has to be read
645
* \param frame Data read from the SENT Channel
646
* \return TRUE if data received otherwise false
647
*
648
* Usage example: see \ref IfxLld_Sent_Sent_Usage
649
*
650
*/
651
IFX_EXTERN
boolean
IfxSent_Sent_readChannelSerialDataFrame
(
IfxSent_Sent_Channel
*channel,
IfxSent_Sent_Frame
*frame);
652
653
/** \brief reads the Serial data recieved and collected over several SENT frames
654
* \param channel reads the Serial data recieved and collected over several SENT frames
655
* \param message Data pointer pointing to the serial data read from the SENT Channel
656
* \return TRUE if serial message received otherwise false
657
*
658
* Usage example: see \ref IfxLld_Sent_Sent_Usage
659
*
660
*/
661
IFX_EXTERN
boolean
IfxSent_Sent_readChannelSerialMessageFrame
(
IfxSent_Sent_Channel
*channel,
IfxSent_Sent_SerialMessageFrame
*message);
662
663
/** \} */
664
665
/******************************************************************************/
666
/*---------------------Inline Function Implementations------------------------*/
667
/******************************************************************************/
668
669
IFX_INLINE
Ifx_SENT_CH_INTSTAT
IfxSent_Sent_getAndClearInterruptStatus
(
IfxSent_Sent_Channel
*channel)
670
{
671
return
IfxSent_getAndClearInterruptStatus
(channel->
driver
->
sent
, channel->
channelId
);
672
}
673
674
675
#endif
/* IFXSENT_SENT_H */
home
mclld
Libraries
release
iLLD_1_0_0_11_0
src
ifx
TC27xD
Sent
Sent
IfxSent_Sent.h
Generated by
1.8.4