]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/include/rpp/fr.h
Documantation for user FlexRay configuration repaired, Error in check cluster paramet...
[pes-rpp/rpp-lib.git] / rpp / include / rpp / fr.h
1 /**
2  * FlexRay Communication RPP API header file.
3  *
4  * @file fr.h
5  *
6  * @copyright Copyright (C) 2013 Czech Technical University in Prague
7  *
8  * @author Carlos Jenkins <carlos@jenkins.co.cr>
9  * @author Michal Horn <hornmich@fel.cvut.cz>
10  */
11
12
13 #ifndef __RPP_FR_H
14 #define __RPP_FR_H
15
16 #include "drv/Fr_GeneralTypes.h"
17 #include "drv/fr_tms570.h"
18
19 typedef enum {
20         RPP_FR_UNKNOWN,
21         RPP_FR_CONFIGURED,
22         RPP_FR_NOT_INITIALIZED,
23         RPP_FR_DRV_INITIALIZED,
24         RPP_FR_CTR_INITIALIZED,
25         RPP_FR_RUNNING,
26         RPP_FR_HALTED,
27         RPP_FR_ABORTED
28 } rpp_fr_state_t;
29
30 /**
31  * Store cluster configuration parameters.
32  *
33  * This functions provides a mechanism to do the user FlexRay configuration.
34  * The function parses the string with parameters and stores them into an
35  * internal structure.
36  * For complete user configuration also rpp_fr_config_node_params and
37  * rpp_fr_config_static_buffer have to be called to configure local
38  * FlexRay parameters and at least one static buffer.
39  *
40  * The string with configuration contains hexadecimal numbers separated by spaces.
41  * Each number stands for one parameter in this order:
42  * gColdStartAttempts
43  * gListenNoise
44  * gMacroPerCycle
45  * gMaxWithoutClockCorrectionFatal
46  * gMaxWithoutClockCorrectionPassive
47  * gNetworkManagementVectorLength
48  * gNumberOfMinislots
49  * gNumberOfStaticSlots
50  * gOffsetCorrectionStart
51  * gPayloadLengthStatic
52  * gSyncNodeMax
53  * gdActionPointOffset
54  * gdCASRxLowMax
55  * gdDynamicSlotIdlePhase
56  * gdMinislot
57  * gdMinislotActionPointOffset
58  * gdNIT
59  * gdSampleClockPeriod
60  * gdStaticSlot
61  * gdTSSTransmitter
62  * gdWakeupSymbolRxIdle
63  * gdWakeupSymbolRxLow
64  * gdWakeupSymbolRxWindow
65  * gdWakeupSymbolTxIdle
66  * gdWakeupSymbolTxLow
67  *
68  * For example:
69  * "0x2 0xF 0x15E0 0xF 0xF 0xC 0x15A 0x8 0xAE4 0x9 0xF 0x4 0x43 0x1 0x4 0x2 0xAE3 0x0 0x56 0xA 0x12 0x12 0x4C 0xB4 0x3C"
70  *
71  * @param [in] params Address of the string with configuration parameters
72  *
73  * @return SUCCESS if configuration successful.
74  *         FAILURE if parameter parsing fails.
75  */
76 int8_t rpp_fr_config_cluster_params(const char* params);
77
78 /**
79  * Store node configuration parameters.
80  *
81  * This functions provides a mechanism to do the user FlexRay configuration.
82  * The function parses the string with parameters and stores them into an
83  * internal structure.
84  * For complete user configuration also rpp_fr_config_cluster_params and
85  * rpp_fr_config_static_buffer have to be called to configure global
86  * FlexRay parameters and at least one static buffer.
87  *
88  * The string with configuration contains hexadecimal numbers separated by spaces.
89  * Each number stands for one parameter in this order:
90  * pAllowHaltDueToClock
91  * pAllowPassiveToActive
92  * pChannels (0 - A, 1 - B, 2 - AB)
93  * pClusterDriftDamping
94  * pDelayCompensationA
95  * pDelayCompensationB
96  * pExternOffsetCorrection
97  * pExternRateCorrection
98  * pKeySlotUsedForStartup
99  * pKeySlotUsedForSync
100  * pLatestTx
101  * pMacroInitialOffsetA
102  * pMacroInitialOffsetB
103  * pMicroInitialOffsetA
104  * pMicroInitialOffsetB
105  * pMicroPerCycle
106  * pRateCorrectionOut
107  * pOffsetCorrectionOut
108  * pSamplesPerMicrotick
109  * pSingleSlotEnabled
110  * pWakeupChannel (0 - A, 1 - B)
111  * pWakeupPattern
112  * pdAcceptedStartupRange
113  * pdListenTimeout
114  * pdMaxDrift
115  * pDecodingCorrection
116  * syncFramePayloadMultiplexEnabled
117  * secureBuffers (0 - FR_SB_RECONFIG_ENABLED, 1 - FR_SB_STAT_REC_DISABLED_STAT_TR_DISABLED, 2 - FR_SB_ALL_REC_DISABLED, 3 - FR_SB_ALL_REC_DISABLED_STAT_TR_DISABLED)
118  *
119  * For example:
120  * "0x0 0x0 0x2 0x1 0x3 0x3 0x0 0x0 0x1 0x1 0x10D 0x6 0x6 0x18 0x18 0x36B00 0xCD 0x151 0x0 0x1 0x0 0x2 0x81 0x36DA2 0x151 0x33 0x0 0x0"
121  *
122  * @param [in] params Address of the string with configuration parameters
123  *
124  * @return SUCCESS if configuration successful.
125  *         FAILURE if parameter parsing fails.
126  */
127 int8_t rpp_fr_config_node_params(const char* params);
128
129 /**
130  * Add new static buffer configuration into the list of buffers.
131  *
132  * This functions provides a mechanism to do the user FlexRay configuration.
133  * The function parses the string with parameters and stores them into an
134  * internal structure.
135  * For complete user configuration also rpp_fr_config_cluster_params and
136  * rpp_fr_config_node_params have to be called to configure global and local
137  * FlexRay parameters.
138  * At least one static buffer must be configured as TX. For sync and coldstart nodes
139  * the first buffer should be configured as TX.
140  *
141  * The string with configuration contains hexadecimal numbers or strings separated by spaces.
142  * Each number or string stands for one parameter in this order:
143  * channel (0 - A, 1 - B, 2 - AB)
144  * cycleCounterFiltering
145  * isTx
146  * maxPayload
147  * msgBufferInterrupt
148  * payloadPreambleIndicatorTr
149  * singleTransmit
150  * slotId
151  *
152  * For example:
153  * "0x2 0x0 0x1 0x9 0x1 0x0 0x0 0x1"
154  *
155  * @param [in] params Address of the string with configuration parameters
156  *
157  * @return SUCCESS if configuration successful.
158  *         FAILURE if parameter parsing fails.
159  */
160 int8_t rpp_fr_config_static_buffer(const char* params);
161
162 /**
163  * Add new dynamic buffer configuration into the list of buffers.
164  *
165  * This functions provides a mechanism to do the user FlexRay configuration.
166  * The function parses the string with parameters and stores them into an
167  * internal structure.
168  * For complete user configuration also rpp_fr_config_cluster_params,
169  * rpp_fr_config_node_params and rpp_fr_config_static_buffer have to be called
170  * to configure global, local FlexRay parameters and at least one static buffer.
171  *
172  * The string with configuration contains hexadecimal numbers or strings separated by spaces.
173  * Each number or string stands for one parameter in this order:
174  * channel (0 - A, 1 - B)
175  * cycleCounterFiltering
176  * isTx
177  * maxPayload
178  * msgBufferInterrupt
179  * singleTransmit
180  * slotId
181  *
182  * For example:
183  * "0x0 0x0 0x1 0x9 0x1 0x0 0x1"
184  *
185  * @param [in] params Address of the string with configuration parameters
186  *
187  * @return SUCCESS if configuration successful.
188  *         FAILURE if parameter parsing fails.
189  */
190 int8_t rpp_fr_config_dynamic_buffer(const char* params);
191
192 /**
193  * Configures new RX FIFO buffer configuration into the list of buffers.
194  *
195  * This functions provides a mechanism to do the user FlexRay configuration.
196  * The function parses the string with parameters and stores them into an
197  * internal structure.
198  * For complete user configuration also rpp_fr_config_cluster_params,
199  * rpp_fr_config_node_params and rpp_fr_config_static_buffer have to be called
200  * to configure global, local FlexRay parameters and at least one static buffer.
201  * Only one RX FIFO buffer with specified depth can be configured.
202  *
203  * The string with configuration contains hexadecimal numbers or strings separated by spaces.
204  * Each number or string stands for one parameter in this order:
205  * depth
206  * channel (0 - A, 1 - B, 2 - AB)
207  * cycleCounterFiltering
208  * maxPayload
209  * rejectNullFrames
210  * rejectStaticSegment
211  * slotId (zero means no frame will be rejected)
212  *
213  * For example:
214  * "0x5 0x2 0x0 0x40 0x1 0x0 0x0"
215  *
216  * @param [in] params Address of the string with configuration parameters
217  *
218  * @return SUCCESS if configuration successful.
219  *         FAILURE if parameter parsing fails.
220  */
221 int8_t rpp_fr_config_fifo_buffer(const char* params);
222
223 /**
224  * FR module initialization.
225  *
226  * Call this method before using this module.
227  *
228  * @return SUCCESS if initialization successful.\n
229  *         FAILURE if module already initialized.
230  */
231 int8_t rpp_fr_init();
232
233 /**
234  * FlexRay driver initialization.
235  *
236  * This method should be called after rpp_fr_init and before any
237  * other function from this module, except rpp_fr_config functions.
238  *
239  * The functions copies configuration data into drivers internal
240  * structures and initializes the driver.
241  *
242  * There are two ways how to configure FlexRay.
243  * 1) Passing address of the config structure as an argument from the application
244  * 2) Using rpp_fr_config functions to create user configuration. Then the argument
245  * for this function has to be NULL and configuration functions have to be called before
246  * this function.
247  *
248  * After successful driver initialization, the FlexRay is ready for:
249  * rpp_fr_init_controller
250  * rpp_fr_get_poc_status
251  * rpp_fr_get_wakeup_rx_status
252  * rpp_fr_get_timer_irq_status
253  *
254  * @param [in] Fr_ConfigPtr Address of the structure with all FlexRay
255  * configuration parameters. If it is NULL, then default structure,
256  * filled by rpp_fr_config functions, is used.
257  * @param [out] error Address where error flags will be stored. The flags
258  * definitions can be found in fr_tms570h, with ERR_PARAM prefix.
259  *
260  * @return SUCCESS if initialization successful.
261  *         FAILURE if module already initialized.
262  *
263  */
264 int8_t rpp_fr_init_driver(const Fr_ConfigType* config_ptr, uint32_t* error);
265
266 /**
267  * FlexRay controller initialization.
268  *
269  * This method should be called after rpp_fr_init_driver and before any
270  * other function from this module.
271  *
272  * The functions checks configuration parameters and configures FlexRay
273  * controller registers.
274  *
275  * After successful controller initialization, the FlexRay is ready for:
276  * rpp_fr_get_poc_status
277  * rpp_fr_get_wakeup_rx_status
278  * rpp_fr_get_timer_irq_status
279  * rpp_fr_start_communication
280  * rpp_fr_send_wup
281  * rpp_fr_set_wu_channel
282  * rpp_fr_get_global_time
283  * rpp_fr_get_network_management_vector
284  * rpp_fr_get_channel_status
285  *
286  * @param [in] ctrl Not used, set always to zero.
287  * @param [out] error Address where error flags will be stored. The flags
288  * definitions can be found in fr_tms570h, with ERR_PARAM and FR_INIT_ERR
289  * prefix.
290  *
291  * @return SUCCESS if initialization successful.
292  *         FAILURE if module already initialized.
293  *
294  */
295 int8_t rpp_fr_init_controller(uint8_t ctrl, uint32_t* error);
296
297 /**
298  * FlexRay start communication
299  *
300  * This method should be called after rpp_fr_init_controller and attempt
301  * to sending or receiving messages
302  *
303  * For coldstarter the function tries to listen and join an existing network.
304  * If it fails, it tries to initiate the new one.
305  * For regular node it only listens on the bus and tries to join to
306  * some existing network.
307  *
308  * After successful communication start, the FlexRay is ready for:
309  * rpp_fr_get_poc_status
310  * rpp_fr_get_wakeup_rx_status
311  * rpp_fr_get_timer_irq_status
312  * rpp_fr_set_wu_channel
313  * rpp_fr_get_global_time
314  * rpp_fr_get_network_management_vector
315  * rpp_fr_get_channel_status
316  * rpp_fr_all_slots
317  * rpp_fr_halt_communication
318  * rpp_fr_abort_communication
319  * rpp_fr_transmit_lpdu
320  * rpp_fr_cancel_transmit_lpdu
321  * rpp_fr_receive_lpdu
322  * rpp_fr_check_tx_lpdu_status
323  * rpp_fr_disable_lpdu
324  * rpp_fr_get_clock_correction
325  * rpp_fr_get_sync_frame_list
326  * rpp_fr_set_timer
327  * rpp_fr_cancel_timer
328  *
329  * @param [in] ctrl Not used, set always to zero.
330  * @param [out] error Address where error flags will be stored. The flags
331  * definitions can be found in fr_tms570h, with FR_STARTUP_ERR prefix.
332  *
333  * @return SUCCESS if initialization successful.
334  *         FAILURE if module already initialized.
335  *
336  */
337 int8_t rpp_fr_start_communication(uint8_t ctrl, uint32_t* error);
338
339 /**
340  * FlexRay allow communication on all slots
341  *
342  * The FlexRay node can be configured to communicate only on key frames
343  * after the startup. Using this function the communication on all
344  * configured slots can be allowed.
345  *
346  * The function should be called only when the communication is running.
347  *
348  * @param [in] ctrl Not used, set always to zero.
349  *
350  * @return SUCCESS if started successfully.
351  *         FAILURE if timeout reached.
352  *
353  */
354 int8_t rpp_fr_all_slots(uint8_t ctrl);
355
356 /**
357  * FlexRay stop communication after the end of the cycle.
358  *
359  * The function should be called only when the communication is running.
360  *
361  * After the communication is stopped, only those functions are allowed:
362  * rpp_fr_set_wu_channel
363  * rpp_fr_get_global_time
364  * rpp_fr_get_network_management_vector
365  * rpp_fr_get_channel_status
366  * rpp_fr_get_clock_correction
367  * rpp_fr_get_sync_frame_list
368  * rpp_fr_get_wakeup_rx_status
369  * rpp_fr_get_poc_status
370  *
371  * To establish new communication, reset the device.
372
373  * @param [in] ctrl Not used, set always to zero.
374  *
375  * @return SUCCESS if command passed successfully.
376  *         FAILURE if command rejected.
377  *
378  */
379 int8_t rpp_fr_halt_communication(uint8_t ctrl);
380
381 /**
382  * FlexRay stop communication immediately.
383  *
384  * The function should be called only when the communication is running.
385  *
386  * After the communication is stopped, only those functions are allowed:
387  * rpp_fr_set_wu_channel
388  * rpp_fr_get_global_time
389  * rpp_fr_get_network_management_vector
390  * rpp_fr_get_channel_status
391  * rpp_fr_get_clock_correction
392  * rpp_fr_get_sync_frame_list
393  * rpp_fr_get_wakeup_rx_status
394  * rpp_fr_get_poc_status
395  *
396  * To establish new communication, reset the device.
397  *
398  * @param [in] ctrl Not used, set always to zero.
399  *
400  * @return SUCCESS if command passed successfully.
401  *         FAILURE if command rejected.
402  *
403  */
404 int8_t rpp_fr_abort_communication(uint8_t ctrl);
405
406 /**
407  * FlexRay send wakeup pattern.
408  *
409  * The function should be called after FlexRay controller is initialized
410  * and before the communication start.
411  *
412  * @param [in] ctrl Not used, set always to zero.
413  *
414  * @return SUCCESS if command passed successfully.
415  *         FAILURE if command rejected.
416  *
417  */
418 int8_t rpp_fr_send_wup(uint8_t ctrl);
419
420 /**
421  * FlexRay set channel for wakeup pattern sending.
422  *
423  * The function should be called after FlexRay controller is initialized
424  * and before the communication start.
425  *
426  * @param [in] ctrl Not used, set always to zero.
427  *
428  * @return SUCCESS if command passed successfully.
429  *         FAILURE if command rejected.
430  *
431  */
432 int8_t rpp_fr_set_wu_channel(uint8_t ctrl, Fr_ChannelType channel);
433
434 /**
435  * Get FlexRay POC state
436  *
437  * The function can be called any time after driver is initialized.
438  *
439  * @param [in] ctrl Not used, set always to zero.
440  * @parap [out] poc_status_ptr Address where status will be stored.
441  *
442  * @return SUCCESS if status retrieved successfully.
443  *         FAILURE if something failed.
444  *
445  */
446 int8_t rpp_fr_get_poc_status(uint8_t ctrl, Fr_POCStatusType* poc_status_ptr);
447
448 /**
449  * Send a message on the bus in the specified frame
450  *
451  * The function can be called any time when communication is running
452  * (Fr_StartCommunication was called).
453  *
454  * If the buffer assigned to the frame is in continuous mode, this
455  * functions starts sending a message periodically. The transmission can
456  * be stopped by rpp_fr_cancel_transmit_lpdu.
457  * If the buffer assigned to the frame is in single-shot mode, the
458  * message is sent only once.
459  *
460  * @param [in] ctrl Not used, set always to zero.
461  * @param [in] lpdu_idx Index of the frame, where the message will be sent.
462  * @param [in] lsdu Address of the first byte of the message.
463  * @param [in] lsdu_length Number of bytes of the message.
464  *
465  * @return SUCCESS if message was transmitted.
466  *         FAILURE if something failed.
467  *
468  */
469 int8_t rpp_fr_transmit_lpdu(uint8_t ctrl, uint16_t lpdu_idx, const uint8_t* lsdu, uint8_t lsdu_length);
470
471 /**
472  * Cancel a transmission of the message.
473  *
474  * The function can be called any time when communication is running
475  * (Fr_StartCommunication was called).
476  *
477  * This is one way to stop transmission for buffers configured
478  * in continuous mode.
479  *
480  * @param [in] ctrl Not used, set always to zero.
481  * @param [in] lpdu_idx Index of the frame, where the message transmission will be stopped.
482  *
483  * @return SUCCESS if the transmission was stopped.
484  *         FAILURE if something failed.
485  *
486  */
487 int8_t rpp_fr_cancel_transmit_lpdu(uint8_t ctrl, uint16_t lpdu_idx);
488
489 /**
490  * Receive a message from the bus in the specified frame
491  *
492  * The function can be called any time when communication is running
493  * (Fr_StartCommunication was called).
494  *
495  * If new message was received in static or dynamic buffer into some RX buffer,
496  * this function can retrieve it.
497  *
498  * @param [in] ctrl Not used, set always to zero.
499  * @param [in] lpdu_idx Index of the frame where message will be received from.
500  * @param [out] lsdu Address of the first byte of the buffer, where message will be stored.
501  * @param [out] lpdu_status Address where the status will be stored. It can be:
502  * FR_NOT_RECEIVED, FR_RECEIVED, FR_RECEIVED_MORE_DATA_AVAILABLE - for FIFO only.
503  * @param [out] lsdu_length Number of bytes of the message.
504  *
505  * @return SUCCESS if message was received.
506  *         FAILURE if something failed.
507  *
508  */
509 int8_t rpp_fr_receive_lpdu(uint8_t ctrl, uint16_t lpdu_idx, uint8_t* lsdu, Fr_RxLPduStatusType* lpdu_status, uint8_t* lsdu_length);
510
511 /**
512  * Check TX buffer status
513  *
514  * The function can be called any time when communication is running
515  * (Fr_StartCommunication was called).
516  *
517  * If buffer configured in single-shot mode, the transmission request (TXR)
518  * is pending until the message is send.
519  * For buffers configured in continuous mode, the transmission request is
520  * always pending.
521  *
522  * The TXR pending or not pending is the status of the buffer.
523  *
524  * @param [in] ctrl Not used, set always to zero.
525  * @param [in] lpdu_idx Index of the frame to which the buffer is assigned.
526  * @param [out] lpdu_status Address of the status. It can be FR_TRANSMITTED,
527  * which means the TXR is not pending, or FR_NOT_TRANSMITTED which means that
528  * TXR is pending.
529  *
530  * @return SUCCESS if everything is OK.
531  *         FAILURE if something failed.
532  *
533  */
534 int8_t rpp_fr_check_tx_lpdu_status(uint8_t ctrl, uint16_t lpdu_idx, Fr_TxLPduStatusType* lpdu_status);
535
536 /**
537  * Disable FlexRay buffer
538  *
539  * The function can be called any time when communication is running
540  * (Fr_StartCommunication was called).
541  *
542  * This functions resets the configuration of the selected buffer.
543  * The disabled buffer is not usable any more.
544  *
545  * @param [in] ctrl Not used, set always to zero.
546  * @param [in] lpdu_idx Index of the frame to which the buffer is assigned.
547  *
548  * @return SUCCESS if buffer was disabled.
549  *         FAILURE if something failed.
550  *
551  */
552 int8_t rpp_fr_disable_lpdu(uint8_t ctrl, uint16_t lpdu_idx);
553
554 /**
555  * Get FlexRay global time
556  *
557  * The function can be called any time after controller is initialized.
558  *
559  * @param [in] ctrl Not used, set always to zero.
560  * @param [out] cycle Adress where the number of actual cycle will be stored.
561  * @param [out] macroticks Address where offset in the cycle will be stored.
562  *
563  * @return SUCCESS if everything is OK.
564  *         FAILURE if something failed.
565  *
566  */
567 int8_t rpp_fr_get_global_time(uint8_t ctrl, uint8_t* cycle, uint16_t* macroticks);
568
569 /**
570  * Get Network management vector.
571  *
572  * The function can be called any time after controller is initialized.
573  *
574  * The FlexRay controller updates the vector at the end of every cycle by
575  * doing bit-wise or on every network managemet vectors received from all nodes.
576  *
577  * The NM vector can be sent to a frame by a buffer with payloadPreambleIndicatorTr
578  * set. Those frames are automatically processed by the controller. But sending the
579  * vector has to be done manually by copying the NM vector data (obtainable by
580  * this function) into the TX buffer (using rpp_fr_transmit_lpdu function).
581  *
582  * @param [in] ctrl Not used, set always to zero.
583  * @param [out] nm_vector Address where the vector will be stored. The size of the buffer has to be at least gNetworkManagementVectorLength.
584  *
585  * @return SUCCESS if everything is OK.
586  *         FAILURE if something failed.
587  *
588  */
589 int8_t rpp_fr_get_network_management_vector(uint8_t ctrl, uint8_t* nm_vector);
590
591 /**
592  * Get Channel status.
593  *
594  * The function can be called any time after controller is initialized.
595  *
596  * The output of the function is bitcoded in this way:
597  * Bit 0: Channel A/B aggregated channel status vSS!ValidFrame
598  * Bit 1: Channel A/B aggregated channel status vSS!SyntaxError
599  * Bit 2: Channel A/B aggregated channel status vSS!ContentError
600  * Bit 3: Channel A/B aggregated channel status additional communication
601  * Bit 4: Channel A/B aggregated channel status vSS!Bviolation
602  * Bit 5: Channel A/B aggregated channel status vSS!TxConflict
603  * Bit 6: Not used (0)
604  * Bit 7: Not used (0)
605  * Bit 8: Channel A/B symbol window status data vSS!ValidMTS
606  * Bit 9: Channel A/B symbol window status data vSS!SyntaxError
607  * Bit 10: Channel A/B symbol window status data vSS!Bviolation
608  * Bit 11: Channel A/B symbol window status data vSS!TxConflict
609  * Bit 12: Channel A/B NIT status data vSS!SyntaxError
610  * Bit 13: Channel A/B NIT status data vSS!Bviolation
611  * Bit 14: Not used (0)
612  * Bit 15: Not used (0)
613  *
614  *
615  * @param [in] ctrl Not used, set always to zero.
616  * @param [out] channel_a_status Address where the bitcoded status of the channel A will be stored.
617  * @param [out] channel_b_status Address where the bitcoded status of the channel B will be stored.
618  *
619  * @return SUCCESS if everything is OK.
620  *         FAILURE if something failed.
621  *
622  */
623 int8_t rpp_fr_get_channel_status(uint8_t ctrl, uint16_t* channel_a_status, uint16_t* channel_b_status);
624
625 /**
626  * Get clock correction.
627  *
628  * The function can be called while communication is running or was stopped.
629  *
630  * @param [in] ctrl Not used, set always to zero.
631  * @param [out] rate_correction Address where the rate will be stored.
632  * @param [out] offset_correction Address where the offset will be stored.
633  *
634  * @return SUCCESS if everything is OK.
635  *         FAILURE if something failed.
636  *
637  */
638 int8_t rpp_fr_get_clock_correction(uint8_t ctrl, int16_t* rate_correction, int32_t* offset_correction);
639
640 /**
641  * Get clock correction.
642  *
643  * The function can be called while communication is running or was stopped.
644  *
645  * @param [in] ctrl Not used, set always to zero.
646  * @param [out] rate_correction Address where the rate will be stored.
647  * @param [out] offset_correction Address where the offset will be stored.
648  *
649  * @return SUCCESS if everything is OK.
650  *         FAILURE if something failed.
651  *
652  */
653 int8_t rpp_fr_get_sync_frame_list(uint8_t ctrl, uint8_t list_size, uint16_t* channel_a_even_list, uint16_t* channel_b_even_list, uint16_t* channel_a_odd_list, uint16_t* channel_bodd_list);
654
655 /**
656  * Get the status of WUP receiving
657  *
658  * The function can be called any time after controller is initialized.
659  *
660  * If Wake Up Pattern was received on some channel, the flag is set in status address.
661  * Bit 0: Wakeup received on channel A indicator
662  * Bit 1: Wakeup received on channel B indicator
663  * Bit 2-7: Unused
664  *
665  * @param [in] ctrl Not used, set always to zero.
666  * @param [out] status Address where the status will be stored.
667  *
668  * @return SUCCESS if everything is OK.
669  *         FAILURE if something failed.
670  *
671  */
672 int8_t rpp_fr_get_wakeup_rx_status(uint8_t ctrl, uint8_t* status);
673
674 /**
675  * Set an absolute timer and start it.
676  *
677  * The function can be called any time after communication is running.
678  * The FlexRay controller has two absolute timers. Each of them can be
679  * configured to request the interrupt, when the global time reaches
680  * configured cycle and offset.
681  *
682  * Timer interrupt request can be detected by rpp_fr_get_timer_irq_status.
683  * Timer interrupt request can be cleared by rpp_fr_clear_timer_irq
684  * Timer can be canceled by rpp_fr_cancel_timer.
685  *
686  * @param [in] ctrl Not used, set always to zero.
687  * @param [in] timer_idx Index of the timer (0,1).
688  * @param [in] cycle_threshold Number of the cycle.
689  * @param [in] offset_threshold Offset in the cycle in mactroticks.
690  *
691  * @return SUCCESS if everything is OK.
692  *         FAILURE if something failed.
693  *
694  */
695 int8_t rpp_fr_set_timer(uint8_t ctrl, uint8_t timer_idx, uint8_t cycle_threshold, uint16_t offset_threshold);
696
697 /**
698  * Stops an absolute timer, clear IRQ.
699  *
700  * The function can be called any time after communication is running.
701  *
702  * The FlexRay controller has two absolute timers. Each of them can be
703  * configured to request the interrupt, when the global time reaches
704  * configured cycle and offset. This function stops the timer and clears
705  * the interrupt request.
706  *
707  * Timer interrupt request can be detected by rpp_fr_get_timer_irq_status.
708  * Timer interrupt request can be cleared by rpp_fr_clear_timer_irq
709  * Timer can be started by rpp_fr_set_timer.
710  *
711  * @param [in] ctrl Not used, set always to zero.
712  * @param [in] timer_idx Index of the timer (0,1).
713  *
714  * @return SUCCESS if everything is OK.
715  *         FAILURE if something failed.
716  *
717  */
718 int8_t rpp_fr_cancel_timer(uint8_t ctrl, uint8_t timer_idx);
719
720 /**
721  * Clear IRQ flag of the absolute timer
722  *
723  * The function can be called any time after communication is running.
724  *
725  * The FlexRay controller has two absolute timers. Each of them can be
726  * configured to request the interrupt, when the global time reaches
727  * configured cycle and offset. This function clears the IRQ flag.
728  *
729  * Timer interrupt request can be detected by rpp_fr_get_timer_irq_status.
730  * Timer can be started by rpp_fr_set_timer.
731  * Timer can be canceled by rpp_fr_cancel_timer.
732  *
733  * @param [in] ctrl Not used, set always to zero.
734  * @param [in] timer_idx Index of the timer (0,1).
735  *
736  * @return SUCCESS if everything is OK.
737  *         FAILURE if something failed.
738  *
739  */
740 int8_t rpp_fr_clear_timer_irq(uint8_t ctrl, uint8_t timer_idx);
741
742 /**
743  * Get IRQ flag of the absolute timer
744  *
745  * The function can be called any time after communication is running.
746  *
747  * The FlexRay controller has two absolute timers. Each of them can be
748  * configured to request the interrupt, when the global time reaches
749  * configured cycle and offset. Using this function the IRQ can be detected.
750  *
751  * Timer interrupt request can be cleared by rpp_fr_clear_timer_irq
752  * Timer can be started by rpp_fr_set_timer.
753  * Timer can be canceled by rpp_fr_cancel_timer.
754  *
755  * @param [in] ctrl Not used, set always to zero.
756  * @param [in] timer_idx Index of the timer (0,1).
757  *
758  * @return SUCCESS if everything is OK.
759  *         FAILURE if something failed.
760  *
761  */
762 int8_t rpp_fr_get_timer_irq_status(uint8_t ctrl, uint8_t timer_idx, boolean_t* irq_pending);
763
764 /**
765  * Get information about the driver vendor, module and version.
766  *
767  * The function can be called any time.
768  *
769  * @param [out] version Address, where the information will be stored.
770  *
771  * @return always SUCCESS
772  *
773  */
774 int8_t rpp_fr_get_driver_version(Std_VersionInfoType* version);
775
776 /**
777  * Get configuration parameter value from the internal driver structures.
778  *
779  * The function can be called any time.
780  *
781  * @param [in] ctrl Not used, set always to zero.
782  * @param [in] param_idx The index if the parameter. You can find the indexes in Fr_GeneralTypes.h file with FR_CIDX prefix.
783  * @param [out] param_value Address, where the information will be stored.
784  *
785  * @return SUCCESS if everything is OK.
786  *         FAILURE if something failed.
787  *
788  */
789 int8_t rpp_fr_read_com_ctrl_config(uint8_t ctrl, uint8_t param_idx, uint32_t* param_value);
790
791 #endif /* __RPP_FR_H */
792