summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/ixp/npe/include/IxTimeSyncAcc.h
blob: 25effed90b4085f1c7dffee616332bf056cc95a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
/**
 * @file IxTimeSyncAcc.h
 *
 * @author Intel Corporation
 * @date 07 May 2004
 *
 * @brief  Header file for IXP400 Access Layer to IEEE 1588(TM) Precision
 * Clock Synchronisation Protocol Hardware Assist
 *
 * @version 1
 *
 * @par
 * IXP400 SW Release version 2.0
 * 
 * -- Copyright Notice --
 * 
 * @par
 * Copyright 2001-2005, Intel Corporation.
 * All rights reserved.
 * 
 * @par
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the Intel Corporation nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 * 
 * @par
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * 
 * @par
 * -- End of Copyright Notice --
 */

/**
 * @defgroup IxTimeSyncAcc IXP400 Time Sync Access Component API 
 *
 * @brief Public API for IxTimeSyncAcc
 *
 * @{
 */
#ifndef IXTIMESYNCACC_H
#define IXTIMESYNCACC_H

#ifdef  __ixp46X

#include "IxOsal.h"

/**
 * Section for enum
 */

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @enum IxTimeSyncAccStatus
 *
 * @brief The status as returned from the API
 */
typedef enum /**< IxTimeSyncAccStatus */
{
    IX_TIMESYNCACC_SUCCESS = IX_SUCCESS,    /**< Requested operation successful */
    IX_TIMESYNCACC_INVALIDPARAM,            /**< An invalid parameter was passed */
    IX_TIMESYNCACC_NOTIMESTAMP,             /**< While polling no time stamp available */
    IX_TIMESYNCACC_INTERRUPTMODEINUSE,      /**< Polling not allowed while operating in interrupt mode */
    IX_TIMESYNCACC_FAILED                   /**< Internal error occurred */
}IxTimeSyncAccStatus;

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @enum IxTimeSyncAccAuxMode
 *
 * @brief Master or Slave Auxiliary Time Stamp (Snap Shot)
 */
typedef enum /**< IxTimeSyncAccAuxMode */
{
    IX_TIMESYNCACC_AUXMODE_MASTER,          /**< Auxiliary Master Mode */
    IX_TIMESYNCACC_AUXMODE_SLAVE,           /**< Auxiliary Slave Mode */
    IX_TIMESYNCACC_AUXMODE_INVALID          /**< Invalid Auxiliary Mode */
}IxTimeSyncAccAuxMode;

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @enum IxTimeSyncAcc1588PTPPort
 *
 * @brief IEEE 1588 PTP Communication Port(Channel)
 */
typedef enum /**< IxTimeSyncAcc1588PTPPort */
{
    IX_TIMESYNCACC_NPE_A_1588PTP_PORT,      /**< PTP Communication Port on NPE-A */
    IX_TIMESYNCACC_NPE_B_1588PTP_PORT,      /**< PTP Communication Port on NPE-B */
    IX_TIMESYNCACC_NPE_C_1588PTP_PORT,      /**< PTP Communication Port on NPE-C */
    IX_TIMESYNCACC_NPE_1588PORT_INVALID     /**< Invalid PTP Communication Port */
} IxTimeSyncAcc1588PTPPort;

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @enum IxTimeSyncAcc1588PTPPortMode
 *
 * @brief Master or Slave mode for IEEE 1588 PTP Communication Port
 */
typedef enum  /**< IxTimeSyncAcc1588PTPPortMode */
{
    IX_TIMESYNCACC_1588PTP_PORT_MASTER,       /**< PTP Communication Port in Master Mode */
    IX_TIMESYNCACC_1588PTP_PORT_SLAVE,        /**< PTP Communication Port in Slave Mode */
    IX_TIMESYNCACC_1588PTP_PORT_ANYMODE,      /**< PTP Communication Port in ANY Mode
                                                  allows time stamping of all messages
                                                  including non-1588 PTP */
    IX_TIMESYNCACC_1588PTP_PORT_MODE_INVALID  /**< Invalid PTP Port Mode */
}IxTimeSyncAcc1588PTPPortMode;

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @enum IxTimeSyncAcc1588PTPMsgType
 *
 * @brief 1588 PTP Messages types that can be detected on communication port
 *
 * Note that client code can determine this based on master/slave mode in which
 * it is already operating in and this information is made available for the sake
 * of convenience only.
 */
