亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? yavrtos.dox

?? yavrtos,一款用于廣泛用于AVR單片機的RTOS,文件里是這款OS的源碼
?? DOX
?? 第 1 頁 / 共 5 頁
字號:
/**

\mainpage YAVRTOS

\htmlonly
<p align="center"><font size="+2"><b><a href="yavrtos.zip">Download YAVRTOS</a></b></font></p>
\endhtmlonly

\section History
YAVRTOS was my Christmas 2007-2008 project. I decided to do it
\li because I wanted a good RTOS for other projects
\li to see if I could write an RTOS
\li because I didn't fully understand the other RTOSes out there

Since understanding is one of my aims, I have documented YAVRTOS in the hope that it will help others who were in the same situation as me.

\section naming What's in a name?
YAVRTOS stands for Yet Another Atmel&reg; AVR&reg; Real-Time Operating System

\section TandC Terms and Conditions
YAVROTS is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 

YAVROTS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \ref LGPL "GNU Lesser General Public License" for more details.

\section prereq Pre-requisites
I've developed this using the WinAVR&tm; compiler (http://winavr.sourceforge.net/), and the AVR&reg; Studio debugger (available from http://www.atmel.com/). I've only tested it against an ATmega32 so far.

\section Status
At present, this project has not been rigorously tested. I've run many tests against the AVR&reg; Studio debugger running
an ATmega32, and everything seems to work. I've started to use it on another project, and I've met with success. This other
project uses mailboxes (which in turn use semaphores) fairly extensively, and it also bit-bang receives serial data at
4800 baud on an 8MHz ATmega32.

Apart from testing, there are some other things I want to do with this project
- more documentation
- at present, malloc() can be used by create_task() and reserve_task(), and interrupts are disabled during the calls to malloc(). The solution I have - a mutex for the microcontrollers' memory - isn't that bad, I think. A more interesting solution would be to write a thread-safe malloc()...

What all this means is that you should check back
\htmlonly
<a href="http://www.chris.obyrne.com/yavrtos/">here</a>
\endhtmlonly
often for updates, and you should check
that YAVRTOS works as expected in your application. If you
find a bug, please email me (my email address is at the bottom of the page).

\section What What is a real-time operating system?

Processors are only actually only able to do one thing at a time, whereas we need them to do more than one thing at a time (e.g. update the display while checking for keypresses while reading the serial port). A real-time operating system (RTOS) provides facilities for achieving that.

\section what-task What is a task?

A task does one of the things (e.g. update the display, check for keypresses, read the serial port) that the application needs done. The real-time operating system allows tasks to execute concurrently, while providing facilities for e.g. tasks to communicate with each other. See the \ref task "task"
page for more information.

\section what-tick What is a tick?

The RTOS needs to be able to switch betwen tasks - they way it does this is by using a regular processor interrupt
(e.g. one of the timer interrupts). Every such interrupt is called a "tick". These interrupts must be set up before the RTOS is started.
See \ref isr for more information.

\section what-scheduler What is the task scheduler?

The task scheduler (or "task switcher") is the central component of the RTOS. It is responsible for ensuring that the tasks are run according to the rules of priority. It runs every tick, and it also runs when anything happens that may change the list of runnable tasks (e.g. a mutex being released, or a semaphore changing value).

When the task scheduler runs, it effectively generates a list of the highest-priority runnable tasks. If one of those tasks has just had control of the processor, it runs the next task in the list, otherwise it runs the first task in the list.

\section what-stack What is the stack?

The stack is the standard stack that the processor implements with its stack pointer. However, when more than one task can be executing at a time, the stack becomes more complicated. In particular, every task must have its own stack, and the size of this stack is specified when the task is created. And, each stack must be large enough to accommodate all the uses the task puts the stack to.

As well as a stack for each task, there is another "system" stack - this stack is used by ISRs, and must also be large enough to accommodate the requirements of the ISRs. If it is possible for more than one ISR to be running concurrently, then the system stack must be large enough to accommodate the requirements of all the ISRs that could be running concurrently.

\section what-stack-uses What are the uses the stack is put to?

The stack is used -

\li To hold the value of local variables. For instance,
\code
void proc() {
	char c;
\endcode
The variable "c" will use up one byte of the stack.
\li To hold the return address of function calls.
\code
void proc() {
	proc2();
\endcode
The call to proc2() will use up two bytes of the stack.
\li To hold the CPU context on task switch - there must be at least 35 bytes on the stack to handle task switching
\li To hold the return address, and some other information, on interrupt - this takes maybe another 10 bytes of stack
\li As a system scratchpad - maybe another half-dozen bytes of stack.

So a minimum stack size would be about 55 bytes.

\section what-small-stack What happens if the stack isn't big enough?

Memory corruption, and hence a probable spectacular (and untraceable) crash.

\section seealso Further reading

\li \ref task
\li \ref semaphore
\li \ref mutex
\li \ref mailbox
\li \ref Example
\li \ref usage "Using YAVRTOS"
\li \ref howdoI "How do I?"
\li \ref QandA "Questions and Answers"
\li \ref isr
\li \ref api-usage-restrictions "API Usage Restrictions"

*/


