Chapter 4 Applications Development Procedure Overview - 63 -
#include <itron.h>
#include <kernel.h>
#include "kernel_id.h"
void main() /* main task */
{
printf("LBP start simulation \n");
sta_tsk(ID_idle,1); /* activate idle task */
sta_tsk(ID_image,1); /* activate image expansion task */
sta_tsk(ID_printer,1); /* activate printer engine task */
}
void image() /* activate image expansion task */
{
while(1){
wai_flg(ID_pagein,waiptn,TWF_ANDW, &flgptn);/* wait for 1-page input */
printf(" bit map expansion processing \n");
wup_tsk(ID_printer); /* wake up printer engine task */
}
}
void printer() /* printer engine task */
{
while(1){
slp_tsk();
printf(" printer engine operation \n");
}
}
void sent_in() /* Centronics interface handler */
{
/* Process input from Centronics interface */
if ( /* 1-page input completed */ )
iset_flg(ID_pagein,setptn);
}
Figure 4.2 Program Example