Subversion Repositories HelenOS

Compare Revisions

No changes between revisions

Ignore whitespace Rev 4155 → Rev 4156

/branches/dd/uspace/lib/libc/include/ddi.h
37,6 → 37,7
 
#include <task.h>
 
extern int device_assign_devno(void);
extern int physmem_map(void *, void *, unsigned long, int);
extern int iospace_enable(task_id_t, void *, unsigned long);
extern int preemption_control(int);
/branches/dd/uspace/lib/libc/include/console.h
38,9 → 38,17
#include <console/style.h>
#include <console/color.h>
 
extern void console_open(void);
extern void console_close(void);
 
extern int console_phone_get(void);
extern void console_wait(void);
 
extern void console_clear(void);
extern void console_goto(int, int);
extern void console_putchar(int);
extern void console_flush(void);
 
extern int console_get_size(int *, int *);
extern void console_set_style(int);
extern void console_set_color(int, int, int);
/branches/dd/uspace/lib/libc/include/io/stream.h
39,8 → 39,6
 
#define EMFILE -17
 
extern void open_console(void);
extern void close_console(void);
extern void klog_update(void);
 
extern ssize_t read_stdin(void *, size_t);
47,9 → 45,6
extern ssize_t write_stdout(const void *, size_t);
extern ssize_t write_stderr(const void *, size_t);
 
extern int get_console_phone(void);
extern void console_wait(void);
 
#endif
 
/** @}
/branches/dd/uspace/lib/libc/generic/kbd.c
37,15 → 37,19
#include <kbd/kbd.h>
#include <ipc/ipc.h>
#include <ipc/console.h>
#include <console.h>
#include <async.h>
 
int kbd_get_event(kbd_event_t *ev)
{
int console_phone = get_console_phone();
int cons_phone = console_phone_get();
ipcarg_t r0, r1, r2, r3;
int rc;
 
rc = async_req_0_4(console_phone, CONSOLE_GETKEY, &r0, &r1, &r2, &r3);
if (cons_phone < 0)
return -1;
 
rc = async_req_0_4(cons_phone, CONSOLE_GETKEY, &r0, &r1, &r2, &r3);
if (rc < 0)
return -1;
 
/branches/dd/uspace/lib/libc/generic/ddi.c
41,6 → 41,16
#include <libarch/config.h>
#include <kernel/ddi/ddi_arg.h>
 
/** Return unique device number.
*
* @return New unique device number.
*
*/
int device_assign_devno(void)
{
return __SYSCALL0(SYS_DEVICE_ASSIGN_DEVNO);
}
 
