Paste: hello world MINIX driver
Author: | yuuki |
Mode: | c |
Date: | Sat, 8 Aug 2009 17:34:23 |
Plain Text |
#include <minix/config.h>
#include <minix/com.h>
#include <minix/syslib.h>
#include <minix/const.h>
#include <minix/ipc.h>
#include <minix/safecopies.h>
#include <string.h>
#include <timers.h>
#include <errno.h>
#include <termios.h>
#include "../../kernel/arch/i386/include/archtypes.h"
#include "../../kernel/proc.h"
#include "../tty/tty.h"
message mess;
char* buf = "Hello World!\n";
struct proc pr;
int main(int argc, char **argv)
{
if (OK == sys_getproc(&pr, SELF))
{
cp_grant_id_t g = cpf_grant_direct(
TTY_PROC_NR, buf, mess.COUNT = strlen(buf), CPF_READ);
mess.m_type = DEV_WRITE_S;
mess.TTY_LINE = CONS_MINOR;
mess.IO_ENDPT = pr.p_endpoint;
mess.ADDRESS = g;
sendrec(TTY_PROC_NR, &mess);
}
receive(ANY, &mess);
}
New Annotation