blob: 25effed90b4085f1c7dffee616332bf056cc95a2 [file] [log] [blame]
Wolfgang Denkba94a1b2006-05-30 15:56:48 +02001/**
2 * @file IxTimeSyncAcc.h
3 *
4 * @author Intel Corporation
5 * @date 07 May 2004
6 *
7 * @brief Header file for IXP400 Access Layer to IEEE 1588(TM) Precision
8 * Clock Synchronisation Protocol Hardware Assist
9 *
10 * @version 1
11 *
12 * @par
13 * IXP400 SW Release version 2.0
14 *
15 * -- Copyright Notice --
16 *
17 * @par
18 * Copyright 2001-2005, Intel Corporation.
19 * All rights reserved.
20 *
21 * @par
22 * Redistribution and use in source and binary forms, with or without
23 * modification, are permitted provided that the following conditions
24 * are met:
25 * 1. Redistributions of source code must retain the above copyright
26 * notice, this list of conditions and the following disclaimer.
27 * 2. Redistributions in binary form must reproduce the above copyright
28 * notice, this list of conditions and the following disclaimer in the
29 * documentation and/or other materials provided with the distribution.
30 * 3. Neither the name of the Intel Corporation nor the names of its contributors
31 * may be used to endorse or promote products derived from this software
32 * without specific prior written permission.
33 *
34 * @par
35 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
36 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
39 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
40 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
41 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
42 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
43 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
44 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45 * SUCH DAMAGE.
46 *
47 * @par
48 * -- End of Copyright Notice --
49 */
50
51/**
52 * @defgroup IxTimeSyncAcc IXP400 Time Sync Access Component API
53 *
54 * @brief Public API for IxTimeSyncAcc
55 *
56 * @{
57 */
58#ifndef IXTIMESYNCACC_H
59#define IXTIMESYNCACC_H
60
61#ifdef __ixp46X
62
63#include "IxOsal.h"
64
65/**
66 * Section for enum
67 */
68
69/**
70 * @ingroup IxTimeSyncAcc
71 *
72 * @enum IxTimeSyncAccStatus
73 *
74 * @brief The status as returned from the API
75 */
76typedef enum /**< IxTimeSyncAccStatus */
77{
78 IX_TIMESYNCACC_SUCCESS = IX_SUCCESS, /**< Requested operation successful */
79 IX_TIMESYNCACC_INVALIDPARAM, /**< An invalid parameter was passed */
80 IX_TIMESYNCACC_NOTIMESTAMP, /**< While polling no time stamp available */
81 IX_TIMESYNCACC_INTERRUPTMODEINUSE, /**< Polling not allowed while operating in interrupt mode */
82 IX_TIMESYNCACC_FAILED /**< Internal error occurred */
83}IxTimeSyncAccStatus;
84
85/**
86 * @ingroup IxTimeSyncAcc
87 *
88 * @enum IxTimeSyncAccAuxMode
89 *
90 * @brief Master or Slave Auxiliary Time Stamp (Snap Shot)
91 */
92typedef enum /**< IxTimeSyncAccAuxMode */
93{
94 IX_TIMESYNCACC_AUXMODE_MASTER, /**< Auxiliary Master Mode */
95 IX_TIMESYNCACC_AUXMODE_SLAVE, /**< Auxiliary Slave Mode */
96 IX_TIMESYNCACC_AUXMODE_INVALID /**< Invalid Auxiliary Mode */
97}IxTimeSyncAccAuxMode;
98
99/**
100 * @ingroup IxTimeSyncAcc
101 *
102 * @enum IxTimeSyncAcc1588PTPPort
103 *
104 * @brief IEEE 1588 PTP Communication Port(Channel)
105 */
106typedef enum /**< IxTimeSyncAcc1588PTPPort */
107{
108 IX_TIMESYNCACC_NPE_A_1588PTP_PORT, /**< PTP Communication Port on NPE-A */
109 IX_TIMESYNCACC_NPE_B_1588PTP_PORT, /**< PTP Communication Port on NPE-B */
110 IX_TIMESYNCACC_NPE_C_1588PTP_PORT, /**< PTP Communication Port on NPE-C */
111 IX_TIMESYNCACC_NPE_1588PORT_INVALID /**< Invalid PTP Communication Port */
112} IxTimeSyncAcc1588PTPPort;
113
114/**
115 * @ingroup IxTimeSyncAcc
116 *
117 * @enum IxTimeSyncAcc1588PTPPortMode
118 *
119 * @brief Master or Slave mode for IEEE 1588 PTP Communication Port
120 */
121typedef enum /**< IxTimeSyncAcc1588PTPPortMode */
122{
123 IX_TIMESYNCACC_1588PTP_PORT_MASTER, /**< PTP Communication Port in Master Mode */
124 IX_TIMESYNCACC_1588PTP_PORT_SLAVE, /**< PTP Communication Port in Slave Mode */
125 IX_TIMESYNCACC_1588PTP_PORT_ANYMODE, /**< PTP Communication Port in ANY Mode
126 allows time stamping of all messages
127 including non-1588 PTP */
128 IX_TIMESYNCACC_1588PTP_PORT_MODE_INVALID /**< Invalid PTP Port Mode */
129}IxTimeSyncAcc1588PTPPortMode;
130
131/**
132 * @ingroup IxTimeSyncAcc
133 *
134 * @enum IxTimeSyncAcc1588PTPMsgType
135 *
136 * @brief 1588 PTP Messages types that can be detected on communication port
137 *
138 * Note that client code can determine this based on master/slave mode in which
139 * it is already operating in and this information is made available for the sake
140 * of convenience only.
141 */
142typedef enum /**< IxTimeSyncAcc1588PTPMsgType */
143{
144 IX_TIMESYNCACC_1588PTP_MSGTYPE_SYNC, /**< PTP Sync message sent by Master or received by Slave */
145 IX_TIMESYNCACC_1588PTP_MSGTYPE_DELAYREQ, /**< PTP Delay_Req message sent by Slave or received by Master */
146 IX_TIMESYNCACC_1588PTP_MSGTYPE_UNKNOWN /**< Other PTP and non-PTP message sent or received by both
147 Master and/or Slave */
148} IxTimeSyncAcc1588PTPMsgType;
149
150/**
151 * Section for struct
152 */
153
154/**
155 * @ingroup IxTimeSyncAcc
156 *
157 * @struct IxTimeSyncAccTimeValue
158 *
159 * @brief Struct to hold 64 bit SystemTime and TimeStamp values
160 */
161typedef struct /**< IxTimeSyncAccTimeValue */
162{
163 UINT32 timeValueLowWord; /**< Lower 32 bits of the time value */
164 UINT32 timeValueHighWord; /**< Upper 32 bits of the time value */
165} IxTimeSyncAccTimeValue;
166
167/**
168 * @ingroup IxTimeSyncAcc
169 *
170 * @struct IxTimeSyncAccUuid
171 *
172 * @brief Struct to hold 48 bit UUID values captured in Sync or Delay_Req messages
173 */
174typedef struct /**< IxTimeSyncAccUuid */
175{
176 UINT32 uuidValueLowWord; /**<The lower 32 bits of the UUID */
177 UINT16 uuidValueHighHalfword; /**<The upper 16 bits of the UUID */
178} IxTimeSyncAccUuid;
179
180/**
181 * @ingroup IxTimeSyncAcc
182 *
183 * @struct IxTimeSyncAccPtpMsgData
184 *
185 * @brief Struct for data from the PTP message returned when TimeStamp available
186 */
187typedef struct /**< IxTimeSyncAccPtpMsgData */
188{
189 IxTimeSyncAcc1588PTPMsgType ptpMsgType; /**< PTP Messages type */
190 IxTimeSyncAccTimeValue ptpTimeStamp; /**< 64 bit TimeStamp value from PTP Message */
191 IxTimeSyncAccUuid ptpUuid; /**< 48 bit UUID value from the PTP Message */
192 UINT16 ptpSequenceNumber; /**< 16 bit Sequence Number from PTP Message */
193} IxTimeSyncAccPtpMsgData;
194
195/**
196 * @ingroup IxTimeSyncAcc
197 *
198 * @struct IxTimeSyncAccStats
199 *
200 * @brief Statistics for the PTP messages
201 */
202typedef struct /**< IxTimeSyncAccStats */
203{
204 UINT32 rxMsgs; /**< Count of timestamps for received PTP Messages */
205 UINT32 txMsgs; /**< Count of timestamps for transmitted PTP Messages */
206} IxTimeSyncAccStats;
207
208/**
209 * @ingroup IxTimeSyncAcc
210 *
211 * @typedef IxTimeSyncAccTargetTimeCallback
212 *
213 * @brief Callback for use by target time stamp interrupt
214 */
215typedef void (*IxTimeSyncAccTargetTimeCallback)(IxTimeSyncAccTimeValue targetTime);
216
217/**
218 * @ingroup IxTimeSyncAcc
219 *
220 * @typedef IxTimeSyncAccAuxTimeCallback
221 *
222 * @brief Callback for use by auxiliary time interrupts
223 */
224typedef void (*IxTimeSyncAccAuxTimeCallback)(IxTimeSyncAccAuxMode auxMode,
225 IxTimeSyncAccTimeValue auxTime);
226
227/*
228 * Section for prototypes interface functions
229 */
230
231/**
232 * @ingroup IxTimeSyncAcc
233 *
234 * @fn IxTimeSyncAccStatus ixTimeSyncAccPTPPortConfigSet(
235 IxTimeSyncAcc1588PTPPort ptpPort,
236 IxTimeSyncAcc1588PTPPortMode ptpPortMode)
237 *
238 * @brief Configures the IEEE 1588 message detect on particular PTP port.
239 *
240 * @param ptpPort [in] - PTP port to config
241 * @param ptpPortMode [in]- Port to operate in Master or Slave mode
242 *
243 * This API will enable the time stamping on a particular PTP port.
244 *
245 * @li Re-entrant : No
246 * @li ISR Callable : No
247 *
248 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
249 * @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
250 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
251 */
252PUBLIC IxTimeSyncAccStatus
253ixTimeSyncAccPTPPortConfigSet(IxTimeSyncAcc1588PTPPort ptpPort,
254 IxTimeSyncAcc1588PTPPortMode ptpPortMode);
255
256/**
257 * @ingroup IxTimeSyncAcc
258 *
259 * @fn IxTimeSyncAccStatus ixTimeSyncAccPTPPortConfigGet(
260 IxTimeSyncAcc1588PTPPort ptpPort,
261 IxTimeSyncAcc1588PTPPortMode *ptpPortMode)
262 *
263 * @brief Retrieves IEEE 1588 PTP operation mode on particular PTP port.
264 *
265 * @param ptpPort [in] - PTP port
266 * @param ptpPortMode [in]- Mode of operation of PTP port (Master or Slave)
267 *
268 * This API will identify the time stamping capability of a PTP port by means
269 * of obtaining its mode of operation.
270 *
271 * @li Re-entrant : No
272 * @li ISR Callable : No
273 *
274 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
275 * @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
276 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
277 */
278PUBLIC IxTimeSyncAccStatus
279ixTimeSyncAccPTPPortConfigGet(IxTimeSyncAcc1588PTPPort ptpPort,
280 IxTimeSyncAcc1588PTPPortMode *ptpPortMode);
281
282/**
283 * @ingroup IxTimeSyncAcc
284 *
285 * @fn IxTimeSyncAccStatus ixTimeSyncAccPTPRxPoll(
286 IxTimeSyncAcc1588PTPPort ptpPort,
287 IxTimeSyncAccPtpMsgData *ptpMsgData)
288 *
289 * @brief Polls the IEEE 1588 message/time stamp detect status on a particular
290 * PTP Port on the Receive side.
291 *
292 * @param ptpPort [in] - PTP port to poll
293 * @param ptpMsgData [out] - Current TimeStamp and other Data
294 *
295 * This API will poll for the availability of a time stamp on the received Sync
296 * (Slave) or Delay_Req (Master) messages.
297 * The client application will provide the buffer.
298 *
299 * @li Re-entrant : No
300 * @li ISR Callable : No
301 *
302 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
303 * @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
304 * @li IX_TIMESYNCACC_NOTIMESTAMP - No time stamp available
305 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
306 */
307PUBLIC IxTimeSyncAccStatus
308ixTimeSyncAccPTPRxPoll(IxTimeSyncAcc1588PTPPort ptpPort,
309 IxTimeSyncAccPtpMsgData *ptpMsgData);
310
311/**
312 * @ingroup IxTimeSyncAcc
313 *
314 * @fn IxTimeSyncAccStatus ixTimeSyncAccPTPTxPoll(
315 IxTimeSyncAcc1588PTPPort ptpPort,
316 IxTimeSyncAccPtpMsgData *ptpMsgData)
317 *
318 *
319 * @brief Polls the IEEE 1588 message/time stamp detect status on a particular
320 * PTP Port on the Transmit side.
321 *
322 * @param ptpPort [in] - PTP port to poll
323 * @param ptpMsgData [out] - Current TimeStamp and other Data
324 *
325 * This API will poll for the availability of a time stamp on the transmitted
326 * Sync (Master) or Delay_Req (Slave) messages.
327 * The client application will provide the buffer.
328 *
329 * @li Re-entrant : No
330 * @li ISR Callable : No
331 *
332 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
333 * @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
334 * @li IX_TIMESYNCACC_NOTIMESTAMP - No time stamp available
335 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
336 */
337PUBLIC IxTimeSyncAccStatus
338ixTimeSyncAccPTPTxPoll(IxTimeSyncAcc1588PTPPort ptpPort,
339 IxTimeSyncAccPtpMsgData *ptpMsgData);
340
341/**
342 * @ingroup IxTimeSyncAcc
343 *
344 * @fn IxTimeSyncAccStatus ixTimeSyncAccSystemTimeSet(
345 IxTimeSyncAccTimeValue systemTime)
346 *
347 * @brief Sets the System Time in the IEEE 1588 hardware assist block
348 *
349 * @param systemTime [in] - Value to set System Time
350 *
351 * This API will set the SystemTime to given value.
352 *
353 * @li Re-entrant : yes
354 * @li ISR Callable : no
355 *
356 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
357 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
358 */
359PUBLIC IxTimeSyncAccStatus
360ixTimeSyncAccSystemTimeSet(IxTimeSyncAccTimeValue systemTime);
361
362/**
363 * @ingroup IxTimeSyncAcc
364 *
365 * @fn IxTimeSyncAccStatus ixTimeSyncAccSystemTimeGet(
366 IxTimeSyncAccTimeValue *systemTime)
367 *
368 * @brief Gets the System Time from the IEEE 1588 hardware assist block
369 *
370 * @param systemTime [out] - Copy the current System Time into the client
371 * application provided buffer
372 *
373 * This API will get the SystemTime from IEEE1588 block and return to client
374 *
375 * @li Re-entrant : no
376 * @li ISR Callable : no
377 *
378 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
379 * @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
380 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
381 */
382PUBLIC IxTimeSyncAccStatus
383ixTimeSyncAccSystemTimeGet(IxTimeSyncAccTimeValue *systemTime);
384
385/**
386 * @ingroup IxTimeSyncAcc
387 *
388 * @fn IxTimeSyncAccStatus ixTimeSyncAccTickRateSet(
389 UINT32 tickRate)
390 *
391 * @brief Sets the Tick Rate (Frequency Scaling Value) in the IEEE 1588
392 * hardware assist block
393 *
394 * @param tickRate [in] - Value to set Tick Rate
395 *
396 * This API will set the Tick Rate (Frequency Scaling Value) in the IEEE
397 * 1588 block to the given value. The Accumulator register (not client
398 * visible) is incremented by this TickRate value every clock cycle. When
399 * the Accumulator overflows, the SystemTime is incremented by one. This
400 * TickValue can therefore be used to adjust the system timer.
401 *
402 * @li Re-entrant : yes
403 * @li ISR Callable : no
404 *
405 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
406 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
407 */
408PUBLIC IxTimeSyncAccStatus
409ixTimeSyncAccTickRateSet(UINT32 tickRate);
410
411/**
412 * @ingroup IxTimeSyncAcc
413 *
414 * @fn IxTimeSyncAccStatus ixTimeSyncAccTickRateGet(
415 UINT32 *tickRate)
416 *
417 * @brief Gets the Tick Rate (Frequency Scaling Value) from the IEEE 1588
418 * hardware assist block
419 *
420 * @param tickRate [out] - Current Tick Rate value in the IEEE 1588 block
421 *
422 * This API will get the TickRate on IEE15588 block. Refer to @ref
423 * ixTimeSyncAccTickRateSet for notes on usage of this value.
424 *
425 * @li Reentrant : yes
426 * @li ISR Callable : no
427 *
428 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
429 * @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
430 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
431 */
432PUBLIC IxTimeSyncAccStatus
433ixTimeSyncAccTickRateGet(UINT32 *tickRate);
434
435/**
436 * @ingroup IxTimeSyncAcc
437 *
438 * @fn IxTimeSyncAccStatus ixTimeSyncAccTargetTimeInterruptEnable(
439 IxTimeSyncAccTargetTimeCallback targetTimeCallback)
440 *
441 * @brief Enables the interrupt to verify the condition where the System Time
442 * greater or equal to the Target Time in the IEEE 1588 hardware assist block.
443 * If the condition is true an interrupt will be sent to XScale.
444 *
445 * @param targetTimeCallback [in] - Callback to be invoked when interrupt fires
446 *
447 * This API will enable the Target Time reached/hit condition interrupt.
448 *
449 * NOTE: The client application needs to ensure that the APIs
450 * @ref ixTimeSyncAccTargetTimeInterruptEnable, @ref ixTimeSyncAccTargetTimeSet and
451 * @ref ixTimeSyncAccTargetTimeInterruptDisable are accessed in mutual exclusive
452 * manner with respect to each other.
453 *
454 * @li Re-entrant : no
455 * @li ISR Callable : yes
456 *
457 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
458 * @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed for callback
459 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
460 */
461PUBLIC IxTimeSyncAccStatus
462ixTimeSyncAccTargetTimeInterruptEnable(IxTimeSyncAccTargetTimeCallback targetTimeCallback);
463
464/**
465 * @ingroup IxTimeSyncAcc
466 *
467 * @fn IxTimeSyncAccStatus ixTimeSyncAccTargetTimeInterruptDisable(
468 void)
469 *
470 * @brief Disables the interrupt for the condition explained in the function
471 * description of @ref ixTimeSyncAccTargetTimeInterruptEnable.
472 *
473 * This API will disable the Target Time interrupt.
474 *
475 * NOTE: The client application needs to ensure that the APIs
476 * @ref ixTimeSyncAccTargetTimeInterruptEnable, @ref ixTimeSyncAccTargetTimeSet and
477 * @ref ixTimeSyncAccTargetTimeInterruptDisable are accessed in mutual exclusive
478 * manner with respect to each other.
479 *
480 * @li Re-entrant : no
481 * @li ISR Callable : yes
482 *
483 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
484 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
485 */
486PUBLIC IxTimeSyncAccStatus
487ixTimeSyncAccTargetTimeInterruptDisable(void);
488
489/**
490 * @ingroup IxTimeSyncAcc
491 *
492 * @fn IxTimeSyncAccStatus ixTimeSyncAccTargetTimePoll(
493 BOOL *ttmPollFlag,
494 IxTimeSyncAccTimeValue *targetTime)
495 *
496 * @brief Poll to verify the condition where the System Time greater or equal to
497 * the Target Time in the IEEE 1588 hardware assist block. If the condition is
498 * true an event flag is set in the hardware.
499 *
500 * @param ttmPollFlag [out] - TRUE if the target time reached/hit condition event set
501 * FALSE if the target time reached/hit condition event is
502 not set
503 * @param targetTime [out] - Capture current targetTime into client provided buffer
504 *
505 * Poll the target time reached/hit condition status. Return true and the current
506 * target time value, if the condition is true else return false.
507 *
508 * NOTE: The client application will need to clear the event flag that will be set
509 * as long as the condition that the System Time greater or equal to the Target Time is
510 * valid, in one of the following ways:
511 * 1) Invoke the API to change the target time
512 * 2) Change the system timer value
513 *
514 * @li Re-entrant : yes
515 * @li ISR Callable : no
516 *
517 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
518 * @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed
519 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
520 * @li IX_TIMESYNCACC_INTERRUPTMODEINUSE - Interrupt mode in use
521 */
522PUBLIC IxTimeSyncAccStatus
523ixTimeSyncAccTargetTimePoll(BOOL *ttmPollFlag,
524 IxTimeSyncAccTimeValue *targetTime);
525
526/**
527 * @ingroup IxTimeSyncAcc
528 *
529 * @fn IxTimeSyncAccStatus ixTimeSyncAccTargetTimeSet(
530 IxTimeSyncAccTimeValue targetTime)
531 *
532 * @brief Sets the Target Time in the IEEE 1588 hardware assist block
533 *
534 * @param targetTime [in] - Value to set Target Time
535 *
536 * This API will set the Target Time to a given value.
537 *
538 * NOTE: The client application needs to ensure that the APIs
539 * @ref ixTimeSyncAccTargetTimeInterruptEnable, @ref ixTimeSyncAccTargetTimeSet and
540 * @ref ixTimeSyncAccTargetTimeInterruptDisable are accessed in mutual exclusive
541 * manner with respect to each other.
542 *
543 * @li Reentrant : no
544 * @li ISR Callable : yes
545 *
546 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
547 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
548 */
549PUBLIC IxTimeSyncAccStatus
550ixTimeSyncAccTargetTimeSet(IxTimeSyncAccTimeValue targetTime);
551
552/**
553 * @ingroup IxTimeSyncAcc
554 *
555 * @fn IxTimeSyncAccStatus ixTimeSyncAccTargetTimeGet(
556 IxTimeSyncAccTimeValue *targetTime)
557 *
558 * @brief Gets the Target Time in the IEEE 1588 hardware assist block
559 *
560 * @param targetTime [out] - Copy current time to client provided buffer
561 *
562 * This API will get the Target Time from IEEE 1588 block and return to the
563 * client application
564 *
565 * @li Re-entrant : yes
566 * @li ISR Callable : no
567 *
568 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
569 * @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed
570 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
571 */
572PUBLIC IxTimeSyncAccStatus
573ixTimeSyncAccTargetTimeGet(IxTimeSyncAccTimeValue *targetTime);
574
575/**
576 * @ingroup IxTimeSyncAcc
577 *
578 * @fn IxTimeSyncAccStatus ixTimeSyncAccAuxTimeInterruptEnable(
579 IxTimeSyncAccAuxMode auxMode,
580 IxTimeSyncAccAuxTimeCallback auxTimeCallback)
581 *
582 * @brief Enables the interrupt notification for the given mode of Auxiliary Time
583 * Stamp in the IEEE 1588 hardware assist block
584 *
585 * @param auxMode [in] - Auxiliary time stamp register (slave or master) to use
586 * @param auxTimeCallback [in] - Callback to be invoked when interrupt fires
587 *
588 * This API will enable the Auxiliary Master/Slave Time stamp Interrupt.
589 *
590 * <pre>
591 * NOTE: 1) An individual callback is to be registered for each Slave and Master
592 * Auxiliary Time Stamp registers. Thus to register for both Master and Slave time
593 * stamp interrupts either the same callback or two separate callbacks the API has
594 * to be invoked twice.
595 * 2) On the IXDP465 Development Platform, the Auxiliary Timestamp signal for
596 * slave mode is tied to GPIO 8 pin. This signal is software routed by default to
597 * PCI for backwards compatibility with the IXDP425 Development Platform. This
598 * routing must be disabled for the auxiliary slave time stamp register to work
599 * properly. The following commands may be used to accomplish this. However, refer
600 * to the IXDP465 Development Platform Users Guide or the BSP/LSP documentation for
601 * more specific information.
602 *
603 * For Linux (at the Redboot prompt i.e., before loading zImage):
604 * mfill -b 0x54100000 -1 -l 1 -p 8
605 * mfill -b 0x54100001 -1 -l 1 -p 0x7f
606 * For vxWorks, at the prompt:
607 * intDisable(25)
608 * ixdp400FpgaIODetach(8)
609 * </pre>
610 *
611 * @li Re-entrant : no
612 * @li ISR Callable : no
613 *
614 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
615 * @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed for callback or
616 invalid auxiliary snapshot mode
617 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
618 */
619PUBLIC IxTimeSyncAccStatus
620ixTimeSyncAccAuxTimeInterruptEnable(IxTimeSyncAccAuxMode auxMode,
621 IxTimeSyncAccAuxTimeCallback auxTimeCallback);
622
623/**
624 * @ingroup IxTimeSyncAcc
625 *
626 * @fn IxTimeSyncAccStatus ixTimeSyncAccAuxTimeInterruptDisable(
627 IxTimeSyncAccAuxMode auxMode)
628 *
629 * @brief Disables the interrupt for the indicated mode of Auxiliary Time Stamp
630 * in the IEEE 1588 hardware assist block
631 *
632 * @param auxMode [in] - Auxiliary time stamp mode (slave or master) using which
633 * the interrupt will be disabled.
634 *
635 * This API will disable the Auxiliary Time Stamp Interrupt (Master or Slave)
636 *
637 * @li Re-entrant : yes
638 * @li ISR Callable : no
639 *
640 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
641 * @li IX_TIMESYNCACC_INVALIDPARAM - Invalid parameters passed
642 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
643 */
644PUBLIC IxTimeSyncAccStatus
645ixTimeSyncAccAuxTimeInterruptDisable(IxTimeSyncAccAuxMode auxMode);
646
647/**
648 * @ingroup IxTimeSyncAcc
649 *
650 * @fn IxTimeSyncAccStatus ixTimeSyncAccAuxTimePoll(
651 IxTimeSyncAccAuxMode auxMode,
652 BOOL *auxPollFlag,
653 IxTimeSyncAccTimeValue *auxTime)
654 *
655 * @brief Poll for the Auxiliary Time Stamp captured for the mode indicated
656 * (Master or Slave)
657 *
658 * @param auxMode [in] - Auxiliary Snapshot Register (Slave or Master) to be checked
659 * @param auxPollFlag [out] - TRUE if the time stamp captured in auxiliary
660 snapshot register
661 * FALSE if the time stamp not captured in
662 auxiliary snapshot register
663 * @param auxTime [out] - Copy the current Auxiliary Snapshot Register value into the
664 * client provided buffer
665 *
666 * Polls for the Time stamp in the appropriate Auxiliary Snapshot Registers based
667 * on the mode specified. Return true and the contents of the Auxiliary snapshot,
668 * if it is available else return false.
669 *
670 * Please refer to the note #2 of the API @ref ixTimeSyncAccAuxTimeInterruptEnable
671 * for more information for Auxiliary Slave mode.
672 *
673 * @li Re-entrant : yes
674 * @li ISR Callable : no
675 *
676 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
677 * @li IX_TIMESYNCACC_INVALIDPARAM - Null parameter passed for auxPollFlag,
678 callback or invalid auxiliary snapshot mode
679 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
680 * @li IX_TIMESYNCACC_INTERRUPTMODEINUSE - Interrupt mode in use
681 */
682PUBLIC IxTimeSyncAccStatus
683ixTimeSyncAccAuxTimePoll(IxTimeSyncAccAuxMode auxMode,
684 BOOL *auxPollFlag,
685 IxTimeSyncAccTimeValue *auxTime);
686
687/**
688 * @ingroup IxTimeSyncAcc
689 *
690 * @fn IxTimeSyncAccStatus ixTimeSyncAccReset(void)
691 *
692 * @brief Resets the IEEE 1588 hardware assist block
693 *
694 * Sets the reset bit in the IEEE1588 silicon which fully resets the silicon block
695 *
696 * @li Reentrant : yes
697 * @li ISR Callable : no
698 *
699 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
700 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
701 */
702PUBLIC IxTimeSyncAccStatus
703ixTimeSyncAccReset(void);
704
705/**
706 * @ingroup IxTimeSyncAcc
707 *
708 * @fn IxTimeSyncAccStatus ixTimeSyncAccStatsGet(IxTimeSyncAccStats
709 *timeSyncStats)
710 *
711 * @brief Returns the IxTimeSyncAcc Statistics in the client supplied buffer
712 *
713 * @param timeSyncStats [out] - TimeSync statistics counter values
714 *
715 * This API will return the statistics of the received or transmitted messages.
716 *
717 * NOTE: 1) These counters are updated only when the client polls for the time
718 * stamps or interrupt are enabled. This is because the IxTimeSyncAcc module
719 * does not either transmit or receive messages and does only run the code
720 * when explicit requests received by client application.
721 *
722 * 2) These statistics reflect the number of valid PTP messages exchanged
723 * in Master and Slave modes but includes all the messages (including valid
724 * non-PTP messages) while operating in the Any mode.
725 *
726 * @li Reentrant : no
727 * @li ISR Callable : no
728 *
729 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
730 * @li IX_TIMESYNCACC_INVALIDPARAM - NULL parameter passed
731 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
732 */
733PUBLIC IxTimeSyncAccStatus
734ixTimeSyncAccStatsGet(IxTimeSyncAccStats *timeSyncStats);
735
736/**
737 * @ingroup IxTimeSyncAcc
738 *
739 * @fn void ixTimeSyncAccStatsReset(void)
740 *
741 * @brief Reset Time Sync statistics
742 *
743 * This API will reset the statistics counters of the TimeSync access layer.
744 *
745 * @li Reentrant : yes
746 * @li ISR Callable: no
747 *
748 * @return @li None
749 */
750PUBLIC void
751ixTimeSyncAccStatsReset(void);
752
753/**
754 * @ingroup IxTimeSyncAcc
755 *
756 * @fn IxTimeSyncAccStatus ixTimeSyncAccShow(void)
757 *
758 * @brief Displays the Time Sync current status
759 *
760 * This API will display status on the current configuration of the IEEE
761 * 1588 hardware assist block, contents of the various time stamp registers,
762 * outstanding interrupts and/or events.
763 *
764 * Note that this is intended for debug only, and in contrast to the other
765 * functions, it does not clear the any of the status bits associated with
766 * active timestamps and so is passive in its nature.
767 *
768 * @li Reentrant : yes
769 * @li ISR Callable : no
770 *
771 * @return @li IX_TIMESYNCACC_SUCCESS - Operation is successful
772 * @li IX_TIMESYNCACC_FAILED - Internal error occurred
773 */
774PUBLIC IxTimeSyncAccStatus
775ixTimeSyncAccShow(void);
776
777#endif /* __ixp46X */
778#endif /* IXTIMESYNCACC_H */
779
780/**
781 * @} defgroup IxTimeSyncAcc
782 */
783