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

📄 task_test8.c

📁 TI OMAP 1510上mcbsp的驱动程序
💻 C
字号:
/* * dspapps/dsp/task_testB/task_test8.c * * DSP task example: parallel task / priority control * * Copyright (C) 2002,2003 Nokia Corporation * * Written by Toshihiro Kobayashi <toshihiro.kobayashi@nokia.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: task_test8.c * $Revision: 2.0 * $Date: 2003/11/11 * */#include <std.h>#include <sem.h>#include <tsk.h>#include "mailbox.h"#include "tokliBIOS.h"extern Int	strcpy16to8(Char *d, Char *s);static Uns	t8_rcv_wdsnd(struct dsptask *task, Uns data);struct task_t8 {	struct dsptask	task_head;	char	*s;	LgUns	interval;};/* * task 8a: normal priority */struct task_t8 task_test8a = {	{		TID_MAGIC,	// tid		"test8a",	// name		MBCMD_TTYP_BKDM | MBCMD_TTYP_ASND,				// ttyp: active block snd, passive word rcv		t8_rcv_wdsnd,	// rcv_snd		NULL,		// rcv_req		NULL,		// rcv_tctl		NULL		// tsk_attrs	},	"Hello from task8a! *   \n",	// s	520000L				// interval};/* * task 8b: normal priority */struct task_t8 task_test8b = {	{		TID_MAGIC,	// tid		"test8b",	// name		MBCMD_TTYP_BKDM | MBCMD_TTYP_ASND,				// ttyp: active block snd, passive word rcv		t8_rcv_wdsnd,	// rcv_snd		NULL,		// rcv_req		NULL,		// rcv_tctl		NULL		// tsk_attrs	},	"Hello from task8b!  *  \n",	// s	200000L				// interval};/* * task 8c: high priority */static struct TSK_Attrs	attr_c = {	DSPTASK_DEFAULT_PRIORITY+1,	// priority	NULL,				// stack	DSPTASK_DEFAULT_STACKSIZE,	// stacksize	DSPTASK_DEFAULT_SYSSTACKSIZE,	// sysstacksize	0,				// stackseg: can't be overridden	NULL,				// environ	NULL,				// name: can't be overridden	TRUE				// exitflag};struct task_t8 task_test8c = {	{		TID_MAGIC,	// tid		"test8c",	// name		MBCMD_TTYP_BKDM | MBCMD_TTYP_ASND,				// ttyp: active block snd, passive word rcv		t8_rcv_wdsnd,	// rcv_snd		NULL,		// rcv_req		NULL,		// rcv_tctl		&attr_c		// tsk_attrs	},	"Hello from task8c!   * \n",	// s	200000L				// interval};static Uns t8_rcv_wdsnd(struct dsptask *task, Uns data){	struct task_t8	*task_t8 = (struct task_t8*)task;	Char	*s = task_t8->s;	LgUns	interval = task_t8->interval;	Uns	bid;	Int	cnt, i;	LgUns	j;	for(i=0; i<data; i++) {		for(j=0; j<interval; j++); // busy wait		bid = get_free_ipbuf(task);		if(bid == MBCMD_BID_NULL) {			return MBCMD_EID_STVBUF;		}		cnt = strcpy16to8((Char*)ipbuf_d[bid], s);		bksnd(task, bid, cnt);	}	return 0;}// We use same function in hellotimer.c////Int strcpy16to8(Char *d, Char *s) {//	Int cnt = 0;////	for(; *s; s++, d++) {//		*d = *s;//		*d |= *++s << 8;//		cnt++;//		if(!*s)//			return cnt;//	}//	*d = '\0';//	return cnt;//}

⌨️ 快捷键说明

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