⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 root.c

📁 TM1300/PNX1300系列DSP(主要用于视频处理)操作系统pSOS系统的几个demo
💻 C
字号:
/*
 *  COPYRIGHT (c) 1995,2000 TriMedia Technologies Inc.
 *
 *   +-----------------------------------------------------------------+
 *   | THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED |
 *   | AND COPIED IN ACCORDANCE WITH THE TERMS AND CONDITIONS OF SUCH  |
 *   | A LICENSE AND WITH THE INCLUSION OF THE THIS COPY RIGHT NOTICE. |
 *   | THIS SOFTWARE OR ANY OTHER COPIES OF THIS SOFTWARE MAY NOT BE   |
 *   | PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON. THE   |
 *   | OWNERSHIP AND TITLE OF THIS SOFTWARE IS NOT TRANSFERRED.        |
 *   +-----------------------------------------------------------------+
 *
 *  Module name              : root.c    1.12
 *
 *  Module type              : IMPLEMENTATION
 *
 *  Title                    : 
 *
 *  Author                   : Juul van der Spek 
 *
 *  Last update              : 15:07:34 - 00/06/19
 *
 *  Reviewed                 : 
 *
 *  Revision history         : 
 *
 *  Description              :  
 *
 */

/*----------------------------includes----------------------------------------*/

#include "sys_conf.h"
#include <stdio.h>
#include <psos.h>
#include <probe.h>


/*---------------------------- Functions -------------------------------------*/




ULONG mq;

void aaaa()
{
    int i;

    for (i=9909; i<10000; i++) {
	q_vsend(mq, &i, 4);
    }
    
    i=0;
    q_vsend(mq, &i, 4);

    t_suspend(0L);
}


void bbbb()
{
    int buf,dummy;

    do {
        q_vreceive(mq,Q_WAIT,0,(void *)&buf,4,(void *)&dummy);
        printf("*** RECEIVED: %d\n", buf);
    } while (buf);

    printf("*** TERMINATED\n", buf);
    _psos_exit(0);
}





/*
 * At initialistion, pSOS starts two tasks, the IDLE
 * task, which does nothing but spinning at the lowest
 * possible priority, and the ROOT task, which starts
 * executing at the highest possible priority with
 * a user provided function with prescribed name 'root'
 * Root should bring up your tasking systm.
 * NOTE that task functions in pSOS are not allowed 
 * to terminate other than with a t_suspend(0) or a
 * t_delete(0):
 */

void root(void)
{
   ULONG task1, task2;

   printf("Hello, world\n");

   t_create( "aaaa",
                 4,
                 10000,
                 10000,
                 0,
                 &task1
   );



   t_create( "bbbb",
                 100,
                 10000,
                 10000,
                 0,
                 &task2
   );


   q_vcreate( "0", Q_LOCAL | Q_FIFO, 100, 4, &mq );


   t_start( task1, T_PREEMPT | T_TSLICE | T_ASR | T_ISR, aaaa,  0 );
   t_start( task2, T_PREEMPT | T_TSLICE | T_ASR | T_ISR, bbbb,  0 );

   printf("Goodbye, world\n");

   t_suspend(0L);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -