source: cmedia/trunk/Include/tmr0_idc.h@ 559

Last change on this file since 559 was 354, checked in by stevenhl, 17 years ago

Import untested baseline cmedia sources, work products and binaries
Binaries and work products should be deleted from repository.
once new builds are verified to work.

File size: 2.8 KB
Line 
1/* TMR0_IDC.H
2
3 MODIFICATION HISTORY
4 DATE PROGRAMMER COMMENT
5 01-Jul-95 Timur Tabi Creation
6*/
7
8#ifndef TIMER0_INCLUDED
9#define TIMER0_INCLUDED
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#define TMR0_REG 0
16#define TMR0_DEREG 1
17#define TMR0_GETTMRPTR 2
18
19/* This function will will register a new time handler, modify a current
20** time handler, and deregister a current one. A registered one will be
21** called every n milliseconds. Modifying a handler means to change the
22** repeat time by sending a function hook that already exists. Note that
23** a handler can not be added or removed with an interrupt thread. A current
24** time handler can be modified with an interrupt thread.
25*/
26
27/* The actual rate is once every .999849142 milliseconds, which is slower than
28** 1ms by 0.015%. It will be behind by one millisecond every 6.628 seconds.
29*/
30
31/* This is the IDC parameter convention for calling Timer0. The first parm,
32** command, is what action needs to be done. ulParm1 is used as a
33** Ptr to a function, the function being the timer handler. ulParm2
34** is used for any other parms that might be needed. Currently it is
35** being used as a ULONG with the repeat timer in number of milliseconds.
36*/
37
38/* To call this function use DevHelp_AttachDD, to get the IdcHandler location.
39** Then declare a PTMRFN, Pointer to Timer Function which is defined below,
40** and put the correct data from DevHelpAttachDD into the PTMRFN. Then
41** just call the PTMRFN with the right parameters.
42*/
43
44/* EX To register a device that will have function FOO called every 10ms
45** one would type.
46**
47** PMTMRFN ptmrfn;
48** ptmrfn(TMR0_REG, FOO, 10);
49*/
50
51/* NOTE: THE UPPER 16 BITS (MSW) OF THE THIRD PARAMETER MUST BE ZERO!!!!!
52** That is, even though it's defined as a ULONG, it can only contain values
53** in the range 0 to 65535.
54*/
55
56/* Return Codes: 0 - Worked Correctly
57** 1 - Interrupt Thread trying to modify size of array
58** 2 - Too many devices
59** 3 - Hook not found
60** 4 - Illegal parameter
61** 5 - Problem getting IRQ0
62** 6 - Trying to register during or before INIT COMPLETE
63*/
64
65typedef void (__far __loadds *PFN_TMR0REG) (void);
66// the type of the function that TIMER0 calls every n milliseconds
67
68typedef int (__far __loadds __cdecl *PTMRFN) (int iCmd, ULONG ulParm1, ULONG ulParm2);
69// the type of the TIMER0$ IDC entry point function.
70
71typedef struct {
72 USHORT ausReserved[3]; // 3 reserved words
73 PTMRFN pfn; // far pointer to IDC entry
74 USHORT ds; // data segment of IDC
75} TIMER0_ATTACH_DD;
76
77#ifdef __cplusplus
78}
79#endif
80
81#endif
Note: See TracBrowser for help on using the repository browser.