source: rtems/c/src/lib/libbsp/arm/tms570/console/printk-support.c @ 9588946

4.115
Last change on this file since 9588946 was 4407ee6, checked in by Premysl Houdek <kom541000@…>, on 08/20/14 at 15:24:23

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)

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 * @file printk-support.c
3 *
4 * @ingroup tms570
5 *
6 * @brief definitions of serial line for debugging.
7 */
8
9/*
10 * Copyright (c) 2014 Premysl Houdek <kom541000@gmail.com>
11 *
12 * Google Summer of Code 2014 at
13 * Czech Technical University in Prague
14 * Zikova 1903/4
15 * 166 36 Praha 6
16 * Czech Republic
17 *
18 * Based on LPC24xx and LPC1768 BSP
19 * by embedded brains GmbH and others
20 *
21 * The license and distribution terms for this file may be
22 * found in the file LICENSE in this distribution or at
23 * http://www.rtems.org/license/LICENSE.
24 */
25
26#include <rtems/bspIo.h>
27#include <stdint.h>
28#include <bsp/tms570-sci.h>
29#include <bsp/tms570-sci-driver.h>
30
31
32/**
33 * @brief Puts chars into peripheral
34 *
35 * debug functions always use serial dev 0 peripheral
36 *
37 * @retval Void
38 */
39static void tms570_putc(char ch)
40{
41  rtems_interrupt_level level;
42
43  rtems_interrupt_disable(level);
44  while ( ( driver_context_table[0].regs->SCIFLR & 0x100 ) == 0) {
45    rtems_interrupt_flash(level);
46  }
47  driver_context_table[0].regs->SCITD = ch;
48  rtems_interrupt_enable(level);
49}
50
51/**
52 * @brief debug console output
53 *
54 * debug functions always use serial dev 0 peripheral
55 *
56 * @retval Void
57 */
58static void tms570_uart_output(char c)
59{
60  if ( c == '\n' ) {
61    char r = '\r';
62    tms570_putc(r);
63  }
64  tms570_putc(c);
65}
66
67/**
68 * @brief debug console input
69 *
70 * debug functions always use serial dev 0 peripheral
71 *
72 * @retval x Read char
73 * @retval -1 No input character available
74 */
75static int tms570_uart_input( void )
76{
77  if ( driver_context_table[0].regs->SCIFLR & (1<<9) ) {
78      return driver_context_table[0].regs->SCIRD;
79  } else {
80      return -1;
81  }
82}
83
84BSP_output_char_function_type BSP_output_char = tms570_uart_output;
85BSP_polling_getchar_function_type BSP_poll_char = tms570_uart_input;
Note: See TracBrowser for help on using the repository browser.