?? task_test5.c
字號:
/* * dspapps/dsp/task_testB/task_test5.c * * DSP task example: active word receive * * 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_test5.c * $Revision: 2.0 * $Date: 2003/11/11 * */#include <std.h>#include <mem.h>#include "mailbox.h"#include "tokliBIOS.h"static Uns t5_rcv_wdsnd(struct dsptask *task, Uns data);static Uns t5_rcv_tctl(struct dsptask *task, Uns ctlcmd);static Uns t5_snd_wdreq(struct dsptask *task);struct task_t5 { struct dsptask task_head; Void *t1q_id; Int waiting;};struct task_t5 task_test5 = { { TID_MAGIC, // tid "test5", // name MBCMD_TTYP_ASND | MBCMD_TTYP_AREQ, // ttyp: active word snd, active word rcv t5_rcv_wdsnd, // rcv_snd NULL, // rcv_req t5_rcv_tctl, // rcv_tctl NULL // tsk_attrs }, MEM_ILLEGAL, // t1q_id};static Uns t5_rcv_wdsnd(struct dsptask *task, Uns data){ struct task_t5 *task_t5 = (struct task_t5*)task; wdsnd(task, data); // echo back task_t5->waiting = 0; return 0;}static Uns t5_rcv_tctl(struct dsptask *task, Uns ctlcmd){ struct task_t5 *task_t5 = (struct task_t5*)task; switch(ctlcmd) { case MBCMD_TCTL_TEN: if(task_t5->t1q_id != MEM_ILLEGAL) // already registered return 0; task_t5->t1q_id = register_tq_1s(task, t5_snd_wdreq); if(task_t5->t1q_id == MEM_ILLEGAL) return MBCMD_EID_NORES; task_t5->waiting = 0; return 0; case MBCMD_TCTL_TDIS: unregister_tq_1s(task, task_t5->t1q_id); task_t5->t1q_id = MEM_ILLEGAL; return 0; default: return MBCMD_EID_BADTCTL; }}static Uns t5_snd_wdreq(struct dsptask *task){ struct task_t5 *task_t5 = (struct task_t5*)task; if(!task_t5->waiting) wdreq(task); task_t5->waiting = 1; return 0;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -