/* * Unregister device initial setting information */ LOCAL ER delIDev( void ) { ER ercd = E_OK; /* Delete message buffer for event notification */ if ( DefaultIDev.evtmbfid > 0 ) { ercd = tk_del_mbf(DefaultIDev.evtmbfid); DefaultIDev.evtmbfid = 0; } #ifdef DEBUG if ( ercd < E_OK ) { DEBUG_PRINT(("delIDev ercd = %d\n", ercd)); } #endif return ercd; }
/* * syslog finalization sequence */ EXPORT ER finish_syslog( void ) { #if USE_SYSLOG_CONSIO ER ercd; /* Delete message buffer This also stops log task */ ercd = tk_del_mbf(log_mbfid); #ifdef DEBUG if ( ercd < E_OK ) { DEBUG_PRINT(("finish_syslog ercd = %d\n", ercd)); } #endif return ercd; #else return E_OK; #endif }
/* initial setting at driver start up time */ LOCAL ER kpStartUp(void) { W w[L_DEVCONF_VAL]; W dd, n; ER er; RawEvt evt; T_CMBF cmbf; T_CFLG cflg; ID datatsk; void* name; union { FlgInStat stat; UW uw; } u; /* extract ID of the mailbox for event notification to KB/PD driver */ dd = er = tk_opn_dev(devkbpd, TD_READ); if (er >= E_OK) { er = tk_srea_dev(dd, DN_KPINPUT, (VB*)&EvtMbx, sizeof(EvtMbx), &n); tk_cls_dev(dd, 0); } if (er < E_OK) goto EEXIT1; /* KBID is extracted from DEVCONF parameter */ KbdId = (GetDevConf("KBTYPE", w) == 1) ? w[0] : KID_IBM_JP; /* input message buffer creation */ SetOBJNAME(cmbf.exinf, "lkbM"); cmbf.mbfatr = TA_TFIFO; cmbf.bufsz = sizeof(InMsg) * MAX_INMSG; cmbf.maxmsz = sizeof(InMsg); if ((er = tk_cre_mbf(&cmbf)) < E_OK) goto EEXIT1; InpMbf = er; /* creating the event flag for command */ SetOBJNAME(cflg.exinf, "lkbC"); cflg.flgatr = TA_WMUL; cflg.iflgptn = 0; if ((er = tk_cre_flg(&cflg)) < E_OK) goto EEXIT2; CmdFlg = (ID)er; /* create and start data processing task */ SetOBJNAME(name, "lkbD"); er = kpCreTask((W)name, kpDataTask); if (er < E_OK) goto EEXIT3; datatsk = (ID)er; /* create and start command processing task */ SetOBJNAME(name, "lkbC"); er = kpCreTask((W)name, kpCmdTask); if (er < E_OK) goto EEXIT4; CmdTsk = (ID)er; /* registering event flag for commands */ u.uw = 0; evt.f.stat = u.stat; evt.f.stat.cmd = INP_FLG; evt.f.stat.kb = 1; evt.f.stat.kbid = KbdId; evt.f.stat.reg = 1; evt.f.flgid = CmdFlg; if ((er = kpSendMsg(&evt)) < E_OK) goto EEXIT5; /* device initialization processing */ er = hwInit(DC_OPEN); if (er < E_OK) goto EEXIT5; return E_OK; EEXIT5: tk_ter_tsk(CmdTsk); tk_del_tsk(CmdTsk); EEXIT4: tk_ter_tsk(datatsk); tk_del_tsk(datatsk); EEXIT3: tk_del_flg(CmdFlg); EEXIT2: tk_del_mbf(InpMbf); EEXIT1: DP(("kpStartUp: err=%#x\n", er)); return er; }