Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1445 → Rev 1444

/uspace/trunk/console/Makefile
File deleted
/uspace/trunk/console/console.c
File deleted
/uspace/trunk/libc/include/ipc/services.h
37,8 → 37,7
#define SERVICE_PCI 1
#define SERVICE_FRAME_BUFFER 2
#define SERVICE_KEYBOARD 3
#define SERVICE_VIDEO 4
#define SERVICE_CONSOLE 5
#define SERVICE_VIDEO 4
 
/* Memory area to be received from NS */
#define SERVICE_MEM_REALTIME 1
/uspace/trunk/init/init.c
305,18 → 305,17
int phoneid;
 
printf("Test: Starting connect...\n");
while ((phoneid = ipc_connect_me_to(PHONE_NS, SERVICE_CONSOLE, 0)) < 0) {
while ((phoneid = ipc_connect_me_to(PHONE_NS, SERVICE_KEYBOARD, 0)) < 0) {
};
printf("Test: Connected: %d\n", res);
printf("Test: pinging.\n");
/* while (1) {
while (1) {
res = ipc_call_sync(phoneid, KBD_GETCHAR, 0xbeef,&result);
// printf("Test: Retval: %d - received: %c\n", res, result);
printf("%c", result);
}
*/
printf("Test: Hangin up\n");
ipc_hangup(phoneid);
}
336,8 → 335,14
printf("Test: Connected: %d\n", res);
printf("Test: pinging.\n");
 
 
aid = async_send_2(phoneid, KBD_GETCHAR, 0, 0, &kbddata);
while (1) {
if (async_wait_timeout(aid, NULL, 1000000)) {
printf("^");
continue;
}
printf("%c", IPC_GET_ARG1(kbddata));
aid = async_send_2(phoneid, KBD_GETCHAR, 0, 0, &kbddata);
}
printf("Test: Hangin up\n");
/uspace/trunk/fb/fb.c
160,18 → 160,13
ipcarg_t retval, arg1, arg2;
 
if(!sysinfo_value("fb")) {
printf("Framebuffer initialization failed.\n");
return -1;
}
if(!sysinfo_value("fb")) return -1;
 
 
if ((res = ipc_connect_to_me(PHONE_NS, SERVICE_VIDEO, 0, &phonead)) != 0)
return -1;
if (init_fb() != 0) {
printf("Framebuffer initialization failed.\n");
return -1;
}
init_fb();
 
async_manager();
/* Never reached */
/uspace/trunk/Makefile
37,8 → 37,7
softfloat \
init \
ns \
fb \
console
fb
 
ifeq ($(ARCH), amd64)
DIRS += pci \
/uspace/trunk/kbd/generic/kbd.c
35,24 → 35,29
#include <errno.h>
#include <arch/kbd.h>
#include <kbd.h>
#include <key_buffer.h>
#include <libadt/fifo.h>
#include <key_buffer.h>
 
#define NAME "KBD"
void hello(void *private, int retval, ipc_call_t *data) {
printf("%s: got answer from console with retval %d.\n", NAME, retval);
}
 
#define KBD_REQUEST_MAX 32 /**< Maximum requests buffered until keypress */
 
int main(int argc, char **argv)
{
ipc_call_t call;
ipc_callid_t callid;
char connected = 0;
int res;
int c;
ipcarg_t phonead;
int phoneid;
char connected = 0;
ipcarg_t retval, arg1, arg2;
 
/* Counter of unsatisfied calls */
fifo_count_t callers_counter = 0;
/* Fifo with callid's of unsatisfied calls requred for answer */
FIFO_INITIALIZE_STATIC(callers_buffer, ipc_callid_t, KBD_REQUEST_MAX);
 
printf("Uspace kbd service started.\n");
 
/* Initialize arch dependent parts */
77,8 → 82,19
// printf("%s:Call phone=%lX..", NAME, call.in_phone_hash);
switch (IPC_GET_METHOD(call)) {
case IPC_M_PHONE_HUNGUP:
printf("%s: Phone hung up.\n", NAME);
connected = 0;
if (connected) {
/* If nobody's connected, clear keybuffer and dont store new keys */
if (--connected == 0) {
callers_counter = 0;
callers_buffer.head = callers_buffer.tail = 0;
key_buffer_free();
}
printf("%s: Phone hung up.\n", NAME);
} else {
printf("%s: Oops, got phone hung up, but nobody connected.\n", NAME);
}
retval = 0;
break;
case IPC_M_CONNECT_ME_TO:
91,35 → 107,43
connected = 1;
}
break;
case IPC_M_CONNECT_TO_ME:
phoneid = IPC_GET_ARG3(call);
retval = 0;
break;
 
case IPC_M_INTERRUPT:
if (connected) {
/* recode to ASCII - one interrupt can produce more than one code so result is stored in fifo */
/* recode scancode and store it into key buffer */
kbd_arch_process(IPC_GET_ARG2(call));
//printf("%s: GOT INTERRUPT: %c\n", NAME, IPC_GET_ARG2(call));
 
//printf("%s: GOT INTERRUPT: %c\n", NAME, key);
 
/* Some callers could awaiting keypress - if its true, we have to send keys to them.
* One interrupt can store more than one key into buffer. */
retval = 0;
 
while (!key_buffer_empty()) {
arg2 = 0xbeef;
while ((callers_counter) && (!key_buffer_empty())) {
callers_counter--;
if (!key_buffer_pop((char *)&arg1)) {
printf("%s: KeyBuffer is empty but it should not be.\n");
printf("%s: KeyBuffer empty but it should not be.\n");
break;
}
/*FIXME: detection of closed connection */
ipc_call_async(phoneid, KBD_PUSHCHAR, arg1, 0, &hello);
ipc_answer_fast(fifo_pop(callers_buffer), retval, arg1, arg2);
}
 
}
printf("%s: Interrupt processed.\n", NAME);
break;
case KBD_GETCHAR:
// printf("%s: Getchar: ", NAME);
retval = 0;
arg1 = 0;
if (!key_buffer_pop((char *)&arg1)) {
if (callers_counter < KBD_REQUEST_MAX) {
callers_counter++;
fifo_push(callers_buffer, callid);
} else {
retval = ELIMIT;
}
continue;
};
arg2 = 0xbeef;
// printf("GetChar return %c\n", arg1);
break;
default:
printf("%s: Unknown method: %zd\n", NAME, IPC_GET_METHOD(call));
retval = ENOENT;
/uspace/trunk/kbd/include/kbd.h
29,7 → 29,7
#ifndef __KBD_H__
#define __KBD_H__
 
#define KBD_PUSHCHAR 1024
#define KBD_GETCHAR 1024
 
#endif