iLLD_TC27xD  1.0
IfxEray_Eray.h
Go to the documentation of this file.
1 /**
2  * \file IfxEray_Eray.h
3  * \brief ERAY ERAY details
4  * \ingroup IfxLld_Eray
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  * \defgroup IfxLld_Eray_Eray_Usage How to use the ERAY Interface driver?
25  * \ingroup IfxLld_Eray
26  *
27  * \section IfxLld_Eray_Eray_Preparation Preparation
28  * \subsection IfxLld_Eray_Eray_Include Include Files
29  *
30  * Include following header file into your C code:
31  *
32  * \code
33  * #include <Eray/Eray/IfxEray_Eray.h>
34  * #include <Scu/Std/IfxScuWdt.h>
35  * #include <eray_commands.h>
36  * \endcode
37  *
38  *
39  *
40  * \subsection IfxLld_Eray_Eray_Defines Defines
41  * \code
42  *
43  * // Number of tested communication cycles
44  * #define NUMBER_ERAY_COMM_CYCLES 8
45  * #define NO_OF_SLOTS 2
46  * \endcode
47  *
48  * \subsection IfxLld_Eray_Eray_Variables Variables
49  *
50  * \code
51  * // global variables
52  * static IfxEray_Eray eray;
53  * volatile unsigned receivedDataCounter;
54  * uint32 receivedData[NUMBER_ERAY_COMM_CYCLES][NO_OF_SLOTS];
55  * \endcode
56  *
57  * \subsection IfxLld_Eray_Eray_Interrupt Interrupt Handler Installation
58  * Define priorities for the Interrrupt handler. This is normally done in the Ifx_IntPrioDef.h file:
59  * \code
60  * #define IFX_ERAY_INT0_PRIO 1
61  * #define IFX_ERAY_INT1_PRIO 2
62  * #define IFX_ERAY_NDAT0_PRIO 3
63  * #define IFX_ERAY_NDAT1_PRIO 4
64  * #define IFX_ERAY_MBSC0_PRIO 5
65  * #define IFX_ERAY_MBSC1_PRIO 6
66  * \endcode
67  *
68  * Add the interrupt service routine to your C code. It has to call the ERAY interrupt handler:
69  * \code
70  * // ISR routines for interrupt handling
71  * void ERAY_irqInt0Handler();
72  * void ERAY_irqInt1Handler();
73  * void ERAY_irqNdat0Handler();
74  * void ERAY_irqNdat1Handler();
75  * void ERAY_irqMbsc0Handler();
76  * void ERAY_irqMbsc1Handler();
77  *
78  * IFX_INTERRUPT(eray0Int0ISR, 0, IFX_ERAY_INT0_PRIO)
79  * {
80  * ERAY_irqInt0Handler();
81  * }
82  * IFX_INTERRUPT(eray0Int1ISR, 0, IFX_ERAY_INT1_PRIO)
83  * {
84  * ERAY_irqInt1Handler();
85  * }
86  * IFX_INTERRUPT(eray0Ndat0ISR, 0, IFX_ERAY_NDAT0_PRIO)
87  * {
88  * ERAY_irqNdat0Handler();
89  * }
90  * IFX_INTERRUPT(eray0Ndat1ISR, 0, IFX_ERAY_NDAT1_PRIO)
91  * {
92  * ERAY_irqNdat1Handler();
93  * }
94  * IFX_INTERRUPT(eray0Mbsc0ISR, 0, IFX_ERAY_MBSC0_PRIO)
95  * {
96  * ERAY_irqMbsc0Handler();
97  * }
98  * IFX_INTERRUPT(eray0Mbsc1ISR, 0, IFX_ERAY_MBSC1_PRIO)
99  * {
100  * ERAY_irqMbsc1Handler();
101  * }
102  * \endcode
103  *
104  * Finally install the interrupt handlers in your initialisation function:
105  * \code
106  * // install interrupt handler
107  * IfxCpu_Irq_installInterruptHandler(&eray0Int0ISR, IFX_ERAY_INT0_PRIO);
108  * IfxCpu_Irq_installInterruptHandler(&eray0Int1ISR, IFX_ERAY_INT1_PRIO);
109  * IfxCpu_Irq_installInterruptHandler(&eray0Ndat0ISR, IFX_ERAY_NDAT0_PRIO);
110  * IfxCpu_Irq_installInterruptHandler(&eray0Ndat1ISR, IFX_ERAY_NDAT1_PRIO);
111  * IfxCpu_Irq_installInterruptHandler(&eray0Mbsc0ISR, IFX_ERAY_MBSC0_PRIO);
112  * IfxCpu_Irq_installInterruptHandler(&eray0Mbsc1ISR, IFX_ERAY_MBSC1_PRIO);
113  *
114  * // enable all cpu0 interrupts
115  * IfxCpu_enableInterrupts();
116  * \endcode
117  *
118  *
119  * \subsection IfxLld_Eray_Eray_Init Module Initialisation
120  *
121  * First ensure that the ERAY PLL is configured to output a 80 MHz clock for the ERAY module:
122  * \code
123  * // initialize Eray PLL
124  * //clib_ver_printf("Initialize ERAY PLL\n");
125  * {
126  * IfxScuCcu_ErayPllConfig ErayPllConfig;
127  * IfxScuCcu_initErayPllConfig(&ErayPllConfig);
128  * result |= IfxScuCcu_initErayPll(&ErayPllConfig);
129  * }
130  * \endcode
131  *
132  * Thereafter initialize the module:
133  * \code
134  * // create module config
135  * IfxEray_Eray_Config erayModuleConfig;
136  * #if TEST_ERAY1
137  * //clib_ver_printf("Initialize ERAY1\n");
138  * IfxEray_Eray_initModuleConfig(&erayModuleConfig, &MODULE_ERAY1);
139  * #else
140  * //clib_ver_printf("Initialize ERAY0\n");
141  * IfxEray_Eray_initModuleConfig(&erayModuleConfig, &MODULE_ERAY0);
142  * #endif
143  *
144  * // ISR priorities
145  * erayModuleConfig.interrupt.int0Priority = IFX_ERAY_INT0_PRIO;
146  * erayModuleConfig.interrupt.int1Priority = IFX_ERAY_INT1_PRIO;
147  * erayModuleConfig.interrupt.ndat0Priority = IFX_ERAY_NDAT0_PRIO;
148  * erayModuleConfig.interrupt.ndat1Priority = IFX_ERAY_NDAT1_PRIO;
149  * erayModuleConfig.interrupt.mbsc0Priority = IFX_ERAY_MBSC0_PRIO;
150  * erayModuleConfig.interrupt.mbsc1Priority = IFX_ERAY_MBSC1_PRIO;
151  *
152  * // init module
153  * IfxEray_Eray_initModule( &eray, &erayModuleConfig );
154  * \endcode
155  *
156  * \subsection IfxLld_Eray_Eray_Node_Init Node Initialisation
157  *
158  * The node initialisation can be done in the same function.
159  * \code
160  * // get ERAY node default configuration
161  * IfxEray_Eray_NodeConfig nodeConfig;
162  * IfxEray_Eray_Node_initConfig(&nodeConfig);
163  *
164  * // configuration changes for interaction with external testbench element
165  * {
166  * // only for simulation: start external ERAY node
167  * {
168  * TbeMessage reply;
169  *
170  * // start ERay Testbench Element
171  * sendMessage(MSG_ID_TESTBENCH_ERAY, CMD_ERAY_TBE_START, 0 );
172  * receiveMessageBlockingFrom(MSG_ID_TESTBENCH_ERAY, reply);
173  * }
174  *
175  * {
176  * // SUCC1
177  * IfxEray_Eray_Succ1Config *succ1 = &nodeConfig.controllerConfig.succ1Config;
178  *
179  * succ1->clockSyncErrorHalt = FALSE;
180  * }
181  *
182  * {
183  * // PRTC1
184  * IfxEray_Eray_Prtc1Control *prtc1 = &nodeConfig.controllerConfig.prtc1Control;
185  *
186  * prtc1->transmissionStartTime = 10;
187  * prtc1->collisionAvoidanceDuration = 0;
188  * prtc1->strobePosition = IfxEray_StrobePosition_5;
189  * prtc1->baudrate = IfxEray_Baudrate_10;
190  * prtc1->receiveWakeupTestDuration = 76;
191  * prtc1->transmitWakeupRepetitions = 2;
192  * }
193  *
194  * {
195  * // PRTC2
196  * IfxEray_Eray_Prtc2Control *prtc2 = &nodeConfig.controllerConfig.prtc2Control;
197  *
198  * prtc2->receiveWakeupIdleTime = 18;
199  * prtc2->receiveWakeupLowTime = 18;
200  * prtc2->transmitWakeupIdleTime = 180;
201  * prtc2->transmitWakeupLowTime = 60;
202  * }
203  *
204  * {
205  * // SUCC2
206  * IfxEray_Eray_Succ2Config *succ2 = &nodeConfig.controllerConfig.succ2Config;
207  * succ2->listenTimeOut = 2500;
208  * succ2->listenTimeOutNoise = IfxEray_ListenTimeOutNoise_16;
209  * }
210  *
211  * {
212  * // GTU
213  * IfxEray_Eray_GTUConfig *gtu = &nodeConfig.controllerConfig.gtuConfig;
214  *
215  * gtu->gtu01Config.microticksPerCycle = 3000;
216  * gtu->gtu02Config.macroticksPerCycle = 50;
217  * gtu->gtu02Config.maxSyncFrames = 15;
218  * gtu->gtu03Config.channelAMicrotickInitialOffset = 0;
219  * gtu->gtu03Config.channelBMicrotickInitialOffset = 0;
220  * gtu->gtu03Config.channelAMacrotickInitialOffset = 2;
221  * gtu->gtu03Config.channelBMacrotickInitialOffset = 2;
222  * gtu->gtu04Config.networkStartIdleTime = 0x2f;
223  * gtu->gtu04Config.correctionOffset = 0x30;
224  * gtu->gtu05Config.channelAReceptionDelay = 0x4;
225  * gtu->gtu05Config.channelBReceptionDelay = 0x4;
226  * gtu->gtu05Config.clusterDrift = 1;
227  * gtu->gtu05Config.decodingCorrection = 0x34;
228  * gtu->gtu06Config.acceptedStartupDeviation = 0x81;
229  * gtu->gtu06Config.maxDriftOffset = 0x31;
230  * gtu->gtu07Config.staticSlotLength = 0x10;
231  * gtu->gtu07Config.staticSlotsCount = 0x2;
232  * gtu->gtu08Config.dynamicSlotLength = 2;
233  * gtu->gtu08Config.dynamicSlotCount = 2;
234  * gtu->gtu09Config.idleDynamicSlots = IfxEray_IdleDynamicSlots_1; // bug: not set by IfxEray_setDynamicSlots
235  * gtu->gtu09Config.staticActionPoint = 1;
236  * gtu->gtu09Config.dynamicActionPoint = 1;
237  * gtu->gtu10Config.maxOffsetCorrection = 0xcd;
238  * gtu->gtu10Config.maxRateCorrection = 0x31;
239  * gtu->gtu11Config.externalOffsetCorrection = IfxEray_ExternalOffsetCorrection_0;
240  * gtu->gtu11Config.externalRateCorrection = IfxEray_ExternalRateCorrection_0;
241  * gtu->gtu11Config.externalOffset = IfxEray_ExternalOffset_noCorrection;
242  * gtu->gtu11Config.externalRate = IfxEray_ExternalRate_noCorrection;
243  * }
244  * }
245  *
246  * // Messages
247  * nodeConfig.messageRAMConfig.numberOfMessageBuffers = 2;
248  * nodeConfig.messageRAMConfig.firstDynamicBuffer = 0x40;
249  * nodeConfig.messageRAMConfig.fifoBufferStartIndex = 0x40;
250  *
251  * // Frame header
252  * IfxEray_Header header[2] = {
253  * // fid cyc cha chb buffer direction ppit transmission mode mbi pl dp startupfr syncfr
254  * { 1, 1, TRUE, TRUE, IfxEray_BufferDirection_transmit, TRUE, IfxEray_TransmissionMode_continuous, TRUE, 4, 0x30, TRUE, TRUE },
255  * { 2, 1, TRUE, TRUE, IfxEray_BufferDirection_receive, FALSE, IfxEray_TransmissionMode_continuous, TRUE, 4, 0x40, FALSE, FALSE },
256  * };
257  *
258  * // slot buffer
259  * IfxEray_SlotConfig slot[2] = {
260  * // header data stxrh buffNum
261  * { TRUE, TRUE, TRUE, 0 },
262  * { TRUE, FALSE, FALSE, 1 },
263  * };
264  *
265  * for(int i=0; i < 2; ++i) {
266  * nodeConfig.messageRAMConfig.header[i] = &header[i];
267  * nodeConfig.messageRAMConfig.slotControl[i] = &slot[i];
268  * nodeConfig.messageRAMConfig.data[i] = NULL_PTR;
269  * }
270  *
271  * #if TEST_ERAY1
272  * // channel A pins
273  * const IfxEray_Eray_NodeA nodeAPins = {
274  * IfxPort_InputMode_pullDown, IfxPort_OutputMode_pushPull,
275  * IfxPort_PadDriver_cmosAutomotiveSpeed3, IfxPort_OutputMode_pushPull,
276  * &IfxEray1_RXDA0_P14_8_IN, &IfxEray1_TXDA_P14_10_OUT,
277  * &IfxEray1_TXENA_P14_9_OUT
278  * };
279  *
280  * // channel B pins
281  * const IfxEray_Eray_NodeB nodeBPins = {
282  * IfxPort_InputMode_pullDown, IfxPort_OutputMode_pushPull,
283  * IfxPort_PadDriver_cmosAutomotiveSpeed3, IfxPort_OutputMode_pushPull,
284  * &IfxEray1_RXDB0_P14_7_IN, &IfxEray1_TXDB_P14_5_OUT,
285  * &IfxEray1_TXENB_P14_6_OUT
286  * };
287  * #else
288  * // channel A pins
289  * const IfxEray_Eray_NodeA nodeAPins = {
290  * IfxPort_InputMode_pullDown, IfxPort_OutputMode_pushPull,
291  * IfxPort_PadDriver_cmosAutomotiveSpeed3, IfxPort_OutputMode_pushPull,
292  * &IfxEray0_RXDA0_P14_8_IN, &IfxEray0_TXDA_P14_10_OUT,
293  * &IfxEray0_TXENA_P14_9_OUT
294  * };
295  *
296  * // channel B pins
297  * const IfxEray_Eray_NodeB nodeBPins = {
298  * IfxPort_InputMode_pullDown, IfxPort_OutputMode_pushPull,
299  * IfxPort_PadDriver_cmosAutomotiveSpeed3, IfxPort_OutputMode_pushPull,
300  * &IfxEray0_RXDB0_P14_7_IN, &IfxEray0_TXDB_P14_5_OUT,
301  * &IfxEray0_TXENB_P14_6_OUT
302  * };
303  * #endif
304  *
305  * const IfxEray_Eray_Pins pins = { (IfxEray_Eray_NodeA *)&nodeAPins, (IfxEray_Eray_NodeB *)&nodeBPins };
306  * nodeConfig.pins = (IfxEray_Eray_Pins *)&pins;
307  *
308  * // ERAY node initialisation with supplied configuration
309  * IfxEray_Eray_Node_init(&eray, &nodeConfig);
310  *
311  * // set interrupt outputs for data and message buffers
312  * IfxEray_Eray_setNewDataInterruptDestination(&eray, 0, 0); // New Data #0 -> NDAT0
313  * IfxEray_Eray_setNewDataInterruptDestination(&eray, 1, 1); // New Data #1 -> NDAT1
314  * IfxEray_Eray_setMessageBufferInterruptDestination(&eray, 0, 0); // Message Buffer #0 -> MBSC0
315  * IfxEray_Eray_setMessageBufferInterruptDestination(&eray, 1, 1); // Message Buffer #1 -> MBSC1
316  *
317  * //clib_ver_printf("Send wakeup pattern\n");
318  *
319  * // send wakeup pattern on default configured channel ( IfxEray_Channel_a )
320  * IfxEray_PocState pocState;
321  * do {
322  * pocState = IfxEray_Eray_getPocState( &eray );
323  * if ( pocState != IfxEray_PocState_wakeupListen ) {
324  * while ( !IfxEray_Eray_changePocState( &eray, IfxEray_PocCommand_wakeup ));
325  * }
326  * } while ( pocState != IfxEray_PocState_wakeupListen );
327  *
328  * // allow node to cold-start and wait until cold-start is successful
329  * while( !IfxEray_Eray_allowColdStart(&eray) );
330  *
331  * // start the communication in cluster and wait until communication is successfull
332  * while( !IfxEray_Eray_startCommunication(&eray) );
333  *
334  * // wait until communication Controller enters NORMAL_ACTIVE or NORMAL_PASSIVE state, exit if communication Controller enters HALT state.
335  * do {
336  * pocState = IfxEray_Eray_getPocState( &eray );
337  * // if communication Controller enters HALT state, break the loop.
338  * if( pocState == IfxEray_PocState_halt) {
339  * break;
340  * }
341  * } while( !((pocState == IfxEray_PocState_normalActive) || (pocState == IfxEray_PocState_normalPassive)) );
342  *
343  * // enter ALL_SLOTS mode when Communication Controller is in NORMAL_ACTIVE or NORMAL_PASSIVE state only.
344  * if ( pocState == IfxEray_PocState_normalActive || pocState == IfxEray_PocState_normalPassive ) {
345  * while ( !IfxEray_Eray_setPocAllSlots(&eray) );
346  * }
347  * \endcode
348  *
349  * \subsection IfxLld_Eray_Eray_TxRx Transactions
350  *
351  * \code
352  * unsigned prevReceivedDataCounter = 0;
353  * while( 1 ) {
354  * if( receivedDataCounter != prevReceivedDataCounter ) {
355  * prevReceivedDataCounter = receivedDataCounter;
356  * //clib_ver_printf("Received %d packets", receivedDataCounter);
357  *
358  * if( receivedDataCounter >= NUMBER_ERAY_COMM_CYCLES )
359  * break;
360  * }
361  * };
362  * \endcode
363  *
364  *
365  * \subsection IfxLld_Eray_Eray_ISR Interrupt Service Handlers
366  *
367  * The ISR has to be implemented in the application. Following templates can be used to react on the events:
368  *
369  * \code
370  * void ERAY_irqInt0Handler()
371  * {
372  * //clib_ver_note(1); // for debugging in simulation: notify Int0
373  *
374  * Ifx_ERAY_EIR ErrIntStat = IfxEray_Eray_getErrorInterrupts( &eray );
375  * Ifx_ERAY_SIR StatusIntStat = IfxEray_Eray_getStatusInterrupts( &eray );
376  *
377  * if(StatusIntStat.B.SDS)
378  * {
379  * // SDS must be cleared for getting the next interrupt
380  * IfxEray_Eray_clearStatusFlag( &eray, IfxEray_ClearStatusFlag_sds );
381  * }
382  * if(StatusIntStat.B.CYCS)
383  * {
384  * // CYCS must be cleared for getting the next interrupt
385  * IfxEray_Eray_clearStatusFlag( &eray, IfxEray_ClearStatusFlag_cycs );
386  * }
387  * if(StatusIntStat.B.SUCS)
388  * {
389  * // SUCS must be cleared for getting the next interrupt
390  * IfxEray_Eray_clearStatusFlag( &eray, IfxEray_ClearStatusFlag_sucs );
391  * }
392  * if(StatusIntStat.B.TIBC)
393  * {
394  * // TIBC must be cleared for getting the next interrupt
395  * IfxEray_Eray_clearStatusFlag( &eray, IfxEray_ClearStatusFlag_tibc );
396  * }
397  * if(ErrIntStat.B.MHF)
398  * {
399  * // clear flag MHF
400  * IfxEray_Eray_clearErrorFlag( &eray, IfxEray_ClearErrorFlag_mhf );
401  * }
402  * }
403  *
404  * void ERAY_irqInt1Handler()
405  * {
406  * //clib_ver_note(2); // for debugging in simulation: notify Int1
407  *
408  * // TOBC must be cleared for getting the next interrupt
409  * IfxEray_Eray_clearStatusFlag( &eray, IfxEray_ClearStatusFlag_tobc );
410  * }
411  *
412  * void ERAY_irqNdat0Handler()
413  * {
414  * //clib_ver_note(3); // for debugging in simulation: notify Ndat0
415  * }
416  *
417  * void ERAY_irqNdat1Handler()
418  * {
419  * //clib_ver_note(4); // for debugging in simulation: notify Ndat1
420  *
421  * // message received in slot1 buffer?
422  * if( IfxEray_Eray_getNewDataInterruptStatus(&eray, 1) == 1 )
423  * {
424  * // read data
425  * uint32 data[2];
426  *
427  * {
428  * IfxEray_Eray_ReceiveControl config;
429  * config.headerReceived = TRUE;
430  * config.dataReceived = TRUE;
431  * config.receiveRequested = TRUE;
432  * config.swapRequested = TRUE;
433  * config.bufferIndex = 1;
434  *
435  * IfxEray_Eray_receiveFrame(&eray, &config);
436  * IfxEray_Eray_readData(&eray, data, 2*2);
437  * }
438  *
439  * // display received data (Here received data has to be displayed)
440  * //clib_ver_data(data[0]);
441  * //clib_ver_data(data[1]);
442  *
443  * // store received data
444  * if( receivedDataCounter < NUMBER_ERAY_COMM_CYCLES ) {
445  * receivedData[receivedDataCounter][0] = data[0];
446  * receivedData[receivedDataCounter][1] = data[1];
447  * }
448  * ++receivedDataCounter;
449  *
450  * // put some new data into slot0
451  * ++data[0];
452  * ++data[1];
453  *
454  * {
455  * IfxEray_Eray_TransmitControl config;
456  * config.headerTransfered = FALSE;
457  * config.dataTransfered = TRUE;
458  * config.transferRequested = TRUE;
459  * config.bufferIndex = 0;
460  *
461  * IfxEray_Eray_writeData(&eray, data, 2*2);
462  * IfxEray_Eray_transmitFrame(&eray, &config);
463  * }
464  * }
465  * }
466  *
467  * void ERAY_irqMbsc0Handler()
468  * {
469  * //clib_ver_note(5); // for debugging in simulation: notify Mbsc0
470  * }
471  *
472  * void ERAY_irqMbsc1Handler()
473  * {
474  * //clib_ver_note(6); // for debugging in simulation: notify Mbsc1
475  * }
476  * \endcode
477  *
478  * \defgroup IfxLld_Eray_Eray ERAY
479  * \ingroup IfxLld_Eray
480  * \defgroup IfxLld_Eray_Eray_Structures Data Structures
481  * \ingroup IfxLld_Eray_Eray
482  * \defgroup IfxLld_Eray_Eray_Module Module Initialisation Functions
483  * \ingroup IfxLld_Eray_Eray
484  * \defgroup IfxLld_Eray_Eray_Node Node Initialisation Functions
485  * \ingroup IfxLld_Eray_Eray
486  * \defgroup IfxLld_Eray_Eray_Operative Operative Functions
487  * \ingroup IfxLld_Eray_Eray
488  * \defgroup IfxLld_Eray_Eray_Status Status Functions
489  * \ingroup IfxLld_Eray_Eray
490  * \defgroup IfxLld_Eray_Eray_Interrupt Interrupt Functions
491  * \ingroup IfxLld_Eray_Eray
492  */
493 
494 #ifndef IFXERAY_ERAY_H
495 #define IFXERAY_ERAY_H 1
496 
497 /******************************************************************************/
498 /*----------------------------------Includes----------------------------------*/
499 /******************************************************************************/
500 
501 #include "Eray/Std/IfxEray.h"
502 #include "Cpu/Std/IfxCpu.h"
503 #include "Scu/Std/IfxScuWdt.h"
504 #include "Scu/Std/IfxScuCcu.h"
505 
506 /******************************************************************************/
507 /*-----------------------------Data Structures--------------------------------*/
508 /******************************************************************************/
509 
510 /** \addtogroup IfxLld_Eray_Eray_Structures
511  * \{ */
512 /** \brief GTU01 configuration.
513  */
514 typedef struct
515 {
516  uint32 microticksPerCycle; /**< \brief Duration of the communication cycle in Microticks. */
518 
519 /** \brief GTU02 configuration.
520  */
521 typedef struct
522 {
523  uint16 macroticksPerCycle; /**< \brief Duration of the communication cycle in Macroticks. */
524  uint8 maxSyncFrames; /**< \brief Maximum number of sync frames in a cluster. */
526 
527 /** \brief GTU03 configuration.
528  */
529 typedef struct
530 {
531  uint8 channelAMicrotickInitialOffset; /**< \brief difference between adjacent time reference points on channel A in microticks. */
532  uint8 channelBMicrotickInitialOffset; /**< \brief difference between adjacent time reference points on channel B in microticks. */
533  uint8 channelAMacrotickInitialOffset; /**< \brief difference between two adjacent static slots on channel A in macroticks. */
534  uint8 channelBMacrotickInitialOffset; /**< \brief difference between two adjacent static slots on channel B in macroticks. */
536 
537 /** \brief GTU04 configuration.
538  */
539 typedef struct
540 {
541  uint16 networkStartIdleTime; /**< \brief starting point of Network Idle Time Phase. */
542  uint16 correctionOffset; /**< \brief offset correction start point. */
544 
545 /** \brief GTU05 configuration.
546  */
547 typedef struct
548 {
549  uint8 channelAReceptionDelay; /**< \brief reception delay on channel A. */
550  uint8 channelBReceptionDelay; /**< \brief reception delay on channel B. */
551  uint8 clusterDrift; /**< \brief cluster drift damping value used in clock synchronization. */
552  uint8 decodingCorrection; /**< \brief decoding correction to determine the primary time reference point. */
554 
555 /** \brief GTU06 configuration.
556  */
557 typedef struct
558 {
559  uint16 acceptedStartupDeviation; /**< \brief expanded range of measured deviation for startup Frames during integration. */
560  uint16 maxDriftOffset; /**< \brief maximum drift offset between two nodes. */
562 
563 /** \brief GTU07 configuration.
564  */
565 typedef struct
566 {
567  uint16 staticSlotLength; /**< \brief duration of static slot in macroticks. */
568  uint16 staticSlotsCount; /**< \brief number of static slots in a communication cycle. */
570 
571 /** \brief GTU08 configuration.
572  */
573 typedef struct
574 {
575  uint8 dynamicSlotLength; /**< \brief duration of dynamic slot in macroticks. */
576  uint16 dynamicSlotCount; /**< \brief number of dynamic slots in a communication cycle. */
578 
579 /** \brief GTU09 configuration.
580  */
581 typedef struct
582 {
583  uint8 staticActionPoint; /**< \brief static slots and symbol window action point. */
584  uint8 dynamicActionPoint; /**< \brief dynamic slots action point. */
585  IfxEray_IdleDynamicSlots idleDynamicSlots; /**< \brief duration of dynamic slot idle phase. */
587 
588 /** \brief GTU10 configuration.
589  */
590 typedef struct
591 {
592  uint16 maxOffsetCorrection; /**< \brief maximum offset correction to be applied by the internal clock synchronization algorithm. */
593  uint16 maxRateCorrection; /**< \brief maximum rate correction to be applied by the internal clock synchronization algorithm. */
595 
596 /** \brief GTU11 configuration.
597  */
598 typedef struct
599 {
600  IfxEray_ExternalOffsetCorrection externalOffsetCorrection; /**< \brief External clock offset correction value. */
601  IfxEray_ExternalRateCorrection externalRateCorrection; /**< \brief External clock rate correction value. */
602  IfxEray_ExternalOffset externalOffset; /**< \brief External offset correction control. */
603  IfxEray_ExternalRate externalRate; /**< \brief External rate correction control. */
605 
606 /** \} */
607 
608 /** \addtogroup IfxLld_Eray_Eray_Structures
609  * \{ */
610 /** \brief Gloabl Timing Unit configuration structure.
611  */
612 typedef struct
613 {
614  IfxEray_Eray_Gtu01Config gtu01Config; /**< \brief GTU01 configuration. */
615  IfxEray_Eray_Gtu02Config gtu02Config; /**< \brief GTU02 configuration. */
616  IfxEray_Eray_Gtu03Config gtu03Config; /**< \brief GTU03 configuration. */
617  IfxEray_Eray_Gtu04Config gtu04Config; /**< \brief GTU04 configuration. */
618  IfxEray_Eray_Gtu05Config gtu05Config; /**< \brief GTU05 configuration. */
619  IfxEray_Eray_Gtu06Config gtu06Config; /**< \brief GTU06 configuration. */
620  IfxEray_Eray_Gtu07Config gtu07Config; /**< \brief GTU07 configuration. */
621  IfxEray_Eray_Gtu08Config gtu08Config; /**< \brief GTU08 configuration. */
622  IfxEray_Eray_Gtu09Config gtu09Config; /**< \brief GTU09 configuration. */
623  IfxEray_Eray_Gtu10Config gtu10Config; /**< \brief GTU10 configuration. */
624  IfxEray_Eray_Gtu11Config gtu11Config; /**< \brief GTU11 configuration. */
626 
627 /** \brief Pins configuration structure for Node A.
628  */
629 typedef struct
630 {
631  IfxPort_InputMode rxInMode; /**< \brief the RX pin input mode which should be configured */
632  IfxPort_OutputMode txOutMode; /**< \brief the TX pin output mode which should be configured. */
633  IfxPort_PadDriver pinDriver; /**< \brief the pad driver mode which should be configured. */
634  IfxPort_OutputMode txEnOutMode; /**< \brief the TXEN pin output mode which should be configured. */
635  const IfxEray_Rxd_In *rxIn; /**< \brief the RX Pin which should be configured. */
636  const IfxEray_Txd_Out *txOut; /**< \brief the TX Pin which should be configured. */
637  const IfxEray_Txen_Out *txEnOut; /**< \brief the TXEN Pin which should be configured. */
639 
640 /** \brief Pins configuration structure for Node B.
641  */
642 typedef struct
643 {
644  IfxPort_InputMode rxInMode; /**< \brief the RX pin input mode which should be configured */
645  IfxPort_OutputMode txOutMode; /**< \brief the TX pin output mode which should be configured. */
646  IfxPort_PadDriver pinDriver; /**< \brief the pad driver mode which should be configured. */
647  IfxPort_OutputMode txEnOutMode; /**< \brief the TXEN pin output mode which should be configured. */
648  const IfxEray_Rxd_In *rxIn; /**< \brief the RX Pin which should be configured. */
649  const IfxEray_Txd_Out *txOut; /**< \brief the TX Pin which should be configured. */
650  const IfxEray_Txen_Out *txEnOut; /**< \brief the TXEN Pin which should be configured. */
652 
653 /** \brief Protocol operation control properties.
654  */
655 typedef struct
656 {
657  uint8 collisionAvoidanceDuration; /**< \brief accepted duration of collision avoidance symbol. */
658  IfxEray_StrobePosition strobePosition; /**< \brief sample count value for strobing. */
659  IfxEray_Baudrate baudrate; /**< \brief baud rate on the flexray bus. */
660  uint8 receiveWakeupTestDuration; /**< \brief duration of received wakeup pattern in bit times. */
661  uint8 transmitWakeupRepetitions; /**< \brief duration of transmitted wakeup pattern in bit times. */
662  uint16 transmissionStartTime; /**< \brief duration of transmission start time. */
664 
665 /** \brief Wakeup symbol control properties.
666  */
667 typedef struct
668 {
669  uint8 receiveWakeupIdleTime; /**< \brief duration of received wakeup symbol idle phase. */
670  uint8 receiveWakeupLowTime; /**< \brief duration of received wakeup symbol low phase. */
671  uint8 transmitWakeupIdleTime; /**< \brief duration of transmit wakeup symbol idle phase. */
672  uint8 transmitWakeupLowTime; /**< \brief duration of transmit wakeup symbol low phase. */
674 
675 /** \brief communication controller control properties.
676  */
677 typedef struct
678 {
679  boolean startupFrameTransmitted; /**< \brief whether the key slot is used to transmit startup Frames. */
680  boolean syncFrameTransmitted; /**< \brief whether the key slot is used to transmit SYNC Frames. */
681  uint8 maxColdStartAttempts; /**< \brief maximum number of attempts that a cold starting node is permitted. */
682  uint8 numberOfCyclePairsForActive; /**< \brief number of even / odd cycle pairs that must have valid clock correction terms. */
683  IfxEray_WakeupChannel wakeupPatternChannel; /**< \brief Wakeup pattern carry channel */
684  IfxEray_TransmissionSlotMode transmissionSlotMode; /**< \brief Initial transmission mode. */
685  boolean clockSyncErrorHalt; /**< \brief transition to HALT state due to a clock synchronization error. */
686  boolean channelASymbolTransmitted; /**< \brief selects channel A for MTS symbol transmission. */
687  boolean channelBSymbolTransmitted; /**< \brief selects channel B for MTS symbol transmission */
688  boolean channelAConnectedNode; /**< \brief whether the node is connected to channel A. */
689  boolean channelBConnectedNode; /**< \brief whether the node is connected to channel B. */
691 
692 /** \brief Communication listen timeout properties.
693  */
694 typedef struct
695 {
696  uint32 listenTimeOut; /**< \brief wakeup or startup listen timeout in microticks. */
697  IfxEray_ListenTimeOutNoise listenTimeOutNoise; /**< \brief upper limit for startup and wakeup listen timeout in the presence of noise. */
699 
700 /** \brief Clock correction fail properties.
701  */
702 typedef struct
703 {
704  uint8 clockCorrectionCyclesPassive; /**< \brief maximum number of cycles missing clock correction lead active to passive state. */
705  uint8 clockCorrectionCyclesHalt; /**< \brief maximum number of cycles missing clock correctionlead to active or passive to halt. */
707 
708 /** \} */
709 
710 /** \addtogroup IfxLld_Eray_Eray_Structures
711  * \{ */
712 /** \brief Communication Controller configuration structure.
713  */
714 typedef struct
715 {
716  uint32 networkVectorLength; /**< \brief length of network management vector. */
717  uint8 staticFramepayload; /**< \brief payload length of static frame in double bytes. */
718  uint8 latestTransmissionStart; /**< \brief number of dynamic slots before inhibit frame transmission in dynamic segment. */
719  IfxEray_Eray_GTUConfig gtuConfig; /**< \brief gloabl timing unit configuration structure. */
720  IfxEray_Eray_Succ1Config succ1Config; /**< \brief communication controller control properties. */
721  IfxEray_Eray_Succ2Config succ2Config; /**< \brief communication listen timeout properties. */
722  IfxEray_Eray_Succ3Config succ3Config; /**< \brief clock correction fail properties. */
723  IfxEray_Eray_Prtc1Control prtc1Control; /**< \brief protocol operation control properties. */
724  IfxEray_Eray_Prtc2Control prtc2Control; /**< \brief wakeup symbol control properties. */
726 
727 /** \brief Interrupt control properties.
728  */
729 typedef struct
730 {
731  uint16 int0Priority; /**< \brief the interrupt line 0 priority. Always 1 since all interrupts are handled at a time. */
732  uint16 int1Priority; /**< \brief the interrupt line 1 priority. Always 1 since all interrupts are handled at a time. */
733  uint16 tint0Priority; /**< \brief the timer interrupt 0 priority. Always 1 since all interrupts are handled at a time. */
734  uint16 tint1Priority; /**< \brief the timer interrupt 1 priority. Always 1 since all interrupts are handled at a time. */
735  uint16 ndat0Priority; /**< \brief the new data interrupt 0 priority. Always 1 since all interrupts are handled at a time. */
736  uint16 ndat1Priority; /**< \brief the new data interrupt 1 priority. Always 1 since all interrupts are handled at a time. */
737  uint16 mbsc0Priority; /**< \brief the message buffer status changed interrupt 0 priority. Always 1 since all interrupts are handled at a time. */
738  uint16 mbsc1Priority; /**< \brief the message buffer status changed interrupt 1 priority. Always 1 since all interrupts are handled at a time. */
739  uint16 ibusyPriority; /**< \brief the inputput buffer interrupt priority. Always 1 since all interrupts are handled at a time. */
740  uint16 obusyPriority; /**< \brief the output buffer interrupt priority. Always 1 since all interrupts are handled at a time. */
741  IfxSrc_Tos int0IsrProvider; /**< \brief the interrupt line 0 service provider. CPU or DMA. */
742  IfxSrc_Tos int1IsrProvider; /**< \brief the interrupt line 1 service provider. CPU or DMA. */
743  IfxSrc_Tos tint0IsrProvider; /**< \brief the timer interrupt line 0 service provider. CPU or DMA. */
744  IfxSrc_Tos tint1IsrProvider; /**< \brief the timer interrupt line 1 service provider. CPU or DMA. */
745  IfxSrc_Tos ndat0IsrProvider; /**< \brief the new data interrupt 0 service provider. CPU or DMA. */
746  IfxSrc_Tos ndat1IsrProvider; /**< \brief the new data interrupt 1 service provider. CPU or DMA. */
747  IfxSrc_Tos mbsc0IsrProvider; /**< \brief the message buffer status changed interrupt 0 service provider. CPU or DMA. */
748  IfxSrc_Tos mbsc1IsrProvider; /**< \brief the message buffer status changed interrupt 1 service provider. CPU or DMA. */
749  IfxSrc_Tos ibusyIsrProvider; /**< \brief the input buffer interrupt service provider. CPU or DMA. */
750  IfxSrc_Tos obusyIsrProvider; /**< \brief the output buffer interrupt service provider. CPU or DMA. */
752 
753 /** \brief Message RAM configuration structure.
754  */
755 typedef struct
756 {
757  uint8 firstDynamicBuffer; /**< \brief first dynamic buffer index. */
758  uint8 numberOfMessageBuffers; /**< \brief last configured buffer. */
759  uint32 fifoBufferStartIndex; /**< \brief message buffers assigned FIFO. */
760  uint8 fifoDepth; /**< \brief fifo critical level. */
761  uint16 frameIdFilter; /**< \brief Frame ID used for rejection filtering. */
762  IfxEray_ReceiveChannel receiveChannel; /**< \brief FIFO receive channel. */
763  uint16 rejectedFrameId; /**< \brief frame ID to be rejected by the FIFO. */
764  uint8 filteredCycleNumber; /**< \brief the cycle set to which Frame ID and channel rejection filter are applied. */
765  boolean staticFifoDisabled; /**< \brief fifo is not used in static segment. */
766  boolean fifoNullFramesRejected; /**< \brief whether null frames stored in fifo or not. */
767  boolean bufferReconfigEnabled; /**< \brief whether reconfiguration of message buffers is enabled or not. */
768  boolean fifoConfigured; /**< \brief Whether receive FIFO configured or not. */
769  IfxEray_Header *header[128]; /**< \brief Header section of message buffer. */
770  IfxEray_SlotConfig *slotControl[128]; /**< \brief Transmit control properties. */
771  uint32 *data[128]; /**< \brief data section of message buffer. */
773 
774 /** \} */
775 
776 /** \addtogroup IfxLld_Eray_Eray_Node
777  * \{ */
778 /** \brief Pins configuration structure.
779  */
780 typedef struct
781 {
782  const IfxEray_Eray_NodeA *nodeAPins; /**< \brief Pins configuration structure for Node A. */
783  const IfxEray_Eray_NodeB *nodeBPins; /**< \brief Pins configuration structure for Node B. */
785 
786 /** \} */
787 
788 /** \addtogroup IfxLld_Eray_Eray_Structures
789  * \{ */
790 /** \brief ERAY Module handle.
791  */
792 typedef struct
793 {
794  Ifx_ERAY *eray; /**< \brief pointer to ERAY module registers. */
795 } IfxEray_Eray;
796 
797 /** \brief Reconfigurable buffer structure.
798  */
799 typedef struct
800 {
801  IfxEray_Header *header; /**< \brief header of a reconfigurable buffer. */
802  uint32 data[64]; /**< \brief data section of a reconfigurable buffer. */
803  IfxEray_SlotConfig *slotControl; /**< \brief message buffer configuration in message RAM. */
805 
806 /** \brief Module configuration structure
807  */
808 typedef struct
809 {
810  Ifx_ERAY *module; /**< \brief pointer to ERAY module registers. */
811  IfxEray_Eray_Interrupt interrupt; /**< \brief Interrupt control properties. */
813 
814 /** \brief Node configuration structure.
815  */
816 typedef struct
817 {
818  IfxEray_Eray_MessageRAMConfig messageRAMConfig; /**< \brief Message RAM configuration structure. */
819  IfxEray_Eray_ControllerConfig controllerConfig; /**< \brief Communication Controller configuration structure. */
820  const IfxEray_Eray_Pins *pins; /**< \brief Pins configuration structure. */
822 
823 /** \brief Receive control properties structure.
824  */
825 typedef struct
826 {
827  boolean headerReceived; /**< \brief whether header selected for transfer from Message RAM to Output Buffer or not. */
828  boolean dataReceived; /**< \brief whether data selected for transfer from Message RAM to Output Buffer or not. */
829  boolean swapRequested; /**< \brief whether output buffer shadow and output buffer host are swapped or not. */
830  boolean receiveRequested; /**< \brief */
831  uint8 bufferIndex; /**< \brief buffer index in the Message RAM. */
833 
834 /** \brief Received Frame.
835  */
836 typedef struct
837 {
838  IfxEray_ReceivedHeader header; /**< \brief received header in a frame. */
839  uint32 data[64]; /**< \brief received data in a frame. */
841 
842 /** \brief Transfer control in a slot.
843  */
844 typedef struct
845 {
846  boolean headerTransfered; /**< \brief whether header section of frame is transfered or not. */
847  boolean dataTransfered; /**< \brief whether data section of message buffer is transfered or not. */
848  boolean transferRequested; /**< \brief whether frame in a slot is transfered or not. */
849  uint8 bufferIndex; /**< \brief buffer index which gives slot for transfers. */
851 
852 /** \} */
853 
854 /** \addtogroup IfxLld_Eray_Eray_Module
855  * \{ */
856 
857 /******************************************************************************/
858 /*-------------------------Inline Function Prototypes-------------------------*/
859 /******************************************************************************/
860 
861 /** \brief De-initialises the ERAY module.
862  * \param eray pointer to module handle.
863  * \return None
864  *
865  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
866  *
867  */
869 
870 /******************************************************************************/
871 /*-------------------------Global Function Prototypes-------------------------*/
872 /******************************************************************************/
873 
874 /** \brief Initialises the ERAY module with supplied configuration.
875  * \param eray pointer to ERAY Module handle.
876  * \param config pointer to module configuration structure.
877  * \return None
878  *
879  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
880  *
881  */
883 
884 /** \brief Inialises the default module configuration buffer.
885  * \param config pointer to module configuration structure.
886  * \param eray pointer ERAY module registers.
887  * \return None
888  *
889  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
890  *
891  */
892 IFX_EXTERN void IfxEray_Eray_initModuleConfig(IfxEray_Eray_Config *config, Ifx_ERAY *eray);
893 
894 /** \} */
895 
896 /** \addtogroup IfxLld_Eray_Eray_Node
897  * \{ */
898 
899 /******************************************************************************/
900 /*-------------------------Global Function Prototypes-------------------------*/
901 /******************************************************************************/
902 
903 /** \brief Initialises the Node with supplied configuration.
904  * \param eray pointer to ERAY Module handle.
905  * \param config pointer to node configuration structure.
906  * \return None
907  *
908  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
909  *
910  */
912 
913 /** \brief Initialises the default node configuration buffer.
914  * \param config pointer to node configuration structure.
915  * \return None
916  *
917  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
918  *
919  */
921 
922 /** \} */
923 
924 /** \addtogroup IfxLld_Eray_Eray_Operative
925  * \{ */
926 
927 /******************************************************************************/
928 /*-------------------------Inline Function Prototypes-------------------------*/
929 /******************************************************************************/
930 
931 /** \brief Allows node to enter the cold startup state.
932  * \param eray pointer to ERAY Module handle.
933  * \return TRUE if cold start successful otherwise FALSE.
934  *
935  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
936  *
937  */
939 
940 /** \brief Reconfiguring the buffer or changing the slot.
941  * \param eray pointer to module handle.
942  * \param reconfigBuffer pointer reconfigurable buffer structure.
943  * \return None
944  *
945  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
946  *
947  */
949 
950 /** \brief Changes the POC state and return status.
951  * \param eray pointer to module handle.
952  * \param PocCommand POC command to change state.
953  * \return TRUE if command accepted.
954  */
956 
957 /** \brief Reads the received data from output registers.
958  * \param eray pointer to module handle.
959  * \param data pointer to received data buffer.
960  * \param payloadLength payload length received in a frame.
961  * \return None
962  */
963 IFX_INLINE void IfxEray_Eray_readData(IfxEray_Eray *eray, uint32 *data, uint8 payloadLength);
964 
965 /** \brief reads the frame received in a buffer.
966  * \param eray pointer to module handle.
967  * \param frame received frame in a buffer.
968  * \param maxPayloadLength maximum payload length received in a frame.
969  * \return None
970  *
971  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
972  *
973  */
975 
976 /** \brief Sets the Controller state to ALL Slots mode.
977  * \param eray pointer to module handle.
978  * \return TRUE if All slots mode is successful otherwise FALSE.
979  *
980  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
981  *
982  */
984 
985 /** \brief Runs the communication controller.
986  * \param eray pointer to ERAY Module handle.
987  * \return TRUE if communication started otherwise FALSE.
988  *
989  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
990  *
991  */
993 
994 /** \brief Wakeups the channel in a cluster.
995  * \param eray pointer to ERAY Module handle.
996  * \param channel wakeup channel Id.
997  * \return None
998  *
999  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
1000  *
1001  */
1003 
1004 /** \brief Wakeups the node in a cluster.
1005  * \param eray pointer to ERAY Module handle.
1006  * \return TRUE if cluster is wakeup otherwise FALSE.
1007  *
1008  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
1009  *
1010  */
1012 
1013 /** \brief Writes data section of a frame to input data registers.
1014  * \param eray pointer to module handle.
1015  * \param data data section in frame.
1016  * \param payloadLength payload length configured for slot buffer.
1017  * \return None
1018  *
1019  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
1020  *
1021  */
1022 IFX_INLINE void IfxEray_Eray_writeData(IfxEray_Eray *eray, uint32 *data, uint8 payloadLength);
1023 
1024 /******************************************************************************/
1025 /*-------------------------Global Function Prototypes-------------------------*/
1026 /******************************************************************************/
1027 
1028 /** \brief Transfers frame from fifo in message RAM to Output buffer.
1029  * \param eray pointer to ERAY Module handle.
1030  * \param config pointer to receive control structure.
1031  * \return None
1032  *
1033  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
1034  *
1035  */
1037 
1038 /** \brief Transfers header and data from message buffer to output buffer.
1039  * \param eray pointer to ERAY Module handle.
1040  * \param config pointer to receive control structure.
1041  * \return None
1042  *
1043  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
1044  *
1045  */
1047 
1048 /** \brief Transfers the frame in given slot.
1049  * \param eray pointer to module handle.
1050  * \param transmitControl transmits frame in a given slot.
1051  * \return None
1052  *
1053  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
1054  *
1055  */
1057 
1058 /** \} */
1059 
1060 /** \addtogroup IfxLld_Eray_Eray_Status
1061  * \{ */
1062 
1063 /******************************************************************************/
1064 /*-------------------------Inline Function Prototypes-------------------------*/
1065 /******************************************************************************/
1066 
1067 /** \brief Gets the current node controller POC state.
1068  * \param eray pointer to module handle.
1069  * \return current POC state.
1070  */
1072 
1073 /** \brief Gets the received wakeup pattern channel.
1074  * \param eray pointer to module handle.
1075  * \return received wakeup pattern channel.
1076  *
1077  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
1078  *
1079  */
1081 
1082 /** \} */
1083 
1084 /** \addtogroup IfxLld_Eray_Eray_Interrupt
1085  * \{ */
1086 
1087 /******************************************************************************/
1088 /*-------------------------Inline Function Prototypes-------------------------*/
1089 /******************************************************************************/
1090 
1091 /** \brief clears the error interrupt flag requested.
1092  * \param eray pointer to module handle.
1093  * \param errorFlag error flag to be cleared.
1094  * \return None
1095  */
1097 
1098 /** \brief Clears the status interrupt flag requested.
1099  * \param eray pointer to module handle.
1100  * \param statusFlag status flag to be cleared.
1101  * \return None
1102  */
1104 
1105 /** \brief Gets the error interrupt status.
1106  * \param eray pointer to module handle.
1107  * \return error interrupt status.
1108  */
1110 
1111 /** \brief Gets the message buffer interrupt status.
1112  * \param eray pointer to module handle.
1113  * \param messageBuffer message buffer to which interrupt status be checked.
1114  * \return message buffer interrupt status.
1115  */
1117 
1118 /** \brief Gets the new data interrupt buffers status.
1119  * \param eray pointer to module handle.
1120  * \param ndat ndat buffer to which interrupt status be checked.
1121  * \return ndat buffer interrupt status.
1122  */
1124 
1125 /** \brief Gets the node status interrupts.
1126  * \param eray pointer to module handle.
1127  * \return node status interrupts.
1128  */
1130 
1131 /** \brief Enables the message buffer interrupt line.
1132  * \param eray pointer to module handle.
1133  * \param messageBuffer message buffer interrupt which should be configured
1134  * \param messageBufferDestination selects MBSC0 or MBSC1 interrupt output
1135  * \return None
1136  *
1137  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
1138  *
1139  */
1140 IFX_INLINE void IfxEray_Eray_setMessageBufferInterruptDestination(IfxEray_Eray *eray, uint8 messageBuffer, uint8 messageBufferDestination);
1141 
1142 /** \brief Enables the NDAT buffer interrupt line.
1143  * \param eray pointer to module handle.
1144  * \param ndat message buffer number configured to which ndat interrupt line to be set.
1145  * \param ndatDestination selects NDAT0 or NDAT1 interrupt output
1146  * \return None
1147  *
1148  * For usage exapmle see : \ref IfxLld_Eray_Eray_Usage
1149  *
1150  */
1152 
1153 /** \} */
1154 
1155 /******************************************************************************/
1156 /*---------------------Inline Function Implementations------------------------*/
1157 /******************************************************************************/
1158 
1160 {
1162 }
1163 
1164 
1166 {
1167  IfxEray_setSlot(eray->eray, reconfigBuffer->header, reconfigBuffer->data, reconfigBuffer->slotControl);
1168 }
1169 
1170 
1172 {
1173  boolean status = IfxEray_changePocState(eray->eray, PocCommand);
1174  return status;
1175 }
1176 
1177 
1179 {
1180  IfxEray_clearErrorFlag(eray->eray, errorFlag);
1181 }
1182 
1183 
1185 {
1186  IfxEray_clearStatusFlag(eray->eray, statusFlag);
1187 }
1188 
1189 
1191 {
1192  //resets the kernel
1193  IfxEray_resetModule(eray->eray);
1194 }
1195 
1196 
1198 {
1199  Ifx_ERAY_EIR interruptFlags;
1200  interruptFlags = IfxEray_getErrorInterrupts(eray->eray);
1201  return interruptFlags;
1202 }
1203 
1204 
1206 {
1207  uint8 messageBufferInterrupt = IfxEray_getMessageBufferInterruptStatus(eray->eray, messageBuffer);
1208  return messageBufferInterrupt;
1209 }
1210 
1211 
1213 {
1214  uint8 ndatInterrupt = IfxEray_getNewDataInterruptStatus(eray->eray, ndat);
1215  return ndatInterrupt;
1216 }
1217 
1218 
1220 {
1221  return IfxEray_getPocState(eray->eray);
1222 }
1223 
1224 
1226 {
1227  Ifx_ERAY_SIR statusInterrupts = IfxEray_getStatusInterrupts(eray->eray);
1228  return statusInterrupts;
1229 }
1230 
1231 
1233 {
1234  IfxEray_WakeupChannel rxWakeupChannel;
1235  rxWakeupChannel = IfxEray_getWakeupPatternReceivedChannel(eray->eray);
1236 
1237  return rxWakeupChannel;
1238 }
1239 
1240 
1241 IFX_INLINE void IfxEray_Eray_readData(IfxEray_Eray *eray, uint32 *data, uint8 payloadLength)
1242 {
1243  IfxEray_readData(eray->eray, data, payloadLength);
1244 }
1245 
1246 
1248 {
1249  IfxEray_readFrame(eray->eray, &(frame->header), frame->data, maxPayloadLength);
1250 }
1251 
1252 
1253 IFX_INLINE void IfxEray_Eray_setMessageBufferInterruptDestination(IfxEray_Eray *eray, uint8 messageBuffer, uint8 messageBufferDestination)
1254 {
1255  IfxEray_setMessageBufferInterruptDestination(eray->eray, messageBuffer, messageBufferDestination);
1256 }
1257 
1258 
1260 {
1261  IfxEray_setNewDataInterruptDestination(eray->eray, ndat, ndatDestination);
1262 }
1263 
1264 
1266 {
1268 }
1269 
1270 
1272 {
1274 }
1275 
1276 
1278 {
1279  Ifx_ERAY *eraySFR = eray->eray;
1280  boolean result = IfxEray_changePocState(eraySFR, IfxEray_PocCommand_config);
1281 
1282  if (result == TRUE)
1283  {
1284  eraySFR->SUCC1.B.WUCS = channel;
1285  IfxEray_setPocReady(eray->eray);
1286  }
1287 }
1288 
1289 
1291 {
1293 }
1294 
1295 
1296 IFX_INLINE void IfxEray_Eray_writeData(IfxEray_Eray *eray, uint32 *data, uint8 payloadLength)
1297 {
1298  IfxEray_writeData(eray->eray, data, payloadLength);
1299 }
1300 
1301 
1302 #endif /* IFXERAY_ERAY_H */