trax_init.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2020 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #include <stdio.h>
  15. #include "esp_err.h"
  16. #include "esp_log.h"
  17. #include "trax.h"
  18. #include "soc/sensitive_reg.h"
  19. #include "sdkconfig.h"
  20. #define TRACEMEM_MUX_BLK0_NUM 19
  21. #define TRACEMEM_MUX_BLK1_NUM 20
  22. static const char* __attribute__((unused)) TAG = "trax";
  23. int trax_enable(trax_ena_select_t which)
  24. {
  25. #ifndef CONFIG_ESP32S2_TRAX
  26. ESP_LOGE(TAG, "Trax_enable called, but trax is disabled in menuconfig!");
  27. return ESP_ERR_NO_MEM;
  28. #endif
  29. if (which != TRAX_ENA_PRO) {
  30. return ESP_ERR_INVALID_ARG;
  31. }
  32. REG_WRITE(DPORT_PMS_OCCUPY_3_REG, BIT(TRACEMEM_MUX_BLK1_NUM-4));
  33. return ESP_OK;
  34. }