/**

\defgroup task Tasks
A task performs a function in the application, and an application can have a number of tasks running "simultaneously". Tasks
are a function with the signature <tt>void task_func(void *init)</tt>, and optionally a "cleanup" function
<tt>void task_cleanup()</tt> that is called when the task is exiting. The value of the \c init argument to the task function 
is specified when the task is created.

Tasks are created by create_task(), and can be stopped by stop_task().
Tasks are held in memory in a linked list - spaces may be reserved on that list for future tasks using
reserve_task().

Tasks can suspend themselves when they are unable to do any work (e.g. a task
that reads a microcontroller peripheral could suspend itself when the peripheral has no data available), hence
allowing other tasks that can do work to run, and hence the application as a whole can get the maximum
use of the CPU's processing power. The ways a task can suspend itself are
\li by calling lock_on() on a \ref mutex "mutex" that another task has already locked on to. Note that create_task() and reserve_task() can
	decide to lock on to a supplied "memory mutex" - see create_task(), reserve_task() and \ref malloc
\li by calling wait_for_min_value() on a \ref semaphore "semaphore" that hasn't yet reached the specified value
\li by calling wait_for_increment_of() on a \ref semaphore "semaphore"
\li by calling read_mbox_min_version() on a \ref mailbox "mailbox" that hasn't yet reached the specified version
\li by calling write_mbox() - see write_mbox() for the conditions under which a task will be suspended
\li by calling wait_for_receiver() on a \ref mailbox "mailbox" that no-one is waiting to read from
\li a temporary suspension can be caused by calling yield() - if there are other schedulable tasks, they will run, but the calling task will eventually
	be re-scheduled to run
\li by waiting for another task to stop - see stop_task() for more information

Every task has a priority. The rule is that the RTOS will not allow the lowest-priority tasks to run until all higher-priority tasks have suspended
themselves. If there are more than one highest-priority not-suspended tasks, then the RTOS will switch between them once
every tick interrupt (and/or whenever one of the tasks calls yield()).

A priority of zero indicates an "idle" task - a task that is run when there are no other tasks that can run. There must always be at least one idle task, and idle tasks can neither be stopped nor can they do anything to suspend themselves (e.g. they cannot wait for a mutex to be released), as the
microcontroller needs at least one task to be always available for scheduling. Usually there is just one idle task that just sleeps the CPU.
A recommended idle task is
\code
void idle_task(void *p) {
  set_sleep_mode(SLEEP_MODE_IDLE);
  sleep_enable();
  sei();
  sleep_cpu();
}
\endcode

A task switch can occur
\li whenever anything happens to a mutex, semaphore or mailbox that may cancel the suspension of a higher priority
	task (e.g. when a semaphore has its value increased)
\li when a task calls yield()
\li when the system tick interrupt happens - see \ref isr for more information about the tick interrupt.

From the point of view of the RTOS, the microcontroller can be doing one of three things
\li executing code before the RTOS has been started with a call to task_switcher_start(). When the microcontroller is in this state, the RTOS
is obviously unable to "suspend" what the microcontroller is doing, and hence none of the API calls that could cause such a suspension may be
used
\li executing a task, which can be an "idle" task of zero priority, or a "non-idle" task of non-zero priority. When executing an idle task,
a task suspension is disallowed (as there must always be something that the microcontroller can do when it is otherwise unable to do anything).
\li executing an ISR, including the tick interrupt ISR. Again, the RTOS is unable to suspend the ISR.

Therefore there are restrictions on when certain API calls may be made - these restrictions are summarised on the
\ref api-usage-restrictions "api usage restrictions" page.

See the \ref Example "example application" for an example of how to start and run some simple tasks.

Tasks can be stopped by other tasks or by ISRs - see stop_task(). When a task is stopped, mutexes and mailboxes are
released - see task_stopper()

*/



