You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

159 lines
4.9 KiB

  1. /***************************************************************************
  2. * Copyright (C) 2013 Andes technology. *
  3. * Hsiangkai Wang <hkwang@andestech.com> *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 2 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  17. ***************************************************************************/
  18. #ifdef HAVE_CONFIG_H
  19. #include "config.h"
  20. #endif
  21. #include <helper/log.h>
  22. #include "nds32_aice.h"
  23. int aice_read_reg_64(struct aice_port_s *aice, uint32_t num, uint64_t *val)
  24. {
  25. if (!aice->port->api->read_reg_64) {
  26. LOG_WARNING("Not implemented: %s", __func__);
  27. return ERROR_FAIL;
  28. }
  29. return aice->port->api->read_reg_64(aice->coreid, num, val);
  30. }
  31. int aice_write_reg_64(struct aice_port_s *aice, uint32_t num, uint64_t val)
  32. {
  33. if (!aice->port->api->write_reg_64) {
  34. LOG_WARNING("Not implemented: %s", __func__);
  35. return ERROR_FAIL;
  36. }
  37. return aice->port->api->write_reg_64(aice->coreid, num, val);
  38. }
  39. int aice_read_tlb(struct aice_port_s *aice, target_addr_t virtual_address,
  40. target_addr_t *physical_address)
  41. {
  42. if (!aice->port->api->read_tlb) {
  43. LOG_WARNING("Not implemented: %s", __func__);
  44. return ERROR_FAIL;
  45. }
  46. return aice->port->api->read_tlb(aice->coreid, virtual_address, physical_address);
  47. }
  48. int aice_cache_ctl(struct aice_port_s *aice, uint32_t subtype, uint32_t address)
  49. {
  50. if (!aice->port->api->cache_ctl) {
  51. LOG_WARNING("Not implemented: %s", __func__);
  52. return ERROR_FAIL;
  53. }
  54. return aice->port->api->cache_ctl(aice->coreid, subtype, address);
  55. }
  56. int aice_set_retry_times(struct aice_port_s *aice, uint32_t a_retry_times)
  57. {
  58. if (!aice->port->api->set_retry_times) {
  59. LOG_WARNING("Not implemented: %s", __func__);
  60. return ERROR_FAIL;
  61. }
  62. return aice->port->api->set_retry_times(a_retry_times);
  63. }
  64. int aice_program_edm(struct aice_port_s *aice, char *command_sequence)
  65. {
  66. if (!aice->port->api->program_edm) {
  67. LOG_WARNING("Not implemented: %s", __func__);
  68. return ERROR_FAIL;
  69. }
  70. return aice->port->api->program_edm(aice->coreid, command_sequence);
  71. }
  72. int aice_set_command_mode(struct aice_port_s *aice,
  73. enum aice_command_mode command_mode)
  74. {
  75. if (!aice->port->api->set_command_mode) {
  76. LOG_WARNING("Not implemented: %s", __func__);
  77. return ERROR_FAIL;
  78. }
  79. return aice->port->api->set_command_mode(command_mode);
  80. }
  81. int aice_execute(struct aice_port_s *aice, uint32_t *instructions,
  82. uint32_t instruction_num)
  83. {
  84. if (!aice->port->api->execute) {
  85. LOG_WARNING("Not implemented: %s", __func__);
  86. return ERROR_FAIL;
  87. }
  88. return aice->port->api->execute(aice->coreid, instructions, instruction_num);
  89. }
  90. int aice_set_custom_srst_script(struct aice_port_s *aice, const char *script)
  91. {
  92. if (!aice->port->api->set_custom_srst_script) {
  93. LOG_WARNING("Not implemented: %s", __func__);
  94. return ERROR_FAIL;
  95. }
  96. return aice->port->api->set_custom_srst_script(script);
  97. }
  98. int aice_set_custom_trst_script(struct aice_port_s *aice, const char *script)
  99. {
  100. if (!aice->port->api->set_custom_trst_script) {
  101. LOG_WARNING("Not implemented: %s", __func__);
  102. return ERROR_FAIL;
  103. }
  104. return aice->port->api->set_custom_trst_script(script);
  105. }
  106. int aice_set_custom_restart_script(struct aice_port_s *aice, const char *script)
  107. {
  108. if (!aice->port->api->set_custom_restart_script) {
  109. LOG_WARNING("Not implemented: %s", __func__);
  110. return ERROR_FAIL;
  111. }
  112. return aice->port->api->set_custom_restart_script(script);
  113. }
  114. int aice_set_count_to_check_dbger(struct aice_port_s *aice, uint32_t count_to_check)
  115. {
  116. if (!aice->port->api->set_count_to_check_dbger) {
  117. LOG_WARNING("Not implemented: %s", __func__);
  118. return ERROR_FAIL;
  119. }
  120. return aice->port->api->set_count_to_check_dbger(count_to_check);
  121. }
  122. int aice_profiling(struct aice_port_s *aice, uint32_t interval, uint32_t iteration,
  123. uint32_t reg_no, uint32_t *samples, uint32_t *num_samples)
  124. {
  125. if (!aice->port->api->profiling) {
  126. LOG_WARNING("Not implemented: %s", __func__);
  127. return ERROR_FAIL;
  128. }
  129. return aice->port->api->profiling(aice->coreid, interval, iteration,
  130. reg_no, samples, num_samples);
  131. }