/** Map piece of physical memory to task.
*
* Caller of this function must have the CAP_MEM_MANAGER capability.
/branches/dd/uspace/lib/libc/generic/console.c
1,4 → 1,6
/*
* Copyright (c) 2006 Josef Cejka
* Copyright (c) 2006 Jakub Vana
* Copyright (c) 2008 Jiri Svoboda
* All rights reserved.
*
35,29 → 37,70
#include <async.h>
#include <io/stream.h>
#include <ipc/console.h>
#include <ipc/services.h>
#include <console.h>
 
static int console_phone = -1;
 
void console_open(void)
{
if (console_phone < 0) {
int phone = ipc_connect_me_to(PHONE_NS, SERVICE_CONSOLE, 0, 0);
if (phone >= 0)
console_phone = phone;
}
}
 
void console_close(void)
{
if (console_phone >= 0) {
if (ipc_hangup(console_phone) == 0) {
console_phone = -1;
}
}
}
 
int console_phone_get(void)
{
if (console_phone < 0)
console_open();
return console_phone;
}
 
void console_wait(void)
{
while (console_phone < 0)
console_open();
}
 
void console_clear(void)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
async_msg_0(cons_phone, CONSOLE_CLEAR);
}
 
void console_goto(int row, int col)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
async_msg_2(cons_phone, CONSOLE_GOTO, row, col);
}
 
void console_putchar(int c)
{
int cons_phone = console_phone_get();
async_msg_1(cons_phone, CONSOLE_PUTCHAR, c);
}
 
void console_flush(void)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
async_msg_0(cons_phone, CONSOLE_FLUSH);
}
 
int console_get_size(int *rows, int *cols)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
ipcarg_t r, c;
int rc;
 
71,25 → 114,25
 
void console_set_style(int style)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
async_msg_1(cons_phone, CONSOLE_SET_STYLE, style);
}
 
void console_set_color(int fg_color, int bg_color, int flags)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
async_msg_3(cons_phone, CONSOLE_SET_COLOR, fg_color, bg_color, flags);
}
 
void console_set_rgb_color(int fg_color, int bg_color)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
async_msg_2(cons_phone, CONSOLE_SET_RGB_COLOR, fg_color, bg_color);
}
 
void console_cursor_visibility(int show)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
async_msg_1(cons_phone, CONSOLE_CURSOR_VISIBILITY, show != 0);
}
 
/branches/dd/uspace/lib/libc/generic/io/stream.c
43,13 → 43,12
#include <ipc/fb.h>
#include <ipc/services.h>
#include <ipc/console.h>
#include <console.h>
#include <kbd/kbd.h>
#include <unistd.h>
#include <async.h>
#include <sys/types.h>
 
static int console_phone = -1;
 
ssize_t write_stderr(const void *buf, size_t count)
{
return count;
57,8 → 56,9
 
ssize_t read_stdin(void *buf, size_t count)
{
open_console();
if (console_phone >= 0) {
int cons_phone = console_phone_get();
 
if (cons_phone >= 0) {
kbd_event_t ev;
int rc;
size_t i = 0;
79,55 → 79,23
 
ssize_t write_stdout(const void *buf, size_t count)
{
open_console();
if (console_phone >= 0) {
int cons_phone = console_phone_get();
 
if (cons_phone >= 0) {
int i;
 
for (i = 0; i < count; i++)
async_msg_1(console_phone, CONSOLE_PUTCHAR,
((const char *) buf)[i]);
console_putchar(((const char *) buf)[i]);
 
return count;
} else
return __SYSCALL3(SYS_KLOG, 1, (sysarg_t) buf, count);
}
 
void open_console(void)
{
if (console_phone < 0) {
int phone = ipc_connect_me_to(PHONE_NS, SERVICE_CONSOLE, 0, 0);
if (phone >= 0)
console_phone = phone;
}
}
 
void close_console(void)
{
if (console_phone >= 0) {
if (ipc_hangup(console_phone) == 0) {
console_phone = -1;
}
}
}
 
void klog_update(void)
{
(void) __SYSCALL3(SYS_KLOG, 1, NULL, 0);
}
 
int get_console_phone(void)
{
if (console_phone < 0)
console_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_CONSOLE, 0, 0);
return console_phone;
}
 
void console_wait(void)
{
while (console_phone < 0)
get_console_phone();
}
 
/** @}
*/
/branches/dd/uspace/lib/libc/arch/mips32eb/include/ddi.h
0,0 → 1,0
link ../../mips32/include/ddi.h
Property changes:
Added: svn:special
+*
\ No newline at end of property
/branches/dd/uspace/lib/libc/arch/mips32eb/Makefile.inc
29,9 → 29,9
## Toolchain configuration
#
 
TARGET = mips-sgi-irix5
TARGET = mips-linux-gnu
TOOLCHAIN_DIR = $(CROSS_PREFIX)/mips/bin
CFLAGS += -mips3
CFLAGS += -mips3
 
ARCH_SOURCES += arch/$(UARCH)/src/syscall.c \
arch/$(UARCH)/src/fibril.S \
40,4 → 40,4
LFLAGS += -N
 
BFD_ARCH = mips
BFD_NAME = elf32-big
BFD_NAME = elf32-tradbigmips