memcpy.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef _PCILIB_MEMCPY_H
  2. #define _PCILIB_MEMCPY_H
  3. #include <stdio.h>
  4. #include <stdint.h>
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. /**
  9. * The collection of slow memcpy functions to move the data between BAR and system memory.
  10. *
  11. * The hardware may restrict access width or expose different behavior depending on the
  12. * access width. These functions access memory using the specified word width only.
  13. * 8-, 16-, 32-, and 64-bit wide access is supported.
  14. *
  15. * @param[out] dst - the destination memory region
  16. * @param[in] src - the source memory region
  17. * @param[in] access - the size of word (a single memory access) in bytes
  18. * @param[in] n - the number of words to copy (\p n * \p access bytes are copied).
  19. * @return - `dst` or NULL on error
  20. */
  21. void *pcilib_memcpy(void * dst, void const * src, uint8_t access, size_t n);
  22. /**
  23. * The collection of slow memcpy functions to move the data between BAR and system memory.
  24. *
  25. * The hardware may restrict access width or expose different behavior depending on the
  26. * access width. This function only perform 8-bit memory accesses.
  27. *
  28. * @param[out] dst - the destination memory region
  29. * @param[in] src - the source memory region
  30. * @param[in] len - the number of bytes to copy
  31. * @return - `dst` or NULL on error
  32. */
  33. void *pcilib_memcpy8(void * dst, void const * src, size_t len);
  34. /**
  35. * The collection of slow memcpy functions to move the data between BAR and system memory.
  36. *
  37. * The hardware may restrict access width or expose different behavior depending on the
  38. * access width. This function only perform 32-bit memory accesses.
  39. *
  40. * @param[out] dst - the destination memory region
  41. * @param[in] src - the source memory region
  42. * @param[in] len - the number of bytes to copy
  43. * @return - `dst` or NULL on error
  44. */
  45. void *pcilib_memcpy32(void * dst, void const * src, size_t len);
  46. /**
  47. * The collection of slow memcpy functions to move the data between BAR and system memory.
  48. *
  49. * The hardware may restrict access width or expose different behavior depending on the
  50. * access width. This function only perform 64-bit memory accesses.
  51. *
  52. * @param[out] dst - the destination memory region
  53. * @param[in] src - the source memory region
  54. * @param[in] len - the number of bytes to copy
  55. * @return - `dst` or NULL on error
  56. */
  57. void *pcilib_memcpy64(void * dst, void const * src, size_t len);
  58. #ifdef __cplusplus
  59. }
  60. #endif
  61. #endif /* _PCILIB_MEMCPY_H */