IxTimeSyncAcc.h 27 KB

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