1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys: remove uart0

This commit is contained in:
Kaspar Schleiser 2015-06-04 13:42:37 +02:00
parent ea4fb69f9d
commit a13bc46f3e
11 changed files with 10 additions and 249 deletions

View File

@ -205,10 +205,6 @@ ifneq (,$(filter newlib,$(USEMODULE)))
USEMODULE += uart_stdio
endif
ifneq (,$(filter uart0,$(USEMODULE)))
USEMODULE += posix
endif
ifneq (,$(filter posix,$(USEMODULE)))
USEMODULE += timex
USEMODULE += vtimer

View File

@ -1,22 +0,0 @@
/*
* Copyright 2014 Kaspar Schleiser <kaspar@schleiser.de>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
#ifndef UART0_H_
#define UART0_H_
#ifdef __cplusplus
extern "C" {
#endif
extern kernel_pid_t uart0_handler_pid;
#ifdef __cplusplus
}
#endif
#endif /* UART0_H */

View File

@ -27,18 +27,6 @@ uint32_t get_system_speed(void);
void cpu_clock_scale(uint32_t source, uint32_t target, uint32_t *prescale);
void arm_reset(void);
void stdio_flush(void);
/**
* @brief Writes an array of characters to the UART0 device
*
* @param[in] astring The string to write
* @param[in] length Length of the string
*
* @returns Always @p length
*/
int uart0_puts(char *astring, int length);
#ifdef __cplusplus
}

1
dist/Makefile vendored
View File

@ -33,7 +33,6 @@ QUIET ?= 1
# Modules to include:
#USEMODULE += shell
#USEMODULE += uart0
#USEMODULE += posix
#USEMODULE += vtimer

View File

