summaryrefslogtreecommitdiffstats
path: root/private/utils/ntbackup/inc/backgrnd.h
blob: e8f21078c57ca2bb0818678fc506b7788abc04ef (plain) (blame)
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
/**
Copyright(c) Maynard Electronics, Inc. 1984-89


     Name:         backgrnd.h

     Date Updated: $./FDT$ $./FTM$

     Description:  

     Location:     


	$Log:   N:/LOGFILES/BACKGRND.H_V  $
 * 
 *    Rev 1.1   11 Sep 1991 09:59:18   DON
 * changed 'far' to PTR_SIZE - defined in stdtypes.h for portability
 * 
 *    Rev 1.0   09 May 1991 13:31:04   HUNTER
 * Initial revision.

**/
/* $end$ */

/**
    :IH1:   Copyright (C) Maynard Electronics, Inc. 1984-89

    :Name:         backgrnd.h

    :Description:  Contains the function prototypes for the background
                   process manager.

                   The data structure required by applications to use the
                   background process manager is listed below:

                       typedef struct { ... } BACKGROUND_CONTROL;

                    The application must allocate and pass a structure
                    of type BACKGROUND_CONTROL to the InstallBackgroundRoutine
                    function.  The structure must be static until it is
                    passed to the RemoveBackgroundRoutine function.

                    The interfaces to the background process manager are
                    listed below:

                     VOID InstallBackgroundRoutine( BACKGRND_CONTROL_PTR control_elem_ptr,
                                                    BACKGRND_FUNC_PTR func_ptr );

                     This function installs a function to be called repeatedly
                     in the background, behind the main program.


                     VOID RemoveBackgroundRoutine( BACKGRND_CONTROL_PTR control_elem_ptr );

                     This function removes a previously installed background routine.
                     The control_elem_ptr must point to the same structure which was
                     passed to the InstallBackgroundRoutine.

                    The InstallInt28Routine and RemoveInt28Routine functions work
                    similarly, except that the handlers they install are called
                    when DOS is idling at the prompt (DOS alternates between issuing
                    a no-wait keyboard read and calling interrupt 28).              

                    InstallBackgroundHooks traps the interrupt vectors necessary for
                    background processing.  RemoveBackgroundHooks restores the vectors
                    to their system defaults.                  

                     Since background routines are frequently used to schedule
                     processes to occur at a later time the following macros are
                     provided

                          TIME()   -   returns a UINT32 representing the number of
                                       clock ticks since the first background
                                       routine was installed.

                          NO_TIMEOUT - a value which TIME() will always be less than.

    $Header:   N:/LOGFILES/BACKGRND.H_V   1.1   11 Sep 1991 09:59:18   DON  $

    $Log$
   
      Rev 2.0   18 May 1990 19:06:36   PAT
   Baseline Maynstream 3.1
**/



#ifndef BACKGRND
#define BACKGRND


typedef UINT32 TIMEOUT_VALUE;
extern TIMEOUT_VALUE background_timer;


typedef Q_ELEM BACKGRND_CONTROL;

typedef BACKGRND_CONTROL PTR_SIZE *BACKGRND_CONTROL_PTR;

#define BACKGRND_FUNC PF_VOID

typedef enum { CallerIPX,CallerInt28 } CallerType;

typedef VOID (PTR_SIZE *BACKGRND_FUNC_PTR)( CallerType caller );

#define INTR_NUM (0x1C)



VOID InstallBackgroundRoutine( BACKGRND_CONTROL_PTR control_elem_ptr, BACKGRND_FUNC_PTR func_ptr );
VOID RemoveBackgroundRoutine( BACKGRND_CONTROL_PTR control_elem_ptr );
VOID InstallInt28Routine( BACKGRND_CONTROL_PTR control_elem_ptr, BACKGRND_FUNC_PTR func_ptr );
VOID RemoveInt28Routine( BACKGRND_CONTROL_PTR control_elem_ptr );
VOID InstallBackgroundHooks( VOID );
VOID RemoveBackgroundHook( VOID );

extern UINT8 In28Hook;     

#define TIME() background_timer
#define NO_TIMEOUT ( (UINT32) ( (TIMEOUT_VALUE) 1) << (((sizeof(TIMEOUT_VALUE)-1)*8) - 1) )

#endif