sys.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright(c) 2007-2022 Jianjun Jiang <8192542@qq.com>
  3. * Official site: http://xboot.org
  4. * Mobile phone: +86-18665388956
  5. * QQ: 8192542
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8. * of this software and associated documentation files (the "Software"), to deal
  9. * in the Software without restriction, including without limitation the rights
  10. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. * copies of the Software, and to permit persons to whom the Software is
  12. * furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in all
  15. * copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  23. * SOFTWARE.
  24. *
  25. */
  26. // (C) 2024 Victor Suarez Rovere <suarezvictor@gmail.com>
  27. // SPDX-License-Identifier: AGPL-3.0-only
  28. #include "driver_uart.h"
  29. void sys_dram_init(void)
  30. {
  31. /*
  32. // Copy ddr bin to 0x00030000
  33. la t1, _ddr_bin_start
  34. LREG t1, (t1)
  35. la t2, _ddr_bin_end
  36. LREG t2, (t2)
  37. sub a2, t2, t1
  38. la t1, _image_start
  39. LREG t1, (t1)
  40. la t2, _ddr_bin_start
  41. LREG t2, (t2)
  42. sub t0, t2, t1
  43. la a1, _start
  44. add a1, a1, t0
  45. li a0, 0x00030000
  46. call memcpy
  47. */
  48. }
  49. struct pt_regs_t {
  50. unsigned long x[32];
  51. unsigned long status;
  52. unsigned long epc;
  53. unsigned long badvaddr;
  54. unsigned long cause;
  55. unsigned long insn;
  56. };
  57. void riscv64_handle_exception(struct pt_regs_t * regs)
  58. {
  59. }
  60. //NOTE: this is called from start.S, so IT IS NOT called if program is loaded by FEL
  61. void sys_uart_init(void)
  62. {
  63. uart_probe(UART_BOOT);
  64. }