aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-06-16 14:15:43 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-06-22 10:51:49 -0400
commitb3105019709d69225e5d160bf7ac8722d0aefa7e (patch)
tree638e406df92979fe2b34583aded65b13d052ac08
parente92ce565ddd1bc5941491f8003ea996661bf6ae5 (diff)
downloadkutter-b3105019709d69225e5d160bf7ac8722d0aefa7e.tar.gz
kutter-b3105019709d69225e5d160bf7ac8722d0aefa7e.tar.xz
kutter-b3105019709d69225e5d160bf7ac8722d0aefa7e.zip
sam3x8e: Use readl/writel instead of readb/writeb() in serial.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/sam3x8e/serial.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/sam3x8e/serial.c b/src/sam3x8e/serial.c
index 2b76a69b..652d54d4 100644
--- a/src/sam3x8e/serial.c
+++ b/src/sam3x8e/serial.c
@@ -7,7 +7,7 @@
#include <string.h> // memmove
#include "autoconf.h" // CONFIG_SERIAL_BAUD
#include "board/gpio.h" // gpio_peripheral
-#include "board/io.h" // readb
+#include "board/io.h" // readl
#include "board/irq.h" // irq_save
#include "board/misc.h" // console_get_input
#include "command.h" // DECL_CONSTANT
@@ -86,7 +86,7 @@ enable_tx_irq(void)
char *
console_get_input(uint8_t *plen)
{
- *plen = readb(&receive_pos);
+ *plen = readl(&receive_pos);
return receive_buf;
}
@@ -96,7 +96,7 @@ console_pop_input(uint8_t len)
{
uint32_t copied = 0;
for (;;) {
- uint32_t rpos = readb(&receive_pos);
+ uint32_t rpos = readl(&receive_pos);
uint32_t needcopy = rpos - len;
if (needcopy) {
memmove(&receive_buf[copied], &receive_buf[copied + len]
@@ -104,7 +104,7 @@ console_pop_input(uint8_t len)
copied = needcopy;
}
irqstatus_t flag = irq_save();
- if (rpos != readb(&receive_pos)) {
+ if (rpos != readl(&receive_pos)) {
// Raced with irq handler - retry
irq_restore(flag);
continue;
@@ -119,23 +119,23 @@ console_pop_input(uint8_t len)
char *
console_get_output(uint8_t len)
{
- uint32_t tpos = readb(&transmit_pos), tmax = readb(&transmit_max);
+ uint32_t tpos = readl(&transmit_pos), tmax = readl(&transmit_max);
if (tpos >= tmax) {
tpos = tmax = 0;
- writeb(&transmit_max, 0);
- writeb(&transmit_pos, 0);
+ writel(&transmit_max, 0);
+ writel(&transmit_pos, 0);
}
if (tmax + len <= sizeof(transmit_buf))
return &transmit_buf[tmax];
if (tmax - tpos + len > sizeof(transmit_buf))
return NULL;
// Disable TX irq and move buffer
- writeb(&transmit_max, 0);
- tpos = readb(&transmit_pos);
+ writel(&transmit_max, 0);
+ tpos = readl(&transmit_pos);
tmax -= tpos;
memmove(&transmit_buf[0], &transmit_buf[tpos], tmax);
- writeb(&transmit_pos, 0);
- writeb(&transmit_max, tmax);
+ writel(&transmit_pos, 0);
+ writel(&transmit_max, tmax);
enable_tx_irq();
return &transmit_buf[tmax];
}
@@ -144,6 +144,6 @@ console_get_output(uint8_t len)
void
console_push_output(uint8_t len)
{
- writeb(&transmit_max, readb(&transmit_max) + len);
+ writel(&transmit_max, readl(&transmit_max) + len);
enable_tx_irq();
}