mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-25 07:18:00 +08:00
Patch from John Cotton <john.cotton@nrc.ca>, Charles-Antoine Gauthier
<charles.gauthier@iit.nrc.ca>, and Darlene A. Stewart <Darlene.Stewart@nrc.ca> to add support for a number of very significant things: + BSPs for many variations on the Motorola MBX8xx board series + Cache Manager including initial support for m68040 and PowerPC + Rework of mpc8xx libcpu code so all mpc8xx CPUs now use same code base. + Rework of eth_comm BSP to utiltize above. John reports this works on the 821 and 860.
This commit is contained in:
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* PowerPC Cache enable routines
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems/system.h>
|
||||
|
||||
#define PPC_Get_HID0( _value ) \
|
||||
do { \
|
||||
_value = 0; /* to avoid warnings */ \
|
||||
asm volatile( \
|
||||
"mfspr %0, 0x3f0;" /* get HID0 */ \
|
||||
"isync" \
|
||||
: "=r" (_value) \
|
||||
: "0" (_value) \
|
||||
); \
|
||||
} while (0)
|
||||
|
||||
#define PPC_Set_HID0( _value ) \
|
||||
do { \
|
||||
asm volatile( \
|
||||
"isync;" \
|
||||
"mtspr 0x3f0, %0;" /* load HID0 */ \
|
||||
"isync" \
|
||||
: "=r" (_value) \
|
||||
: "0" (_value) \
|
||||
); \
|
||||
} while (0)
|
||||
|
||||
|
||||
void powerpc_instruction_cache_enable ()
|
||||
{
|
||||
unsigned32 value;
|
||||
|
||||
/*
|
||||
* Enable the instruction cache
|
||||
*/
|
||||
|
||||
PPC_Get_HID0( value );
|
||||
|
||||
value |= 0x00008000; /* Set ICE bit */
|
||||
|
||||
PPC_Set_HID0( value );
|
||||
}
|
||||
|
||||
void powerpc_data_cache_enable ()
|
||||
{
|
||||
unsigned32 value;
|
||||
|
||||
/*
|
||||
* enable data cache
|
||||
*/
|
||||
|
||||
PPC_Get_HID0( value );
|
||||
|
||||
value |= 0x00004000; /* set DCE bit */
|
||||
|
||||
PPC_Set_HID0( value );
|
||||
}
|
||||
|
||||
@@ -1,214 +0,0 @@
|
||||
/*
|
||||
* This file contains directives for the GNU linker which are specific
|
||||
* to the Motorola MVME167 board. This linker script produces ELF
|
||||
* executables.
|
||||
*
|
||||
* Copyright (c) 1999, National Research Council of Canada.
|
||||
* Some of this material was copied from binutils-2.9.4 linker scripts,
|
||||
* and is therefore likely to be copyrighted by the Free Software
|
||||
* Foundation, even though explicit copyright notices did not appear in
|
||||
* those files.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/* These are not really needed here */
|
||||
OUTPUT_FORMAT("elf32-m68k")
|
||||
OUTPUT_ARCH(m68k)
|
||||
ENTRY(_start)
|
||||
|
||||
/*
|
||||
* Declare some sizes.
|
||||
*/
|
||||
_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000;
|
||||
_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* The location of RAM is the address space is configurable.
|
||||
This is where we put one board. The base address should be
|
||||
passed as a parameter when building multiprocessor images
|
||||
where each board resides at a different address. */
|
||||
ram : org = 0x00800000, l = 4M
|
||||
rom : org = 0xFF800000, l = 4M
|
||||
sram : org = 0xFFE00000, l = 128K
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/*
|
||||
* We want the entry point to be the first thing in memory.
|
||||
* Merge all read-only data into the .text section.
|
||||
*/
|
||||
.text 0x00800000 :
|
||||
{
|
||||
text_start = . ;
|
||||
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
*(.stub)
|
||||
|
||||
/* C++ constructors/destructors */
|
||||
*(.gnu.linkonce.t*)
|
||||
|
||||
/* Initialization and finalization code.
|
||||
*
|
||||
* Various files can provide initialization and finalization functions.
|
||||
* crtbegin.o and crtend.o are two instances. The body of these functions
|
||||
* are in .init and .fini sections. We accumulate the bodies here, and
|
||||
* prepend function prologues from crti.o and function epilogues from
|
||||
* crtn.o. crti.o must be linked first; crtn.o must be linked last.
|
||||
* Because these are wildcards, it doesn't matter if the user does not
|
||||
* actually link against crti.o and crtn.o; the linker won't look for a
|
||||
* file to match a wildcard. The wildcard also means that it doesn't
|
||||
* matter which directory crti.o and crtn.o are in.
|
||||
*/
|
||||
PROVIDE (_init = .);
|
||||
*crti.o(.init)
|
||||
*(.init)
|
||||
*crtn.o(.init)
|
||||
|
||||
PROVIDE (_fini = .);
|
||||
*crti.o(.fini)
|
||||
*(.fini)
|
||||
*crtn.o(.init)
|
||||
|
||||
. = ALIGN (16);
|
||||
|
||||
/* C++ constructors and destructors for static objects.
|
||||
*
|
||||
* gcc uses crtbegin.o to find the start of the constructors and
|
||||
* destructors so we make sure it is first. Because this is a wildcard,
|
||||
* it doesn't matter if the user does not actually link against
|
||||
* crtbegin.o; the linker won't look for a file to match a wildcard. The
|
||||
* wildcard also means that it doesn't matter which directory crtbegin.o
|
||||
* is in. The constructor and destructor list are terminated in crtend.o.
|
||||
* The same comments apply to it.
|
||||
*/
|
||||
PROVIDE (__CTOR_LIST__ = .);
|
||||
*crtbegin.o(.ctors)
|
||||
*(.ctors)
|
||||
*crtend.o(.ctors)
|
||||
PROVIDE (__CTOR_END__ = .);
|
||||
|
||||
PROVIDE (__DTOR_LIST__ = .);
|
||||
*crtbegin.o(.dtors)
|
||||
*(.dtors)
|
||||
*crtend.o(.dtors)
|
||||
PROVIDE (__DTOR_END__ = .);
|
||||
|
||||
. = ALIGN (16);
|
||||
|
||||
/* Exception frame info */
|
||||
*(.eh_frame)
|
||||
|
||||
. = ALIGN (16);
|
||||
|
||||
/* Do we have any of these with egcs-1.x and higher? */
|
||||
*(.gcc_exc)
|
||||
|
||||
. = ALIGN (16);
|
||||
|
||||
_rodata_start = . ;
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r*)
|
||||
*(.rodata1)
|
||||
_erodata = .;
|
||||
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
|
||||
} >ram =0x4e75
|
||||
|
||||
. = ALIGN (16);
|
||||
|
||||
.data :
|
||||
{
|
||||
data_start = .;
|
||||
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.gnu.linkonce.d*)
|
||||
*(.gcc_except_table)
|
||||
|
||||
. = ALIGN (16);
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
} >ram
|
||||
|
||||
.bss :
|
||||
{
|
||||
bss_start = .;
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
*(.sbss)
|
||||
*(.scommon)
|
||||
|
||||
. = ALIGN (16);
|
||||
_end = .;
|
||||
PROVIDE (end = .);
|
||||
} >ram
|
||||
|
||||
_HeapStart = .;
|
||||
. += HeapSize; /* XXX -- Old gld can't handle this */
|
||||
_HeapEnd = .;
|
||||
_StackStart = .;
|
||||
. += _StackSize; /* XXX -- Old gld can't handle this */
|
||||
/* . += 0x10000; */ /* HeapSize for old gld */
|
||||
/* . += 0x1000; */ /* _StackSize for old gld */
|
||||
. = ALIGN (16);
|
||||
_StackEnd = .;
|
||||
stack_init = .;
|
||||
clear_end = .;
|
||||
|
||||
_WorkspaceBase = .;
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* These must appear regardless of . */
|
||||
}
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
/*
|
||||
* MPC860 buffer descriptor allocation routines
|
||||
*
|
||||
* Modified from original code by Jay Monkman (jmonkman@frasca.com)
|
||||
*
|
||||
* Original was written by:
|
||||
* W. Eric Norum
|
||||
* Saskatchewan Accelerator Laboratory
|
||||
* University of Saskatchewan
|
||||
* Saskatoon, Saskatchewan, CANADA
|
||||
* eric@skatter.usask.ca
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <bsp.h>
|
||||
#include <rtems/rtems/intr.h>
|
||||
#include <rtems/error.h>
|
||||
#include <mpc860.h>
|
||||
#include <info.h>
|
||||
|
||||
/*
|
||||
* Send a command to the CPM RISC processer
|
||||
*/
|
||||
void M860ExecuteRISC(rtems_unsigned16 command)
|
||||
{
|
||||
rtems_unsigned16 lvl;
|
||||
|
||||
rtems_interrupt_disable(lvl);
|
||||
while (m860.cpcr & M860_CR_FLG) {
|
||||
continue;
|
||||
}
|
||||
|
||||
m860.cpcr = command | M860_CR_FLG;
|
||||
rtems_interrupt_enable (lvl);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Allocation order:
|
||||
* - Dual-Port RAM section 0
|
||||
* - Dual-Port RAM section 1
|
||||
* - Dual-Port RAM section 2
|
||||
* - Dual-Port RAM section 3
|
||||
* - Dual-Port RAM section 4
|
||||
*/
|
||||
static struct {
|
||||
char *base;
|
||||
unsigned int size;
|
||||
unsigned int used;
|
||||
} bdregions[] = {
|
||||
{ (char *)&m860.dpram0[0], sizeof m860.dpram0, 0 },
|
||||
{ (char *)&m860.dpram1[0], sizeof m860.dpram1, 0 },
|
||||
{ (char *)&m860.dpram2[0], sizeof m860.dpram2, 0 },
|
||||
{ (char *)&m860.dpram3[0], sizeof m860.dpram3, 0 },
|
||||
{ (char *)&m860.dpram4[0], sizeof m860.dpram4, 0 },
|
||||
};
|
||||
|
||||
void *
|
||||
M860AllocateBufferDescriptors (int count)
|
||||
{
|
||||
unsigned int i;
|
||||
ISR_Level level;
|
||||
void *bdp = NULL;
|
||||
unsigned int want = count * sizeof(m860BufferDescriptor_t);
|
||||
|
||||
/*
|
||||
* Running with interrupts disabled is usually considered bad
|
||||
* form, but this routine is probably being run as part of an
|
||||
* initialization sequence so the effect shouldn't be too severe.
|
||||
*/
|
||||
_ISR_Disable (level);
|
||||
for (i = 0 ; i < sizeof(bdregions) / sizeof(bdregions[0]) ; i++) {
|
||||
/*
|
||||
* Verify that the region exists.
|
||||
* This test is necessary since some chips have
|
||||
* less dual-port RAM.
|
||||
*/
|
||||
if (bdregions[i].used == 0) {
|
||||
volatile unsigned char *cp = bdregions[i].base;
|
||||
*cp = 0xAA;
|
||||
if (*cp != 0xAA) {
|
||||
bdregions[i].used = bdregions[i].size;
|
||||
continue;
|
||||
}
|
||||
*cp = 0x55;
|
||||
if (*cp != 0x55) {
|
||||
bdregions[i].used = bdregions[i].size;
|
||||
continue;
|
||||
}
|
||||
*cp = 0x0;
|
||||
}
|
||||
if (bdregions[i].size - bdregions[i].used >= want) {
|
||||
bdp = bdregions[i].base + bdregions[i].used;
|
||||
bdregions[i].used += want;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_ISR_Enable(level);
|
||||
if (bdp == NULL)
|
||||
rtems_panic("Can't allocate %d buffer descriptor(s).\n", count);
|
||||
return bdp;
|
||||
}
|
||||
|
||||
void *
|
||||
M860AllocateRiscTimers (int count)
|
||||
{
|
||||
/*
|
||||
* Convert the count to the number of buffer descriptors
|
||||
* of equal or larger size. This ensures that all buffer
|
||||
* descriptors are allocated with appropriate alignment.
|
||||
*/
|
||||
return M860AllocateBufferDescriptors (((count * 4) +
|
||||
sizeof(m860BufferDescriptor_t) - 1) /
|
||||
sizeof(m860BufferDescriptor_t));
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
/*
|
||||
* mmu.c - this file contains functions for initializing the MMU
|
||||
*
|
||||
* Written by Jay Monkman (jmonkman@frasca.com)
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
#include <mpc860.h>
|
||||
|
||||
/* Macros for handling all the MMU SPRs */
|
||||
#define PUT_MI_CTR(r) __asm__ volatile ("mtspr 0x310,%0\n" ::"r"(r))
|
||||
#define GET_MI_CTR(r) __asm__ volatile ("mfspr %0,0x310\n" :"=r"(r))
|
||||
#define PUT_MD_CTR(r) __asm__ volatile ("mtspr 0x318,%0\n" ::"r"(r))
|
||||
#define GET_MD_CTR(r) __asm__ volatile ("mfspr %0,0x318\n" :"=r"(r))
|
||||
#define PUT_M_CASID(r) __asm__ volatile ("mtspr 0x319,%0\n" ::"r"(r))
|
||||
#define GET_M_CASID(r) __asm__ volatile ("mfspr %0,0x319\n" :"=r"(r))
|
||||
#define PUT_MI_EPN(r) __asm__ volatile ("mtspr 0x313,%0\n" ::"r"(r))
|
||||
#define GET_MI_EPN(r) __asm__ volatile ("mfspr %0,0x313\n" :"=r"(r))
|
||||
#define PUT_MI_TWC(r) __asm__ volatile ("mtspr 0x315,%0\n" ::"r"(r))
|
||||
#define GET_MI_TWC(r) __asm__ volatile ("mfspr %0,0x315\n" :"=r"(r))
|
||||
#define PUT_MI_RPN(r) __asm__ volatile ("mtspr 0x316,%0\n" ::"r"(r))
|
||||
#define GET_MI_RPN(r) __asm__ volatile ("mfspr %0,0x316\n" :"=r"(r))
|
||||
#define PUT_MD_EPN(r) __asm__ volatile ("mtspr 0x313,%0\n" ::"r"(r))
|
||||
#define GET_MD_EPN(r) __asm__ volatile ("mfspr %0,0x313\n" :"=r"(r))
|
||||
#define PUT_M_TWB(r) __asm__ volatile ("mtspr 0x31c,%0\n" ::"r"(r))
|
||||
#define GET_M_TWB(r) __asm__ volatile ("mfspr %0,0x31c\n" :"=r"(r))
|
||||
#define PUT_MD_TWC(r) __asm__ volatile ("mtspr 0x31d,%0\n" ::"r"(r))
|
||||
#define GET_MD_TWC(r) __asm__ volatile ("mfspr %0,0x31d\n" :"=r"(r))
|
||||
#define PUT_MD_RPN(r) __asm__ volatile ("mtspr 0x31e,%0\n" ::"r"(r))
|
||||
#define GET_MD_RPN(r) __asm__ volatile ("mfspr %0,0x31e\n" :"=r"(r))
|
||||
#define PUT_MI_AP(r) __asm__ volatile ("mtspr 0x312,%0\n" ::"r"(r))
|
||||
#define GET_MI_AP(r) __asm__ volatile ("mfspr %0,0x312\n" :"=r"(r))
|
||||
#define PUT_MD_AP(r) __asm__ volatile ("mtspr 0x31a,%0\n" ::"r"(r))
|
||||
#define GET_MD_AP(r) __asm__ volatile ("mfspr %0,0x31a\n" :"=r"(r))
|
||||
#define PUT_M_TW(r) __asm__ volatile ("mtspr 0x31f,%0\n" ::"r"(r))
|
||||
#define GET_M_TW(r) __asm__ volatile ("mfspr %0,0x31f\n" :"=r"(r))
|
||||
#define PUT_MI_DCAM(r) __asm__ volatile ("mtspr 0x330,%0\n" ::"r"(r))
|
||||
#define GET_MI_DCAM(r) __asm__ volatile ("mfspr %0,0x330\n" :"=r"(r))
|
||||
#define PUT_MI_DRAM0(r) __asm__ volatile ("mtspr 0x331,%0\n" ::"r"(r))
|
||||
#define GET_MI_DRAM0(r) __asm__ volatile ("mfspr %0,0x331\n" :"=r"(r))
|
||||
#define PUT_MI_DRAM1(r) __asm__ volatile ("mtspr 0x332,%0\n" ::"r"(r))
|
||||
#define GET_MI_DRAM1(r) __asm__ volatile ("mfspr %0,0x332\n" :"=r"(r))
|
||||
#define PUT_MD_DCAM(r) __asm__ volatile ("mtspr 0x338,%0\n" ::"r"(r))
|
||||
#define GET_MD_DCAM(r) __asm__ volatile ("mfspr %0,0x338\n" :"=r"(r))
|
||||
#define PUT_MD_DRAM0(r) __asm__ volatile ("mtspr 0x339,%0\n" ::"r"(r))
|
||||
#define GET_MD_DRAM0(r) __asm__ volatile ("mfspr %0,0x339\n" :"=r"(r))
|
||||
#define PUT_MD_DRAM1(r) __asm__ volatile ("mtspr 0x33a,%0\n" ::"r"(r))
|
||||
#define GET_MD_DRAM1(r) __asm__ volatile ("mfspr %0,0x33a\n" :"=r"(r))
|
||||
#define PUT_IC_CST(r) __asm__ volatile ("mtspr 0x230,%0\n" ::"r"(r))
|
||||
#define GET_IC_CST(r) __asm__ volatile ("mfspr %0,0x230\n" :"=r"(r))
|
||||
#define PUT_DC_CST(r) __asm__ volatile ("mtspr 0x238,%0\n" ::"r"(r))
|
||||
#define GET_DC_CST(r) __asm__ volatile ("mfspr %0,0x238\n" :"=r"(r))
|
||||
#define PUT_IC_ADR(r) __asm__ volatile ("mtspr 0x231,%0\n" ::"r"(r))
|
||||
#define GET_IC_ADR(r) __asm__ volatile ("mfspr %0,0x231\n" :"=r"(r))
|
||||
#define PUT_IC_DAT(r) __asm__ volatile ("mtspr 0x232,%0\n" ::"r"(r))
|
||||
#define GET_IC_DAT(r) __asm__ volatile ("mfspr %0,0x232\n" :"=r"(r))
|
||||
|
||||
extern rtems_configuration_table BSP_Configuration;
|
||||
|
||||
void mmu_init(void)
|
||||
{
|
||||
register unsigned long t1, t2;
|
||||
|
||||
/* Let's clear MSR[IR] and MSR[DR] */
|
||||
t2 = PPC_MSR_IR | PPC_MSR_DR;
|
||||
__asm__ volatile (
|
||||
"mfmsr %0\n"
|
||||
"andc %0, %0, %1\n"
|
||||
"mtmsr %0\n" :"=r"(t1), "=r"(t2):
|
||||
"1"(t2));
|
||||
|
||||
/* Invalidate the TLBs */
|
||||
__asm__ volatile ("tlbia\n"::);
|
||||
__asm__ volatile ("isync\n"::);
|
||||
|
||||
/* make sure no TLB entries are reserved */
|
||||
t1 = 0;
|
||||
PUT_MI_CTR(t1);
|
||||
|
||||
t1 = M860_MD_CTR_TWAM; /* 4K pages */
|
||||
/* PUT_MD_CTR(t1); */
|
||||
|
||||
t1 = M860_MI_EPN_VALID; /* make entry valid */
|
||||
/* PUT_MD_EPN(t1); */
|
||||
PUT_MI_EPN(t1);
|
||||
|
||||
t1 = M860_MI_TWC_PS8 | M860_MI_TWC_VALID; /* 8 MB pages, valid */
|
||||
/* PUT_MD_TWC(t1); */
|
||||
PUT_MI_TWC(t1);
|
||||
|
||||
t1 = M860_MD_RPN_CHANGE | M860_MD_RPN_F | M860_MD_RPN_16K |
|
||||
M860_MD_RPN_SHARED | M860_MD_RPN_VALID;
|
||||
/* PUT_MD_RPN(t1); */
|
||||
PUT_MI_RPN(t1);
|
||||
|
||||
t1 = M860_MI_AP_Kp << 30;
|
||||
PUT_MI_AP(t1);
|
||||
/* PUT_MD_AP(t1); */
|
||||
|
||||
t1 = M860_CACHE_CMD_UNLOCK;
|
||||
/* PUT_DC_CST(t1); */
|
||||
PUT_IC_CST(t1);
|
||||
|
||||
t1 = M860_CACHE_CMD_INVALIDATE;
|
||||
/* PUT_DC_CST(t1); */
|
||||
PUT_IC_CST(t1);
|
||||
|
||||
t1 = M860_CACHE_CMD_ENABLE;
|
||||
PUT_IC_CST(t1);
|
||||
|
||||
t1 = M860_CACHE_CMD_SFWT;
|
||||
/* PUT_DC_CST(t1); */
|
||||
t1 = M860_CACHE_CMD_ENABLE;
|
||||
/* PUT_DC_CST(t1);*/
|
||||
|
||||
|
||||
|
||||
/* Let's set MSR[IR] */
|
||||
t2 = PPC_MSR_IR;
|
||||
__asm__ volatile (
|
||||
"mfmsr %0\n"
|
||||
"or %0, %0, %1\n"
|
||||
"mtmsr %0\n" :"=r"(t1), "=r"(t2):
|
||||
"1"(t2));
|
||||
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -1,10 +0,0 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
SUBDIRS = include console-generic clock timer vectors
|
||||
|
||||
include $(top_srcdir)/../../../../../automake/subdirs.am
|
||||
include $(top_srcdir)/../../../../../automake/local.am
|
||||
@@ -1,2 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -1,29 +0,0 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
PGM = $(ARCH)/clock.rel
|
||||
|
||||
C_FILES = clock.c
|
||||
|
||||
clock_rel_OBJECTS = $(C_FILES:%.c=$(ARCH)/%.o)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../../../../../automake/lib.am
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
$(PGM): $(clock_rel_OBJECTS)
|
||||
$(make-rel)
|
||||
|
||||
all-local: $(ARCH) $(clock_rel_OBJECTS) $(PGM)
|
||||
|
||||
.PRECIOUS: $(PGM)
|
||||
|
||||
EXTRA_DIST = clock.c
|
||||
|
||||
include $(top_srcdir)/../../../../../automake/local.am
|
||||
@@ -1,178 +0,0 @@
|
||||
/* clock.c
|
||||
*
|
||||
* This routine initializes the PIT on the MPC821.
|
||||
* The tick frequency is specified by the bsp.
|
||||
*
|
||||
* Author: Jay Monkman (jmonkman@frasca.com)
|
||||
* Copyright (C) 1998 by Frasca International, Inc.
|
||||
*
|
||||
* Derived from c/src/lib/libcpu/ppc/ppc403/clock/clock.c:
|
||||
*
|
||||
* Author: Andrew Bray <andy@i-cubed.co.uk>
|
||||
*
|
||||
* COPYRIGHT (c) 1995 by i-cubed ltd.
|
||||
*
|
||||
* To anyone who acknowledges that this file is provided "AS IS"
|
||||
* without any express or implied warranty:
|
||||
* permission to use, copy, modify, and distribute this file
|
||||
* for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice and this notice appears in all
|
||||
* copies, and that the name of i-cubed limited not be used in
|
||||
* advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
* i-cubed limited makes no representations about the suitability
|
||||
* of this software for any purpose.
|
||||
*
|
||||
* Derived from c/src/lib/libcpu/hppa1_1/clock/clock.c:
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <clockdrv.h>
|
||||
#include <rtems/libio.h>
|
||||
|
||||
#include <stdlib.h> /* for atexit() */
|
||||
#include <mpc821.h>
|
||||
|
||||
volatile rtems_unsigned32 Clock_driver_ticks;
|
||||
extern volatile m821_t m821;
|
||||
|
||||
void Clock_exit( void );
|
||||
|
||||
/*
|
||||
* These are set by clock driver during its init
|
||||
*/
|
||||
|
||||
rtems_device_major_number rtems_clock_major = ~0;
|
||||
rtems_device_minor_number rtems_clock_minor;
|
||||
|
||||
/*
|
||||
* ISR Handler
|
||||
*/
|
||||
rtems_isr Clock_isr(rtems_vector_number vector)
|
||||
{
|
||||
m821.piscr |= M821_PISCR_PS;
|
||||
Clock_driver_ticks++;
|
||||
rtems_clock_tick();
|
||||
}
|
||||
|
||||
void Install_clock(rtems_isr_entry clock_isr)
|
||||
{
|
||||
rtems_isr_entry previous_isr;
|
||||
rtems_unsigned32 pit_value;
|
||||
|
||||
Clock_driver_ticks = 0;
|
||||
|
||||
pit_value = rtems_configuration_get_microseconds_per_tick() /
|
||||
rtems_cpu_configuration_get_clicks_per_usec();
|
||||
if (pit_value == 0) {
|
||||
pit_value = 0xffff;
|
||||
} else {
|
||||
pit_value--;
|
||||
}
|
||||
|
||||
if (pit_value > 0xffff) { /* pit is only 16 bits long */
|
||||
rtems_fatal_error_occurred(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* initialize the interval here
|
||||
* First tick is set to right amount of time in the future
|
||||
* Future ticks will be incremented over last value set
|
||||
* in order to provide consistent clicks in the face of
|
||||
* interrupt overhead
|
||||
*/
|
||||
|
||||
rtems_interrupt_catch(clock_isr, PPC_IRQ_LVL0, &previous_isr);
|
||||
|
||||
m821.sccr &= ~(1<<24);
|
||||
m821.pitc = pit_value;
|
||||
|
||||
/* set PIT irq level, enable PIT, PIT interrupts */
|
||||
/* and clear int. status */
|
||||
m821.piscr = M821_PISCR_PIRQ(0) |
|
||||
M821_PISCR_PTE | M821_PISCR_PS | M821_PISCR_PIE;
|
||||
|
||||
m821.simask |= M821_SIMASK_LVM0;
|
||||
atexit(Clock_exit);
|
||||
}
|
||||
|
||||
void
|
||||
ReInstall_clock(rtems_isr_entry new_clock_isr)
|
||||
{
|
||||
rtems_isr_entry previous_isr;
|
||||
rtems_unsigned32 isrlevel = 0;
|
||||
|
||||
rtems_interrupt_disable(isrlevel);
|
||||
|
||||
rtems_interrupt_catch(new_clock_isr, PPC_IRQ_LVL0, &previous_isr);
|
||||
|
||||
rtems_interrupt_enable(isrlevel);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called via atexit()
|
||||
* Remove the clock interrupt handler by setting handler to NULL
|
||||
*/
|
||||
void
|
||||
Clock_exit(void)
|
||||
{
|
||||
/* disable PIT and PIT interrupts */
|
||||
m821.piscr &= ~(M821_PISCR_PTE | M821_PISCR_PIE);
|
||||
|
||||
(void) set_vector(0, PPC_IRQ_LVL0, 1);
|
||||
}
|
||||
|
||||
rtems_device_driver Clock_initialize(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
Install_clock( Clock_isr );
|
||||
|
||||
/*
|
||||
* make major/minor avail to others such as shared memory driver
|
||||
*/
|
||||
|
||||
rtems_clock_major = major;
|
||||
rtems_clock_minor = minor;
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_device_driver Clock_control(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
rtems_libio_ioctl_args_t *args = pargp;
|
||||
|
||||
if (args == 0)
|
||||
goto done;
|
||||
|
||||
/*
|
||||
* This is hokey, but until we get a defined interface
|
||||
* to do this, it will just be this simple...
|
||||
*/
|
||||
|
||||
if (args->command == rtems_build_name('I', 'S', 'R', ' ')) {
|
||||
Clock_isr(PPC_IRQ_LVL0);
|
||||
}
|
||||
else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) {
|
||||
ReInstall_clock(args->buffer);
|
||||
}
|
||||
|
||||
done:
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -1,29 +0,0 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
PGM = $(ARCH)/console-generic.rel
|
||||
|
||||
C_FILES = console-generic.c
|
||||
|
||||
console_generic_rel_OBJECTS = $(C_FILES:%.c=$(ARCH)/%.o)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../../../../../automake/lib.am
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
$(PGM): $(console_generic_rel_OBJECTS)
|
||||
$(make-rel)
|
||||
|
||||
all-local: $(ARCH) $(console_generic_rel_OBJECTS) $(PGM)
|
||||
|
||||
.PRECIOUS: $(PGM)
|
||||
|
||||
EXTRA_DIST = console-generic.c
|
||||
|
||||
include $(top_srcdir)/../../../../../automake/local.am
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,2 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -1,21 +0,0 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
H_FILES = console.h mpc821.h
|
||||
noinst_HEADERS = $(H_FILES)
|
||||
|
||||
TMPINSTALL_FILES += $(PROJECT_INCLUDE)/mpc821 \
|
||||
$(H_FILES:%=$(PROJECT_INCLUDE)/mpc821/%)
|
||||
|
||||
$(PROJECT_INCLUDE)/mpc821:
|
||||
$(mkinstalldirs) $@
|
||||
|
||||
$(PROJECT_INCLUDE)/mpc821/%.h: %.h
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
all-local: $(TMPINSTALL_FILES)
|
||||
|
||||
include $(top_srcdir)/../../../../../automake/local.am
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _M821_CONSOLE_H_
|
||||
#define _M821_CONSOLE_H_
|
||||
|
||||
#include <rtems/libio.h>
|
||||
|
||||
int m821_smc_set_attributes(int, const struct termios*);
|
||||
int m821_scc_set_attributes(int, const struct termios*);
|
||||
void m821_scc_initialize(int);
|
||||
void m821_smc_initialize(int);
|
||||
int m821_char_poll_read(int);
|
||||
int m821_char_poll_write(int, const char*, int);
|
||||
rtems_isr m821_scc1_console_interrupt_handler(rtems_vector_number);
|
||||
rtems_isr m821_scc2_console_interrupt_handler(rtems_vector_number);
|
||||
rtems_isr m821_smc1_console_interrupt_handler(rtems_vector_number);
|
||||
rtems_isr m821_smc2_console_interrupt_handler(rtems_vector_number);
|
||||
int m821_buf_poll_read(int, char**);
|
||||
int m821_buf_poll_write(int, char*, int);
|
||||
void m821_console_initialize(void);
|
||||
rtems_device_driver m821_console_read(rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void*);
|
||||
rtems_device_driver m821_console_write(rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void*);
|
||||
|
||||
|
||||
typedef struct Buf_t_ {
|
||||
struct Buf_t_ *next;
|
||||
volatile char *buf;
|
||||
volatile int len;
|
||||
int pos;
|
||||
} Buf_t;
|
||||
|
||||
#define SMC1_MINOR 0
|
||||
#define SMC2_MINOR 1
|
||||
#define SCC1_MINOR 2
|
||||
#define SCC2_MINOR 3
|
||||
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,2 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -1,29 +0,0 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
PGM = $(ARCH)/timer.rel
|
||||
|
||||
C_FILES = timer.c
|
||||
|
||||
timer_rel_OBJECTS = $(C_FILES:%.c=$(ARCH)/%.o)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../../../../../automake/lib.am
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
$(PGM): $(timer_rel_OBJECTS)
|
||||
$(make-rel)
|
||||
|
||||
all-local: $(ARCH) $(timer_rel_OBJECTS) $(PGM)
|
||||
|
||||
.PRECIOUS: $(PGM)
|
||||
|
||||
EXTRA_DIST = timer.c
|
||||
|
||||
include $(top_srcdir)/../../../../../automake/local.am
|
||||
@@ -1,100 +0,0 @@
|
||||
/* timer.c
|
||||
*
|
||||
* This file manages the interval timer on the PowerPC MPC821.
|
||||
* NOTE: This is not the PIT, but rather the RTEMS interval
|
||||
* timer
|
||||
* We shall use the bottom 32 bits of the timebase register,
|
||||
*
|
||||
* The following was in the 403 version of this file. I don't
|
||||
* know what it means. JTM 5/19/98
|
||||
* NOTE: It is important that the timer start/stop overhead be
|
||||
* determined when porting or modifying this code.
|
||||
*
|
||||
* Author: Jay Monkman (jmonkman@frasca.com)
|
||||
* Copywright (C) 1998 by Frasca International, Inc.
|
||||
*
|
||||
* Derived from c/src/lib/libcpu/ppc/ppc403/timer/timer.c:
|
||||
*
|
||||
* Author: Andrew Bray <andy@i-cubed.co.uk>
|
||||
*
|
||||
* COPYRIGHT (c) 1995 by i-cubed ltd.
|
||||
*
|
||||
* To anyone who acknowledges that this file is provided "AS IS"
|
||||
* without any express or implied warranty:
|
||||
* permission to use, copy, modify, and distribute this file
|
||||
* for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice and this notice appears in all
|
||||
* copies, and that the name of i-cubed limited not be used in
|
||||
* advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
* i-cubed limited makes no representations about the suitability
|
||||
* of this software for any purpose.
|
||||
*
|
||||
* Derived from c/src/lib/libcpu/hppa1_1/timer/timer.c:
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <mpc821.h>
|
||||
|
||||
static volatile rtems_unsigned32 Timer_starting;
|
||||
static rtems_boolean Timer_driver_Find_average_overhead;
|
||||
|
||||
/*
|
||||
* This is so small that this code will be reproduced where needed.
|
||||
*/
|
||||
static inline rtems_unsigned32 get_itimer(void)
|
||||
{
|
||||
rtems_unsigned32 ret;
|
||||
|
||||
asm volatile ("mftb %0" : "=r" ((ret))); /* TBLO */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Timer_initialize(void)
|
||||
{
|
||||
/* set interrupt level and enable timebase. This should never */
|
||||
/* generate an interrupt however. */
|
||||
m821.tbscr |= M821_TBSCR_TBIRQ(4) | M821_TBSCR_TBE;
|
||||
|
||||
Timer_starting = get_itimer();
|
||||
}
|
||||
|
||||
int Read_timer(void)
|
||||
{
|
||||
rtems_unsigned32 clicks;
|
||||
rtems_unsigned32 total;
|
||||
|
||||
clicks = get_itimer();
|
||||
|
||||
total = clicks - Timer_starting;
|
||||
|
||||
if ( Timer_driver_Find_average_overhead == 1 )
|
||||
return total; /* in XXX microsecond units */
|
||||
|
||||
else {
|
||||
if ( total < rtems_cpu_configuration_get_timer_least_valid() ) {
|
||||
return 0; /* below timer resolution */
|
||||
}
|
||||
return (total - rtems_cpu_configuration_get_timer_average_overhead());
|
||||
}
|
||||
}
|
||||
|
||||
rtems_status_code Empty_function(void)
|
||||
{
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
void Set_find_average_overhead(rtems_boolean find_flag)
|
||||
{
|
||||
Timer_driver_Find_average_overhead = find_flag;
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -1,32 +0,0 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
VPATH = @srcdir@:@srcdir@/../../ppc403/vectors
|
||||
|
||||
## FIXME
|
||||
|
||||
PGM = ${ARCH}/vectors.rel
|
||||
|
||||
## Assembly sources
|
||||
S_FILES = vectors.S align_h.S
|
||||
|
||||
vectors_rel_OBJECTS = $(S_FILES:%.S=${ARCH}/%.o)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../../../../../automake/lib.am
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
$(PGM): $(vectors_rel_OBJECTS)
|
||||
$(make-rel)
|
||||
|
||||
all-local: ${ARCH} $(PGM)
|
||||
|
||||
EXTRA_DIST = vectors.S README
|
||||
|
||||
include $(top_srcdir)/../../../../../automake/local.am
|
||||
@@ -1,20 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
The location of the vectors file object is critical.
|
||||
|
||||
From the comments at the head of vectors.s:
|
||||
|
||||
The issue with this file is getting it loaded at the right place.
|
||||
The first vector MUST be at address 0x????0100.
|
||||
How this is achieved is dependant on the tool chain.
|
||||
|
||||
...
|
||||
|
||||
The variable 'PPC_VECTOR_FILE_BASE' must be defined to be the
|
||||
offset from 0x????0000 to the first location in the file. This
|
||||
will be either 0x0000 or 0xfff0.
|
||||
|
||||
The eth_comm BSP defines PPC_VECTOR_FILE_BASE to be 0x00000000
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,2 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -1,10 +0,0 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
SUBDIRS = include console-generic clock timer vectors
|
||||
|
||||
include $(top_srcdir)/../../../../../automake/subdirs.am
|
||||
include $(top_srcdir)/../../../../../automake/local.am
|
||||
@@ -1,19 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
Various non BSP dependant support routines.
|
||||
|
||||
clock - Uses the MPC860 PITPIT (Programmable interval timer) to
|
||||
generate RTEMS clock ticks.
|
||||
|
||||
console_generic - Uses the MPC860 SCCs and SMCs to to serial I/O
|
||||
|
||||
include - console.h: function declarations for console related functions
|
||||
|
||||
timer - Uses the MPC860 timebase register for timing
|
||||
tests. It only uses the lower 32 bits
|
||||
|
||||
vectors - MPC860 specific vector entry points.
|
||||
Includes CPU dependant, application independant
|
||||
handlers: alignment.
|
||||
@@ -1,2 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -1,29 +0,0 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
PGM = $(ARCH)/clock.rel
|
||||
|
||||
C_FILES = clock.c
|
||||
|
||||
clock_rel_OBJECTS = $(C_FILES:%.c=$(ARCH)/%.o)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../../../../../automake/lib.am
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
$(PGM): $(clock_rel_OBJECTS)
|
||||
$(make-rel)
|
||||
|
||||
all-local: $(ARCH) $(clock_rel_OBJECTS) $(PGM)
|
||||
|
||||
.PRECIOUS: $(PGM)
|
||||
|
||||
EXTRA_DIST = clock.c
|
||||
|
||||
include $(top_srcdir)/../../../../../automake/local.am
|
||||
@@ -1,179 +0,0 @@
|
||||
/* clock.c
|
||||
*
|
||||
* This routine initializes the PIT on the MPC860.
|
||||
* The tick frequency is specified by the bsp.
|
||||
*
|
||||
* Author: Jay Monkman (jmonkman@frasca.com)
|
||||
* Copyright (C) 1998 by Frasca International, Inc.
|
||||
*
|
||||
* Derived from c/src/lib/libcpu/ppc/ppc403/clock/clock.c:
|
||||
*
|
||||
* Author: Andrew Bray <andy@i-cubed.co.uk>
|
||||
*
|
||||
* COPYRIGHT (c) 1995 by i-cubed ltd.
|
||||
*
|
||||
* To anyone who acknowledges that this file is provided "AS IS"
|
||||
* without any express or implied warranty:
|
||||
* permission to use, copy, modify, and distribute this file
|
||||
* for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice and this notice appears in all
|
||||
* copies, and that the name of i-cubed limited not be used in
|
||||
* advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
* i-cubed limited makes no representations about the suitability
|
||||
* of this software for any purpose.
|
||||
*
|
||||
* Derived from c/src/lib/libcpu/hppa1_1/clock/clock.c:
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <clockdrv.h>
|
||||
#include <rtems/libio.h>
|
||||
|
||||
#include <stdlib.h> /* for atexit() */
|
||||
#include <mpc860.h>
|
||||
|
||||
volatile rtems_unsigned32 Clock_driver_ticks;
|
||||
extern volatile m860_t m860;
|
||||
|
||||
void Clock_exit( void );
|
||||
|
||||
/*
|
||||
* These are set by clock driver during its init
|
||||
*/
|
||||
|
||||
rtems_device_major_number rtems_clock_major = ~0;
|
||||
rtems_device_minor_number rtems_clock_minor;
|
||||
|
||||
/*
|
||||
* ISR Handler
|
||||
*/
|
||||
rtems_isr Clock_isr(rtems_vector_number vector)
|
||||
{
|
||||
m860.piscr |= M860_PISCR_PS;
|
||||
Clock_driver_ticks++;
|
||||
rtems_clock_tick();
|
||||
}
|
||||
|
||||
void Install_clock(rtems_isr_entry clock_isr)
|
||||
{
|
||||
rtems_isr_entry previous_isr;
|
||||
rtems_unsigned32 pit_value;
|
||||
|
||||
Clock_driver_ticks = 0;
|
||||
|
||||
pit_value = rtems_configuration_get_microseconds_per_tick() /
|
||||
rtems_cpu_configuration_get_clicks_per_usec();
|
||||
if (pit_value == 0) {
|
||||
pit_value = 0xffff;
|
||||
} else {
|
||||
pit_value--;
|
||||
}
|
||||
|
||||
if (pit_value > 0xffff) { /* pit is only 16 bits long */
|
||||
rtems_fatal_error_occurred(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* initialize the interval here
|
||||
* First tick is set to right amount of time in the future
|
||||
* Future ticks will be incremented over last value set
|
||||
* in order to provide consistent clicks in the face of
|
||||
* interrupt overhead
|
||||
*/
|
||||
|
||||
rtems_interrupt_catch(clock_isr, PPC_IRQ_LVL0, &previous_isr);
|
||||
|
||||
m860.sccr &= ~(1<<24);
|
||||
m860.pitc = pit_value;
|
||||
|
||||
/* set PIT irq level, enable PIT, PIT interrupts */
|
||||
/* and clear int. status */
|
||||
m860.piscr = M860_PISCR_PIRQ(0) |
|
||||
M860_PISCR_PTE | M860_PISCR_PS | M860_PISCR_PIE;
|
||||
|
||||
m860.simask |= M860_SIMASK_LVM0;
|
||||
atexit(Clock_exit);
|
||||
}
|
||||
|
||||
void
|
||||
ReInstall_clock(rtems_isr_entry new_clock_isr)
|
||||
{
|
||||
rtems_isr_entry previous_isr;
|
||||
rtems_unsigned32 isrlevel = 0;
|
||||
|
||||
rtems_interrupt_disable(isrlevel);
|
||||
|
||||
rtems_interrupt_catch(new_clock_isr, PPC_IRQ_LVL0, &previous_isr);
|
||||
|
||||
rtems_interrupt_enable(isrlevel);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called via atexit()
|
||||
* Remove the clock interrupt handler by setting handler to NULL
|
||||
*/
|
||||
void
|
||||
Clock_exit(void)
|
||||
{
|
||||
/* disable PIT and PIT interrupts */
|
||||
m860.piscr &= ~(M860_PISCR_PTE | M860_PISCR_PIE);
|
||||
|
||||
(void) set_vector(0, PPC_IRQ_LVL0, 1);
|
||||
}
|
||||
|
||||
rtems_device_driver Clock_initialize(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
Install_clock( Clock_isr );
|
||||
|
||||
/*
|
||||
* make major/minor avail to others such as shared memory driver
|
||||
*/
|
||||
|
||||
rtems_clock_major = major;
|
||||
rtems_clock_minor = minor;
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_device_driver Clock_control(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
rtems_libio_ioctl_args_t *args = pargp;
|
||||
|
||||
if (args == 0)
|
||||
goto done;
|
||||
|
||||
/*
|
||||
* This is hokey, but until we get a defined interface
|
||||
* to do this, it will just be this simple...
|
||||
*/
|
||||
|
||||
if (args->command == rtems_build_name('I', 'S', 'R', ' ')) {
|
||||
Clock_isr(PPC_IRQ_LVL0);
|
||||
}
|
||||
else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) {
|
||||
ReInstall_clock(args->buffer);
|
||||
}
|
||||
|
||||
done:
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -1,29 +0,0 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
PGM = $(ARCH)/console-generic.rel
|
||||
|
||||
C_FILES = console-generic.c
|
||||
|
||||
console_generic_rel_OBJECTS = $(C_FILES:%.c=$(ARCH)/%.o)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../../../../../automake/lib.am
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
$(PGM): $(console_generic_rel_OBJECTS)
|
||||
$(make-rel)
|
||||
|
||||
all-local: $(ARCH) $(console_generic_rel_OBJECTS) $(PGM)
|
||||
|
||||
.PRECIOUS: $(PGM)
|
||||
|
||||
EXTRA_DIST = console-generic.c
|
||||
|
||||
include $(top_srcdir)/../../../../../automake/local.am
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,2 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -1,27 +0,0 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
H_FILES = mpc860.h
|
||||
MPC860_H_FILES = console.h
|
||||
|
||||
noinst_HEADERS = $(H_FILES) $(MPC860_H_FILES)
|
||||
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/mpc860 \
|
||||
$(H_FILES:%.h=$(PROJECT_INCLUDE)/%.h) \
|
||||
$(MPC860_H_FILES:%.h=$(PROJECT_INCLUDE)/mpc860/%.h)
|
||||
|
||||
$(PROJECT_INCLUDE)/mpc860:
|
||||
$(mkinstalldirs) $@
|
||||
|
||||
$(PROJECT_INCLUDE)/%.h: %.h
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
$(PROJECT_INCLUDE)/mpc860/%.h: %.h
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
all-local: $(PREINSTALL_FILES)
|
||||
|
||||
include $(top_srcdir)/../../../../../automake/local.am
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _M860_CONSOLE_H_
|
||||
#define _M860_CONSOLE_H_
|
||||
|
||||
#include <rtems/libio.h>
|
||||
|
||||
int m860_smc_set_attributes(int, const struct termios*);
|
||||
int m860_scc_set_attributes(int, const struct termios*);
|
||||
void m860_scc_initialize(int);
|
||||
void m860_smc_initialize(int);
|
||||
int m860_char_poll_read(int);
|
||||
int m860_char_poll_write(int, const char*, int);
|
||||
rtems_isr m860_scc1_console_interrupt_handler(rtems_vector_number);
|
||||
rtems_isr m860_scc2_console_interrupt_handler(rtems_vector_number);
|
||||
rtems_isr m860_scc3_console_interrupt_handler(rtems_vector_number);
|
||||
rtems_isr m860_scc4_console_interrupt_handler(rtems_vector_number);
|
||||
rtems_isr m860_smc1_console_interrupt_handler(rtems_vector_number);
|
||||
rtems_isr m860_smc2_console_interrupt_handler(rtems_vector_number);
|
||||
int m860_buf_poll_read(int, char**);
|
||||
int m860_buf_poll_write(int, char*, int);
|
||||
void m860_console_initialize(void);
|
||||
rtems_device_driver m860_console_read(rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void*);
|
||||
rtems_device_driver m860_console_write(rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void*);
|
||||
|
||||
|
||||
typedef struct Buf_t_ {
|
||||
struct Buf_t_ *next;
|
||||
volatile char *buf;
|
||||
volatile int len;
|
||||
int pos;
|
||||
} Buf_t;
|
||||
|
||||
#define SMC1_MINOR 0
|
||||
#define SMC2_MINOR 1
|
||||
#define SCC1_MINOR 2
|
||||
#define SCC2_MINOR 3
|
||||
#define SCC3_MINOR 4
|
||||
#define SCC4_MINOR 5
|
||||
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,2 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -1,29 +0,0 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
PGM = $(ARCH)/timer.rel
|
||||
|
||||
C_FILES = timer.c
|
||||
|
||||
timer_rel_OBJECTS = $(C_FILES:%.c=$(ARCH)/%.o)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../../../../../automake/lib.am
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
$(PGM): $(timer_rel_OBJECTS)
|
||||
$(make-rel)
|
||||
|
||||
all-local: $(ARCH) $(timer_rel_OBJECTS) $(PGM)
|
||||
|
||||
.PRECIOUS: $(PGM)
|
||||
|
||||
EXTRA_DIST = timer.c
|
||||
|
||||
include $(top_srcdir)/../../../../../automake/local.am
|
||||
@@ -1,100 +0,0 @@
|
||||
/* timer.c
|
||||
*
|
||||
* This file manages the interval timer on the PowerPC MPC860.
|
||||
* NOTE: This is not the PIT, but rather the RTEMS interval
|
||||
* timer
|
||||
* We shall use the bottom 32 bits of the timebase register,
|
||||
*
|
||||
* The following was in the 403 version of this file. I don't
|
||||
* know what it means. JTM 5/19/98
|
||||
* NOTE: It is important that the timer start/stop overhead be
|
||||
* determined when porting or modifying this code.
|
||||
*
|
||||
* Author: Jay Monkman (jmonkman@frasca.com)
|
||||
* Copywright (C) 1998 by Frasca International, Inc.
|
||||
*
|
||||
* Derived from c/src/lib/libcpu/ppc/ppc403/timer/timer.c:
|
||||
*
|
||||
* Author: Andrew Bray <andy@i-cubed.co.uk>
|
||||
*
|
||||
* COPYRIGHT (c) 1995 by i-cubed ltd.
|
||||
*
|
||||
* To anyone who acknowledges that this file is provided "AS IS"
|
||||
* without any express or implied warranty:
|
||||
* permission to use, copy, modify, and distribute this file
|
||||
* for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice and this notice appears in all
|
||||
* copies, and that the name of i-cubed limited not be used in
|
||||
* advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
* i-cubed limited makes no representations about the suitability
|
||||
* of this software for any purpose.
|
||||
*
|
||||
* Derived from c/src/lib/libcpu/hppa1_1/timer/timer.c:
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <mpc860.h>
|
||||
|
||||
static volatile rtems_unsigned32 Timer_starting;
|
||||
static rtems_boolean Timer_driver_Find_average_overhead;
|
||||
|
||||
/*
|
||||
* This is so small that this code will be reproduced where needed.
|
||||
*/
|
||||
static inline rtems_unsigned32 get_itimer(void)
|
||||
{
|
||||
rtems_unsigned32 ret;
|
||||
|
||||
asm volatile ("mftb %0" : "=r" ((ret))); /* TBLO */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Timer_initialize(void)
|
||||
{
|
||||
/* set interrupt level and enable timebase. This should never */
|
||||
/* generate an interrupt however. */
|
||||
m860.tbscr |= M860_TBSCR_TBIRQ(4) | M860_TBSCR_TBE;
|
||||
|
||||
Timer_starting = get_itimer();
|
||||
}
|
||||
|
||||
int Read_timer(void)
|
||||
{
|
||||
rtems_unsigned32 clicks;
|
||||
rtems_unsigned32 total;
|
||||
|
||||
clicks = get_itimer();
|
||||
|
||||
total = clicks - Timer_starting;
|
||||
|
||||
if ( Timer_driver_Find_average_overhead == 1 )
|
||||
return total; /* in XXX microsecond units */
|
||||
|
||||
else {
|
||||
if ( total < rtems_cpu_configuration_get_timer_least_valid() ) {
|
||||
return 0; /* below timer resolution */
|
||||
}
|
||||
return (total - rtems_cpu_configuration_get_timer_average_overhead());
|
||||
}
|
||||
}
|
||||
|
||||
rtems_status_code Empty_function(void)
|
||||
{
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
void Set_find_average_overhead(rtems_boolean find_flag)
|
||||
{
|
||||
Timer_driver_Find_average_overhead = find_flag;
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -1,32 +0,0 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
VPATH = @srcdir@:@srcdir@/../../ppc403/vectors
|
||||
|
||||
## FIXME
|
||||
|
||||
PGM = ${ARCH}/vectors.rel
|
||||
|
||||
## Assembly sources
|
||||
S_FILES = vectors.S align_h.S
|
||||
|
||||
vectors_rel_OBJECTS = $(S_FILES:%.S=${ARCH}/%.o)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../../../../../automake/lib.am
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
$(PGM): $(vectors_rel_OBJECTS)
|
||||
$(make-rel)
|
||||
|
||||
all-local: ${ARCH} $(PGM)
|
||||
|
||||
EXTRA_DIST = vectors.S README
|
||||
|
||||
include $(top_srcdir)/../../../../../automake/local.am
|
||||
@@ -1,20 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
The location of the vectors file object is critical.
|
||||
|
||||
From the comments at the head of vectors.s:
|
||||
|
||||
The issue with this file is getting it loaded at the right place.
|
||||
The first vector MUST be at address 0x????0100.
|
||||
How this is achieved is dependant on the tool chain.
|
||||
|
||||
...
|
||||
|
||||
The variable 'PPC_VECTOR_FILE_BASE' must be defined to be the
|
||||
offset from 0x????0000 to the first location in the file. This
|
||||
will be either 0x0000 or 0xfff0.
|
||||
|
||||
The eth_comm BSP defines PPC_VECTOR_FILE_BASE to be 0x00000000
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user