1 /*******************************************************************
2 Components for embedded applications builded for
3 laboratory and medical instruments firmware
5 cmd_proc_io_tisci.c - IO layer functions for SCI on TMS570 and FreeRTOS
7 Copyright (C) 2001-2009 by Pavel Pisa pisa@cmp.felk.cvut.cz
8 (C) 2002-2009 by PiKRON Ltd. http://www.pikron.com
9 (C) 2007 by Michal Sojka <sojkam1@fel.cvut.cz>
10 (C) 2012 by Michal Horn <hornmich@fel.cvut.cz>
12 This file can be used and copied according to next
14 - MPL - Mozilla Public License
15 - GPL - GNU Public License
16 - other license provided by project originators
17 *******************************************************************/
21 #include "cmdproc_io_tisci.h"
26 * @brief Print character on SCI
27 * @param cmd_io cmd_io structure
28 * @param ch character to be printed
32 int tisci_putc(cmd_io_t *cmd_io, int ch)
34 rpp_sci_putc((uint8_t)ch);
39 * @brief Read character from SCI
40 * @param cmd_io cmd_io structure
41 * @return character ASCII code
44 int tisci_getc(cmd_io_t *cmd_io)
54 int tisci_getc_nb(cmd_io_t *cmd_io)
58 if (rpp_sci_read_nb(1, &ch) == FAILURE)
65 * @brief Print string on SCI
66 * @param cmd_io cmd_io structure
67 * @param buf String buffer to be printed
68 * @param count maximum character number to be printed
69 * @return number of printed characters
72 int tisci_write(cmd_io_t *cmd_io, const void *buf, int count)
74 const char *tmpBuf = buf;
76 return rpp_sci_printf("%s", tmpBuf);
80 * @brief Read string from SCI
81 * @param cmd_io cmd_io structure
82 * @param buf String buffer
83 * @param count maximum character number to be read
86 int tisci_read(cmd_io_t *cmd_io, void *buf, int count)
88 uint8_t *tmpBuf = buf;
90 return rpp_sci_read(count, tmpBuf);
94 * IO stack for cmdProc
96 cmd_io_t cmd_io_tisci = {