单片机操作系统RTX51原理分析与移植
block sizes. The application must provide an XDATA area for this purpose. The pool is stored and managed by RTX
n Request Memory Block from Pool
As soon as a pool has been generated, the application can request memory
blocks. The individual pools are identified by their block size in this case.
If an additional block is still free in the pool, RTX-51 supplies the start address
of this block to the application. If no block is free, a null pointer is returned (see
system function "os_get_block").
n Return Memory Block to Pool
If the application no longer needs a requested memory block, it can be returned
to the pool for additional use (see system function "os_free_block").
4. 时间管理
RTX-51 maintains an internal time counter, which measures the relative time passed since system start. The physical source of this time base is a hardware timer that generates an interrupt periodically. The time passed between these interrupts is called a system time slice or a system tick.
This time base is used to support time dependent services, such as pause or timeout on a task wait.
Three time-related functions are supported:
n Set system time slice
The period between the interrupts of the system timer sets the "granularity" of the time base. The length of this period, also called a time slice, can be set by the application in a wide range (see system function "os_set_slice").
n Delay a task
A task may be delayed for a selectable number of time slices. Upon calling this system function the task will be blocked (sleep) until the specified number of system ticks has passed (see system function "os_wait").
n Cyclic task activation
For many real-time applications it is a requirement to do something on a regular basis. A periodic task activation can be achieved by the RTX interval wait function (see system function "os_wait"). The amount of time spent between two execution periods of the same task is controlled, using os_wait, and is measured in number of system ticks and may be set by the application.
5. RTX(FULL)函数纵览(Functions Overview)
Initialize and Start the System:
os_start_system (task_number)
Task Management:
os_create_task (task_number)
os_delete_task (task_number)
os_ running_task_id ()
Interrupt Management:
os_attach_interrupt (interrupt)
os_detach_interrupt (interrupt)
os_enable_isr (interrupt)
os_disable_isr (interrupt)
os_wait (event_selector, timeout, 0)
oi_set_int_masks (ien0, ien1, ien2)
oi_reset_int_masks (ien0, ien1, ien2)
Signal Functions:
os_send_signal (task_number)
os_wait (event_selector, timeout, 0)
os_clear_signal (task_number)
isr_send_signal (task_number)
Message Functions:
os_send_message (mailbox, message, timeout)
os_wait (event_selector, timeout, *message)
isr_send_message (mailbox, message)
isr_recv_message (mailbox, *message)
Semaphore Functions:
os_send_token (semaphore)
os_wait (event_selector, timeout, 0)
Dynamic Memory Management:
os_create_pool (block_size, *memory, mem_size)
os_get_block (block_size)
os_free_block (block_size, *block)
Functions with the System Clock:
os_set_slice (timeslice)
os_wait (event_selector, timeout, 0)
Debug Functions:
os_check_tasks (*table)
os_check_task (task_number, *table)
os_check_mailboxes (*table)
os_check_mailbox (mailbox, *table)
os_check_semaphores (*table)
os_check_semaphore (semaphore, *table)
os_check_pool (block_size, *table)
三.RTX51移植
本试验是用的RTX的Tiny版本。也就是说没有优先级之分,没有邮箱机制,没有动态内存的管理。移植它很简单,就是配置一下它带的配置文件,然后和写好的程序一起编译连接,连接的时候加一个rtxtny参数,意思是说当我连接的时候,我把RTXtiny的库文件连接上,也就
- FPGA的DSP性能揭秘(06-16)
- 基于单片机通用引脚的软件UART设计(10-16)
- 分时操作系统思想在单片机中的具体应用 (10-30)
- 基于AT89C51+DSP的双CPU伺服运动控制器的研究(05-26)
- 关于RTX51 TINY的分析与探讨(05-30)
- 基于MC9S12DGl28单片机的智能寻迹车设计(04-03)