sw_cores.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // This file is Copyright (c) 2023 Victor Suarez Rovere <suarezvictor@gmail.com>
  2. // SPDX-License-Identifier: AGPL-3.0-only
  3. #define BUSMASTER_CPU busmaster_t //this enable compilation/execution of cores on CPU
  4. #ifdef __linux__
  5. #include <stdint.h>
  6. //FIXME: move the logic elsewhere
  7. #if UINTPTR_MAX > 0xFFFFFFFF
  8. #error 64-bit compilation would require that accelleration use a 64-bit offset to for busmaster)
  9. #endif
  10. #else
  11. #warning use std types
  12. typedef __INTPTR_TYPE__ intptr_t;
  13. typedef unsigned long long uint64_t;
  14. #endif
  15. #include "cflexhdl.h"
  16. #include "bus.h"
  17. #include "misc.h" //ACCEL_STATIC_ASSERT
  18. #include "accel_regs.h"
  19. #if SDRAM_BUS_BITS==32
  20. typedef uint32_t *busmaster_t;
  21. #else
  22. #error bus width not supported
  23. #endif
  24. #include "rectangle_fill32.cc"
  25. #include "ellipse_fill32.cc"
  26. #include "line32.cc"
  27. #include "sw_cores.h"
  28. void sw_rectangle_fill(accel_rectangle_fill32_layout_t *regs)
  29. {
  30. uint16 x0 = regs->x0;
  31. uint16 x1 = regs->x1;
  32. uint16 y0 = regs->y0;
  33. uint16 y1 = regs->y1;
  34. uint32 rgba = regs->rgba;
  35. uint32 base = regs->base;
  36. uint32 xstride = regs->xstride;
  37. uint32 ystride = regs->ystride;
  38. rectangle_fill32(BUSMASTER_ARG, x0, x1, y0, y1, rgba, base, xstride, ystride);
  39. }
  40. void sw_ellipse_fill(accel_ellipse_fill32_layout_t *regs)
  41. {
  42. uint16 x0 = regs->x0;
  43. uint16 x1 = regs->x1;
  44. uint16 y0 = regs->y0;
  45. uint16 y1 = regs->y1;
  46. uint32 rgba = regs->rgba;
  47. uint32 base = regs->base;
  48. uint32 xstride = regs->xstride;
  49. uint32 ystride = regs->ystride;
  50. ellipse_fill32(BUSMASTER_ARG, x0, x1, y0, y1, rgba, base, xstride, ystride);
  51. }
  52. void sw_line(accel_line32_layout_t *regs)
  53. {
  54. uint16 x0 = regs->x0;
  55. uint16 x1 = regs->x1;
  56. uint16 y0 = regs->y0;
  57. uint16 y1 = regs->y1;
  58. uint32 rgba = regs->rgba;
  59. uint32 base = regs->base;
  60. uint32 xstride = regs->xstride;
  61. uint32 ystride = regs->ystride;
  62. line32(BUSMASTER_ARG, x0, x1, y0, y1, rgba, base, xstride, ystride);
  63. }