target.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * @file target.h
  3. * @brief Debug target functions.
  4. *
  5. * This file is responsible for configuring the debug target
  6. * and accessing its memory-mapped devices.
  7. */
  8. #pragma once
  9. #include <stddef.h>
  10. #include <stdint.h>
  11. #include <stdbool.h>
  12. /**
  13. * @brief Attach and halt the debug target.
  14. *
  15. * @param[in] target_id target address or id (specified in device datasheet)
  16. * @returns true on success, false otherwise.
  17. */
  18. bool target_attach(uint32_t id);
  19. /**
  20. * @brief Detach and resume the debug target.
  21. *
  22. * @returns true on success, false otherwise.
  23. */
  24. bool target_detach(void);
  25. /**
  26. * @brief Read a 32-bit word within target address space.
  27. *
  28. * @param[in] address target memory address.
  29. * @param[out] data pointer to the value to hold the read data.
  30. * @returns true on success, false otherwise.
  31. */
  32. bool target_read_memory_32(uint32_t address, uint32_t* data);
  33. /**
  34. * @brief Write a 32-bit word within target address space.
  35. *
  36. * @param[in] address target memory address.
  37. * @param[in] data value to be written as data.
  38. * @returns true on success, false otherwise.
  39. */
  40. bool target_write_memory_32(uint32_t address, uint32_t data);