typedef enum  /**< IxTimeSyncAcc1588PTPMsgType */
{
    IX_TIMESYNCACC_1588PTP_MSGTYPE_SYNC,     /**< PTP Sync message sent by Master or received by Slave */
    IX_TIMESYNCACC_1588PTP_MSGTYPE_DELAYREQ, /**< PTP Delay_Req message sent by Slave or received by Master */
    IX_TIMESYNCACC_1588PTP_MSGTYPE_UNKNOWN   /**< Other PTP and non-PTP message sent or received by both
                                                Master and/or Slave */
} IxTimeSyncAcc1588PTPMsgType;

/**
 * Section for struct
 */

/**
 * @ingroup IxTimeSyncAcc
 *
 * @struct IxTimeSyncAccTimeValue
 *
 * @brief Struct to hold 64 bit SystemTime and TimeStamp values
 */
typedef struct  /**< IxTimeSyncAccTimeValue */
{
    UINT32 timeValueLowWord;               /**< Lower 32 bits of the time value */
    UINT32 timeValueHighWord;              /**< Upper 32 bits of the time value */  
} IxTimeSyncAccTimeValue;

/**
 * @ingroup IxTimeSyncAcc
 *
 * @struct IxTimeSyncAccUuid
 *
 * @brief Struct to hold 48 bit UUID values captured in Sync or Delay_Req messages
 */
typedef struct  /**< IxTimeSyncAccUuid */
{
    UINT32 uuidValueLowWord;               /**<The lower 32 bits of the UUID */
    UINT16 uuidValueHighHalfword;          /**<The upper 16 bits of the UUID */  
} IxTimeSyncAccUuid;

/**
 * @ingroup IxTimeSyncAcc
 *
 * @struct IxTimeSyncAccPtpMsgData
 *
 * @brief Struct for data from the PTP message returned when TimeStamp available
 */
typedef struct  /**< IxTimeSyncAccPtpMsgData */
{
    IxTimeSyncAcc1588PTPMsgType ptpMsgType; /**< PTP Messages type */
    IxTimeSyncAccTimeValue ptpTimeStamp;    /**< 64 bit TimeStamp value from PTP Message */
    IxTimeSyncAccUuid ptpUuid;              /**< 48 bit UUID value from the PTP Message */
    UINT16 ptpSequenceNumber;               /**< 16 bit Sequence Number from PTP Message */
} IxTimeSyncAccPtpMsgData;

/**
 * @ingroup IxTimeSyncAcc
 *
 * @struct IxTimeSyncAccStats
 *
 * @brief Statistics for the PTP messages
 */
typedef struct  /**< IxTimeSyncAccStats */
{
    UINT32 rxMsgs; /**< Count of timestamps for received PTP Messages */
    UINT32 txMsgs; /**< Count of timestamps for transmitted PTP Messages */
} IxTimeSyncAccStats;

/**
 * @ingroup IxTimeSyncAcc
 *
 * @typedef IxTimeSyncAccTargetTimeCallback
 *
 * @brief Callback for use by target time stamp interrupt
 */
typedef void (*IxTimeSyncAccTargetTimeCallback)(IxTimeSyncAccTimeValue targetTime);

/**
 * @ingroup IxTimeSyncAcc
 *
 * @typedef IxTimeSyncAccAuxTimeCallback
 *
 * @brief Callback for use by auxiliary time interrupts
 */
typedef void (*IxTimeSyncAccAuxTimeCallback)(IxTimeSyncAccAuxMode auxMode,
             IxTimeSyncAccTimeValue auxTime);

