28.12.2014 Views

uC/OS-II (Structure) - 경희대학교

uC/OS-II (Structure) - 경희대학교

uC/OS-II (Structure) - 경희대학교

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Kernel <strong>Structure</strong> (Cont’d)<br />

• Task / <strong>OS</strong>_TaskStat()<br />

MicroC/<strong>OS</strong>-<strong>II</strong> .<br />

<strong>OS</strong>_CFG.H <strong>OS</strong>_TASK_STAT_EN 1 Task <br />

Task CPU 1 % .<br />

Task Task Task<br />

.<br />

void main (void)<br />

{<br />

<strong>OS</strong>Init(); /* Initialize <strong>uC</strong>/<strong>OS</strong>-<strong>II</strong> */<br />

/* Install <strong>uC</strong>/<strong>OS</strong>-<strong>II</strong>'s context switch vector */<br />

/* Create your startup task (for sake of discussion, TaskStart()) */<br />

<strong>OS</strong>Start(); /* Start multitasking */<br />

}<br />

void TaskStart (void *pdata)<br />

{<br />

/* Install and initialize <strong>uC</strong>/<strong>OS</strong>-<strong>II</strong>’s ticker */<br />

<strong>OS</strong>StatInit(); /* Initialize statistics task */<br />

/* Create your application task(s) */<br />

for (;;) {<br />

/* Code for TaskStart() goes here! */<br />

}<br />

}<br />

Embedded System Lab. <strong>II</strong> 26

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!