rtCell ― 实时微内核(可用GCC 3.xx、visual C++ 及 watcom C++ 编译)
该内核借鉴了minix、windows NT、linux的部分原理,具有下列功能:
1.完全抢占的多任务实时微内核,任务调度、等待与唤醒操作均具有良好的确定性(与任务数目无关)
独立的内核栈,中断和系统调用均切换到内核栈执行;
2.256个优先级,254个可用优先级1~254, 0为最高优先级(系统保留),255为空闲优先级;
3.不同优先级可完全抢占,同优先级之间可按先进先出直到阻塞,或时间片轮转方式执行,
可在任务对象创建时选择其执行方式;
4.在一系统(定时器服务)任务中实现内核定时器,用于超时等待内核对象、周期性定时器、任
务延迟;此(定时器服务)任务的优先级由其客户任务的最高优先级驱动,随之动态改变,以
消除优先级隐式反转现象;
5.任何内核对象用一整数ID标识,而非指针,从而可避免用户任务空指针的副作用,内核对
象总数不超过32768(即32K);
6.提供任务(Task)、互斥信号量(Mutex)、计数信号量(Semaphore)、位域标志(Flag)、
周期性定时器(Timer)、优先级消息(Message)和环形队列消息(Ring buffer)内核对象;
7.互斥信号量同时提供优先级继承和优先级置顶协议,在创建时设置,且总是按优先级等待;
8.其它对象的等待方式有,优先级等待和先进先出等待(节省内存),在创建时设置;
9.内核数据的同步,除在任务切换,及任务和内核之间切换堆栈时暂时关中断外,其它地
方均以延迟过程调用机制(DPC)执行;
10.系统调用以陷阱指令(x86中int指令)实现,易于扩展到具有“内存保护”的分级模式;
11.在内核中提供一个简单的堆内存分配机制,用于内核对象的动态内存分配;
12.在内核中实现了中断的进出接口,支持中断嵌套,计数信号量(Semaphore)、位域标志(Flag)、
优先级消息(Message)和环形队列消息(Ring buffer)的唤醒操作可在中断中执行,用户处理中断
时只需编写标准的C函数,而不必关心有关中断底层处理的细节。
32位内核,在 windows 2000,mingwin 4.0(gcc 3.xx)和 visual C++ 5.0/6.0 下编译通过;
16位内核,在 windows 2000,Open watcom C/C++ 1.3 下编译通过。
rtCell_vc5_sources.rar ,rtCell_vc5.rar 是32位实时微内核rtCell32的库文件等源代码(串行通信、磁盘及fat16文件操作),请用visual C++ 5.0/6.0编译。
watcom_C16.rar 是16位实时微内核rtCell的DOS库文件等源代码(仅适用于open watcom c/c++);
bochs.rar 中为 rtCell 在“虚拟机软件 bochs ”中的硬盘引导启动演示;
该演示中用 freedos boot loader 从 fat16 格式文件系统加载到 0x600 处执行。
16位rtCell编译后有 50 k 左右,包括静态分配的 4k 内核栈和4 k 有余的其它内核数据;
32位rtCell编译后有 87 k 左右,包括静态分配的 8k 内核栈和4 k 有余的其它内核数据。
32位 rtCell 在 P4 、1.7G、256 M 内存的“联想机器”上,
进行了连续10天的稳定性、可靠性测试。
E-mail:
taowentao_twt@163.com
点击超连接下载文件:
附件 2:
rtCell_vc5.rar (2005-12-16 05:38 PM, 127.07 K)
http://www.cn-dos.net/forum/attachment.php?aid=623&checkid=69e88&download=1
附件 3:
bochs.rar (2005-12-19 10:00 AM, 849.1 K)
http://www.cn-dos.net/forum/attachment.php?aid=655&checkid=c4727&download=1
附件 4:
rtCell_vc5_sources.rar (2005-12-19 10:04 AM, 127.07 K)
http://www.cn-dos.net/forum/attachment.php?aid=656&checkid=69e88&download=1
下面是16位dos实模式鼠标(ps2普通串口鼠标)、键盘应用演示及其可用库文件;
demo.exe 在纯dos下鼠标(ps2)、键盘应用演示,注意:在(win98/2k/xp的)dos窗口不能使用鼠标;
KERNEL.SYS用于 free dos 的 free loader 加载启动的鼠标、键盘演示;
rtCell16.lib 是实时微内核rtCell的16位库文件(仅适用于open watcom c/c++);
rtPC_input.obj是鼠标(ps2)、键盘输入obj文件,进行相应的I/O操作,其源代码请到
FreeDOS-32 release 0.0.5下查阅;
sys_demo.bat及EXEFLAT.EXE用于将demo.exe生成KERNEL.SYS,以便用于 free dos 的 free loader 加载启动。
真正的多任务、多(文本模式)窗口演示:
中断驱动的鼠标、键盘,事件驱动的多窗口,真正的多任务,完全抢占的实时微内核;
红色标题为活动窗口,蓝色标题为非活动窗口,非活动窗口可后台动态刷新;
其中一个窗口显示任务状态,另外两个窗口显示当前时间及“窗口”二字,桌面显示键盘输入;
可用鼠标移动、激活窗口、(窗口右下角)改变窗口大小。
“ctrl + z”键切换到任务状态窗口。
附件 1: qemu_0.8_domo.rar内是在虚拟机上的演示,解压缩,执行rtCell.bat后,鼠标点击窗口;
下载连接:
http://www.cn-dos.net/forum/attachment.php?aid=807&checkid=972c0&download=1
附件 2: dos_demo.rar (demo.exe及demo_.exe)用于在纯dos(windows上无鼠标)下,用串行鼠标演示。
下载连接:
http://www.cn-dos.net/forum/attachment.php?aid=854&checkid=12353&download=1
最新图形模式多窗口演示
giCell 真正的图形模式多窗口 - 全部源代码(C 语言)不到六千行,具有下列功能:
1. 完善而精巧的多视口裁剪和消隐处理,与实时微内核rtCell紧密结合;
2. 真正的事件(或消息)驱动的多窗口技术,且支持顶层窗口和透明窗口;
3. 当前支持Label、Edit、Botton、Slider和Checkbox控件,其中的Edit控件支持剪切、复制和粘贴;
4. 支持窗口的平移、缩放,和窗口系统按钮,及窗口和控件的过程回调;
5. 内存需求小(不到64K),窗口和控件所耗内存很小,因此实用性强,包括rtCell、鼠标、键盘及图形驱动,在DOS下也仅 100 多 K 字节。
演示方法:解压缩gui_Test.rar,在windows下(双击)执行gui_Test.bat,
或在纯dos下直接执行bc_gui.exe(在windows的dos窗口中无鼠标)。
注意:本演示中由于包含一个说明性位图而使得bc_gui.exe比较大。
下载地址:
http://zhenlove.com.cn/cndos/fileup/files/gui_Test.rar
Last edited by taowentao on 2006-10-5 at 22:24 ]
rtCell ― Real-Time Microkernel (compilable with GCC 3.xx, Visual C++, and Watcom C++)
This kernel draws on principles from Minix, Windows NT, and Linux, and has the following functions:
1. Fully preemptive multitasking real-time microkernel. Task scheduling, waiting, and wake-up operations have good determinism (independent of the number of tasks).
Independent kernel stack; interrupts and system calls are all switched to the kernel stack for execution;
2. 256 priorities. 254 available priorities 1~254, 0 is the highest priority (reserved by the system), and 255 is the idle priority;
3. Different priorities can be fully preempted. Between the same priorities, tasks can be executed in first-in-first-out until blocked or in round-robin mode. The execution mode can be selected when the task object is created;
4. A kernel timer is implemented in a system (timer service) task, used for timeout waiting for kernel objects, periodic timers, and task delays. The priority of this (timer service) task is driven by the highest priority of its client tasks and changes dynamically to eliminate the priority inversion phenomenon;
5. Any kernel object is identified by an integer ID, not a pointer, thus avoiding the side effects of null pointers in user tasks. The total number of kernel objects does not exceed 32768 (i.e., 32K);
6. Provides kernel objects such as Task, Mutex, Semaphore, Flag, Timer, Message, and Ring buffer;
7. The mutex semaphore provides both priority inheritance and priority ceiling protocols, which are set at creation and always wait by priority;
8. The waiting methods for other objects are priority waiting and first-in-first-out waiting (to save memory), which are set at creation;
9. For synchronization of kernel data, except for temporarily disabling interrupts during task switching and when switching stacks between tasks and the kernel, other operations are performed using the deferred procedure call (DPC) mechanism;
10. System calls are implemented using the trap instruction (int instruction in x86), making it easy to expand to a hierarchical mode with "memory protection";
11. A simple heap memory allocation mechanism is provided in the kernel for dynamic memory allocation of kernel objects;
12. Interrupt entry and exit interfaces are implemented in the kernel, supporting interrupt nesting. The wake-up operations of Semaphore, Flag, Message, and Ring buffer can be executed in interrupts. When users handle interrupts, they only need to write standard C functions without caring about the details of the underlying interrupt processing.
The 32-bit kernel has been compiled successfully under Windows 2000, Mingwin 4.0 (GCC 3.xx), and Visual C++ 5.0/6.0;
The 16-bit kernel has been compiled successfully under Windows 2000 and Open Watcom C/C++ 1.3.
rtCell_vc5_sources.rar and rtCell_vc5.rar are the library files and source codes (serial communication, disk, and fat16 file operations) of the 32-bit real-time microkernel rtCell32. Please compile with Visual C++ 5.0/6.0.
Watcom_C16.rar is the DOS library files and source codes (only applicable to Open Watcom C/C++ ) of the 16-bit real-time microkernel rtCell;
bochs.rar contains the hard disk boot startup demonstration of rtCell in the "virtual machine software Bochs";
In this demonstration, the FreeDOS boot loader is used to load from the fat16 format file system to 0x600 for execution.
The 16-bit rtCell after compilation is about 50 K, including 4K statically allocated kernel stack and more than 4K other kernel data;
The 32-bit rtCell after compilation is about 87 K, including 8K statically allocated kernel stack and more than 4K other kernel data.
The 32-bit rtCell was tested for stability and reliability for 10 consecutive days on a "Lenovo machine" with P4, 1.7G, and 256 M memory.
E-mail:
taowentao_twt@163.com
Click the hyperlink to download the file:
Attachment 2:
rtCell_vc5.rar (2005-12-16 05:38 PM, 127.07 K)
http://www.cn-dos.net/forum/attachment.php?aid=623&checkid=69e88&download=1
Attachment 3:
bochs.rar (2005-12-19 10:00 AM, 849.1 K)
http://www.cn-dos.net/forum/attachment.php?aid=655&checkid=c4727&download=1
Attachment 4:
rtCell_vc5_sources.rar (2005-12-19 10:04 AM, 127.07 K)
http://www.cn-dos.net/forum/attachment.php?aid=656&checkid=69e88&download=1
The following are demonstrations of 16-bit DOS real-mode mouse (PS2 ordinary serial port mouse) and keyboard applications and their available library files;
demo.exe is a demonstration of mouse (PS2) and keyboard applications in pure DOS. Note: The mouse cannot be used in the DOS window of (Win98/2K/XP);
KERNEL.SYS is used for the mouse and keyboard demonstration loaded and started by the Free DOS free loader;
rtCell16.lib is the 16-bit library file of the real-time microkernel rtCell (only applicable to Open Watcom C/C++);
rtPC_input.obj is the mouse (PS2) and keyboard input obj file for corresponding I/O operations. The source code can be found in FreeDOS-32 release 0.0.5;
sys_demo.bat and EXEFLAT.EXE are used to generate KERNEL.SYS from demo.exe for loading and starting by the Free DOS free loader.
True multitasking, multi (text mode) window demonstration:
Interrupt-driven mouse and keyboard, event-driven multi-window, true multitasking, fully preemptive real-time microkernel;
The red title is the active window, the blue title is the inactive window, and the inactive window can be dynamically refreshed in the background;
One window displays the task status, the other two windows display the current time and the word "window", and the desktop displays keyboard input;
The mouse can be used to move, activate windows, and change window size (at the lower right corner of the window).
Press "ctrl + z" to switch to the task status window.
Attachment 1: qemu_0.8_domo.rar contains the demonstration on the virtual machine. Unzip it, execute rtCell.bat, and click the window with the mouse;
Download link:
http://www.cn-dos.net/forum/attachment.php?aid=807&checkid=972c0&download=1
Attachment 2: dos_demo.rar (demo.exe and demo_.exe) is used to demonstrate with a serial mouse in pure DOS (no mouse in the Windows DOS window).
Download link:
http://www.cn-dos.net/forum/attachment.php?aid=854&checkid=12353&download=1
Latest graphical mode multi-window demonstration
giCell true graphical mode multi-window – all source codes (C language) are less than six thousand lines, and have the following functions:
1. Perfect and delicate multi-viewport clipping and hidden surface removal processing, tightly integrated with the real-time microkernel rtCell;
2. True event (or message) driven multi-window technology, and supports top-level windows and transparent windows;
3. Currently supports Label, Edit, Botton, Slider, and Checkbox controls. The Edit control supports cut, copy, and paste;
4. Supports window translation, scaling, and window system buttons, and process callbacks for windows and controls;
5. Small memory requirements (less than 64K), and the memory consumed by windows and controls is very small, so it is highly practical. Including rtCell, mouse, keyboard, and graphics driver, it is only more than 100 K bytes in DOS.
Demonstration method: Unzip gui_Test.rar, execute gui_Test.bat under Windows (double-click),
or directly execute bc_gui.exe under pure DOS (no mouse in the DOS window of Windows).
Note: In this demonstration, bc_gui.exe is relatively large due to including an illustrative bitmap.
Download address:
http://zhenlove.com.cn/cndos/fileup/files/gui_Test.rar
Last edited by taowentao on 2006-10-5 at 22:24 ]