accel_cores.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // This file is Copyright (c) 2023 Victor Suarez Rovere <suarezvictor@gmail.com>
  2. // SPDX-License-Identifier: AGPL-3.0-only
  3. #ifndef __ACCEL_CORES_H__
  4. #define __ACCEL_CORES_H__
  5. //Most of this file could be generated automatically
  6. #include <stddef.h> //just for NULL
  7. #ifndef DISABLE_HARDWARE_ACCEL
  8. #include <generated/csr.h>
  9. #endif
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. void accel_framebuffer_base_set(uintptr_t base);
  14. // accel_rectangle_fill32 --------------------------------------------------------------------------
  15. #include "accel_rectangle_fill32.inl"
  16. #if !defined(CSR_ACCEL_RECTANGLE_FILL32_BASE) && defined(ACCEL_RECTANGLE_FILL32_REGION)
  17. #define CSR_ACCEL_RECTANGLE_FILL32_BASE (size_t)(ACCEL_RECTANGLE_FILL32_REGION+ACCEL_RECTANGLE_FILL32_CSR_PAGE_OFFSET)
  18. #endif
  19. #ifdef CSR_ACCEL_RECTANGLE_FILL32_BASE
  20. static accel_rectangle_fill32_layout_t * const accel_rectangle_fill32_regs =
  21. (accel_rectangle_fill32_layout_t *) CSR_ACCEL_RECTANGLE_FILL32_BASE;
  22. #else
  23. static accel_rectangle_fill32_layout_t * const accel_rectangle_fill32_regs = NULL;
  24. #endif
  25. unsigned accel_rectangle_fill(accel_rectangle_fill32_layout_t *regs, int x0, int y0, int x1, int y1, uint32_t rgba);
  26. // accel_ellipse_fill32 ----------------------------------------------------------------------------
  27. #include "accel_ellipse_fill32.inl"
  28. #if !defined(CSR_ACCEL_ELLIPSE_FILL32_BASE) && defined(ACCEL_ELLIPSE_FILL32_REGION)
  29. #define CSR_ACCEL_ELLIPSE_FILL32_BASE (size_t)(ACCEL_ELLIPSE_FILL32_REGION+ACCEL_ELLIPSE_FILL32_CSR_PAGE_OFFSET)
  30. #endif
  31. #ifdef CSR_ACCEL_ELLIPSE_FILL32_BASE
  32. static accel_ellipse_fill32_layout_t * const accel_ellipse_fill32_regs =
  33. (accel_ellipse_fill32_layout_t *) CSR_ACCEL_ELLIPSE_FILL32_BASE;
  34. #else
  35. static accel_ellipse_fill32_layout_t * const accel_ellipse_fill32_regs = NULL;
  36. #endif
  37. unsigned accel_ellipse_fill(accel_ellipse_fill32_layout_t *regs, int x0, int y0, int x1, int y1, uint32_t rgba);
  38. // accel_line32 ------------------------------------------------------------------------------------
  39. #include "accel_line32.inl"
  40. #if !defined(CSR_ACCEL_LINE32_BASE) && defined(ACCEL_LINE32_REGION)
  41. #define CSR_ACCEL_LINE32_BASE (size_t)(ACCEL_LINE32_REGION+ACCEL_LINE32_CSR_PAGE_OFFSET)
  42. #endif
  43. #ifdef CSR_ACCEL_LINE32_BASE
  44. static accel_line32_layout_t * const accel_line32_regs =
  45. (accel_line32_layout_t *) CSR_ACCEL_LINE32_BASE;
  46. #else
  47. static accel_line32_layout_t * const accel_line32_regs = NULL;
  48. #endif
  49. unsigned accel_line(accel_line32_layout_t *regs, int x0, int y0, int x1, int y1, uint32_t rgba);
  50. //helpers ------------------------------------------------------------------------------------------
  51. unsigned accel_rectangle(accel_line32_layout_t *regs, int x0, int y0, int x1, int y1, uint32_t rgba);
  52. //decoders ------------------------------------------------------------------------------------------
  53. void accel_jpeg_decode(const void *coded_buf, size_t coded_len, void *dst, unsigned writer_stride,
  54. unsigned *decoded_width, unsigned *decoded_height, int wait_done);
  55. void accel_jpeg_decode_waitdone(unsigned *decoded_width, unsigned *decoded_height);
  56. void accel_bmp_decode(const void *coded_buf, size_t coded_len, void *dst, unsigned writer_stride,
  57. unsigned *decoded_width, unsigned *decoded_height, int wait_done);
  58. #ifdef __cplusplus
  59. } //extern "C"
  60. #endif
  61. #endif //__ACCEL_CORES_H__