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