commit 563e1d61afab3d8c845fd1b151148458c07c118e
parent 4ce9769862d0352900a9a0ec3e4e0b1611f512c7
Author: Ambroise Vincent <ambroise.vincent@arm.com>
Date: Fri, 10 May 2019 16:14:06 +0100
[rom] Initialize console in hosted
Change-Id: I28242736ae539387b264820d193c5a8bba473d85
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
Diffstat:
1 file changed, 21 insertions(+), 0 deletions(-)
diff --git a/target/hosted/rom.c b/target/hosted/rom.c
@@ -50,6 +50,10 @@ imach(void)
static void
namespace(void)
{
+ int fd;
+ static char setin[] = "addin /dev/uart0/raw\n";
+ static char setout[] = "addout /dev/uart0/raw\n";
+
/* Standard input set to 0 */
kin = open("#c/raw", O_READ);
if (kin != 0) {
@@ -80,6 +84,23 @@ namespace(void)
goto error;
}
+ if ((fd = open("/dev/cons/ctl", O_WRITE)) < 0) {
+ kerror("open:/dev/cons/ctl write");
+ goto error;
+ }
+ if (write(fd, setin, sizeof(setin)) < 0) {
+ kerror("write:setin");
+ goto error;
+ }
+ if (write(fd, setout, sizeof(setout)) < 0) {
+ kerror("write:setout");
+ goto error;
+ }
+ if (close(fd) < 0) {
+ kerror("close:/dev/cons/ctl");
+ goto error;
+ }
+
return;
error: