plf_misc.c File Reference


Detailed Description

HAL miscellaneous functions.

Author:
Uwe Kindler, yoshinori sato
Date:
2003-12-06
This file contains miscellaneous functions provided by the

Definition in file plf_misc.c.

Go to the source code of this file.

Functions

externC void __default_interrupt_vsr (void)
 Default interrupt vector service routine.

void hal_platform_init (void)
 Additional platform initialisation.

void hal_clock_initialize (cyg_uint32 period)
 Timer (TPU channel 5) initialisation.

void hal_clock_read (cyg_uint32 *pvalue)
 Reads current value of timer counter.

void cyg_plf_memory_segment (int seg, unsigned char **start, unsigned char **end)
 Provide information about additional memory segment.


Variables

externC volatile CYG_ADDRESS hal_vsr_table [CYGNUM_HAL_VSR_COUNT]
 Contains vector service routines for all interrupt vectors (vectors.S).


Function Documentation

externC void __default_interrupt_vsr void   ) 
 

Default interrupt vector service routine.

void cyg_plf_memory_segment int  seg,
unsigned char **  start,
unsigned char **  end
 

Provide information about additional memory segment.

We provide information about the internal H8S/2674 ram.

Parameters:
start Start address of memory segment
end End address of memory segment
seg Number of segment provided by redboot
Note:
The first memory segment 0 is calculated by RedBoot

Definition at line 205 of file plf_misc.c.

00206 {
00207     cyg_uint32 mem_start;
00208        
00209     //
00210     // we have one additional memory segment - the H8S/2674 internal ram
00211     //
00212     if (seg == 1) 
00213     {
00214         //
00215         // the internal ram contains VSR table, virtual vector table and
00216         // shadow vector table. these areas are reserved and not available 
00217         // so we end at start of CYGHWR_HAL_VSR_TABLE an not at ffc000
00218         //
00219         mem_start = 0xff4000;
00220         *start = (unsigned char *)(mem_start);
00221         *end = (unsigned char *)(CYGHWR_HAL_VSR_TABLE);
00222     } 
00223     else 
00224     {
00225         diag_printf("** Invalid memory segment #%d - ignored\n", seg);
00226         *start = NO_MEMORY;
00227         *end = NO_MEMORY;
00228     }
00229 }

void hal_clock_initialize cyg_uint32  period  ) 
 

Timer (TPU channel 5) initialisation.

Initializes the timer device to interrupt at the given period. The period is essentially the value used to initialize the timer counter and must be calculated from the timer frequency and the desired interrupt rate.

Parameters:
period The timer device should generate an interrupt every period cycles.
Note:
We initialize counter here but we do not enable interrupts. This will be done by kernel later.
  • NUMERATOR = 1.000.000.000
  • DENOMINATOR = 100
  • period = CPU Clock / Prescaler * NUMERATOR / DENOMINATOR / 1.000.000.000

Definition at line 139 of file plf_misc.c.

00140 {
00141     cyg_uint8 tmp;
00142 
00143     //
00144     // start 16 bit timer module in MSTPCRH register
00145     //
00146     HAL_READ_UINT8(CYGARC_MSTPCRH, tmp);                    
00147     tmp &= ~CYGARC_MSTPCRH_TPU;
00148     HAL_WRITE_UINT8(CYGARC_MSTPCRH, tmp);                    
00149     //
00150     // initialize 16 bit timer - first we select timer counter clock and
00151     // counter clearing source TGR
00152     // Clock prescaler is 16 (clock/16) and TCNT is clear at compare match A
00153     //
00154     HAL_WRITE_UINT8(CYGARC_TCR5, CYGARC_TCR_CLR_CMA |      
00155                                  CYGARC_TCR_TPSC_16);
00156     //
00157     // Select output compare register - Designate the TGRA as an output compare
00158     // register by means of TIOR.
00159     //
00160     HAL_WRITE_UINT8(CYGARC_TIOR5, 0x00);              // output compare - output disabled
00161     HAL_WRITE_UINT16(CYGARC_TGRA5, period);           // set compare match value to period
00162     HAL_WRITE_UINT16(CYGARC_TCNT5,  0x00);            // reset up counter
00163     //
00164     // Now start the counter 5 - intterrupts will be enabled from HAL later
00165     //
00166     HAL_WRITE_UINT8(CYGARC_TSTR, CYGARC_TSTR_CST5);
00167 }

void hal_clock_read cyg_uint32 *  pvalue  ) 
 

Reads current value of timer counter.

Reads the current value of the timer counter and puts the value in the location pointed to by pvalue. The value stored will always be the number of timer cycles since the last interrupt, and hence ranges between zero and the initial period value. If this is a count-down cyclic timer, some arithmetic may be necessary to generate this value.

Parameters:
pvalue Points to place where value should be stored

Definition at line 183 of file plf_misc.c.

00184 {
00185     cyg_uint16 val;
00186     HAL_READ_UINT16(CYGARC_TCNT5, val);
00187     *pvalue = val;
00188 }

void hal_platform_init void   ) 
 

Additional platform initialisation.

These will perform any additional initialization needed by platform. This typically includes further initialization of the interrupt controller, PCI bus bridges, basic IO devices and enabling the caches.

Note:
: At the moment there are nothing to do here for the EDOSK platform except for calling hal_if_init() because we youse virtual vector support.

Definition at line 112 of file plf_misc.c.

00113 {
00114     //
00115     // intialize virtual vector calling interface
00116     //
00117     hal_if_init();
00118 }


Variable Documentation

externC volatile CYG_ADDRESS hal_vsr_table[CYGNUM_HAL_VSR_COUNT]
 

Contains vector service routines for all interrupt vectors (vectors.S).

Definition at line 93 of file plf_misc.c.


Generated on Tue Feb 17 09:06:17 2004 for eCos EDOSK-2674 HAL by doxygen 1.3.5