@ -14,10 +14,6 @@ shell commands. These are included via the `shell_commands` module.
Additionally, the `ps` module which provides the `ps` shell command is
included.
Finally, in order for the shell to receive input, the `uart0` module
is used.
Usage
=====
@ -71,7 +67,6 @@ Running the `ps` command on an msba2:
2014-05-09 17:38:33,394 - INFO # pid | name | state Q | pri | stack ( used) location
2014-05-09 17:38:33,401 - INFO # 0 | idle | pending Q | 31 | 160 ( 148) 0x40000014
2014-05-09 17:38:33,407 - INFO # 1 | main | running Q | 15 | 2560 ( 848) 0x400000b4
2014-05-09 17:38:33,414 - INFO # 2 | uart0 | bl rx _ | 14 | 512 ( 296) 0x40000ce0
2014-05-09 17:38:33,431 - INFO # | SUM | | | 4256
```

View File

@ -36,10 +36,6 @@
#include "ltc4150.h"
#endif
#ifdef MODULE_UART0
#include "board_uart0.h"
#endif
#ifdef MODULE_MCI
#include "diskio.h"
#endif
@ -103,12 +99,6 @@ void auto_init(void)
DEBUG("Auto init vtimer module.\n");
vtimer_init();
#endif
#ifndef MODULE_UART_STDIO
#ifdef MODULE_UART0
DEBUG("Auto init uart0 module.\n");
board_uart0_init();
#endif
#endif
#ifdef MODULE_XTIMER
DEBUG("Auto init xtimer module.\n");
xtimer_init();

View File

@ -1,74 +0,0 @@
/*
* Copyright (C) 2010 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup sys_uart0 UART0
* @ingroup sys
* @brief UART0 interface abstraction
* @{
*
* @file
* @brief Interface definitions for the UART0 abstraction
*/
#ifndef __BOARD_UART0_H
#define __BOARD_UART0_H
#include "kernel_types.h"
#include "cpu.h" /* To give user access to UART0_BUFSIZE */
#include "cpu_conf.h" /* Some CPUs define this in cpu_conf.h... */
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Process identifier for the UART0 module.
*/
extern kernel_pid_t uart0_handler_pid;
/**
* @brief Initialize and starts the UART0 handler.
*/
void board_uart0_init(void);
/**
* @brief To be called from the uart interrupt handler for every incoming
* character.
*
* @param[in] c The received character.
*/
void uart0_handle_incoming(int c);
/**
* @brief Notify the chardev thread that new characters are available in the
* ringbuffer.
*/
void uart0_notify_thread(void);
/**
* @brief Reads one character from the ringbuffer.
*
* @returns The first available character from the ringbuffer.
*/
int uart0_readc(void);
/**
* @brief Wrapper to putchar.
*
* @param[in] c The character to put on the UART.
*/
int uart0_putc(int c);
#ifdef __cplusplus
}
#endif
/** @} */
#endif /* __BOARD_UART0_H */

View File

@ -21,9 +21,6 @@
#include <string.h>
#include "posix_io.h"
#ifdef MODULE_UART0
#include "board_uart0.h"
#endif
#include "unistd.h"
#include "fd.h"
@ -40,19 +37,6 @@ int fd_init(void)
{
memset(fd_table, 0, sizeof(fd_t) * FD_MAX);
#ifdef MODULE_UART0
posix_open(uart0_handler_pid, 0);
fd_t fd = {
.internal_active = 1,
.internal_fd = (int)uart0_handler_pid,
.read = (ssize_t ( *)(int, void *, size_t))posix_read,
.write = (ssize_t ( *)(int, const void *, size_t))posix_write,
.close = posix_close
};
memcpy(&fd_table[STDIN_FILENO], &fd, sizeof(fd_t));
memcpy(&fd_table[STDOUT_FILENO], &fd, sizeof(fd_t));
memcpy(&fd_table[STDERR_FILENO], &fd, sizeof(fd_t));
#endif
return FD_MAX;
}

View File

@ -1 +0,0 @@
include $(RIOTBASE)/Makefile.base

View File

@ -1,103 +0,0 @@
/*
* Copyright (C) 2013 INRIA
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup sys
* @{
*
* @file
* @brief UART implementation
*
* @author Oliver Hahm <oliver.hahm@inria.fr>
* @author Ludwig Ortmann <ludwig.ortmann@fu-berlin.de>
*
* @}
*/
#include <stdio.h>
#include "kernel_types.h"
#include "board_uart0.h"
kernel_pid_t uart0_handler_pid = KERNEL_PID_UNDEF;
#ifdef MODULE_UART_STDIO
#include "uart_stdio.h"
void board_uart0_init(void){}
int uart0_readc(void)
{
char c = 0;
uart_stdio_read(&c, 1);
return c;
}
#else
#include "cpu_conf.h"
#include "chardev_thread.h"
#include "ringbuffer.h"
#include "thread.h"
#include "msg.h"
#include "posix_io.h"
#include "irq.h"
#ifndef UART0_BUFSIZE
#define UART0_BUFSIZE (128)
#endif
/* increase when ENABLE_DEBUG in chardev_thread is set to 1! */
#define UART0_STACKSIZE (THREAD_STACKSIZE_DEFAULT)
ringbuffer_t uart0_ringbuffer;
static char buffer[UART0_BUFSIZE];
static char uart0_thread_stack[UART0_STACKSIZE];
void board_uart0_init(void)
{
ringbuffer_init(&uart0_ringbuffer, buffer, UART0_BUFSIZE);
kernel_pid_t pid = thread_create(
uart0_thread_stack,
sizeof(uart0_thread_stack),
THREAD_PRIORITY_MAIN - 1,
CREATE_STACKTEST | CREATE_SLEEPING,
chardev_thread_entry,
&uart0_ringbuffer,
"uart0"
);
uart0_handler_pid = pid;
thread_wakeup(pid);
puts("uart0_init() [OK]");
}
void uart0_handle_incoming(int c)
{
ringbuffer_add_one(&uart0_ringbuffer, c);
}
void uart0_notify_thread(void)
{
msg_t m;
m.type = 0;
msg_send_int(&m, uart0_handler_pid);
}
int uart0_readc(void)
{
char c = 0;
posix_read(uart0_handler_pid, &c, 1);
return c;
}
#endif
int uart0_putc(int c)
{
return putchar(c);
}

View File

@ -34,12 +34,21 @@
#include "periph/uart.h"
#include "board.h"
#include "periph/uart.h"
#define ENABLE_DEBUG 0
#include "debug.h"
#ifndef STDIO
#define STDIO (0)
#endif
#ifndef STDIO_BAUDRATE
#define STDIO_BAUDRATE (115200)
#endif
#ifndef STDIO_RX_BUFSIZE
#define STDIO_RX_BUFSIZE (64)
#define STDIO_RX_BUFSIZE (64)
#endif
/**