Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

kernel/systime.c File Reference

Implementation: system time services. More...

#include <config.h>
#include <sys/time.h>
#include <sys/h8.h>
#include <sys/irq.h>
#include <sys/dmotor.h>
#include <sys/dsound.h>
#include <sys/battery.h>
#include <sys/critsec.h>
#include <sys/timeout.h>

Include dependency graph for systime.c:

Include dependency graph

Go to the source code of this file.

Functions

void clock_handler (void)
 clock handler triggered on the WDT overflow (every msec) on the NMI

void subsystem_handler (void)
 subsystem handler for every 2nd msec

void task_switch_handler (void)
 task switch handler called every msec

void systime_init (void)
 initialize system timer

void systime_shutdown (void)
 shutdown system timer

void systime_set_switcher (void *switcher)
 set task switcher vector

void systime_set_timeslice (unsigned char slice)
 set multitasking timeslice in ms


Variables

volatile time_t sys_time
 current system time

volatile unsigned char tm_timeslice
 task time slice

volatile unsigned char tm_current_slice
 current time remaining

void * tm_switcher_vector
 pointer to task switcher


Detailed Description

Implementation: system time services.

Author:
Markus L. Noga <markus@noga.de>

Definition in file systime.c.


Function Documentation

void clock_handler void   ) 
 

clock handler triggered on the WDT overflow (every msec) on the NMI

this is the system clock

Referenced by systime_init().

void subsystem_handler void   ) 
 

subsystem handler for every 2nd msec

this is the pulse of the system (subsystems). sound, motor and lcd driver calls are initiated here. task_switch_handler is called from here as well.

Referenced by systime_init().

void systime_init void   ) 
 

initialize system timer

task switcher initialized to empty handler motors turned off

Definition at line 267 of file systime.c.

References clock_handler(), dm_shutdown(), nmi_vector, ocia_vector, ocib_vector, rom_dummy_handler(), subsystem_handler(), sys_time, systime_shutdown(), T_CR, T_CSR, T_IER, T_OCR, T_OCRA, T_OCRB, task_switch_handler(), TCR_CLOCK_32, TCSR_RESET_ON_A, TIER_ENABLE_OCA, TIER_ENABLE_OCB, tm_current_slice, TM_DEFAULT_SLICE, tm_switcher_vector, tm_timeslice, TOCR_OCRA, TOCR_OCRB, WDT_CNT_MSEC_64, WDT_CNT_PASSWORD, WDT_CSR, WDT_CSR_CLOCK_64, WDT_CSR_ENABLE, WDT_CSR_MODE_WATCHDOG, WDT_CSR_PASSWORD, and WDT_CSR_WATCHDOG_NMI.

Referenced by kmain().

void systime_set_switcher void *  switcher  ) 
 

set task switcher vector

Parameters:
switcher the switcher

Definition at line 323 of file systime.c.

References tm_switcher_vector.

void systime_set_timeslice unsigned char  slice  ) 
 

set multitasking timeslice in ms

Parameters:
slice the timeslice. must be at least 5ms.

Definition at line 330 of file systime.c.

References tm_current_slice, and tm_timeslice.

void systime_shutdown void   ) 
 

shutdown system timer

will also stop task switching and motors.

Definition at line 314 of file systime.c.

References T_IER, TIER_ENABLE_OCA, TIER_ENABLE_OCB, WDT_CSR, and WDT_CSR_ENABLE.

Referenced by kmain(), and systime_init().

void task_switch_handler void   ) 
 

task switch handler called every msec

handles swapping between tasks

Referenced by systime_init().


Variable Documentation

volatile time_t sys_time
 

current system time

Warning:
This is a 32 bit value which will overflow after 49.7 days of continuous operation.

Definition at line 63 of file systime.c.

Referenced by systime_init().

volatile unsigned char tm_current_slice
 

current time remaining

Definition at line 73 of file systime.c.

Referenced by systime_init(), and systime_set_timeslice().

void* tm_switcher_vector
 

pointer to task switcher

Definition at line 75 of file systime.c.

Referenced by systime_init(), and systime_set_switcher().

volatile unsigned char tm_timeslice
 

task time slice

Definition at line 72 of file systime.c.

Referenced by systime_init(), and systime_set_timeslice().


brickOS is released under the Mozilla Public License.
Original code copyright 1998-2002 by the authors.

Generated on Sun Jul 27 00:12:08 2003 for brickOS Kernel Developer by doxygen 1.3.2