/**

\defgroup semaphore Semaphores
A semaphore contains a number that tasks can suspend themselves against, waiting for the number to
reach at least a certain value before the task is schedulable again.

To update a semaphore's value, use increment_semaphore_by()

To read a semaphore's value, use get_semaphore_value()

To lock on a semaphore, use wait_for_min_value() or wait_for_increment_of()

See \ref usage-sema "using semaphores" for information on how to use semaphores

\defgroup mailbox Mailboxes
Mailboxes are used to pass information between tasks.

Mailboxes contain a pointer to the mailbox data, and a version number. Tasks can both read from and write to mailboxes.
The rules governing mailboxes are
\li A task can only read from one mailbox at a time - the task must finish reading a mailbox before it can start reading
	another one
\li A task cannot write to a mailbox while there are other tasks reading from it
\li A mailbox can contain only one "message" at a time

Mailboxes \b must be initialised with initialise_mbox().
Tasks can write to mailboxes with write_mbox() or write_mbox_now(). Tasks can read from mailboxes with
read_mbox() or read_mbox_min_version(), and \b must subsequently call release_mbox_read() when they are done
reading from the mailbox. Other functions governing the use of mailboxes are get_current_mbox_version()
and wait_for_receiver().

Mailboxes can be synchronous or asynchronous. When task A writes to a mailbox, its version number is incremented. If task B
has been waiting for that version of the mailbox, it is immediately marked as reading the mailbox, hence other tasks are
prevented from writing to the mailbox until task B has finished reading from it. Of course, if there wasn't a task B waiting
for the data, then a task C could over-write what task A wrote to the mailbox without any task ever seeing what task A wrote.
To mitigate this problem, task A is able to request that a certain minimum number of tasks be waiting for the mailbox to be
updated before the data is written to the mailbox - hence task A is guaranteed that the data it writes is seen.

It is the responsibility of the task that writes to the mailbox to allocate memory for the mailbox data. To prevent problems
arising from the memory allocation going out of scope before all the reading tasks have finished reading the data, a writing
task is able to request that all reading tasks finish reading before control is passed back to the writing task. Not only that,
but the writing task is also able to request that the mailbox data be "nullified" (i.e. that a new version of the mailbox with
a null data pointer be published) as soon as all the reading tasks have finished reading, thereby ensuring that no subsequent
reading tasks will attempt to read the writing tasks' data.

See \ref usage-mbox "using mailboxes" for information on how to use mailboxes

*/


/**

\defgroup mutex Mutexes
A <b>MUT</b>ual <B>EX</b>clusion object - only one task can "own" a mutex at any one time.

Mutexes are "owned" by calling lock_on(), and released by calling lock_off()

If another task tries to own an "owned" mutex, that task will be
suspended until the mutex becomes available.

Tasks may own as many mutexes as they wish, and mutexes will automatically be released when the task exits

See \ref usage-mutex "using mutexes" for information on how to use mutexes

If malloc() is going to be used by your task, then you may require a mutex for the microcontroller memory -
see \ref malloc

*/


