source: svn/zas_dstar/hal/os/src/v2lin/vxw_hdrs.h @ 22

Last change on this file since 22 was 22, checked in by phkim, 11 years ago
  1. phkim
  2. newcon3sk 를 kctv 로 브랜치 함
File size: 5.8 KB
Line 
1/****************************************************************************
2 * Copyright (C) 2004, 2005, 2006 v2lin Team <http://v2lin.sf.net>
3 * Copyright (C) 2000,2001  Monta Vista Software Inc.
4 *
5 * This file is part of the v2lin Library.
6 * VxWorks is a registered trademark of Wind River Systems, Inc.
7 *
8 * Initial implementation Gary S. Robertson, 2000, 2001.
9 * Contributed by Andrew Skiba, skibochka@sourceforge.net, 2004.
10 * Contributed by Mike Kemelmakher, mike@ubxess.com, 2005.
11 * Contributed by Constantine Shulyupin, conan.sh@gmail.com, 2006.
12 *
13 * The v2lin library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
17 *
18 * The v2lin Library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21 * Lesser General Public License for more details.
22 *
23 ****************************************************************************/
24
25#ifndef __VXW_HDRS_H
26#define __VXW_HDRS_H
27
28#include <sys/types.h>
29#include "vxw_defs.h"
30#include "v2lpthread.h"
31
32__BEGIN_DECLS;
33
34/*
35**  Object Compatibility data types
36**
37**  These data types are defined here to provide source code compatibility with
38**  existing vxWorks code.  NOTE that they do not necessarily correspond to the
39**  actual Wind River definitions for the defined types, nor to the actual
40**  types of the objects they reference as defined in the v2pthreads
41**  environment.  THIS MAY CAUSE LINKER ERRORS IF TYPE-SAFE LINKAGE IS USED!
42**  It works okay with standard ANSII C-style linkage, however.
43*/
44
45/*****************************************************************************
46**  Control block for v2pthread watchdog timer
47**
48**  These watchdog timers provide a means of executing delayed or cyclic
49**  functions.  They are inherently 'one-shot' timers.  For cyclic operation,
50**  the timeout handler function must call wdStart to restart the timer.
51**  In the v2pthreads environment, these timers execute from the
52**  context of the system exception task rather tha the timer interrupt.
53*****************************************************************************/
54typedef struct v2pt_mqueue * MSG_Q_ID;
55typedef struct v2lsem *SEM_ID;
56typedef struct v2pt_wdog *WDOG_ID;
57typedef int SEM_B_STATE;
58//typedef void *FUNCPTR;
59typedef int (*FUNCPTR) (int, int, int, int, int, int, int, int, int, int);
60
61
62// This function must be called ASAP in main()
63extern int v2lin_init(void);
64
65/*
66**  Round-Robin Scheduling Control
67**
68**  The following three functions are unique to v2pthreads.
69**  They are used to manipulate a global system setting which affects all
70**  tasks spawned or initialized after the round-robin control call is made.
71**  They have no effect on tasks spawned or initialized prior to the call.
72**  Round-Robin scheduling causes tasks at the same priority level to be
73**  scheduled on a 'time-sliced' basis within that priority level, so that
74**  all tasks at a given priority level get an equal opportunity to execute.
75**  Round-robin scheduling is TURNED OFF by default.
76*/
77
78extern void disableRoundRobin(void);
79extern void enableRoundRobin(void);
80extern BOOL roundRobinIsEnabled(void);
81extern STATUS kernelTimeSlice(int ticks_per_quantum);
82
83/*
84**  taskLib Function Prototypes
85*/
86
87#if TO_BE_DELETED
88extern int taskSpawn(char *name, int pri, int opts, int stksize, FUNCPTR entry, int arg1,
89                                         int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8,
90                                         int arg9, int arg10);
91
92extern STATUS taskInit(WIND_TCB * task, char *name, int pri,
93                                           int opts, char *pstack, int stksize, FUNCPTR entry, int arg1, int arg2,
94                                           int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9,
95                                           int arg10);
96
97STATUS taskActivate(int taskId);
98STATUS taskDelete(int taskId);
99STATUS taskDeleteForce(int taskId);
100STATUS taskSuspend(int taskId);
101STATUS taskResume(int taskId);
102STATUS taskRestart(int taskId);
103STATUS taskPrioritySet(int taskId, int priority);
104STATUS taskPriorityGet(int taskId, int *priority);
105STATUS taskLock(void);
106STATUS taskUnlock(void);
107STATUS taskSafe(void);
108STATUS taskUnsafe(void);
109STATUS taskDelay(int ticks_to_wait);
110char *taskName(int taskId);
111int taskNameToId(char *task_name);
112STATUS taskIdVerify(int taskId);
113int taskIdSelf(void);
114int taskIdDefault(int taskId);
115BOOL taskIsReady(int taskId);
116BOOL taskIsSuspended(int taskId);
117WIND_TCB *taskTcb(int taskId);
118int taskIdListGet(int list[], int maxIds);
119#endif
120
121/*
122**  msgQLib Function Prototypes
123*/
124extern MSG_Q_ID msgQCreate(int max_msgs, int msglen, int opt);
125extern STATUS msgQDelete(MSG_Q_ID queue);
126extern STATUS msgQSend(MSG_Q_ID queue, char *msg, uint msglen, int wait, int pri);
127extern int msgQReceive(MSG_Q_ID queue, char *msgbuf, uint buflen, int max_wait);
128extern int msgQNumMsgs(MSG_Q_ID queue);
129
130/*
131**  semLib Function Prototypes
132*/
133extern STATUS semGive(SEM_ID semaphore);
134extern STATUS semTake(SEM_ID semaphore, int max_wait);
135extern STATUS semFlush(SEM_ID semaphore);
136extern STATUS semDelete(SEM_ID semaphore);
137extern SEM_ID semBCreate(int opt, SEM_B_STATE initial_state);
138extern SEM_ID semCCreate(int opt, int initial_count);
139extern SEM_ID semMCreate(int opt);
140extern STATUS semMGiveForce(SEM_ID semaphore);
141
142/*
143**  wdLib Function Prototypes
144*/
145extern STATUS wdCancel(WDOG_ID wdId);
146extern WDOG_ID wdCreate(void);
147extern STATUS wdDelete(WDOG_ID wdId);
148extern STATUS wdStart(WDOG_ID wdId, int delay, void (*f) (int), int parm);
149
150// additinal utility functions
151
152int semList(FILE * out, int mem);
153int taskList(FILE * out, int mem);
154int msgQList(FILE * out,int mem);
155int wdogShow(FILE * out);
156char * VxWorksError(STATUS status);
157
158__END_DECLS;
159#endif                                                  // __VXW_HDRS_H
Note: See TracBrowser for help on using the repository browser.