From 9f8a07d3a0a47a32e88ccb477a2cb7723c9f4934 Mon Sep 17 00:00:00 2001 From: Maurizio Lombardi Date: Thu, 17 Jan 2013 20:58:34 +0100 Subject: [PATCH] bootloader: add support to the beaglebone UART0 --- boot/arch/arm32/include/main.h | 9 +++++++++ boot/arch/arm32/src/putchar.c | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/boot/arch/arm32/include/main.h b/boot/arch/arm32/include/main.h index 62be29f5c..94c8aea76 100644 --- a/boot/arch/arm32/include/main.h +++ b/boot/arch/arm32/include/main.h @@ -50,6 +50,15 @@ /* Check this bit before writing (tx fifo full) */ #define BBXM_THR_FULL 0x00000001 +/** Beaglebone UART register addresses + * + * This is UART0 of AM335x CPU + */ +#define BBONE_SCONS_THR 0x44E09000 +#define BBONE_SCONS_SSR 0x44E09044 + +/** Check this bit before writing (tx fifo full) */ +#define BBONE_TXFIFO_FULL 0x00000001 /** GTA02 serial console UART register addresses. * diff --git a/boot/arch/arm32/src/putchar.c b/boot/arch/arm32/src/putchar.c index 23a61d964..d5b6cbe19 100644 --- a/boot/arch/arm32/src/putchar.c +++ b/boot/arch/arm32/src/putchar.c @@ -40,6 +40,28 @@ #include #include +#ifdef MACHINE_beaglebone + +/** Send a byte to the am335x serial console. + * + * @param byte Byte to send. + */ +static void scons_sendb_bbone(uint8_t byte) +{ + volatile uint32_t *thr = + (volatile uint32_t *) BBONE_SCONS_THR; + volatile uint32_t *ssr = + (volatile uint32_t *) BBONE_SCONS_SSR; + + /* Wait until transmitter is empty */ + while (*ssr & BBONE_TXFIFO_FULL); + + /* Transmit byte */ + *thr = (uint32_t) byte; +} + +#endif + #ifdef MACHINE_beagleboardxm /** Send a byte to the amdm37x serial console. @@ -105,6 +127,9 @@ static void scons_sendb_icp(uint8_t byte) */ static void scons_sendb(uint8_t byte) { +#ifdef MACHINE_beaglebone + scons_sendb_bbone(byte); +#endif #ifdef MACHINE_beagleboardxm scons_sendb_bbxm(byte); #endif -- 2.11.4.GIT