/*
 * Section for prototypes interface functions
 */

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccPTPPortConfigSet(
                               IxTimeSyncAcc1588PTPPort ptpPort,
                               IxTimeSyncAcc1588PTPPortMode ptpPortMode)
 *
 * @brief Configures the IEEE 1588 message detect on particular PTP port.
 *
 * @param ptpPort [in] - PTP port to config
 * @param ptpPortMode [in]- Port to operate in Master or Slave mode
 *
 * This API will enable the time stamping on a particular PTP port.
 *          
 * @li Re-entrant   : No
 * @li ISR Callable : No
 * 
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccPTPPortConfigSet(IxTimeSyncAcc1588PTPPort ptpPort,
       IxTimeSyncAcc1588PTPPortMode ptpPortMode);

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccPTPPortConfigGet(
                               IxTimeSyncAcc1588PTPPort ptpPort,
                               IxTimeSyncAcc1588PTPPortMode *ptpPortMode)
 *
 * @brief Retrieves IEEE 1588 PTP operation mode on particular PTP port.
 *
 * @param ptpPort [in] - PTP port
 * @param ptpPortMode [in]- Mode of operation of PTP port (Master or Slave)
 *
 * This API will identify the time stamping capability of a PTP port by means
 * of obtaining its mode of operation.
 *          
 * @li Re-entrant   : No
 * @li ISR Callable : No
 * 
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccPTPPortConfigGet(IxTimeSyncAcc1588PTPPort ptpPort,
    IxTimeSyncAcc1588PTPPortMode *ptpPortMode);

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccPTPRxPoll(
                               IxTimeSyncAcc1588PTPPort ptpPort,
                               IxTimeSyncAccPtpMsgData  *ptpMsgData)
 *
 * @brief Polls the IEEE 1588 message/time stamp detect status on a particular 
 * PTP Port on the Receive side.
 *
 * @param ptpPort [in] - PTP port to poll
 * @param ptpMsgData [out] - Current TimeStamp and other Data
 *
 * This API will poll for the availability of a time stamp on the received Sync 
 * (Slave) or Delay_Req (Master) messages.
 * The client application will provide the buffer.
 *              
 * @li Re-entrant   : No
 * @li ISR Callable : No
 * 
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
 *         @li IX_TIMESYNCACC_NOTIMESTAMP - No time stamp available
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccPTPRxPoll(IxTimeSyncAcc1588PTPPort ptpPort,
    IxTimeSyncAccPtpMsgData  *ptpMsgData);

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccPTPTxPoll(
                               IxTimeSyncAcc1588PTPPort ptpPort,
                               IxTimeSyncAccPtpMsgData  *ptpMsgData)
 *
 *
 * @brief Polls the IEEE 1588 message/time stamp detect status on a particular 
 * PTP Port on the Transmit side.
 *
 * @param ptpPort [in] - PTP port to poll
 * @param ptpMsgData [out] - Current TimeStamp and other Data
 *                        
 * This API will poll for the availability of a time stamp on the transmitted
 * Sync (Master) or Delay_Req (Slave) messages.
 * The client application will provide the buffer.
 *              
 * @li Re-entrant   : No
 * @li ISR Callable : No
 * 
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
 *         @li IX_TIMESYNCACC_NOTIMESTAMP - No time stamp available
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccPTPTxPoll(IxTimeSyncAcc1588PTPPort ptpPort,
    IxTimeSyncAccPtpMsgData  *ptpMsgData);

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccSystemTimeSet(
                               IxTimeSyncAccTimeValue systemTime)
 *
 * @brief Sets the System Time in the IEEE 1588 hardware assist block
 *
 * @param systemTime [in] - Value to set System Time
 *                        
 * This API will set the SystemTime to given value.
 *              
 * @li Re-entrant   : yes
 * @li ISR Callable : no
 * 
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccSystemTimeSet(IxTimeSyncAccTimeValue systemTime);

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccSystemTimeGet(
                               IxTimeSyncAccTimeValue *systemTime)
 *
 * @brief Gets the System Time from the IEEE 1588 hardware assist block
 *
 * @param systemTime [out] - Copy the current System Time into the client 
 * application provided buffer
 *
 * This API will get the SystemTime from IEEE1588 block and return to client
 *      
 * @li Re-entrant   : no
 * @li ISR Callable : no
 * 
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccSystemTimeGet(IxTimeSyncAccTimeValue *systemTime);

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccTickRateSet(
                               UINT32 tickRate)
 *
 * @brief Sets the Tick Rate (Frequency Scaling Value) in the IEEE 1588
 * hardware assist block
 *
 * @param tickRate [in] - Value to set Tick Rate
 *                        
 * This API will set the Tick Rate (Frequency Scaling Value) in the IEEE
 * 1588 block to the given value. The Accumulator register (not client 
 * visible) is incremented by this TickRate value every clock cycle. When 
 * the Accumulator overflows, the SystemTime is incremented by one. This
 * TickValue can therefore be used to adjust the system timer.
 *           
 * @li Re-entrant   : yes
 * @li ISR Callable : no
 *
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccTickRateSet(UINT32 tickRate);

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccTickRateGet(
                               UINT32 *tickRate)
 *
 * @brief Gets the Tick Rate (Frequency Scaling Value) from the IEEE 1588
 * hardware assist block
 *
 * @param tickRate [out] - Current Tick Rate value in the IEEE 1588 block
 *
 * This API will get the TickRate on IEE15588 block. Refer to @ref 
 * ixTimeSyncAccTickRateSet for notes on usage of this value.
 *         
 * @li   Reentrant    : yes
 * @li   ISR Callable : no
 *
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccTickRateGet(UINT32 *tickRate);

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccTargetTimeInterruptEnable(
                               IxTimeSyncAccTargetTimeCallback targetTimeCallback)
 *
 * @brief Enables the interrupt to verify the condition where the System Time 
 * greater or equal to the Target Time in the IEEE 1588 hardware assist block. 
 * If the condition is true an interrupt will be sent to XScale.
 *
 * @param targetTimeCallback [in] - Callback to be invoked when interrupt fires
 *
 * This API will enable the Target Time reached/hit condition interrupt.
 *
 * NOTE: The client application needs to ensure that the APIs 
 * @ref ixTimeSyncAccTargetTimeInterruptEnable, @ref ixTimeSyncAccTargetTimeSet and
 * @ref ixTimeSyncAccTargetTimeInterruptDisable are accessed in mutual exclusive 
 * manner with respect to each other.
 *
 * @li Re-entrant   : no
 * @li ISR Callable : yes
 *
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed for callback
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccTargetTimeInterruptEnable(IxTimeSyncAccTargetTimeCallback targetTimeCallback);

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccTargetTimeInterruptDisable(
                               void)
 *
 * @brief Disables the interrupt for the condition explained in the function
 * description of @ref ixTimeSyncAccTargetTimeInterruptEnable.
 *
 * This API will disable the Target Time interrupt.
 *
 * NOTE: The client application needs to ensure that the APIs 
 * @ref ixTimeSyncAccTargetTimeInterruptEnable, @ref ixTimeSyncAccTargetTimeSet and
 * @ref ixTimeSyncAccTargetTimeInterruptDisable are accessed in mutual exclusive 
 * manner with respect to each other.
 *              
 * @li Re-entrant   : no
 * @li ISR Callable : yes
 *
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccTargetTimeInterruptDisable(void);

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccTargetTimePoll(
                               BOOL *ttmPollFlag,
                               IxTimeSyncAccTimeValue *targetTime)
 *
 * @brief Poll to verify the condition where the System Time greater or equal to
 * the Target Time in the IEEE 1588 hardware assist block. If the condition is
 * true an event flag is set in the hardware.
 *
 * @param ttmPollFlag [out] - TRUE  if the target time reached/hit condition event set
 *                            FALSE if the target time reached/hit condition event is 
                                    not set
 * @param targetTime [out] - Capture current targetTime into client provided buffer
 *
 * Poll the target time reached/hit condition status. Return true and the current
 * target time value, if the condition is true else return false.
 *
 * NOTE: The client application will need to clear the event flag that will be set
 * as long as the condition that the System Time greater or equal to the Target Time is
 * valid, in one of the following ways:
 *     1) Invoke the API to change the target time
 *     2) Change the system timer value 
 *              
 * @li Re-entrant   : yes
 * @li ISR Callable : no
 *
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 *         @li IX_TIMESYNCACC_INTERRUPTMODEINUSE - Interrupt mode in use
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccTargetTimePoll(BOOL *ttmPollFlag,
    IxTimeSyncAccTimeValue *targetTime);

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccTargetTimeSet(
                               IxTimeSyncAccTimeValue targetTime)
 *
 * @brief Sets the Target Time in the IEEE 1588 hardware assist block
 *
 * @param targetTime [in] - Value to set Target Time
 *                        
 * This API will set the Target Time to a given value.
 *
 * NOTE: The client application needs to ensure that the APIs 
 * @ref ixTimeSyncAccTargetTimeInterruptEnable, @ref ixTimeSyncAccTargetTimeSet and
 * @ref ixTimeSyncAccTargetTimeInterruptDisable are accessed in mutual exclusive 
 * manner with respect to each other.
 *              
 * @li   Reentrant    : no
 * @li   ISR Callable : yes
 *
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccTargetTimeSet(IxTimeSyncAccTimeValue targetTime);

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccTargetTimeGet(
                               IxTimeSyncAccTimeValue *targetTime)
 *
 * @brief Gets the Target Time in the IEEE 1588 hardware assist block
 *
 * @param targetTime [out] - Copy current time to client provided buffer
 *                                                 
 * This API will get the Target Time from IEEE 1588 block and return to the 
 * client application
 *            
 * @li Re-entrant   : yes
 * @li ISR Callable : no
 *
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccTargetTimeGet(IxTimeSyncAccTimeValue *targetTime);

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccAuxTimeInterruptEnable(
                               IxTimeSyncAccAuxMode auxMode, 
                               IxTimeSyncAccAuxTimeCallback auxTimeCallback)
 *
 * @brief Enables the interrupt notification for the given mode of Auxiliary Time 
 * Stamp in the IEEE 1588 hardware assist block
 * 
 * @param auxMode [in] - Auxiliary time stamp register (slave or master) to use
 * @param auxTimeCallback [in] - Callback to be invoked when interrupt fires 
 *                                                              
 * This API will enable the Auxiliary Master/Slave Time stamp Interrupt.
 *
 * <pre>
 * NOTE: 1) An individual callback is to be registered for each Slave and Master 
 * Auxiliary Time Stamp registers. Thus to register for both Master and Slave time
 * stamp interrupts either the same callback or two separate callbacks the API has
 * to be invoked twice.
 *       2) On the IXDP465 Development Platform, the Auxiliary Timestamp signal for 
 * slave mode is tied to GPIO 8 pin. This signal is software routed by default to 
 * PCI for backwards compatibility with the IXDP425 Development Platform. This
 * routing must be disabled for the auxiliary slave time stamp register to work 
 * properly. The following commands may be used to accomplish this. However, refer
 * to the IXDP465 Development Platform Users Guide or the BSP/LSP documentation for
 * more specific information.
 *
 * For Linux (at the Redboot prompt i.e., before loading zImage):
 *     mfill -b 0x54100000 -1 -l 1 -p 8
 *     mfill -b 0x54100001 -1 -l 1 -p 0x7f
 * For vxWorks, at the prompt:
 *     intDisable(25)
 *     ixdp400FpgaIODetach(8)
 * </pre>
 *              
 * @li Re-entrant   : no
 * @li ISR Callable : no
 *
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed for callback or
                                            invalid auxiliary snapshot mode
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccAuxTimeInterruptEnable(IxTimeSyncAccAuxMode auxMode,
    IxTimeSyncAccAuxTimeCallback auxTimeCallback);

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccAuxTimeInterruptDisable(
                               IxTimeSyncAccAuxMode auxMode)
 *
 * @brief Disables the interrupt for the indicated mode of Auxiliary Time Stamp
 * in the IEEE 1588 hardware assist block
 *
 * @param auxMode [in] - Auxiliary time stamp mode (slave or master) using which
 * the interrupt will be disabled.
 *                        
 * This API will disable the Auxiliary Time Stamp Interrupt (Master or Slave)
 *              
 * @li Re-entrant   : yes
 * @li ISR Callable : no
 *
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccAuxTimeInterruptDisable(IxTimeSyncAccAuxMode auxMode);

