mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
* shared/clock/clock.c: Standard decrementer exception is now more
robust against erroneous external exception disable times.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2009-03-05 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* shared/clock/clock.c: Standard decrementer exception is now more
|
||||
robust against erroneous external exception disable times.
|
||||
|
||||
2009-02-11 Matt Rippa <mrippa@gemini.edu>
|
||||
|
||||
PR 1352/bsps
|
||||
|
||||
@@ -466,12 +466,12 @@ int mpc5200_eth_mii_read(struct mpc5200_enet_struct *sc, unsigned char phyAddr,
|
||||
* 18-wire ethernet tranceiver (PHY). Please see your PHY
|
||||
* documentation for the register map.
|
||||
*
|
||||
* Returns: Success (boolean)
|
||||
* Returns: Success (bool)
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*/
|
||||
static int mpc5200_eth_mii_write(struct mpc5200_enet_struct *sc, unsigned char phyAddr, unsigned char regAddr, unsigned short data)
|
||||
static bool mpc5200_eth_mii_write(struct mpc5200_enet_struct *sc, unsigned char phyAddr, unsigned char regAddr, unsigned short data)
|
||||
{
|
||||
unsigned long reg; /* convenient holder for the PHY register */
|
||||
unsigned long phy; /* convenient holder for the PHY */
|
||||
@@ -514,12 +514,12 @@ static int mpc5200_eth_mii_write(struct mpc5200_enet_struct *sc, unsigned char p
|
||||
* Description: Reset a running ethernet driver including the hardware
|
||||
* FIFOs and the FEC.
|
||||
*
|
||||
* Returns: Success (boolean)
|
||||
* Returns: Success (bool)
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*/
|
||||
static int mpc5200_fec_reset(struct mpc5200_enet_struct *sc) {
|
||||
static bool mpc5200_fec_reset(struct mpc5200_enet_struct *sc) {
|
||||
volatile int delay;
|
||||
/*
|
||||
* Clear FIFO status registers
|
||||
|
||||
@@ -7,18 +7,19 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008
|
||||
* Copyright (c) 2008, 2009
|
||||
* Embedded Brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* D-82178 Puchheim
|
||||
* Germany
|
||||
* rtems@embedded-brains.de
|
||||
*
|
||||
* The license and distribution terms for this file may be found in the file
|
||||
* LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*/
|
||||
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems.h>
|
||||
#include <rtems/clockdrv.h>
|
||||
|
||||
#include <libcpu/powerpc-utility.h>
|
||||
@@ -57,34 +58,40 @@ static void (*ppc_clock_tick)(void) = ppc_clock_no_tick;
|
||||
|
||||
static int ppc_clock_exception_handler( BSP_Exception_frame *frame, unsigned number)
|
||||
{
|
||||
uint32_t reg1;
|
||||
uint32_t reg2;
|
||||
uint32_t reg3;
|
||||
uint32_t msr;
|
||||
uint32_t delta = ppc_clock_decrementer_value;
|
||||
uint32_t next = ppc_clock_next_time_base;
|
||||
uint32_t dec = 0;
|
||||
uint32_t now = 0;
|
||||
uint32_t msr = 0;
|
||||
|
||||
/* Set new decrementer value according to a reference time base */
|
||||
asm volatile (
|
||||
"lwz %0, ppc_clock_next_time_base@sdarel(13);"
|
||||
"lwz %1, ppc_clock_decrementer_value@sdarel(13);"
|
||||
"mftb %2;"
|
||||
"add %0, %0, %1;"
|
||||
"subf %1, %2, %0;"
|
||||
"stw %0, ppc_clock_next_time_base@sdarel(13);"
|
||||
"mtdec %1;"
|
||||
: "=r" (reg1), "=r" (reg2), "=r" (reg3)
|
||||
);
|
||||
do {
|
||||
/* Increment clock ticks */
|
||||
Clock_driver_ticks += 1;
|
||||
|
||||
/* Increment clock ticks */
|
||||
Clock_driver_ticks += 1;
|
||||
/* Enable external exceptions */
|
||||
msr = ppc_external_exceptions_enable();
|
||||
|
||||
/* Enable external exceptions */
|
||||
msr = ppc_external_exceptions_enable();
|
||||
/* Call clock ticker */
|
||||
ppc_clock_tick();
|
||||
|
||||
/* Call clock ticker */
|
||||
ppc_clock_tick();
|
||||
/* Restore machine state */
|
||||
ppc_external_exceptions_disable( msr);
|
||||
|
||||
/* Restore machine state */
|
||||
ppc_external_exceptions_disable( msr);
|
||||
/* Next time base */
|
||||
next += delta;
|
||||
|
||||
/* Current time */
|
||||
now = ppc_time_base();
|
||||
|
||||
/* New decrementer value */
|
||||
dec = next - now;
|
||||
} while (dec > delta);
|
||||
|
||||
/* Set decrementer */
|
||||
ppc_set_decrementer_register( dec);
|
||||
|
||||
/* Expected next time base */
|
||||
ppc_clock_next_time_base = next;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -201,7 +208,7 @@ rtems_device_driver Clock_initialize( rtems_device_major_number major, rtems_dev
|
||||
/* Check decrementer value */
|
||||
if (ppc_clock_decrementer_value == 0) {
|
||||
ppc_clock_decrementer_value = PPC_CLOCK_DECREMENTER_MAX;
|
||||
SYSLOG_ERROR( "Decrementer value would be zero, will be set to maximum value instead\n");
|
||||
SYSLOG_ERROR( "decrementer value would be zero, will be set to maximum value instead\n");
|
||||
}
|
||||
|
||||
/* Set the nanoseconds since last tick handler */
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#ifndef __TQM_H__
|
||||
#define __TQM_H__
|
||||
|
||||
#if !defined(ASM)
|
||||
#include <rtems.h>
|
||||
|
||||
typedef struct {
|
||||
@@ -40,7 +42,9 @@ typedef struct {
|
||||
void (*put_char)(int c); /* function to output characters */
|
||||
} tqm_bd_info_t;
|
||||
|
||||
#endif /* !defined(ASM) */
|
||||
#define TQM_BD_INFO_ADDR 0x3400
|
||||
|
||||
#define TQM_BD_INFO (*(tqm_bd_info_t *)TQM_BD_INFO_ADDR)
|
||||
|
||||
#define TQM_CONF_INFO_BLOCK_ADDR 0x4001fe00
|
||||
|
||||
Reference in New Issue
Block a user