caam_qnx.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* caam_qnx.h
  2. *
  3. * Copyright (C) 2006-2023 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL.
  6. *
  7. * wolfSSL is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * wolfSSL is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  20. */
  21. /* This file is porting low level QNX interactions, such as reading register */
  22. #ifndef CAAM_QNX_H
  23. #define CAAM_QNX_H
  24. #include <sys/mman.h>
  25. #ifdef __aarch64__
  26. #include <aarch64/inout.h>
  27. #else
  28. #include <hw/inout.h>
  29. #endif
  30. #include <sys/iofunc.h>
  31. #include <sys/neutrino.h>
  32. #include <pthread.h>
  33. #define CAAM_MUTEX pthread_mutex_t
  34. #define CAAM_INIT_MUTEX(x) pthread_mutex_init((x), NULL)
  35. #define CAAM_FREE_MUTEX(x) pthread_mutex_destroy((x))
  36. #define CAAM_LOCK_MUTEX(x) pthread_mutex_lock((x))
  37. #define CAAM_UNLOCK_MUTEX(x) pthread_mutex_unlock((x))
  38. #define Error int
  39. #define Value int
  40. #define Boolean int
  41. #define CAAM_ADDRESS uintptr_t
  42. #define Success 1
  43. #define Failure 0
  44. #define INTERRUPT_Panic() do {} while (0)
  45. #define MemoryMapMayNotBeEmpty -1
  46. #define CAAM_WAITING -2
  47. #define NoActivityReady -1
  48. #define MemoryOperationNotPerformed -1
  49. #define CAAM_ARGS_E -3
  50. #ifndef WOLFSSL_CAAM_BUFFER
  51. #define WOLFSSL_CAAM_BUFFER
  52. typedef struct CAAM_BUFFER {
  53. int BufferType;
  54. CAAM_ADDRESS TheAddress;
  55. int Length;
  56. } CAAM_BUFFER;
  57. #endif
  58. /* check kernel and yield to same priority threads waiting */
  59. #define CAAM_CPU_CHILL() sched_yield()
  60. #endif /* CAAM_QNX_H */