/**
 * @ingroup IxTimeSyncAcc
 * 
 * @fn IxTimeSyncAccStatus ixTimeSyncAccAuxTimePoll(
                               IxTimeSyncAccAuxMode auxMode,
                               BOOL *auxPollFlag,
                               IxTimeSyncAccTimeValue *auxTime)
 *
 * @brief Poll for the Auxiliary Time Stamp captured for the mode indicated 
 * (Master or Slave)
 *
 * @param auxMode [in] - Auxiliary Snapshot Register (Slave or Master) to be checked
 * @param auxPollFlag [out] - TRUE if the time stamp captured in auxiliary 
                                   snapshot register
 *                            FALSE if the time stamp not captured in 
                                   auxiliary snapshot register
 * @param auxTime [out] - Copy the current Auxiliary Snapshot Register value into the
 * client provided buffer
 *
 * Polls for the Time stamp in the appropriate Auxiliary Snapshot Registers based 
 * on the mode specified. Return true and the contents of the Auxiliary snapshot,
 * if it is available else return false.
 * 
 * Please refer to the note #2 of the API @ref ixTimeSyncAccAuxTimeInterruptEnable
 * for more information for Auxiliary Slave mode.
 *
 * @li Re-entrant   : yes
 * @li ISR Callable : no
 *
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed for auxPollFlag,
                   callback or invalid auxiliary snapshot mode
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 *         @li IX_TIMESYNCACC_INTERRUPTMODEINUSE - Interrupt mode in use
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccAuxTimePoll(IxTimeSyncAccAuxMode auxMode,
    BOOL *auxPollFlag,
    IxTimeSyncAccTimeValue *auxTime);

/**
 * @ingroup IxTimeSyncAcc
 *
 * @fn IxTimeSyncAccStatus ixTimeSyncAccReset(void)
 *
 * @brief Resets the IEEE 1588 hardware assist block
 *
 * Sets the reset bit in the IEEE1588 silicon which fully resets the silicon block
 *            
 * @li Reentrant    : yes
 * @li ISR Callable : no
 *
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_FAILED  - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccReset(void);

/**
 * @ingroup IxTimeSyncAcc
 *
 * @fn IxTimeSyncAccStatus ixTimeSyncAccStatsGet(IxTimeSyncAccStats
                               *timeSyncStats)
 *
 * @brief Returns the IxTimeSyncAcc Statistics in the client supplied buffer
 *
 * @param timeSyncStats [out] - TimeSync statistics counter values
 *
 * This API will return the statistics of the received or transmitted messages.
 * 
 * NOTE: 1) These counters are updated only when the client polls for the time 
 * stamps or interrupt are enabled. This is because the IxTimeSyncAcc module 
 * does not either transmit or receive messages and does only run the code 
 * when explicit requests received by client application.
 *
 *       2) These statistics reflect the number of valid PTP messages exchanged
 * in Master and Slave modes but includes all the messages (including valid 
 * non-PTP messages) while operating in the Any mode.
 *              
 * @li Reentrant    : no
 * @li ISR Callable : no
 *
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_INVALIDPARAM - NULL parameter passed
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccStatsGet(IxTimeSyncAccStats *timeSyncStats);

/**
 * @ingroup IxTimeSyncAcc
 *
 * @fn void ixTimeSyncAccStatsReset(void)
 *
 * @brief Reset Time Sync statistics
 *
 * This API will reset the statistics counters of the TimeSync access layer.
 *             
 * @li Reentrant    : yes
 * @li ISR Callable:  no
 *
 * @return @li None
 */
PUBLIC void
ixTimeSyncAccStatsReset(void);

/**
 * @ingroup IxTimeSyncAcc
 *
 * @fn IxTimeSyncAccStatus ixTimeSyncAccShow(void)
 *
 * @brief Displays the Time Sync current status
 *
 * This API will display status on the current configuration of the IEEE
 * 1588 hardware assist block, contents of the various time stamp registers,
 * outstanding interrupts and/or events.
 *
 * Note that this is intended for debug only, and in contrast to the other
 * functions, it does not clear the any of the status bits associated with
 * active timestamps and so is passive in its nature.
 *            
 * @li Reentrant    : yes
 * @li ISR Callable : no
 *
 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
 *         @li IX_TIMESYNCACC_FAILED - Internal error occurred
 */
PUBLIC IxTimeSyncAccStatus
ixTimeSyncAccShow(void);

#endif /* __ixp46X */
#endif /* IXTIMESYNCACC_H */

/**
 * @} defgroup IxTimeSyncAcc
 */