1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280
|
//----------------------------------------------------------------------
// Driver for the STMicroelectronics ADSL Chip Taurus
//----------------------------------------------------------------------
// File: rapi.h
// Author: Christophe Piel
// Copyright F.H.L.P. 2000
// Copyright ST Microelectronics 2000
//----------------------------------------------------------------------
// provides definitions for Operating System API to the Taurus chip
//----------------------------------------------------------------------
#ifndef __rapi__h_
#define __rapi__h_
#ifdef __cplusplus
extern "C" {
#endif
enum {
_SM_WAIT=0,
_SM_NOWAIT=1
};
void setShowtime(void); // Set showtime FLAG to TRUE
void resetShowtime(void); // Set showtime FLAG to FALSE
void setAtmRate( // reports ATM cell rates
unsigned short upRate,
unsigned short downRate
);
//----------------------------------------------------------------------
// INTERRUPT MANAGEMENT
//----------------------------------------------------------------------
typedef void (*ITHANDLER)(DWORD);
#define ERR_BSP_ILL_INTR 8
DWORD
board_set_intr_handler(
DWORD intr,
ITHANDLER p_handler,
DWORD devNumber
);
DWORD
board_reset_intr_handler(
DWORD intr
);
DWORD
board_clear_intr_pending(
DWORD intr
);
DWORD
board_mask_intr(
DWORD intr
);
DWORD
board_unmask_intr(
DWORD intr
);
void
board_disable_intrs(
void
);
void
board_enable_intrs(
void
);
//----------------------------------------------------------------------
// TASK MANAGEMENT
//----------------------------------------------------------------------
#define XPRIO_EVENT_HDLR 200
#define XPRIO_CRITICAL_APPL 150
#define XPRIO_OAM_APLL 100
#define XPRIO_BACKGRND_APPL 50
typedef void (*START_FUNC)(DWORD,DWORD,DWORD,DWORD);
// Creates a task
// --------------
DWORD xt_create(
char name[4],
DWORD prio,
DWORD sstack,
DWORD ustack,
DWORD flags,
DWORD *tid
);
// Starts a task
// -------------
DWORD xt_start(
DWORD tid,
DWORD mode,
START_FUNC start_addr,
DWORD targs[4]
);
// Disables task scheduling
// ------------------------
void xt_entercritical(void);
// Enables task scheduling
// -----------------------
void xt_exitcritical(void);
// Waits until all tasks terminate
// -------------------------------
void xt_waitexit(void);
//----------------------------------------------------------------------
// MEMORY MANAGEMENT
//----------------------------------------------------------------------
// Allocates a memory buffer
// -------------------------
DWORD xm_getmem(
DWORD size,
PVOID *bufaddr
);
// Release a memory buffer
// -----------------------
DWORD xm_retmem(
PVOID bufaddr
);
//----------------------------------------------------------------------
// INTER TASK COMMUNICATION AND SYNCHRONIZATION (SEMAPHORE)
//----------------------------------------------------------------------
// Creates a semaphore
// -------------------
DWORD xsm_create(
char name[4],
DWORD count,
DWORD flags,
DWORD *smid
);
// Gets a semaphore ident
// ----------------------
DWORD xsm_ident(
char name[4],
DWORD node,
DWORD *smid
);
// Allows a task to acquire a semaphore
// ------------------------------------
DWORD xsm_p(
DWORD smid,
DWORD flags,
DWORD timeout
);
// Releases a semaphore
// --------------------
DWORD xsm_v(
DWORD smid
);
//----------------------------------------------------------------------
// INTER TASK COMMUNICATION AND SYNCHRONIZATION (QUEUE)
//----------------------------------------------------------------------
// Creates a message queue
// -----------------------
DWORD xq_create(
char name[4],
DWORD count,
DWORD flags,
DWORD *qid
);
// Receives a message from a queue
// -------------------------------
DWORD xq_receive(
DWORD qid,
DWORD flags,
DWORD timeout,
DWORD msg_buf[4]
);
// Sends a message to a queue
// --------------------------
DWORD xq_send(
DWORD qid,
DWORD msg_buf[4]
);
//----------------------------------------------------------------------
// TIMER MANAGEMENT
//----------------------------------------------------------------------
typedef enum {
E_XTM_ONE_SHOT = 1,
E_XTM_PERIODIC = 2,
}
T_timer_mode;
#define XMID_TIMER_EX 1
// Starts a timer
// --------------
DWORD xtm_startmsgtimer(
DWORD qid,
T_timer_mode mode,
DWORD interval,
DWORD userdata,
BYTE owner_ctrl,
DWORD *tmid
);
// Stops a timer
// -------------
DWORD xtm_stopmsgtimer(
DWORD tmid
);
//----------------------------------------------------------------------
// TIME FUNCTIONS
//----------------------------------------------------------------------
// Wake up after n milliseconds
// ----------------------------
DWORD xtm_wkafter(
DWORD ms
);
// Returns system time in ms.
// --------------------------
DWORD xtm_gettime(
void
);
// Returns in ms the difference between two times
// ----------------------------------------------
DWORD xtm_timediff(
DWORD time1,
DWORD time2
);
// Returns the elapsed time since the given time
// ---------------------------------------------
DWORD xtm_elapse(
DWORD time
);
// Gets a time stamp in ms and s.
// -----------------------------
DWORD xtm_gettimestamp(
DWORD *microseconds,
DWORD *seconds
);
//----------------------------------------------------------------------
// MISCELLANEOUS
//----------------------------------------------------------------------
//#define dbg_print DbgPrint
//DWORD __cdecl DbgPrint(char *fmt,...);
extern DWORD tosca_hardITABLE[14];
extern WORD tosca_softITABLE[28]; // TOSCA Interrupt table visible to MSW
extern int rapi_init(void);
extern void rapi_exit(void);
#define rapi_lock()
#define rapi_unlock()
//#define rapi_lock() do_rapi_lock(__FUNCTION__)
//#define rapi_unlock() do_rapi_unlock(__FUNCTION__)
extern void do_rapi_lock(const char *func);
extern void do_rapi_unlock(const char *func);
extern void tosca_interrupt(void);
//----------------------------------------------------------------------
// END
//----------------------------------------------------------------------
#ifdef __cplusplus
} //extern "C"
#endif
#endif // __rapi__h_
|