summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/tms570/console/printk-support.c
diff options
context:
space:
mode:
authorPremysl Houdek <kom541000@gmail.com>2014-08-20 17:24:23 +0200
committerGedare Bloom <gedare@rtems.org>2014-08-20 13:44:23 -0400
commit4407ee675cb22e8bb870a76eafc590eb6e754315 (patch)
treeaf8b73c912e1011cd99d5c8966756c06a08bacfd /c/src/lib/libbsp/arm/tms570/console/printk-support.c
parentlpc24xx/lpc17xx: lpc24xx_pin_set_function() keep LPC4088 W type pin in digita... (diff)
downloadrtems-4407ee675cb22e8bb870a76eafc590eb6e754315.tar.bz2
BSP for TMS570LS31x Hercules Development Kit from TI (TMS570LS3137)
Included variants: tms570ls3137_hdk_intram - place code and data into internal SRAM tms570ls3137_hdk_sdram - place code into external SDRAM and data to SRAM tms570ls3137_hdk - variant prepared for stand-alone RTEMS aplication stored and running directly from flash. Not working yet. Chip initialization code not included in BSP. External startup generated by TI's HalCoGen was used for testing and debugging. More information about TMS570 BSP can be found at http://www.rtems.org/wiki/index.php/Tms570 Patch version 2 - most of the formatting suggestion applied. - BSP converted to use clock shell - console driver "set attributes" tested. Baudrate change working Patch version 3 - more formatting changes. - removed leftover defines and test functions Todo: refactor header files (name register fields)
Diffstat (limited to 'c/src/lib/libbsp/arm/tms570/console/printk-support.c')
-rw-r--r--c/src/lib/libbsp/arm/tms570/console/printk-support.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/arm/tms570/console/printk-support.c b/c/src/lib/libbsp/arm/tms570/console/printk-support.c
new file mode 100644
index 0000000000..241ca9b996
--- /dev/null
+++ b/c/src/lib/libbsp/arm/tms570/console/printk-support.c
@@ -0,0 +1,85 @@
+/**
+ * @file printk-support.c
+ *
+ * @ingroup tms570
+ *
+ * @brief definitions of serial line for debugging.
+ */
+
+/*
+ * Copyright (c) 2014 Premysl Houdek <kom541000@gmail.com>
+ *
+ * Google Summer of Code 2014 at
+ * Czech Technical University in Prague
+ * Zikova 1903/4
+ * 166 36 Praha 6
+ * Czech Republic
+ *
+ * Based on LPC24xx and LPC1768 BSP
+ * by embedded brains GmbH and others
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include <rtems/bspIo.h>
+#include <stdint.h>
+#include <bsp/tms570-sci.h>
+#include <bsp/tms570-sci-driver.h>
+
+
+/**
+ * @brief Puts chars into peripheral
+ *
+ * debug functions always use serial dev 0 peripheral
+ *
+ * @retval Void
+ */
+static void tms570_putc(char ch)
+{
+ rtems_interrupt_level level;
+
+ rtems_interrupt_disable(level);
+ while ( ( driver_context_table[0].regs->SCIFLR & 0x100 ) == 0) {
+ rtems_interrupt_flash(level);
+ }
+ driver_context_table[0].regs->SCITD = ch;
+ rtems_interrupt_enable(level);
+}
+
+/**
+ * @brief debug console output
+ *
+ * debug functions always use serial dev 0 peripheral
+ *
+ * @retval Void
+ */
+static void tms570_uart_output(char c)
+{
+ if ( c == '\n' ) {
+ char r = '\r';
+ tms570_putc(r);
+ }
+ tms570_putc(c);
+}
+
+/**
+ * @brief debug console input
+ *
+ * debug functions always use serial dev 0 peripheral
+ *
+ * @retval x Read char
+ * @retval -1 No input character available
+ */
+static int tms570_uart_input( void )
+{
+ if ( driver_context_table[0].regs->SCIFLR & (1<<9) ) {
+ return driver_context_table[0].regs->SCIRD;
+ } else {
+ return -1;
+ }
+}
+
+BSP_output_char_function_type BSP_output_char = tms570_uart_output;
+BSP_polling_getchar_function_type BSP_poll_char = tms570_uart_input;