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