]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blob - rpp/lib/cmdproc/src/cmdproc_io_tisci.c
CMDPROC modified for new IO functions and library
[pes-rpp/rpp-test-sw.git] / rpp / lib / cmdproc / src / cmdproc_io_tisci.c
1 /** @file cmdio_tisci.c
2 *   @brief Texas Instrument SCI IO for cmdProc
3 *   @date 17.July.2012
4 *
5 *  Definition of IO. This implementation uses queues as buffers, which are than used for input and output.
6 *
7 */
8
9 /* Include files */
10 #include "cmdproc_io_tisci.h"
11 #include "types.h"
12 #include "rpp/rpp.h"
13
14 int tisci_putc(cmd_io_t *cmd_io, int ch) {
15         rpp_sci_putc((uint8_t)ch);
16     return 1;
17 }
18
19 int tisci_getc(cmd_io_t *cmd_io) {
20         int ret = '\0';
21         ret = rpp_sci_getc();
22         if (ret == FAILURE) {
23         ret = '\0';
24         }
25     return ret;
26 }
27 int tisci_write(cmd_io_t *cmd_io, const void *buf, int count) {
28     const char *tmpBuf = buf;
29
30         return rpp_sci_printf("%s", tmpBuf);
31 }
32 int tisci_read(cmd_io_t *cmd_io, void *buf, int count) {
33     uint8_t* tmpBuf = buf;
34         return rpp_sci_read(count, tmpBuf);
35 }
36
37 /* Setting io stack for cmdProc */
38 cmd_io_t cmd_io_buf={
39         tisci_putc,
40         tisci_getc,
41         tisci_write,
42         tisci_read
43 };
44