aboutsummaryrefslogtreecommitdiffstats
path: root/src/pru/main.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-06-30 17:04:30 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-06-30 19:54:40 -0400
commitc8dca0a56cc9be84c43b6e16266411196f51656c (patch)
tree26701569ade224c4de5680bdf43a0349a09ebe33 /src/pru/main.c
parentda3569c49044e23f7dee0ce0226f350fd9f039f9 (diff)
downloadkutter-c8dca0a56cc9be84c43b6e16266411196f51656c.tar.gz
kutter-c8dca0a56cc9be84c43b6e16266411196f51656c.tar.xz
kutter-c8dca0a56cc9be84c43b6e16266411196f51656c.zip
pru: Use a pointer when working with send_data array items
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/pru/main.c')
-rw-r--r--src/pru/main.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/pru/main.c b/src/pru/main.c
index ea0ec602..40327b39 100644
--- a/src/pru/main.c
+++ b/src/pru/main.c
@@ -125,19 +125,16 @@ console_sendf(const struct command_encoder *ce, va_list args)
{
// Verify space for message
uint32_t max_size = ce->max_size;
- if (max_size > sizeof(SHARED_MEM->send_data[0].data))
- return;
uint32_t send_push_pos = SHARED_MEM->send_push_pos;
- if (readl(&SHARED_MEM->send_data[send_push_pos].count))
- // Queue full
+ struct shared_response_buffer *s = &SHARED_MEM->send_data[send_push_pos];
+ if (max_size > sizeof(s->data) || readl(&s->count))
return;
// Generate message
- char *buf = SHARED_MEM->send_data[send_push_pos].data;
- uint32_t msglen = command_encodef(buf, max_size, ce, args);
+ uint32_t msglen = command_encodef(s->data, max_size, ce, args);
// Signal PRU0 to transmit message
- writel(&SHARED_MEM->send_data[send_push_pos].count, msglen);
+ writel(&s->count, msglen);
write_r31(R31_WRITE_IRQ_SELECT | (KICK_PRU0_EVENT - R31_WRITE_IRQ_OFFSET));
SHARED_MEM->send_push_pos = (
(send_push_pos + 1) % ARRAY_SIZE(SHARED_MEM->send_data));