/**


\defgroup isr Interrupt Service Routines
Interrupt Service Routines are functions that are called when an interrupt occurs, and
are defined with the TASK_ISR() macro.
*/


/**


\defgroup taskstategroup The possible states that a task can be in
\internal
These are the states that a task can be in (i.e. the possible values of task.status).


*/


/**


\page Example

In this example, we will flash two LEDs connected to port A at different rates.

\code
#include "task.h"

#include <stdint.h>
#include <avr/interrupt.h>
#include <avr/io.h>
#include <avr/sleep.h>

// A semaphore that we will increment at every tick
static semaphore_t tick;
// We will also create a mutex for port A, as both tasks will be using it potentially "simultaneously"
static mutex_t porta_mutex;

// This is our first task - blinking port A bit 0 once every 200 ticks
void blink1(void *p) {
        while (1) {
                // Obtain a lock on the port A mutex
                lock_on(&porta_mutex);
                // OK - port A is now all ours, so blink the LED
                PORTA ^= 0x01;
                // Release our hold on the port A mutex

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美大片在线观看| 色综合天天做天天爱| 日韩精品一区二区三区swag| 日本中文字幕一区二区视频 | 欧美性淫爽ww久久久久无| 亚洲欧美偷拍三级| 欧美在线观看一区二区| 日日夜夜精品免费视频| 精品免费一区二区三区| 成人激情免费电影网址| 亚洲日本一区二区三区| 在线成人免费视频| 精品午夜久久福利影院| 中文字幕中文字幕一区| 在线亚洲高清视频| 美女脱光内衣内裤视频久久影院| 久久综合九色综合欧美98 | 裸体歌舞表演一区二区| 国产性做久久久久久| 日本乱码高清不卡字幕| 免费一区二区视频| 国产精品久久福利| 欧美日韩中文一区| 韩国v欧美v亚洲v日本v| 亚洲欧美综合色| 欧美一区二区三区人| 成人性视频网站| 亚洲成人免费在线观看| 久久精品亚洲乱码伦伦中文| 色呦呦网站一区| 激情综合色综合久久| 亚洲免费观看高清在线观看| 欧美不卡一二三| 99久久er热在这里只有精品66| 丝袜亚洲精品中文字幕一区| 欧美韩国一区二区| 欧美男男青年gay1069videost| 国内成人自拍视频| 性做久久久久久| 国产精品久久久久久久久免费丝袜| 91精品国产黑色紧身裤美女| 91网站最新地址| 国产经典欧美精品| 日本网站在线观看一区二区三区| 国产精品少妇自拍| 欧美大尺度电影在线| 91国偷自产一区二区开放时间 | 日韩欧美一二三四区| 99精品视频一区二区| 日本成人在线不卡视频| 日韩理论片中文av| 国产午夜亚洲精品理论片色戒| 欧美日本国产视频| 不卡的av在线| 国产精品一区2区| 丝袜诱惑制服诱惑色一区在线观看| 亚洲欧洲国产专区| 国产欧美精品一区二区色综合朱莉 | 爽好久久久欧美精品| 亚洲婷婷在线视频| 欧美激情在线一区二区三区| 欧美大白屁股肥臀xxxxxx| 欧美影视一区二区三区| 97se亚洲国产综合在线| 成人在线综合网| 国产一区二区三区精品视频| 日本欧美韩国一区三区| 日韩精品亚洲一区| 午夜精品久久久久久久久久久| 亚洲另类在线视频| 亚洲精品少妇30p| 中文字幕在线不卡一区| 国产精品日韩精品欧美在线| 国产农村妇女毛片精品久久麻豆| 精品国产电影一区二区| 欧美日韩1234| 精品视频1区2区| 欧美嫩在线观看| 欧美一三区三区四区免费在线看| 欧美久久高跟鞋激| 欧美一区二区在线视频| 欧美精品三级在线观看| 91麻豆精品国产综合久久久久久 | 精品少妇一区二区三区免费观看| 欧美一卡二卡三卡| 日韩精品最新网址| www国产成人| 久久久不卡网国产精品二区| 久久久精品黄色| 中文字幕一区二区三| 亚洲天堂免费看| 亚洲一二三四区| 五月开心婷婷久久| 国内精品视频666| 国产成人鲁色资源国产91色综| 成人小视频在线| 色88888久久久久久影院野外 | 日韩av一区二区在线影视| 久久精品国产99国产精品| 激情文学综合丁香| 99久久婷婷国产综合精品| 欧美自拍丝袜亚洲| 91精品国产麻豆| 欧美国产精品v| 夜夜嗨av一区二区三区网页 | 精品一区二区三区免费| 国产成人午夜电影网| 色综合久久久久综合体桃花网| 欧美性生交片4| 日韩丝袜美女视频| 成人免费一区二区三区在线观看| 亚洲国产精品久久不卡毛片| 日本欧美在线看| 成人激情文学综合网| 欧美系列在线观看| 久久久综合精品| 亚洲午夜精品网| 国产成人午夜电影网| 91国产福利在线| 国产偷国产偷精品高清尤物| 亚洲欧美一区二区三区久本道91 | www.日韩av| 欧美高清激情brazzers| 国产午夜亚洲精品羞羞网站| 亚洲综合无码一区二区| 国产酒店精品激情| 欧美性极品少妇| 欧美国产欧美综合| 美女视频黄久久| 91色.com| 久久九九久久九九| 亚洲成a人片在线不卡一二三区| 国产精品影视网| 欧美精品九九99久久| 亚洲欧洲日韩av| 韩国一区二区视频| 在线91免费看| 亚洲精品欧美综合四区| 国产a区久久久| 欧美xxxxx裸体时装秀| 午夜视频久久久久久| 99精品在线免费| 国产视频视频一区| 免费成人深夜小野草| 欧美色大人视频| 国产精品国产三级国产aⅴ原创| 激情五月激情综合网| 91精品国产综合久久久久久久| 亚洲欧美激情在线| 成人中文字幕电影| 国产日韩欧美精品在线| 蜜桃在线一区二区三区| 国产精品无码永久免费888| 美女诱惑一区二区| 欧美二区三区91| 亚洲国产日韩精品| 色综合久久久久网| 亚洲精品你懂的| 色94色欧美sute亚洲线路二| 亚洲欧洲av色图| 97久久精品人人做人人爽50路| 国产精品午夜在线观看| 丁香婷婷综合激情五月色| 久久久久久久av麻豆果冻| 国产在线精品国自产拍免费| 欧美一区二区国产| 美女高潮久久久| 日韩欧美一区二区三区在线| 日韩高清中文字幕一区| 欧美精品乱码久久久久久按摩| 午夜激情久久久| 日韩欧美一级二级三级| 激情综合一区二区三区| 久久九九全国免费| 成人免费高清在线| 中文字幕在线不卡一区| 色偷偷成人一区二区三区91 | 丝袜国产日韩另类美女| 制服丝袜日韩国产| 久久成人免费网| 久久在线观看免费| 成人免费视频视频| 亚洲人亚洲人成电影网站色| 91视频观看免费| 五月天网站亚洲| 欧美一区二区黄色| 国产麻豆91精品| 中文字幕亚洲一区二区va在线| 91在线视频官网| 首页综合国产亚洲丝袜| 精品三级在线看| av电影一区二区| 亚洲永久免费av| 欧美电影免费观看高清完整版 | 在线欧美日韩国产| 日产国产高清一区二区三区| 欧美精品一区二| 99久久婷婷国产综合精品| 亚洲成人动漫一区| 国产亚洲短视频|