aaqnx.c 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /****************************************************************************
  2. *
  3. * SciTech Nucleus Graphics Architecture
  4. *
  5. * Copyright (C) 1991-1998 SciTech Software, Inc.
  6. * All rights reserved.
  7. *
  8. * ======================================================================
  9. * |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
  10. * | |
  11. * |This copyrighted computer code contains proprietary technology |
  12. * |owned by SciTech Software, Inc., located at 505 Wall Street, |
  13. * |Chico, CA 95928 USA (http://www.scitechsoft.com). |
  14. * | |
  15. * |The contents of this file are subject to the SciTech Nucleus |
  16. * |License; you may *not* use this file or related software except in |
  17. * |compliance with the License. You may obtain a copy of the License |
  18. * |at http://www.scitechsoft.com/nucleus-license.txt |
  19. * | |
  20. * |Software distributed under the License is distributed on an |
  21. * |"AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
  22. * |implied. See the License for the specific language governing |
  23. * |rights and limitations under the License. |
  24. * | |
  25. * |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
  26. * ======================================================================
  27. *
  28. * Language: ANSI C
  29. * Environment: QNX
  30. *
  31. * Description: OS specific Nucleus Graphics Architecture services for
  32. * the QNX operating system.
  33. *
  34. ****************************************************************************/
  35. #include "nucleus/graphics.h"
  36. #include <time.h>
  37. /*---------------------------- Global Variables ---------------------------*/
  38. static ibool haveRDTSC;
  39. /*-------------------------- Implementation -------------------------------*/
  40. /****************************************************************************
  41. REMARKS:
  42. Nothing special for this OS.
  43. ****************************************************************************/
  44. GA_sharedInfo * NAPI GA_getSharedInfo(
  45. int device)
  46. {
  47. (void)device;
  48. return NULL;
  49. }
  50. /****************************************************************************
  51. REMARKS:
  52. Nothing special for this OS.
  53. ****************************************************************************/
  54. ibool NAPI GA_getSharedExports(
  55. GA_exports *gaExp)
  56. {
  57. (void)gaExp;
  58. return false;
  59. }
  60. /****************************************************************************
  61. REMARKS:
  62. This function initialises the high precision timing functions for the
  63. Nucleus loader library.
  64. ****************************************************************************/
  65. ibool NAPI GA_TimerInit(void)
  66. {
  67. if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
  68. haveRDTSC = true;
  69. return true;
  70. }
  71. /****************************************************************************
  72. REMARKS:
  73. This function reads the high resolution timer.
  74. ****************************************************************************/
  75. void NAPI GA_TimerRead(
  76. GA_largeInteger *value)
  77. {
  78. if (haveRDTSC)
  79. _GA_readTimeStamp(value);
  80. else {
  81. struct timespec ts;
  82. clock_gettime(CLOCK_REALTIME, &ts);
  83. value->low = (ts.tv_nsec / 1000 + ts.tv_sec * 1000000);
  84. value->high = 0;
  85. }
  86. }