tk_vtxsa.c
来自「在ARM7和UC/OSII的平台上实现了GPS自动报站的功能,涉及GPS模块LE」· C语言 代码 · 共 148 行
C
148 行
/*
* FILENAME: tk_vtxsa.c
*
* Copyright 2001 By InterNiche Technologies Inc. All rights reserved
*
* Wrapper and utility Functions to map NicheTask "TK_" macros to
* Mentor Graphics native VRTXsa Functions
*
* MODULE: MISCLIB
*
* PORTABLE: yes (within VRTXsa systems)
*
* These wrapper functions for native VrtxSa functions are dependant on the
* the implemenation of the project/target directory osport.c file.
*
* 08/15/2001 - Aditya Kotha
*
*/
#include "ipport.h"
#ifdef VRTX_SA
#include "osport.h"
#include "vrtxil.h" /* VRTXsa declarations, data types, error codes, etc */
void Sc_Wake(int *Id);
void Sc_Delay(void);
void Sc_Tresume(int tid);
void Sc_Tsuspend(void);
int Sc_Tinquiry(void);
void Sc_Wake(int *Id)
{
int err;
sc_tresume(*Id, 0, &err);
if (err == ER_IPP)
{
dtrap("tk_vtxsa 0\n");
panic("Sc_Wake");
}
return;
}
/* tk_yeild() */
void Sc_Delay(void)
{
sc_delay(0);
return;
}
void Sc_Tresume(int tid)
{
int err;
sc_tresume(tid, 0, &err);
if (err == ER_IPP)
{
dtrap("tk_vtxsa 1\n");
panic("Sc_Wake");
}
return;
}
void Sc_Tsuspend(void)
{
int err;
sc_tsuspend(0, 0, &err);
if (err == ER_IPP)
{
dtrap("tk_vtxsa 2\n");
panic("Sc_Tsuspend");
}
return;
}
int Sc_Tinquiry(void)
{
int i, err;
int info[3];
sc_tinquiry(&info[0], 0, &err);
return info[0];
}
/*
* The following is a sample implementation of TK_NEWTASK(), the following
* line is of relevance to the implementaiton of Sc_Tinquiry().
*
* *(nettask->tk_ptr) = task_id;
*
* This copies the task id returned by sc_tecreate() into our list of task
* objects, so that other TK Macro calls can do a wake up (or put to sleep) the
* appropriate task based on "our" (Interniche) Task Object ID.
*
* Examples of such uses are the SignalPktDemux() & SignalEmailTask() calls.
*
*
*
* int
* TK_NEWTASK(struct inet_taskinfo * nettask)
* {
* int task_id, err;
*
* task_id = sc_tecreate(
* (void(*)())nettask->entry,
* WILD_CARD_ID,
* nettask->priority,
* DEF_TASK_MODE,
* nettask->stacksize,
* nettask->stacksize,
* (char *) NULL,
* NO_DATA_COPY,
* &err);
*
* vrtxsa_mem_pointer = vrtxsa_mem_pointer + nettask->stacksize;
*
* if(err != RET_OK)
* {
* printf("Task create error %d on %s\n", nettask->name);
* return TK_ERROR;
* }
* else
* {
* printf("Created %s task.\n", nettask->name);
* *(nettask->tk_ptr) = task_id;
* return 0;
* }
* }
*
*/
#endif /* VRTX_SA */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?