shithub: p9-stm32-example-os

ref: f801657f77f3923ec2388c25bdcb036c8019ba89
dir: /prog/init0.c/

View raw version
#include	<u.h>
#include	"dat.h"
#include	"fns.h"
#include	"mem.h"
#include	"libkern/kern.h"

#include	"prog/prog.h"
#include	"prog/progfns.h"

void
init0(void*)
{
	Proc *kconsole_prog, *devicefs_prog, *dma2q_prog; //, *p;
	Queue *fsiq, *fsoq;

	kconsole_prog = prog_kconsole(); ready(kconsole_prog);

	// wait for console initialization
	_wait(1000000);
	kprint("init0: switching to kconsole");

	fsiq = qopen(DMAQ_BUFSIZE, 0, nil, nil);
	fsoq = qopen(DMAQ_BUFSIZE, 0, nil, nil);

	devicefs_prog = prog_devicefs(fsiq, fsoq);
	dma2q_prog = prog_dma2q(fsiq, fsoq);
	dma2q_prog->env->egrp = devicefs_prog->env->egrp;	// someday useful

	ready(devicefs_prog);
	ready(dma2q_prog);

	kprint("init0: programs started; quitting");
	pexit(nil, 0);
//	up->pri = PriBackground;
//	while(1);
}

Proc*
prog_init0(void)
{
	Proc *p;
	p = newprog("init0", init0, nil, 0, 1024);
	return p;
}