01.06.2013 Views

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Top of list<br />

Index page<br />

TimerProc_Structure<br />

Comments<br />

typedef struct tag_timer_proc<br />

{<br />

unsigned int far *timerID; // pointer to storage the unique timerID<br />

void (far *proc)(); // pointer to the procedure to be executed<br />

void far *dummyptr; // Optional parameter to timer procedure<br />

char name[4]; // -- Field not used -long<br />

interval; // timer execution interval in milliseconds<br />

} TimerProc_Structure;<br />

This structure is defined in the header file rtxapi.h.<br />

Before calling the RTX_INSTALL_TIMER API function the caller must allocate a TimerProc_Structure with the<br />

following members set as specified here:<br />

timerID<br />

Put here a far pointer to a 16 bit location in your program's memory space. The RTX_INSTALL_TIMERAPI<br />

function will output a Timer ID to this referenced location. This Timer ID value is used as handle for this new<br />

timer procedure within the other Timer Procedure API functions.<br />

proc<br />

This is a far vector to your timer procedure. This routine will be called periodically from the kernel. Your timer<br />

procedure should be declared (depending on compiler used) as:<br />

Borland C: void huge MyTimerProc(void)<br />

Microsoft C: void far _saveregs _loadds MyTimerProc(void)<br />

Turbo Pascal:<br />

procedure Timer1_Proc;interrupt;<br />

begin<br />

[... your code ...]<br />

(************************************************)<br />

(* This is needed at the end of the Timer Proc. *)<br />

asm<br />

POP BP<br />

POP ES<br />

POP DS<br />

POP DI<br />

POP SI<br />

POP DX<br />

POP CX<br />

POP BX<br />

POP AX<br />

RETF<br />

end;<br />

(************************************************)<br />

end;<br />

so that the compiler will generate code to set the CPU's DS register, enabling access to your program's data.<br />

Have also a look to some important notesconcerning Timer Procedures.<br />

dummyptr<br />

This four byte value is pushed onto the stack by the system as an input parameter to your timer procedure. You<br />

are free to ignore this parameter as suggested by the above MyTimerProc(void)declarations. Alternatively<br />

you could also use, for example, either of the following timer procedure declarations (Borland):<br />

Page 242 / 400

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!