public Semaphore(ID semid, ref T_CSEM pk_csem, Nucleus pNucleus) { m_SemID = semid; m_csem = pk_csem; m_Count = pk_csem.isemcnt; m_Nucleus = pNucleus; }
public MemoryPoolFixedsize(ID mpfid, ref T_CMPF pk_cmpf, Nucleus pNucleus) { pointer Block; m_MpfID = mpfid; m_cmpf = pk_cmpf; m_Nucleus = pNucleus; for (int i = 0; i < pk_cmpf.blkcnt; i++) { Block = new pointer(pk_cmpf.addr, i * pk_cmpf.blksz); pointer.memset(Block, 0, pk_cmpf.blksz); m_MpfQueue.AddLast(Block); } }
public MemoryPool(ID mplid, ref T_CMPL pk_cmpl, Nucleus pNucleus) { TMemNode Block = new TMemNode(pk_cmpl.addr, pk_cmpl.mplsz); m_MplID = mplid; m_cmpl = pk_cmpl; m_Nucleus = pNucleus; m_MaxSize = pk_cmpl.mplsz; m_FreeSize = pk_cmpl.mplsz; m_FreeMem.AddLast(Block); #if DEBUG m_pFirstBlock = null; m_pLastBlock = null; m_nBlockCount = 0; m_Dumped = false; #endif }
public ER cre_tsk(ID tskid, ref T_CTSK pk_ctsk, out ID p_takid) { ER Result = ER.E_NOEXS; p_takid = ID.NULL; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Result = g_Kernel.Nucleus.CreateTask(tskid, ref pk_ctsk, out p_takid); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER trcv_msg(out T_MSG ppk_msg, ID mbxid, TMO tmout) { ER Result = ER.E_NOEXS; Mailbox Mailbox; ppk_msg = null; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Mailbox = g_Kernel.Nucleus.GetMailbox(mbxid); if (Mailbox == null) Result = ER.E_NOEXS; else Result = Mailbox.ReceiveMessage(out ppk_msg, tmout); } finally { g_Kernel.UnlockCPU(); } return Result; }
public Mailbox(ID mbxid, ref T_CMBX pk_cmbx, Nucleus pNucleus) { m_MbxID = mbxid; m_cmbx = pk_cmbx; m_Nucleus = pNucleus; }
public ER pget_blf(out pointer p_blf, ID mpfid, int blfsz) { ER Result = ER.E_NOEXS; MemoryPoolFixedsize MemoryPoolFixedsize; p_blf = null; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { MemoryPoolFixedsize = g_Kernel.Nucleus.GetMemoryPoolFixedsize(mpfid); if (MemoryPoolFixedsize == null) Result = ER.E_NOEXS; else Result = MemoryPoolFixedsize.GetMemoryBlock(out p_blf, blfsz, TMO.TMO_POL); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER get_blk(out pointer p_blk, ID mplid, int blksz) { ER Result = ER.E_NOEXS; MemoryPool MemoryPool; p_blk = null; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { MemoryPool = g_Kernel.Nucleus.GetMemoryPool(mplid); if (MemoryPool == null) Result = ER.E_NOEXS; else Result = MemoryPool.GetMemoryBlock(out p_blk, blksz, TMO.TMO_FEVR); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER del_tsk(ID tskid) { ER Result = ER.E_NOEXS; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Result = g_Kernel.Nucleus.DeleteTask(tskid); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER del_mpl(ID mplid) { ER Result = ER.E_NOEXS; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Result = g_Kernel.Nucleus.DeleteMemoryPool(mplid); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER can_wup(ref int p_wupcnt, ID tskid) { ER Result = ER.E_NOEXS; Task Task; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Task = g_Kernel.Nucleus.GetTask(tskid); if (Task == null) Result = ER.E_NOEXS; else Result = Task.CanWakeup(ref p_wupcnt); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER wai_sem(ID semid) { ER Result = ER.E_NOEXS; Semaphore Semaphore; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Semaphore = g_Kernel.Nucleus.GetSemaphore(semid); if (Semaphore == null) Result = ER.E_NOEXS; else Result = Semaphore.Wait(TMO.TMO_FEVR); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER wai_flg(ref FLGPTN p_flgptn, ID flgid, FLGPTN waiptn, MODE wfmode) { ER Result = ER.E_NOEXS; EventFlag EventFlag; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { EventFlag = g_Kernel.Nucleus.GetEventFlag(flgid); if (EventFlag == null) Result = ER.E_NOEXS; else Result = EventFlag.WaitEventFlag(ref p_flgptn, TMO.TMO_FEVR, waiptn, wfmode); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER udp_snd_dat(ID cepid, T_IPV4EP p_dstaddr, pointer data, int len, TMO tmout) { ER Result = ER.E_NOEXS; UdpCep UdpCep; if ((data == null) || (len <= 0)) return ER.E_PAR; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { UdpCep = g_Kernel.Nucleus.GetUdpCep(cepid); if (UdpCep == null) Result = ER.E_NOEXS; else Result = UdpCep.SendData(p_dstaddr, data, len, tmout); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER udp_del_cep(ID cepid) { ER Result = ER.E_NOEXS; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Result = g_Kernel.Nucleus.DeleteUdpCep(cepid); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER udp_cre_cep(ID cepid, ref T_UDP_CCEP pk_ccep, out ID p_cepid) { ER Result = ER.E_NOEXS; p_cepid = ID.NULL; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Result = g_Kernel.Nucleus.CreateUdpCep(cepid, ref pk_ccep, out p_cepid); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER udp6_rcv_dat(ID cepid, T_IPV6EP p_dstaddr, pointer data, int len, TMO tmout) { ER Result = ER.E_NOEXS; Udp6Cep UdpCep; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { UdpCep = g_Kernel.Nucleus.GetUdp6Cep(cepid); if (UdpCep == null) Result = ER.E_NOEXS; else Result = UdpCep.ReceiveData(p_dstaddr, data, len, tmout); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER del_flg(ID flgid) { ER Result = ER.E_NOEXS; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Result = g_Kernel.Nucleus.DeleteEventFlag(flgid); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER del_mbx(ID mbxid) { ER Result = ER.E_NOEXS; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Result = g_Kernel.Nucleus.DeleteMailbox(mbxid); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER chg_pri(ID tskid, PRI tskpri) { ER Result = ER.E_NOEXS; Task Task; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Task = g_Kernel.Nucleus.GetTask(tskid); if (Task == null) Result = ER.E_NOEXS; else Result = Task.ChangePriority(tskpri); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER del_sem(ID semid) { ER Result = ER.E_NOEXS; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Result = g_Kernel.Nucleus.DeleteSemaphore(semid); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER clr_flg(ID flgid, FLGPTN clrptn) { ER Result = ER.E_NOEXS; EventFlag EventFlag; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { EventFlag = g_Kernel.Nucleus.GetEventFlag(flgid); if (EventFlag == null) Result = ER.E_NOEXS; else Result = EventFlag.ClearEventFlag(clrptn); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER frsm_tsk(ID tskid) { ER Result = ER.E_NOEXS; Task Task; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Task = g_Kernel.Nucleus.GetTask(tskid); if (Task == null) Result = ER.E_NOEXS; else Result = Task.ForceResume(); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER cre_flg(ID flgid, ref T_CFLG pk_cflg, out ID p_flgid) { ER Result = ER.E_NOEXS; p_flgid = ID.NULL; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Result = g_Kernel.Nucleus.CreateEventFlag(flgid, ref pk_cflg, out p_flgid); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER get_tid(ref ID p_tskid) { Task task; if (g_Kernel == null) return ER.E_DLT; if (p_tskid == 0) return ER.E_PAR; g_Kernel.LockCPU(); try { task = g_Kernel.Nucleus.GetTask(ID.TSK_SELF); p_tskid = (task != null) ? task.TaskID : new ID(0); } finally { g_Kernel.UnlockCPU(); } return ER.E_OK; }
public ER cre_mbx(ID mbxid, ref T_CMBX pk_cmbx, out ID p_mbxid) { ER Result = ER.E_NOEXS; p_mbxid = ID.NULL; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Result = g_Kernel.Nucleus.CreateMailbox(mbxid, ref pk_cmbx, out p_mbxid); } finally { g_Kernel.UnlockCPU(); } return Result; }
public void SetTaskName(ID tskid, string szName) { Kernel g_Kernel = this; CPUContext CPUContext = g_Kernel.StartDelaySuspend(); try { string Name = g_Kernel.m_UnitName + "." + szName; Task task = g_Kernel.Nucleus.GetTask(tskid); CPUContext tc = (CPUContext)(task.GetCPUContext()); tc.SetThreadName(Name); } finally { g_Kernel.EndDelaySuspend(CPUContext); } }
public ER cre_sem(ID semid, ref T_CSEM pk_csem, out ID p_semid) { ER Result = ER.E_NOEXS; p_semid = ID.NULL; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Result = g_Kernel.Nucleus.CreateSemaphore(semid, ref pk_csem, out p_semid); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER cre_mpl(ID mplid, ref T_CMPL pk_cmpl, out ID p_mplid) { ER Result = ER.E_NOEXS; p_mplid = ID.NULL; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { Result = g_Kernel.Nucleus.CreateMemoryPool(mplid, ref pk_cmpl, out p_mplid); } finally { g_Kernel.UnlockCPU(); } return Result; }
public ER tcp_snd_oob(ID cepid, pointer data, int len, TMO tmout) { ER Result = ER.E_NOEXS; TcpCep TcpCep; if (g_Kernel == null) return ER.E_DLT; g_Kernel.LockCPU(); try { TcpCep = g_Kernel.Nucleus.GetTcpCep(cepid); if (TcpCep == null) Result = ER.E_NOEXS; else Result = TcpCep.SendUrgentData(data, len, tmout); } finally { g_Kernel.UnlockCPU(); } return Result; }