34 .buffer_addr_offset = 4,
36 .write_pos_offset = 12,
37 .read_pos_offset = 16,
44 .buffer_addr_offset = 8,
46 .write_pos_offset = 20,
47 .read_pos_offset = 24,
143 uint32_t first_length;
156 len - first_length,
buffer + first_length);
174 uint32_t first_length;
196 len - first_length,
buffer);
226 unsigned int channel_index,
const uint8_t *
buffer,
size_t *
length,
236 LOG_ERROR(
"rtt: Failed to read down-channel %u description",
242 LOG_WARNING(
"rtt: Down-channel %u is not active", channel_index);
247 LOG_WARNING(
"rtt: Down-channel %u is not large enough",
291 size_t id_matched_length = 0;
292 const size_t id_length = strlen(
id);
294 LOG_INFO(
"rtt: Searching for control block '%s'",
id);
299 const size_t buf_size =
MIN(
sizeof(buf), address_end -
addr);
305 for (
size_t buf_off = 0; buf_off < buf_size; buf_off++) {
306 if (id_matched_length > 0 &&
307 buf[buf_off] !=
id[id_matched_length]) {
309 id_matched_length = 0;
312 if (buf[buf_off] ==
id[id_matched_length])
315 if (id_matched_length == id_length) {
337 LOG_ERROR(
"rtt: Failed to read channel %u description",
378 uint32_t first_length;
391 len - first_length,
buffer + first_length);
413 size_t num_channels,
void *user_data)
417 for (
size_t i = 0; i < num_channels; i++) {
430 LOG_ERROR(
"rtt: Failed to read up-channel %zu description", i);
435 LOG_WARNING(
"rtt: Up-channel %zu is not active", i);
440 LOG_WARNING(
"rtt: Up-channel %zu is not large enough", i);
448 LOG_ERROR(
"rtt: Failed to read from up-channel %zu", i);
Support functions to access arbitrary bits in a byte array.
uint64_t buffer
Pointer to data buffer to send over SPI.
uint32_t size
Size of dw_spi_transaction::buffer.
uint32_t address
Starting address. Sector aligned.
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
target_addr_t addr
Start address to search for the control block.
struct rtt_control ctrl
Control block.
#define RTT_CHANNEL_SIZE_64
#define RTT_CB_MAX_ID_LENGTH
Control block ID length in bytes, including the trailing null-terminator.
#define RTT_CHANNEL_BUFFER_MIN_SIZE
#define RTT_CHANNEL_SIZE_32
rtt_channel_type
Channel type.
@ RTT_CHANNEL_TYPE_UP
Up channel (target to host).
@ RTT_CHANNEL_TYPE_DOWN
Down channel (host to target).
uint32_t read_pos
Read position within the buffer in bytes.
target_addr_t buffer_addr
Buffer address on the target.
target_addr_t address
Channel structure address on the target.
uint32_t write_pos
Write position within the buffer in bytes.
uint32_t size
Channel buffer size in bytes.
target_addr_t name_addr
Channel name address on the target.
uint32_t flags
Buffer flags.
unsigned int channel_size
unsigned int read_pos_offset
unsigned int write_pos_offset
unsigned int flags_offset
unsigned int buffer_addr_offset
char id[RTT_CB_MAX_ID_LENGTH]
Control block identifier, including trailing null-terminator.
target_addr_t address
Control block address on the target.
uint32_t num_up_channels
Maximum number of up-channels.
uint32_t num_down_channels
Maximum number of down-channels.
struct rtt_sink_list * next
int target_rtt_read_control_block(struct target *target, target_addr_t address, struct rtt_control *ctrl, void *user_data)
static int read_from_channel(struct target *target, const struct rtt_channel *channel, uint8_t *buffer, size_t *length)
static int read_channel_name(struct target *target, target_addr_t address, char *name, size_t length)
static int read_rtt_channel(struct target *target, const struct rtt_control *ctrl, unsigned int channel_index, enum rtt_channel_type type, struct rtt_channel *channel)
static bool channel_is_active(const struct rtt_channel *channel)
int target_rtt_read_callback(struct target *target, const struct rtt_control *ctrl, struct rtt_sink_list **sinks, size_t num_channels, void *user_data)
static int write_to_channel(struct target *target, const struct rtt_channel *channel, const uint8_t *buffer, size_t *length)
static const struct rtt_control_params * get_rtt_params(struct target *target)
int target_rtt_find_control_block(struct target *target, target_addr_t *address, size_t size, const char *id, bool *found, void *user_data)
int target_rtt_stop(struct target *target, void *user_data)
int target_rtt_start(struct target *target, const struct rtt_control *ctrl, void *user_data)
static const struct rtt_control_params rtt_params_32
int target_rtt_write_callback(struct target *target, struct rtt_control *ctrl, unsigned int channel_index, const uint8_t *buffer, size_t *length, void *user_data)
static const struct rtt_control_params rtt_params_64
int target_rtt_read_channel_info(struct target *target, const struct rtt_control *ctrl, unsigned int channel_index, enum rtt_channel_type type, struct rtt_channel_info *info, void *user_data)
uint64_t target_buffer_get_u64(struct target *target, const uint8_t *buffer)
int target_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
unsigned int target_address_bits(struct target *target)
Return the number of address bits this target supports.
int target_write_u32(struct target *target, target_addr_t address, uint32_t value)
uint32_t target_buffer_get_u32(struct target *target, const uint8_t *buffer)
static struct ublast_lowlevel_priv info