mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 16:29:57 +08:00
The rxgen960 BSP and i960 RPM support was submitted by Mark Bronson
<mark@ramix.com> of RAMIX.
This commit is contained in:
@@ -161,6 +161,9 @@ The following persons/organizations have made contributions:
|
||||
GoAhead web server, BSP for the Motorola MCP750 PowerPC board, and
|
||||
numerous improvements to the i386 and PowerPC ports of RTEMS.
|
||||
|
||||
+ Mark Bronson <mark@ramix.com> of RAMIX for submitting i960RP
|
||||
support and the rxgen960 board support package.
|
||||
|
||||
Finally, the RTEMS project would like to thank those who have contributed
|
||||
to the other free software efforts which RTEMS utilizes. The primary RTEMS
|
||||
development environment is from the Free Software Foundation (the GNU
|
||||
|
||||
@@ -12,10 +12,14 @@
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
/*
|
||||
* 1999/04/26: added support for Intel i960RP
|
||||
*/
|
||||
|
||||
#if defined(__i960CA__) || defined(__i960_CA__) || defined(__i960CA)
|
||||
#elif defined(__i960RP__)
|
||||
#else
|
||||
#warning "*** ENTIRE FILE IMPLEMENTED & TESTED FOR CA ONLY ***"
|
||||
#warning "*** ENTIRE FILE IMPLEMENTED & TESTED FOR CA & RP ONLY ***"
|
||||
#warning "*** THIS FILE WILL NOT COMPILE ON ANOTHER FAMILY MEMBER ***"
|
||||
#endif
|
||||
|
||||
@@ -61,9 +65,14 @@ unsigned32 _CPU_ISR_Get_level( void )
|
||||
*
|
||||
* _CPU_ISR_install_raw_handler
|
||||
*/
|
||||
|
||||
|
||||
#if defined(__i960CA__) || defined(__i960_CA__) || defined(__i960CA)
|
||||
#define _Is_vector_caching_enabled( _prcb ) \
|
||||
((_prcb)->control_tbl->icon & 0x2000)
|
||||
#elif defined(__i960RP__)
|
||||
#define _Is_vector_caching_enabled( _prcb ) \
|
||||
((*((unsigned int *) ICON_ADDR)) & 0x2000)
|
||||
#endif
|
||||
|
||||
void _CPU_ISR_install_raw_handler(
|
||||
unsigned32 vector,
|
||||
@@ -71,7 +80,7 @@ void _CPU_ISR_install_raw_handler(
|
||||
proc_ptr *old_handler
|
||||
)
|
||||
{
|
||||
i960ca_PRCB *prcb = _CPU_Table.Prcb;
|
||||
i960_PRCB *prcb = _CPU_Table.Prcb;
|
||||
proc_ptr *cached_intr_tbl = NULL;
|
||||
|
||||
/* The i80960CA does not support vectors 0-7. The first 9 entries
|
||||
@@ -124,8 +133,9 @@ void _CPU_ISR_install_vector(
|
||||
* _CPU_Install_interrupt_stack
|
||||
*/
|
||||
|
||||
#if defined(__i960CA__) || defined(__i960_CA__) || defined(__i960CA)
|
||||
#define soft_reset( prcb ) \
|
||||
{ register i960ca_PRCB *_prcb = (prcb); \
|
||||
{ register i960_PRCB *_prcb = (prcb); \
|
||||
register unsigned32 *_next=0; \
|
||||
register unsigned32 _cmd = 0x30000; \
|
||||
asm volatile( "lda next,%1; \
|
||||
@@ -134,11 +144,28 @@ void _CPU_ISR_install_vector(
|
||||
: "=d" (_cmd), "=d" (_next), "=d" (_prcb) \
|
||||
: "0" (_cmd), "1" (_next), "2" (_prcb) ); \
|
||||
}
|
||||
#else
|
||||
#if defined(__i960RP__) || defined(__i960_RP__) || defined(__i960RP)
|
||||
#define soft_reset( prcb ) \
|
||||
{ register i960_PRCB *_prcb = (prcb); \
|
||||
register unsigned32 *_next=0; \
|
||||
register unsigned32 _cmd = 0x300; \
|
||||
asm volatile( "lda next,%1; \
|
||||
sysctl %0,%1,%2; \
|
||||
next: mov g0,g0" \
|
||||
: "=d" (_cmd), "=d" (_next), "=d" (_prcb) \
|
||||
: "0" (_cmd), "1" (_next), "2" (_prcb) ); \
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void _CPU_Install_interrupt_stack( void )
|
||||
{
|
||||
i960ca_PRCB *prcb = _CPU_Table.Prcb;
|
||||
i960_PRCB *prcb = _CPU_Table.Prcb;
|
||||
unsigned32 level;
|
||||
#if defined(__i960RP__) || defined(__i960_RP__)
|
||||
int *isp = (int *) ISP_ADDR;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set the Interrupt Stack in the PRCB and force a reload of it.
|
||||
@@ -149,7 +176,11 @@ void _CPU_Install_interrupt_stack( void )
|
||||
|
||||
prcb->intr_stack = _CPU_Interrupt_stack_low;
|
||||
|
||||
#if defined(__i960CA__) || defined(__i960_CA__) || defined(__i960CA)
|
||||
soft_reset( prcb );
|
||||
#elif defined(__i960RP__) || defined(__i960_RP__) || defined(__i960RP)
|
||||
*isp = prcb->intr_stack;
|
||||
#endif
|
||||
|
||||
_CPU_ISR_Enable( level );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,318 @@
|
||||
/*
|
||||
* i960RP Related Definitions.
|
||||
*
|
||||
* NOTE: There is some commonality with the JX series which is
|
||||
* not currently supported by RTEMS.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __I960RP_h
|
||||
#define __I960RP_h
|
||||
|
||||
/*----------------------------------------------------------*/
|
||||
/* Example 6. Include File (evrp.h) */
|
||||
/*----------------------------------------------------------*/
|
||||
/* Define JX Core memory mapped register addresses */
|
||||
/* Common to Jx and RP: */
|
||||
#define DLMCON_ADDR 0xff008100
|
||||
#define LMAR0_ADDR 0xff008108
|
||||
#define LMMR0_ADDR 0xff00810c
|
||||
#define LMAR1_ADDR 0xff008110
|
||||
#define LMMR1_ADDR 0xff008114
|
||||
#define IPB0_ADDR 0xff008400
|
||||
#define IPB1_ADDR 0xff008404
|
||||
#define DAB0_ADDR 0xff008420
|
||||
#define DAB1_ADDR 0xff008424
|
||||
#define BPCON_ADDR 0xff008440
|
||||
#define IPND_ADDR 0xff008500
|
||||
#define IMSK_ADDR 0xff008504
|
||||
#define ICON_ADDR 0xff008510
|
||||
#define IMAP0_ADDR 0xff008520
|
||||
#define IMAP1_ADDR 0xff008524
|
||||
#define IMAP2_ADDR 0xff008528
|
||||
#define PMCON0_ADDR 0xff008600
|
||||
#define PMCON2_ADDR 0xff008608
|
||||
#define PMCON4_ADDR 0xff008610
|
||||
#define PMCON6_ADDR 0xff008618
|
||||
#define PMCON8_ADDR 0xff008620
|
||||
#define PMCON10_ADDR 0xff008628
|
||||
#define PMCON12_ADDR 0xff008630
|
||||
#define PMCON14_ADDR 0xff008638
|
||||
#define BCON_ADDR 0xff0086fc
|
||||
#define PRCB_ADDR 0xff008700
|
||||
#define ISP_ADDR 0xff008704
|
||||
#define SSP_ADDR 0xff008708
|
||||
#define DEVID_ADDR 0xff008710
|
||||
#define TRR0_ADDR 0xff000300
|
||||
#define TCR0_ADDR 0xff000304
|
||||
#define TMR0_ADDR 0xff000308
|
||||
#define TRR1_ADDR 0xff000310
|
||||
#define TCR1_ADDR 0xff000314
|
||||
#define TMR1_ADDR 0xff000318
|
||||
|
||||
/* RP-only addresses: */
|
||||
/* RP MMRs */
|
||||
|
||||
/* PCI-to-PCI Bridge Unit 0000 1000H through 0000 10FFH */
|
||||
#define VIDR_ADDR 0x00001000
|
||||
#define DIDR_ADDR 0x00001002
|
||||
#define PCMDR_ADDR 0x00001004
|
||||
#define PSR_ADDR 0x00001006
|
||||
#define RIDR_ADDR 0x00001008
|
||||
#define CCR_ADDR 0x00001009
|
||||
#define CLSR_ADDR 0x0000100C
|
||||
#define PLTR_ADDR 0x0000100D
|
||||
#define HTR_ADDR 0x0000100E
|
||||
/* Reserved 0x0000100F through 0x00001017 */
|
||||
#define PBNR_ADDR 0x00001018
|
||||
#define SBNR_ADDR 0x00001019
|
||||
#define SUBBNR_ADDR 0x0000101A
|
||||
#define SLTR_ADDR 0x0000101B
|
||||
#define IOBR_ADDR 0x0000101C
|
||||
#define IOLR_ADDR 0x0000101D
|
||||
#define SSR_ADDR 0x0000101E
|
||||
#define MBR_ADDR 0x00001020
|
||||
#define MLR_ADDR 0x00001022
|
||||
#define PMBR_ADDR 0x00001024
|
||||
#define PMLR_ADDR 0x00001026
|
||||
/* Reserved 0x00001028 through 0x00001033 */
|
||||
#define BSVIR_ADDR 0x00001034
|
||||
#define BSIR_ADDR 0x00001036
|
||||
/* Reserved 0x00001038 through 0x0000103D */
|
||||
#define BCR_ADDR 0x0000103E
|
||||
#define EBCR_ADDR 0x00001040
|
||||
#define SISR_ADDR 0x00001042
|
||||
#define PBISR_ADDR 0x00001044
|
||||
#define SBISR_ADDR 0x00001048
|
||||
#define SACR_ADDR 0x0000104C
|
||||
#define PIRSR_ADDR 0x00001050
|
||||
#define SIOBR_ADDR 0x00001054
|
||||
#define SIOLR_ADDR 0x00001055
|
||||
#define SMBR_ADDR 0x00001058
|
||||
#define SMLR_ADDR 0x0000105A
|
||||
#define SDER_ADDR 0x0000105C
|
||||
/* Reserved 0x0000105E through 0x000011FFH */
|
||||
|
||||
/* Address Translation Unit 0000 1200H through 0000 12FFH */
|
||||
#define ATUVID_ADDR 0x00001200
|
||||
#define ATUDID_ADDR 0x00001202
|
||||
#define PATUCMD_ADDR 0x00001204
|
||||
#define PATUSR_ADDR 0x00001206
|
||||
#define ATURID_ADDR 0x00001208
|
||||
#define ATUCCR_ADDR 0x00001209
|
||||
#define ATUCLSR_ADDR 0x0000120C
|
||||
#define ATULT_ADDR 0x0000120D
|
||||
#define ATUHTR_ADDR 0x0000120E
|
||||
#define ATUBISTR_ADDR 0x0000120F
|
||||
#define PIABAR_ADDR 0x00001210
|
||||
/* Reserved 0x00001214 */
|
||||
/* Reserved 0x00001218 */
|
||||
/* Reserved 0x0000121C */
|
||||
/* Reserved 0x00001220 */
|
||||
/* Reserved 0x00001224 */
|
||||
/* Reserved 0x00001228 */
|
||||
#define ASVIR_ADDR 0x0000122C
|
||||
#define ASIR_ADDR 0x0000122E
|
||||
#define ERBAR_ADDR 0x00001230
|
||||
/* Reserved 0x00001234 */
|
||||
/* Reserved 0x00001238 */
|
||||
#define ATUILR_ADDR 0x0000123C
|
||||
#define ATUIPR_ADDR 0x0000123D
|
||||
#define ATUMGNT_ADDR 0x0000123E
|
||||
#define ATUMLAT_ADDR 0x0000123F
|
||||
#define PIALR_ADDR 0x00001240
|
||||
#define PIATVR_ADDR 0x00001244
|
||||
#define SIABAR_ADDR 0x00001248
|
||||
#define SIALR_ADDR 0x0000124C
|
||||
#define SIATVR_ADDR 0x00001250
|
||||
#define POMWVR_ADDR 0x00001254
|
||||
/* Reserved 0x00001258 */
|
||||
#define POIOWVR_ADDR 0x0000125C
|
||||
#define PODWVR_ADDR 0x00001260
|
||||
#define POUDR_ADDR 0x00001264
|
||||
#define SOMWVR_ADDR 0x00001268
|
||||
#define SOIOWVR_ADDR 0x0000126C
|
||||
/* Reserved 0x00001270 */
|
||||
#define ERLR_ADDR 0x00001274
|
||||
#define ERTVR_ADDR 0x00001278
|
||||
/* Reserved 0x0000127C */
|
||||
/* Reserved 0x00001280 */
|
||||
/* Reserved 0x00001284 */
|
||||
#define ATUCR_ADDR 0x00001288
|
||||
/* Reserved 0x0000128C */
|
||||
#define PATUISR_ADDR 0x00001290
|
||||
#define SATUISR_ADDR 0x00001294
|
||||
#define SATUCMD_ADDR 0x00001298
|
||||
#define SATUSR_ADDR 0x0000129A
|
||||
#define SODWVR_ADDR 0x0000129C
|
||||
#define SOUDR_ADDR 0x000012A0
|
||||
#define POCCAR_ADDR 0x000012A4
|
||||
#define SOCCAR_ADDR 0x000012A8
|
||||
#define POCCDR_ADDR 0x000012AC
|
||||
#define SOCCDR_ADDR 0x000012B0
|
||||
/* Reserved 0x000012B4 through 0x000012FF */
|
||||
|
||||
/* Messaging Unit 0000 1300H through 0000 13FFH */
|
||||
#define ARSR_ADDR 0x00001300
|
||||
/* Reserved 0x00001304 */
|
||||
#define AWR_ADDR 0x00001308
|
||||
/* Reserved 0x0000130C */
|
||||
#define IMR0_ADDR 0x00001310
|
||||
#define IMR1_ADDR 0x00001314
|
||||
#define OMR0_ADDR 0x00001318
|
||||
#define OMR1_ADDR 0x0000131C
|
||||
#define IDR_ADDR 0x00001320
|
||||
#define IISR_ADDR 0x00001324
|
||||
#define IIMR_ADDR 0x00001328
|
||||
#define ODR_ADDR 0x0000132C
|
||||
#define OISR_ADDR 0x00001330
|
||||
#define OIMR_ADDR 0x00001334
|
||||
/* Reserved 0x00001338 through 0x0000134F */
|
||||
#define MUCR_ADDR 0x00001350
|
||||
#define QBAR_ADDR 0x00001354
|
||||
/* Reserved 0x00001358 */
|
||||
/* Reserved 0x0000135C */
|
||||
#define IFHPR_ADDR 0x00001360
|
||||
#define IFTPR_ADDR 0x00001364
|
||||
#define IPHPR_ADDR 0x00001368
|
||||
#define IPTPR_ADDR 0x0000136C
|
||||
#define OFHPR_ADDR 0x00001370
|
||||
#define OFTPR_ADDR 0x00001374
|
||||
#define OPHPR_ADDR 0x00001378
|
||||
#define OPTPR_ADDR 0x0000137C
|
||||
#define IAR_ADDR 0x00001380
|
||||
/* Reserved 0x00001384 through 0x000013FF */
|
||||
|
||||
/* DMA Controller 0000 1400H through 0000 14FFH */
|
||||
#define CCR0_ADDR 0x00001400
|
||||
#define CSR0_ADDR 0x00001404
|
||||
/* Reserved 0x00001408 */
|
||||
#define DAR0_ADDR 0x0000140C
|
||||
#define NDAR0_ADDR 0x00001410
|
||||
#define PADR0_ADDR 0x00001414
|
||||
#define PUADR0_ADDR 0x00001418
|
||||
#define LADR0_ADDR 0x0000141C
|
||||
#define BCR0_ADDR 0x00001420
|
||||
#define DCR0_ADDR 0x00001424
|
||||
/* Reserved 0x00001428 through 0x0000143F */
|
||||
#define CCR1_ADDR 0x00001440
|
||||
#define CSR1_ADDR 0x00001444
|
||||
/* Reserved 0x00001448 */
|
||||
#define DAR1_ADDR 0x0000144C
|
||||
#define NDAR1_ADDR 0x00001450
|
||||
#define PADR1_ADDR 0x00001454
|
||||
#define PUADR1_ADDR 0x00001458
|
||||
#define LADR1_ADDR 0x0000145C
|
||||
#define BCR1_ADDR 0x00001460
|
||||
#define DCR1_ADDR 0x00001464
|
||||
/* Reserved 0x00001468 through 0x0000147F */
|
||||
#define CCR2_ADDR 0x00001480
|
||||
#define CSR2_ADDR 0x00001484
|
||||
/* Reserved 0x00001488 */
|
||||
#define DAR2_ADDR 0x0000148C
|
||||
#define NDAR2_ADDR 0x00001490
|
||||
#define PADR2_ADDR 0x00001494
|
||||
#define PUADR2_ADDR 0x00001498
|
||||
#define LADR2_ADDR 0x0000149C
|
||||
#define BCR2_ADDR 0x000014A0
|
||||
#define DCR2_ADDR 0x000014A4
|
||||
/* Reserved 0x000014A8 through 0x000014FF */
|
||||
|
||||
/* Memory Controller 0000 1500H through 0000 15FFH */
|
||||
#define MBCR_ADDR 0x00001500
|
||||
#define MBBAR0_ADDR 0x00001504
|
||||
#define MBRWS0_ADDR 0x00001508
|
||||
#define MBWWS0_ADDR 0x0000150C
|
||||
#define MBBAR1_ADDR 0x00001510
|
||||
#define MBRWS1_ADDR 0x00001514
|
||||
#define MBWWS1_ADDR 0x00001518
|
||||
#define DBCR_ADDR 0x0000151C
|
||||
#define DBAR_ADDR 0x00001520
|
||||
#define DRWS_ADDR 0x00001524
|
||||
#define DWWS_ADDR 0x00001528
|
||||
#define DRIR_ADDR 0x0000152C
|
||||
#define DPER_ADDR 0x00001530
|
||||
#define BMER_ADDR 0x00001534
|
||||
#define MEAR_ADDR 0x00001538
|
||||
#define LPISR_ADDR 0x0000153C
|
||||
/* Reserved 0x00001540 through 0x000015FF */
|
||||
|
||||
/* Local Bus Arbitration Unit 0000 1600H through 0000 167FH
|
||||
*/
|
||||
#define LBACR_ADDR 0x00001600
|
||||
#define LBALCR_ADDR 0x00001604
|
||||
/* Reserved 0x00001608 through 0x0000167F */
|
||||
|
||||
/* I2C Bus Interface Unit 0000 1680H through 0000 16FFH */
|
||||
#define ICR_ADDR 0x00001680
|
||||
#define ISR_ADDR 0x00001684
|
||||
#define ISAR_ADDR 0x00001688
|
||||
#define IDBR_ADDR 0x0000168C
|
||||
#define ICCR_ADDR 0x00001690
|
||||
/* Reserved 0x00001694 through 0x000016FF */
|
||||
|
||||
/* PCI And Peripheral Interrupt Controller 0000 1700H through
|
||||
0000 177FH */
|
||||
#define NISR_ADDR 0x00001700
|
||||
#define X7ISR_ADDR 0x00001704
|
||||
#define X6ISR_ADDR 0x00001708
|
||||
#define PDDIR_ADDR 0x00001710
|
||||
/* Reserved 0x00001714 through 0x0000177F */
|
||||
|
||||
/* APIC Bus Interface Unit 0000 1780H through 0000 17FFH */
|
||||
#define APICIDR_ADDR 0x00001780
|
||||
#define APICARBID_ADDR 0x00001784
|
||||
#define EVR_ADDR 0x00001788
|
||||
#define IMR_ADDR 0x0000178C
|
||||
#define APICCSR_ADDR 0x00001790
|
||||
/* Reserved 0x00001794 through 0x000017FF */
|
||||
|
||||
/* Byte order bit for region configuration */
|
||||
/* Set to Little Endian for the 80960RP*/
|
||||
#define BYTE_ORDER BIG_ENDIAN(0)
|
||||
#define BUS_WIDTH(bw) ((bw==16)?(1<<22):(0)) | ((bw==32)?(2<<22):(0))
|
||||
#define BIG_ENDIAN(on) ((on)?(0x1<<31):0)
|
||||
#define BYTE_N(n,data) (((unsigned)(data) >> (n*8)) & 0xFF)
|
||||
#define BUS_WIDTH_8 0
|
||||
#define BUS_WIDTH_16 (1<<22)
|
||||
#define BUS_WIDTH_32 (1<<23)
|
||||
|
||||
|
||||
/* ATU Register Definitions */
|
||||
|
||||
#define ATUCR_SECOUTEN 0x4
|
||||
#define ATUCR_PRIOUTEN 0x2
|
||||
#define ATUCR_DADRSELEN 0x100
|
||||
#define ATUCR_SECDADREN 0x80
|
||||
#define AUTCR_SECERRINTEN 0x20
|
||||
#define AUTCR_PRIERRINTEN 0x10
|
||||
|
||||
#define ATUSCMD_IOEN 0x1
|
||||
#define ATUSCMD_MEMEN 0x2
|
||||
#define ATUSCMD_BUSMSTEN 0x4
|
||||
|
||||
#define ATUPCMD_IOEN 0x1
|
||||
#define ATUPCMD_MEMEN 0x2
|
||||
#define ATUPCMD_BUSMSTEN 0x4
|
||||
|
||||
/* EBCR Register Definitions */
|
||||
#define EBCR_CCR_MASK 0x4
|
||||
|
||||
#define rp_readreg32( x) ( *((unsigned int *) x))
|
||||
#define rp_writereg32( x, v) ( *((unsigned int *) x) = v)
|
||||
#define rp_readreg16( x) ( *((unsigned short *) x))
|
||||
#define rp_writereg16( x, v) ( *((unsigned short *) x) = v)
|
||||
#define rp_readreg8( x) ( *((unsigned char *) x))
|
||||
#define rp_writereg8( x, v) ( *((unsigned char *) x) = v)
|
||||
|
||||
|
||||
/* i960 Memory Map values */
|
||||
|
||||
#define RP_PRI_IO_WIND_BASE 0x90000000
|
||||
#define RP_SEC_IO_WIND_BASE 0x90010000
|
||||
#define RP_SEC_MEM_WIND_BASE 0x88000000
|
||||
#define RP_PRI_MEM_WIND_BASE 0x80000000
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -215,10 +215,12 @@ SCORE_EXTERN void *_CPU_Interrupt_stack_high;
|
||||
#define CPU_STACK_MINIMUM_SIZE 2048
|
||||
|
||||
/*
|
||||
* i960 is pretty tolerant of alignment. Just put things on 4 byte boundaries.
|
||||
* i960 is pretty tolerant of alignment but some CPU models do
|
||||
* better with different default aligments so we use what the
|
||||
* CPU model selected in rtems/score/i960.h.
|
||||
*/
|
||||
|
||||
#define CPU_ALIGNMENT 4
|
||||
#define CPU_ALIGNMENT I960_CPU_ALIGNMENT
|
||||
#define CPU_HEAP_ALIGNMENT CPU_ALIGNMENT
|
||||
#define CPU_PARTITION_ALIGNMENT CPU_ALIGNMENT
|
||||
|
||||
|
||||
@@ -38,13 +38,19 @@ extern "C" {
|
||||
|
||||
#define CPU_MODEL_NAME "i960ca"
|
||||
#define __RTEMS_I960CA__
|
||||
#define I960_HAS_FPU 0
|
||||
|
||||
#elif defined(__i960HA__) || defined(__i960_HA__) || defined(__i960HA)
|
||||
|
||||
#define CPU_MODEL_NAME "i960ha"
|
||||
#define __RTEMS_I960HA__
|
||||
#define I960_HAS_FPU 0
|
||||
|
||||
#elif defined(__i960RP__)
|
||||
|
||||
#include <i960RP.h>
|
||||
#define CPU_MODEL_NAME "i960rp"
|
||||
#define __RTEMS_I960RP__
|
||||
#define I960_CPU_ALIGNMENT 8
|
||||
#define I960_SOFT_RESET_COMMAND 0x300
|
||||
|
||||
#else
|
||||
|
||||
@@ -52,6 +58,22 @@ extern "C" {
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Now default some CPU model variation parameters
|
||||
*/
|
||||
|
||||
#ifndef I960_HAS_FPU
|
||||
#define I960_HAS_FPU 0
|
||||
#endif
|
||||
|
||||
#ifndef I960_CPU_ALIGNMENT
|
||||
#define I960_CPU_ALIGNMENT 4
|
||||
#endif
|
||||
|
||||
#ifndef I960_SOFT_RESET_COMMAND
|
||||
#define I960_SOFT_RESET_COMMAND 0x30000
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define the name of the CPU family.
|
||||
*/
|
||||
@@ -66,6 +88,18 @@ extern "C" {
|
||||
*/
|
||||
|
||||
#if defined(__RTEMS_I960CA__)
|
||||
/*
|
||||
* Now default some CPU model variation parameters
|
||||
*/
|
||||
|
||||
#ifndef I960_HAS_FPU
|
||||
#define I960_HAS_FPU 0
|
||||
#endif
|
||||
|
||||
#ifndef I960_CPU_ALIGNMENT
|
||||
#define I960_CPU_ALIGNMENT 4
|
||||
#endif
|
||||
|
||||
|
||||
/* i960CA control structures */
|
||||
|
||||
@@ -195,8 +229,101 @@ typedef struct {
|
||||
typedef i960ha_control_table i960_control_table;
|
||||
typedef i960ha_PRCB i960_PRCB;
|
||||
|
||||
#elif defined(__RTEMS_I960RP__)
|
||||
|
||||
/* i960RP control structures */
|
||||
|
||||
/* Intel i960RP Control Table */
|
||||
|
||||
typedef struct {
|
||||
/* Control Group 0 */
|
||||
unsigned int rsvd00;
|
||||
unsigned int rsvd01;
|
||||
unsigned int rsvd02;
|
||||
unsigned int rsvd03;
|
||||
/* Control Group 1 */
|
||||
unsigned int imap0; /* interrupt map 0 */
|
||||
unsigned int imap1; /* interrupt map 1 */
|
||||
unsigned int imap2; /* interrupt map 2 */
|
||||
unsigned int icon; /* interrupt control */
|
||||
/* Control Group 2 */
|
||||
unsigned int pmcon0; /* memory region 0 configuration */
|
||||
unsigned int rsvd1;
|
||||
unsigned int pmcon2; /* memory region 2 configuration */
|
||||
unsigned int rsvd2;
|
||||
/* Control Group 3 */
|
||||
unsigned int pmcon4; /* memory region 4 configuration */
|
||||
unsigned int rsvd3;
|
||||
unsigned int pmcon6; /* memory region 6 configuration */
|
||||
unsigned int rsvd4;
|
||||
/* Control Group 4 */
|
||||
unsigned int pmcon8; /* memory region 8 configuration */
|
||||
unsigned int rsvd5;
|
||||
unsigned int pmcon10; /* memory region 10 configuration */
|
||||
unsigned int rsvd6;
|
||||
/* Control Group 5 */
|
||||
unsigned int pmcon12; /* memory region 12 configuration */
|
||||
unsigned int rsvd7;
|
||||
unsigned int pmcon14; /* memory region 14 configuration */
|
||||
unsigned int rsvd8;
|
||||
/* Control Group 6 */
|
||||
unsigned int rsvd9;
|
||||
unsigned int rsvd10;
|
||||
unsigned int tc; /* trace control */
|
||||
unsigned int bcon; /* bus configuration control */
|
||||
} i960rp_control_table;
|
||||
|
||||
/* Intel i960RP Processor Control Block */
|
||||
|
||||
typedef struct {
|
||||
unsigned int *fault_tbl; /* fault table base address */
|
||||
i960rp_control_table
|
||||
*control_tbl; /* control table base address */
|
||||
unsigned int initial_ac; /* AC register initial value */
|
||||
unsigned int fault_config; /* fault configuration word */
|
||||
void **intr_tbl; /* interrupt table base address */
|
||||
void *sys_proc_tbl; /* system procedure table
|
||||
base address */
|
||||
unsigned int reserved; /* reserved */
|
||||
unsigned int *intr_stack; /* interrupt stack pointer */
|
||||
unsigned int ins_cache_cfg; /* instruction cache
|
||||
configuration word */
|
||||
unsigned int reg_cache_cfg; /* register cache configuration word */
|
||||
} i960rp_PRCB;
|
||||
|
||||
typedef i960rp_control_table i960_control_table;
|
||||
typedef i960rp_PRCB i960_PRCB;
|
||||
|
||||
#else
|
||||
#error "invalid processor selection!"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Miscellaneous Support Routines
|
||||
*/
|
||||
|
||||
#define i960_reload_ctl_group( group ) \
|
||||
{ register int _cmd = ((group)|0x400) ; \
|
||||
asm volatile( "sysctl %0,%0,%0" : "=d" (_cmd) : "0" (_cmd) ); \
|
||||
}
|
||||
|
||||
#define i960_atomic_modify( mask, addr, prev ) \
|
||||
{ register unsigned int _mask = (mask); \
|
||||
register unsigned int *_addr = (unsigned int *)(addr); \
|
||||
asm volatile( "atmod %0,%1,%1" \
|
||||
: "=d" (_addr), "=d" (_mask) \
|
||||
: "0" (_addr), "1" (_mask) ); \
|
||||
(prev) = _mask; \
|
||||
}
|
||||
|
||||
#define atomic_modify( _mask, _address, _previous ) \
|
||||
i960_atomic_modify( _mask, _address, _previous )
|
||||
|
||||
#define i960_enable_tracing() \
|
||||
{ register unsigned int _pc = 0x1; \
|
||||
asm volatile( "modpc 0,%0,%0" : "=d" (_pc) : "0" (_pc) ); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Interrupt Level Routines
|
||||
*/
|
||||
@@ -231,23 +358,16 @@ typedef i960ha_PRCB i960_PRCB;
|
||||
(_level) = ((_level) & 0x1f0000) >> 16; \
|
||||
} while ( 0 )
|
||||
|
||||
#define i960_atomic_modify( mask, addr, prev ) \
|
||||
{ register unsigned int _mask = (mask); \
|
||||
register unsigned int *_addr = (unsigned int *)(addr); \
|
||||
asm volatile( "atmod %0,%1,%1" \
|
||||
: "=d" (_addr), "=d" (_mask) \
|
||||
: "0" (_addr), "1" (_mask) ); \
|
||||
(prev) = _mask; \
|
||||
#define i960_cause_intr( intr ) \
|
||||
{ register int _intr = (intr); \
|
||||
asm volatile( "sysctl %0,%0,%0" : "=d" (_intr) : "0" (_intr) ); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Interrupt Masking Routines
|
||||
*/
|
||||
|
||||
#define atomic_modify( _mask, _address, _previous ) \
|
||||
i960_atomic_modify( _mask, _address, _previous )
|
||||
|
||||
#define i960_enable_tracing() \
|
||||
{ register unsigned int _pc = 0x1; \
|
||||
asm volatile( "modpc 0,%0,%0" : "=d" (_pc) : "0" (_pc) ); \
|
||||
}
|
||||
#if defined(__RTEMS_I960CA__) || defined(__RTEMS_I960HA__)
|
||||
|
||||
#define i960_unmask_intr( xint ) \
|
||||
{ register unsigned int _mask= (1<<(xint)); \
|
||||
@@ -266,27 +386,6 @@ asm volatile( "loop_til_cleared: clrbit %0,sf0,sf0 ; \
|
||||
: "=d" (_xint) : "0" (_xint) ); \
|
||||
}
|
||||
|
||||
#define i960_reload_ctl_group( group ) \
|
||||
{ register int _cmd = ((group)|0x400) ; \
|
||||
asm volatile( "sysctl %0,%0,%0" : "=d" (_cmd) : "0" (_cmd) ); \
|
||||
}
|
||||
|
||||
#define i960_cause_intr( intr ) \
|
||||
{ register int _intr = (intr); \
|
||||
asm volatile( "sysctl %0,%0,%0" : "=d" (_intr) : "0" (_intr) ); \
|
||||
}
|
||||
|
||||
#define i960_soft_reset( prcb ) \
|
||||
{ register i960ca_PRCB *_prcb = (prcb); \
|
||||
register unsigned int *_next=0; \
|
||||
register unsigned int _cmd = 0x30000; \
|
||||
asm volatile( "lda next,%1; \
|
||||
sysctl %0,%1,%2; \
|
||||
next: mov g0,g0" \
|
||||
: "=d" (_cmd), "=d" (_next), "=d" (_prcb) \
|
||||
: "0" (_cmd), "1" (_next), "2" (_prcb) ); \
|
||||
}
|
||||
|
||||
static inline unsigned int i960_pend_intrs()
|
||||
{ register unsigned int _intr=0;
|
||||
asm volatile( "mov sf0,%0" : "=d" (_intr) : "0" (_intr) );
|
||||
@@ -299,12 +398,82 @@ static inline unsigned int i960_mask_intrs()
|
||||
return( _intr );
|
||||
}
|
||||
|
||||
#elif defined(__RTEMS_I960RP__)
|
||||
|
||||
#define i960_unmask_intr( xint ) \
|
||||
{ register unsigned int _mask= (1<<(xint)); \
|
||||
register unsigned int *_imsk = (int * ) IMSK_ADDR; \
|
||||
register unsigned int _val= *_imsk; \
|
||||
asm volatile( "or %0,%2,%0; \
|
||||
st %0,(%1)" \
|
||||
: "=d" (_val), "=d" (_imsk), "=d" (_mask) \
|
||||
: "0" (_val), "1" (_imsk), "2" (_mask) ); \
|
||||
}
|
||||
|
||||
#define i960_mask_intr( xint ) \
|
||||
{ register unsigned int _mask= (1<<(xint)); \
|
||||
register unsigned int *_imsk = (int * ) IMSK_ADDR; \
|
||||
register unsigned int _val = *_imsk; \
|
||||
asm volatile( "andnot %2,%0,%0; \
|
||||
st %0,(%1)" \
|
||||
: "=d" (_val), "=d" (_imsk), "=d" (_mask) \
|
||||
: "0" (_val), "1" (_imsk), "2" (_mask) ); \
|
||||
}
|
||||
#define i960_clear_intr( xint ) \
|
||||
{ register unsigned int _xint=xint; \
|
||||
register unsigned int _mask=(1<<(xint)); \
|
||||
register unsigned int *_ipnd = (int * ) IPND_ADDR; \
|
||||
register unsigned int _rslt = 0; \
|
||||
asm volatile( "loop_til_cleared: mov 0, %0; \
|
||||
atmod %1, %2, %0; \
|
||||
bbs %3,%0, loop_til_cleared" \
|
||||
: "=d" (_rslt), "=d" (_ipnd), "=d" (_mask), "=d" (_xint) \
|
||||
: "0" (_rslt), "1" (_ipnd), "2" (_mask), "3" (_xint) ); \
|
||||
}
|
||||
|
||||
static inline unsigned int i960_pend_intrs()
|
||||
{ register unsigned int _intr= *(unsigned int *) IPND_ADDR;
|
||||
/*register unsigned int *_ipnd = (int * ) IPND_ADDR; \
|
||||
asm volatile( "mov (%0),%1" \
|
||||
: "=d" (_ipnd), "=d" (_mask) \
|
||||
: "0" (_ipnd), "1" (_mask) ); \ */
|
||||
return ( _intr );
|
||||
}
|
||||
|
||||
static inline unsigned int i960_mask_intrs()
|
||||
{ register unsigned int _intr= *(unsigned int *) IMSK_ADDR;
|
||||
/*asm volatile( "mov sf1,%0" : "=d" (_intr) : "0" (_intr) );*/
|
||||
return( _intr );
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline unsigned int i960_get_fp()
|
||||
{ register unsigned int _fp=0;
|
||||
asm volatile( "mov fp,%0" : "=d" (_fp) : "0" (_fp) );
|
||||
return ( _fp );
|
||||
}
|
||||
|
||||
/*
|
||||
* Soft Reset
|
||||
*/
|
||||
|
||||
#if defined(I960_SOFT_RESET_COMMAND)
|
||||
|
||||
#define i960_soft_reset( prcb ) \
|
||||
{ register i960_PRCB *_prcb = (prcb); \
|
||||
register unsigned int *_next=0; \
|
||||
register unsigned int _cmd = I960_SOFT_RESET_COMMAND; \
|
||||
asm volatile( "lda next,%1; \
|
||||
sysctl %0,%1,%2; \
|
||||
next: mov g0,g0" \
|
||||
: "=d" (_cmd), "=d" (_next), "=d" (_prcb) \
|
||||
: "0" (_cmd), "1" (_next), "2" (_prcb) ); \
|
||||
}
|
||||
|
||||
#else
|
||||
#warning "I960_SOFT_RESET_COMMAND is not defined"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following routine swaps the endian format of an unsigned int.
|
||||
* It must be static because it is referenced indirectly.
|
||||
|
||||
@@ -27,7 +27,7 @@ C_PIECES = cpu
|
||||
C_FILES = $(C_PIECES:%=%.c)
|
||||
C_O_FILES = $(C_PIECES:%=${ARCH}/%.o)
|
||||
|
||||
H_PIECES = asm.h
|
||||
H_PIECES = asm.h i960RP.h
|
||||
H_FILES = $(H_PIECES:%=$(srcdir)/../%)
|
||||
|
||||
# Assembly source names, if any, go here -- minus the .S
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/directory.cfg
|
||||
|
||||
# wrapup is the one that actually builds and installs the library
|
||||
# from the individual .rel files built in other directories
|
||||
SUB_DIRS=include startup clock console shmsupp timer wrapup
|
||||
@@ -0,0 +1,6 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
Something should be here to describe the board this runs on,
|
||||
download procedure, using the BSP etc.
|
||||
@@ -0,0 +1,18 @@
|
||||
%rename cpp old_cpp
|
||||
%rename lib old_lib
|
||||
%rename endfile old_endfile
|
||||
%rename startfile old_startfile
|
||||
%rename link old_link
|
||||
|
||||
*cpp:
|
||||
%(old_cpp) %{qrtems: -D__embedded__} -Asystem(embedded)
|
||||
|
||||
*lib:
|
||||
%{!qrtems: %(old_lib)} %{qrtems: --start-group -lc -lrtemsall -lgcc --end-group}
|
||||
|
||||
*startfile:
|
||||
%{!qrtems: %(old_startfile)} %{qrtems: start.o%s}
|
||||
|
||||
*link:
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -T linkcmds%s -e _start}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
PGM=${ARCH}/clock.rel
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
C_PIECES=ckinit
|
||||
C_FILES=$(C_PIECES:%=%.c)
|
||||
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
|
||||
|
||||
H_FILES=
|
||||
|
||||
SRCS=$(C_FILES) $(H_FILES)
|
||||
OBJS=$(C_O_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
DEFINES +=
|
||||
CPPFLAGS +=
|
||||
CFLAGS +=
|
||||
|
||||
LD_PATHS +=
|
||||
LD_LIBS +=
|
||||
LDFLAGS +=
|
||||
|
||||
#
|
||||
# Add your list of files to delete here. The config files
|
||||
# already know how to delete some stuff, so you may want
|
||||
# to just run 'make clean' first to see what gets missed.
|
||||
# 'make clobber' already includes 'make clean'
|
||||
#
|
||||
|
||||
CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
${PGM}: ${SRCS} ${OBJS}
|
||||
$(make-rel)
|
||||
|
||||
all: ${ARCH} $(SRCS) $(PGM)
|
||||
|
||||
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
|
||||
install: all
|
||||
@@ -0,0 +1,187 @@
|
||||
/* Clock_init()
|
||||
*
|
||||
* This routine initializes the i960RP onboard timer
|
||||
* The tick frequency is 1 millisecond; assuming 33MHz core
|
||||
*
|
||||
* Input parameters: NONE
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1997.
|
||||
* RAMiX Inc 1999
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may in
|
||||
* the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <bsp.h>
|
||||
#include <i960RP.h>
|
||||
#include <rtems/libio.h>
|
||||
|
||||
#define CLOCK_VECTOR 0x92
|
||||
|
||||
rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
|
||||
rtems_unsigned32 Reload_Clock_isrs;
|
||||
|
||||
i960_isr_entry Old_ticker;
|
||||
rtems_unsigned32 Clock_driver_ticks;
|
||||
/* ticks since initialization */
|
||||
unsigned int clock_isr_global[16]; /* place to store global regs */
|
||||
|
||||
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;
|
||||
|
||||
/* this is later in the file to avoid it being inlined */
|
||||
rtems_isr Clock_isr( rtems_vector_number vector );
|
||||
|
||||
void Install_clock(
|
||||
rtems_isr_entry clock_isr
|
||||
)
|
||||
{
|
||||
volatile unsigned int *tmr0 = (unsigned int *) TMR0_ADDR;
|
||||
volatile unsigned int *trr0 = (unsigned int *) TRR0_ADDR;
|
||||
volatile unsigned int *tcr0 = (unsigned int *) TCR0_ADDR;
|
||||
volatile unsigned int *icon = (unsigned int *) ICON_ADDR;
|
||||
volatile unsigned int *imap2 = (unsigned int *) IMAP2_ADDR;
|
||||
volatile unsigned int *ipnd = (unsigned int *) IPND_ADDR;
|
||||
volatile unsigned int *imsk = (unsigned int *) IMSK_ADDR;
|
||||
void clockHandler();
|
||||
|
||||
|
||||
Clock_driver_ticks = 0;
|
||||
Reload_Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
|
||||
Clock_isrs = Reload_Clock_isrs;
|
||||
|
||||
/* Not for our case
|
||||
if ( BSP_Configuration.ticks_per_timeslice ) {
|
||||
*icon = 0x6000;
|
||||
|
||||
Old_ticker = set_vector( (((unsigned int) clock_isr) | 0x2), CLOCK_VECTOR, 1 );
|
||||
*/
|
||||
#define BUS_CLOCK_1 0
|
||||
#define TMR_WRITE_CNTL 8
|
||||
#define TMR_AUTO_RELOAD 4
|
||||
#define TMR_ENABLE 2
|
||||
#define TMR_TERM_CNT_STAT 1
|
||||
|
||||
Old_ticker = set_vector( (((unsigned int) clock_isr) | 0x2), CLOCK_VECTOR, 1 );
|
||||
/*
|
||||
*(unsigned int *)(CLOCK_VECTOR >>2) = (unsigned int )clockHandler;
|
||||
*/
|
||||
|
||||
/* initialize the i960RP timer 0 here */
|
||||
|
||||
/* set the timer countdown (Assume 33MHz operation) */
|
||||
*trr0 = 30 * BSP_Configuration.microseconds_per_tick ;
|
||||
*tcr0 = 30 * BSP_Configuration.microseconds_per_tick ;
|
||||
/*
|
||||
kkprintf("Load the timers with %x\n", 30 * BSP_Configuration.microseconds_per_tick / Reload_Clock_isrs);
|
||||
*/
|
||||
|
||||
*tmr0 = BUS_CLOCK_1 | TMR_AUTO_RELOAD | TMR_ENABLE;
|
||||
/* Unmask the interrupts */
|
||||
*ipnd &= ~(1 << 12);
|
||||
*imsk |= 1 << 12;
|
||||
|
||||
}
|
||||
|
||||
void Clock_exit()
|
||||
{
|
||||
volatile unsigned int *tmr0 = (unsigned int *) TMR0_ADDR;
|
||||
|
||||
if ( BSP_Configuration.ticks_per_timeslice ) {
|
||||
/* shut down the timer */
|
||||
*tmr0 = *tmr0 & ~TMR_ENABLE;
|
||||
|
||||
i960_mask_intr( 12 );
|
||||
/* do not restore old vector */
|
||||
}
|
||||
}
|
||||
|
||||
rtems_device_driver Clock_initialize(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
Install_clock( Clock_isr );
|
||||
|
||||
atexit( Clock_exit );
|
||||
|
||||
/*
|
||||
* 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_unsigned32 isrlevel;
|
||||
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(CLOCK_VECTOR);
|
||||
}
|
||||
else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
|
||||
{
|
||||
rtems_interrupt_disable( isrlevel );
|
||||
(void) set_tmr_vector( args->buffer, CLOCK_VECTOR, 0 );
|
||||
rtems_interrupt_enable( isrlevel );
|
||||
}
|
||||
|
||||
done:
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_isr Clock_isr(
|
||||
rtems_vector_number vector
|
||||
)
|
||||
{
|
||||
/* enable_tracing(); */
|
||||
#ifdef NOTMB
|
||||
if ( Clock_isrs == 1 ) {
|
||||
rtems_clock_tick();
|
||||
Clock_isrs = Reload_Clock_isrs;
|
||||
}
|
||||
else
|
||||
{
|
||||
Clock_isrs -= 1;
|
||||
}
|
||||
#else
|
||||
*(int *)(0xfed00000) += 1;
|
||||
rtems_clock_tick();
|
||||
#endif
|
||||
|
||||
i960_clear_intr( 12 );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
PGM=${ARCH}/console.rel
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
C_PIECES=console pcimsgreg
|
||||
C_FILES=$(C_PIECES:%=%.c)
|
||||
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
|
||||
|
||||
H_FILES=$(srcdir)/concntl.h
|
||||
|
||||
# Assembly source names, if any, go here -- minus the .s
|
||||
S_PIECES=
|
||||
S_FILES=$(S_PIECES:%=%.s)
|
||||
S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o)
|
||||
|
||||
SRCS=$(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES)
|
||||
OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
DEFINES +=
|
||||
CPPFLAGS +=
|
||||
CFLAGS +=
|
||||
|
||||
LD_PATHS +=
|
||||
LD_LIBS +=
|
||||
LDFLAGS +=
|
||||
|
||||
#
|
||||
# Add your list of files to delete here. The config files
|
||||
# already know how to delete some stuff, so you may want
|
||||
# to just run 'make clean' first to see what gets missed.
|
||||
# 'make clobber' already includes 'make clean'
|
||||
#
|
||||
|
||||
CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
${PGM}: ${SRCS} ${OBJS}
|
||||
$(make-rel)
|
||||
|
||||
all: ${ARCH} $(SRCS) $(PGM)
|
||||
$(INSTALL) -m 444 $(H_FILES) ${PROJECT_RELEASE}/include
|
||||
|
||||
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CON_KBHIT,
|
||||
CON_GET_RAW_BYTE,
|
||||
CON_SEND_RAW_BYTE
|
||||
} console_ioctl_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
console_ioctl_t ioctl_type;
|
||||
unsigned32 param;
|
||||
} console_ioctl_request_t;
|
||||
@@ -0,0 +1,264 @@
|
||||
/*
|
||||
* This file contains the template for a console IO package.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1997.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may in
|
||||
* the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define NO_BSP_INIT
|
||||
|
||||
|
||||
/* only one of the following can be defined */
|
||||
#define SERIAL_INPUT /* use serial input */
|
||||
|
||||
#include <bsp.h>
|
||||
#include <rtems/libio.h>
|
||||
#include "concntl.h"
|
||||
#include "pcimsgreg.h"
|
||||
|
||||
#ifndef lint
|
||||
static char _sccsid[] = "@(#)console.c 09/12/96 1.13\n";
|
||||
#endif
|
||||
|
||||
/* console_initialize
|
||||
*
|
||||
* This routine initializes the console IO driver.
|
||||
*
|
||||
* Input parameters: NONE
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* Return values:
|
||||
*/
|
||||
|
||||
rtems_device_driver console_initialize(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *arg
|
||||
)
|
||||
{
|
||||
rtems_status_code status;
|
||||
|
||||
if ( console_pmr_init(*(unsigned32*)arg) )
|
||||
return RTEMS_INVALID_NUMBER;
|
||||
|
||||
|
||||
status = rtems_io_register_name(
|
||||
"/dev/console",
|
||||
major,
|
||||
(rtems_device_minor_number) 0
|
||||
);
|
||||
|
||||
if (status != RTEMS_SUCCESSFUL)
|
||||
rtems_fatal_error_occurred(status);
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
|
||||
/* is_character_ready
|
||||
*
|
||||
* This routine returns TRUE if a character is available.
|
||||
*
|
||||
* Input parameters: NONE
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* Return values:
|
||||
*/
|
||||
|
||||
rtems_boolean is_character_ready(
|
||||
char *ch
|
||||
)
|
||||
{
|
||||
*ch = '\0'; /* return NULL for no particular reason */
|
||||
return(console_pmr_kbhit());
|
||||
}
|
||||
|
||||
/* inbyte
|
||||
*
|
||||
* This routine reads a character from the SOURCE.
|
||||
*
|
||||
* Input parameters: NONE
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* Return values:
|
||||
* character read from SOURCE
|
||||
*/
|
||||
|
||||
char inbyte( unsigned int minor )
|
||||
{
|
||||
/*
|
||||
* If polling, wait until a character is available.
|
||||
*/
|
||||
return console_pmr_getc();
|
||||
}
|
||||
|
||||
/* outbyte
|
||||
*
|
||||
* This routine transmits a character out the SOURCE. It may support
|
||||
* XON/XOFF flow control.
|
||||
*
|
||||
* Input parameters:
|
||||
* ch - character to be transmitted
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*/
|
||||
|
||||
void outbyte( unsigned int minor,
|
||||
char ch
|
||||
)
|
||||
{
|
||||
console_pmr_putc( ch );
|
||||
|
||||
/*
|
||||
* Carriage Return/New line translation.
|
||||
*/
|
||||
|
||||
if ( ch == '\n' )
|
||||
outbyte( minor, '\r' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Open entry point
|
||||
*/
|
||||
|
||||
rtems_device_driver console_open(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Close entry point
|
||||
*/
|
||||
|
||||
rtems_device_driver console_close(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
/*
|
||||
* read bytes from the serial port. We only have stdin.
|
||||
*/
|
||||
|
||||
rtems_device_driver console_read(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
rtems_libio_rw_args_t *rw_args;
|
||||
unsigned8 *buffer;
|
||||
unsigned32 maximum;
|
||||
unsigned32 count = 0;
|
||||
|
||||
rw_args = (rtems_libio_rw_args_t *) arg;
|
||||
|
||||
buffer = rw_args->buffer;
|
||||
maximum = rw_args->count;
|
||||
|
||||
for (count = 0; count < maximum; count++) {
|
||||
buffer[ count ] = inbyte(minor);
|
||||
if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
|
||||
buffer[ count++ ] = '\n';
|
||||
buffer[ count ] = 0;
|
||||
outbyte( minor, '\n' ); /* newline */
|
||||
break;
|
||||
}
|
||||
else if (buffer[ count ] == '\b' && count > 0 )
|
||||
{
|
||||
outbyte( minor, '\b' ); /* move back one space */
|
||||
outbyte( minor, ' ' ); /* erase the character */
|
||||
outbyte( minor, '\b' ); /* move back one space */
|
||||
count-=2;
|
||||
}
|
||||
else
|
||||
outbyte( minor, buffer[ count ] ); /* echo the character */
|
||||
}
|
||||
|
||||
rw_args->bytes_moved = count;
|
||||
return (count > 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
|
||||
}
|
||||
|
||||
/*
|
||||
* write bytes to the serial port. Stdout and stderr are the same.
|
||||
*/
|
||||
|
||||
rtems_device_driver console_write(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
int count;
|
||||
int maximum;
|
||||
rtems_libio_rw_args_t *rw_args;
|
||||
unsigned8 *buffer;
|
||||
|
||||
rw_args = (rtems_libio_rw_args_t *) arg;
|
||||
|
||||
buffer = rw_args->buffer;
|
||||
maximum = rw_args->count;
|
||||
|
||||
for (count = 0; count < maximum; count++) {
|
||||
if ( buffer[ count ] == '\n') {
|
||||
outbyte(minor,'\r');
|
||||
}
|
||||
outbyte( minor,buffer[ count ] );
|
||||
}
|
||||
|
||||
rw_args->bytes_moved = maximum;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* IO Control entry point
|
||||
*/
|
||||
|
||||
rtems_device_driver console_control(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
if (!arg)
|
||||
return RTEMS_INVALID_ADDRESS;
|
||||
|
||||
switch( ((console_ioctl_request_t *)arg)->ioctl_type )
|
||||
{
|
||||
case CON_KBHIT:
|
||||
/* check if keyboard was hit */
|
||||
((console_ioctl_request_t *)arg)->param = console_pmr_kbhit();
|
||||
break;
|
||||
|
||||
case CON_GET_RAW_BYTE:
|
||||
((console_ioctl_request_t *)arg)->param = inbyte(minor);
|
||||
break;
|
||||
|
||||
case CON_SEND_RAW_BYTE:
|
||||
outbyte(minor, ((console_ioctl_request_t *)arg)->param);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
@@ -0,0 +1,363 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "serial.h"
|
||||
#include "rtems.h"
|
||||
|
||||
|
||||
typedef unsigned char uchar ; /* Abbreviations */
|
||||
typedef unsigned short ushort ;
|
||||
typedef unsigned long ulong ;
|
||||
int DBGConsole_make_sync = 0;
|
||||
#define CONSOLE_CHANNELS 1
|
||||
|
||||
#define MAX_CONSOLE 4
|
||||
static int consoles[MAX_CONSOLE];
|
||||
static int active_consoles = 0;
|
||||
static struct{
|
||||
rtems_id sem;
|
||||
int rx;
|
||||
int cnt;
|
||||
char in_line[128];
|
||||
}cons_input[MAX_CONSOLE];
|
||||
|
||||
|
||||
|
||||
/* This uses the message out and in buffers as serial emulator.
|
||||
Pretty stupid eh?
|
||||
*/
|
||||
|
||||
#define uart1 ((volatile unsigned char *)0x1318)
|
||||
#define uart1_rx ((volatile unsigned int *)0x1310)
|
||||
|
||||
#define NUM_UARTS 1
|
||||
static volatile unsigned int * uart = { uart1 };
|
||||
static volatile unsigned int * uart_rx = { uart1_rx };
|
||||
|
||||
|
||||
extern void display_msg(void);
|
||||
/*extern int sprintf();*/
|
||||
|
||||
|
||||
|
||||
int
|
||||
console_uartinit(unsigned int BAUDRate)
|
||||
{
|
||||
#ifdef CONSOLE_CHANNELS
|
||||
void cons_isr();
|
||||
rpmu_attach_inmsg0(cons_isr);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/* Introduce a new console channel */
|
||||
console_new(char * name)
|
||||
{
|
||||
#ifdef CONSOLE_CHANNELS
|
||||
unsigned int x, stat;
|
||||
x = 0xfe000000 | (name[0] << 16) | (name[1] << 8) | name[2];
|
||||
do {
|
||||
stat = *uart;
|
||||
} while (DBGConsole_make_sync && (stat != 0));
|
||||
*uart = x;
|
||||
x = ( name[3] << 24) | ( name[4] << 16) | ( name[5] << 8) | name[6] ;
|
||||
do {
|
||||
stat = *uart;
|
||||
} while (DBGConsole_make_sync && (stat != 0));
|
||||
*uart = x;
|
||||
active_consoles += 1;
|
||||
rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &consoles[active_consoles] );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*** Transmit character to host.
|
||||
*** put the console ID in upper byte
|
||||
***
|
||||
***********************************************************************/
|
||||
|
||||
int console_sps_putc(int cc)
|
||||
{
|
||||
register unsigned char stat;
|
||||
int rtid, i;
|
||||
unsigned int ch;
|
||||
unsigned int level;
|
||||
#ifdef CONSOLE_CHANNELS
|
||||
rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &rtid );
|
||||
ch = cc & 0xff;
|
||||
for(i=1; i <= active_consoles; i++){
|
||||
if( rtid == consoles[i]){
|
||||
ch |= (i ) << 24 ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
ch = cc;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Pause until there is room in the UART transmit
|
||||
* buffer.
|
||||
*/
|
||||
|
||||
if (ch == -1)
|
||||
return ch;
|
||||
|
||||
wait:
|
||||
do {
|
||||
stat = *uart;
|
||||
} while (DBGConsole_make_sync && (stat != 0));
|
||||
rtems_interrupt_disable(level);
|
||||
if( (*uart != 0) && DBGConsole_make_sync){
|
||||
rtems_interrupt_enable(level);
|
||||
goto wait;
|
||||
}
|
||||
|
||||
/*
|
||||
* Transmit data. (Junk)
|
||||
*/
|
||||
|
||||
*uart = ch;
|
||||
rtems_interrupt_enable(level);
|
||||
return cc;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* putnum -- print a 32 bit number in hex
|
||||
*/
|
||||
int
|
||||
putnum (num)
|
||||
unsigned int num;
|
||||
{
|
||||
char buffer[9];
|
||||
int count;
|
||||
int digit;
|
||||
|
||||
for (count = 7 ; count >= 0 ; count--) {
|
||||
digit = (num >> (count * 4)) & 0xf;
|
||||
|
||||
if (digit <= 9)
|
||||
console_sps_putc( (char) ('0' + digit));
|
||||
else
|
||||
console_sps_putc( (char) ('A' - 10 + digit));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* putmem -- print the specified memory block
|
||||
*/
|
||||
void
|
||||
putmem (addr, num)
|
||||
char *addr;
|
||||
unsigned int num;
|
||||
{
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int val = 0;
|
||||
int digit = 0;
|
||||
|
||||
console_sps_putc(13);
|
||||
console_sps_putc(10);
|
||||
putnum((unsigned int) addr);
|
||||
console_sps_putc(':');
|
||||
console_sps_putc(' ');
|
||||
while(num)
|
||||
{
|
||||
val = *addr;
|
||||
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
digit = (val & 0xf0) >> 4;
|
||||
val <<= 4;
|
||||
|
||||
if (digit < 10)
|
||||
{
|
||||
console_sps_putc(digit + '0');
|
||||
}
|
||||
else
|
||||
{
|
||||
console_sps_putc(digit - 10 + 'A');
|
||||
}
|
||||
}
|
||||
console_sps_putc(' ');
|
||||
|
||||
num--;
|
||||
addr++;
|
||||
if (++i == 16)
|
||||
{
|
||||
console_sps_putc(13);
|
||||
console_sps_putc(10);
|
||||
putnum((unsigned int) addr);
|
||||
console_sps_putc(':');
|
||||
console_sps_putc(' ');
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
console_sps_putc(13);
|
||||
console_sps_putc(10);
|
||||
}
|
||||
|
||||
/*
|
||||
* putcmem -- print the specified pci config memory block
|
||||
*/
|
||||
void
|
||||
putcmem (addr, num)
|
||||
unsigned char *addr;
|
||||
unsigned int num;
|
||||
{
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
unsigned short val = 0;
|
||||
int digit = 0;
|
||||
unsigned int *satucmd = (unsigned int *) 0x1298;
|
||||
unsigned int *soccar = (unsigned int *) 0x12a8;
|
||||
unsigned int *soccdp = (unsigned int *) 0x12b0;
|
||||
|
||||
*satucmd = 4;
|
||||
|
||||
console_sps_putc(13);
|
||||
console_sps_putc(10);
|
||||
putnum((unsigned int) addr);
|
||||
console_sps_putc(':');
|
||||
console_sps_putc(' ');
|
||||
while(num)
|
||||
{
|
||||
*soccar = (unsigned int) addr;
|
||||
val = *soccdp;
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
digit = (val & 0xf000) >> 12;
|
||||
val <<= 4;
|
||||
|
||||
if (digit < 10)
|
||||
{
|
||||
console_sps_putc(digit + '0');
|
||||
}
|
||||
else
|
||||
{
|
||||
console_sps_putc(digit - 10 + 'A');
|
||||
}
|
||||
}
|
||||
console_sps_putc(' ');
|
||||
|
||||
num -= 2;
|
||||
addr += 2;
|
||||
if (++i == 8)
|
||||
{
|
||||
console_sps_putc(13);
|
||||
console_sps_putc(10);
|
||||
putnum((unsigned int) addr);
|
||||
console_sps_putc(':');
|
||||
console_sps_putc(' ');
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
console_sps_putc(13);
|
||||
console_sps_putc(10);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*** Read character from host.
|
||||
***********************************************************************/
|
||||
#ifdef CONSOLE_CHANNELS
|
||||
int console_sps_getc()
|
||||
{
|
||||
|
||||
int consinx;
|
||||
int rtid, i;
|
||||
unsigned int level, level2;
|
||||
char ch;
|
||||
consinx = 0;
|
||||
rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &rtid );
|
||||
for(i=1; i <= active_consoles; i++){
|
||||
if( rtid == consoles[i]){
|
||||
consinx = i ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( i > active_consoles)
|
||||
consinx = 0;
|
||||
if( cons_input[consinx].sem == 0){
|
||||
rtems_name sname;
|
||||
sname = rtems_build_name('S','U','X',(char)(consinx + '0'));
|
||||
rtems_semaphore_create(sname, 0, RTEMS_DEFAULT_ATTRIBUTES, 0, &cons_input[consinx].sem);
|
||||
cons_input[consinx].rx = 0;
|
||||
}
|
||||
while( cons_input[consinx].cnt == cons_input[consinx].rx){
|
||||
rtems_semaphore_obtain(cons_input[consinx].sem, RTEMS_WAIT, 0);
|
||||
/* rtems_task_wake_after( RTEMS_YIELD_PROCESSOR);*/
|
||||
}
|
||||
rtems_interrupt_disable(level);
|
||||
i = cons_input[consinx].rx;
|
||||
ch = cons_input[consinx].in_line[i];
|
||||
i++;
|
||||
if( i >= sizeof( cons_input[consinx].in_line))
|
||||
i = 0;
|
||||
cons_input[consinx].rx = i;
|
||||
rtems_interrupt_enable(level);
|
||||
return ch;
|
||||
}
|
||||
|
||||
|
||||
void cons_isr()
|
||||
{
|
||||
unsigned int i, chin, consinx, st;
|
||||
chin = *uart_rx;
|
||||
consinx = chin >> 24;
|
||||
if( consinx > active_consoles)
|
||||
goto release;
|
||||
i = cons_input[consinx].cnt;
|
||||
cons_input[consinx].in_line[i] = chin & 0xff;
|
||||
i++;
|
||||
if( i >= sizeof( cons_input[consinx].in_line))
|
||||
i = 0;
|
||||
cons_input[consinx].cnt = i;
|
||||
st = rtems_semaphore_release( cons_input[consinx].sem);
|
||||
release:
|
||||
*uart_rx = 0;
|
||||
}
|
||||
|
||||
#else
|
||||
volatile int console_foo = 0;
|
||||
int console_sps_getc()
|
||||
{
|
||||
volatile unsigned int stat;
|
||||
register int ch;
|
||||
|
||||
stat = *uart_rx;
|
||||
while (stat == 0)
|
||||
{
|
||||
rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
|
||||
stat = *uart_rx;
|
||||
console_foo++;
|
||||
}
|
||||
*uart_rx = 0;
|
||||
|
||||
ch = stat;
|
||||
|
||||
return ch;
|
||||
}
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
*** check character from host.
|
||||
***********************************************************************/
|
||||
|
||||
int console_sps_kbhit()
|
||||
{
|
||||
register unsigned short stat;
|
||||
|
||||
stat = *uart;
|
||||
return ( stat != 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
int console_uartinit(unsigned int BAUDRate);
|
||||
int console_sps_putc(int ch);
|
||||
int console_sps_getc();
|
||||
int console_sps_kbhit();
|
||||
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
H_FILES = $(srcdir)/bsp.h $(srcdir)/coverhd.h
|
||||
|
||||
#
|
||||
# Equate files are for including from assembly preprocessed by
|
||||
# gm4 or gasp. No examples are provided except for those for
|
||||
# other CPUs. The best way to generate them would be to
|
||||
# provide a program which generates the constants used based
|
||||
# on the C equivalents.
|
||||
#
|
||||
# If you add equate files, don't forget to uncomment the install line
|
||||
# below.
|
||||
#
|
||||
|
||||
EQ_FILES =
|
||||
|
||||
SRCS=$(H_FILES) $(EQ_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
all: $(SRCS)
|
||||
$(INSTALL) -m 444 $(H_FILES) $(PROJECT_INCLUDE)
|
||||
$(INSTALL) -m 444 $(EQ_FILES) $(PROJECT_INCLUDE)/cpu
|
||||
|
||||
install: all
|
||||
@@ -0,0 +1,166 @@
|
||||
/* bsp.h
|
||||
*
|
||||
* This include file contains some definitions specific to the
|
||||
* Ramix PMC901 board
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1997.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may in
|
||||
* the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __PMC901_h
|
||||
#define __PMC901_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems.h>
|
||||
#include <iosupp.h>
|
||||
#include <console.h>
|
||||
#include <clockdrv.h>
|
||||
|
||||
/*
|
||||
* Define the time limits for RTEMS Test Suite test durations.
|
||||
* Long test and short test duration limits are provided. These
|
||||
* values are in seconds and need to be converted to ticks for the
|
||||
* application.
|
||||
*
|
||||
*/
|
||||
|
||||
#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
|
||||
#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
|
||||
|
||||
/*
|
||||
* Define the interrupt mechanism for Time Test 27
|
||||
*
|
||||
* NOTE: Following are for i960CA and are board independent
|
||||
*
|
||||
*/
|
||||
|
||||
#define MUST_WAIT_FOR_INTERRUPT 0
|
||||
|
||||
#define Install_tm27_vector( handler ) set_vector( (handler), 6, 1 )
|
||||
|
||||
#define Cause_tm27_intr() i960_cause_intr( 0x62 )
|
||||
|
||||
#define Clear_tm27_intr() i960_clear_intr( 6 )
|
||||
|
||||
#define Lower_tm27_intr()
|
||||
|
||||
/*
|
||||
* Simple spin delay in microsecond units for device drivers.
|
||||
* This is very dependent on the clock speed of the target.
|
||||
*/
|
||||
|
||||
#define delay( microseconds ) \
|
||||
{ register rtems_unsigned32 _delay=(microseconds); \
|
||||
register rtems_unsigned32 _tmp = 0; /* initialized to avoid warning */ \
|
||||
asm volatile( "0: \
|
||||
remo 3,31,%0 ; \
|
||||
cmpo 0,%0 ; \
|
||||
subo 1,%1,%1 ; \
|
||||
cmpobne.t 0,%1,0b " \
|
||||
: "=d" (_tmp), "=d" (_delay) \
|
||||
: "0" (_tmp), "1" (_delay) ); \
|
||||
}
|
||||
|
||||
/* Constants */
|
||||
|
||||
#define RAM_START 0xfed00000
|
||||
#define RAM_END 0xfef00000 /* this should actually be 16MB, most likely */
|
||||
|
||||
/* NINDY console I/O requests:
|
||||
* CO sends a single character to stdout,
|
||||
* CI reads one.
|
||||
*/
|
||||
|
||||
#define NINDY_INPUT 0
|
||||
#define NINDY_OUTPUT 1
|
||||
|
||||
/*
|
||||
* get_prcb
|
||||
*
|
||||
* Returns the PRCB pointer.
|
||||
*/
|
||||
|
||||
static inline PRCB *get_prcb( void )
|
||||
{
|
||||
register PRCB *_prcb = 0;
|
||||
|
||||
asm volatile( "calls 5; \
|
||||
mov g0,%0" \
|
||||
: "=d" (_prcb) \
|
||||
: "0" (_prcb) );
|
||||
return ( _prcb );
|
||||
}
|
||||
|
||||
/*
|
||||
#ifdef C961_INIT
|
||||
#undef BSP_EXTERN
|
||||
#define BSP_EXTERN
|
||||
#else
|
||||
#undef BSP_EXTERN
|
||||
#define BSP_EXTERN extern
|
||||
#endif
|
||||
*/
|
||||
|
||||
#undef BSP_EXTERN
|
||||
#define BSP_EXTERN
|
||||
|
||||
/* miscellaneous stuff assumed to exist */
|
||||
|
||||
extern rtems_configuration_table BSP_Configuration;
|
||||
|
||||
BSP_EXTERN PRCB *Prcb;
|
||||
BSP_EXTERN CNTL_TBL *Ctl_tbl;
|
||||
|
||||
/*
|
||||
#if defined(i960ca)
|
||||
BSP_EXTERN i960ca_control_table *Ctl_tbl;
|
||||
#elif defined(i960rp)
|
||||
BSP_EXTERN i960rp_control_table *Ctl_tbl;
|
||||
#else
|
||||
#error "invalid processor selection!"
|
||||
#endif
|
||||
*/
|
||||
|
||||
/*
|
||||
* Device Driver Table Entries
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE: Use the standard Console driver entry
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE: Use the standard Clock driver entry
|
||||
*/
|
||||
|
||||
/*
|
||||
* How many libio files we want
|
||||
*/
|
||||
|
||||
#define BSP_LIBIO_MAX_FDS 20
|
||||
|
||||
/* functions */
|
||||
|
||||
void bsp_cleanup( void );
|
||||
|
||||
i960_isr_entry set_vector( rtems_isr_entry, unsigned int, unsigned int );
|
||||
i960_isr_entry set_tmr_vector( rtems_isr_entry, unsigned int, unsigned int );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
#error "Did not get any definitions from here!"
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -0,0 +1,104 @@
|
||||
/* coverhd.h
|
||||
*
|
||||
* This include file has defines to represent the overhead associated
|
||||
* with calling a particular directive from C on this target.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1997.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may in
|
||||
* the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __COVERHD_h
|
||||
#define __COVERHD_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 0
|
||||
#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 0
|
||||
#define CALLING_OVERHEAD_TASK_CREATE 0
|
||||
#define CALLING_OVERHEAD_TASK_IDENT 0
|
||||
#define CALLING_OVERHEAD_TASK_START 0
|
||||
#define CALLING_OVERHEAD_TASK_RESTART 0
|
||||
#define CALLING_OVERHEAD_TASK_DELETE 0
|
||||
#define CALLING_OVERHEAD_TASK_SUSPEND 0
|
||||
#define CALLING_OVERHEAD_TASK_RESUME 0
|
||||
#define CALLING_OVERHEAD_TASK_SET_PRIORITY 0
|
||||
#define CALLING_OVERHEAD_TASK_MODE 0
|
||||
#define CALLING_OVERHEAD_TASK_GET_NOTE 0
|
||||
#define CALLING_OVERHEAD_TASK_SET_NOTE 0
|
||||
#define CALLING_OVERHEAD_TASK_WAKE_WHEN 3
|
||||
#define CALLING_OVERHEAD_TASK_WAKE_AFTER 0
|
||||
#define CALLING_OVERHEAD_INTERRUPT_CATCH 0
|
||||
#define CALLING_OVERHEAD_CLOCK_GET 3
|
||||
#define CALLING_OVERHEAD_CLOCK_SET 3
|
||||
#define CALLING_OVERHEAD_CLOCK_TICK 0
|
||||
|
||||
#define CALLING_OVERHEAD_TIMER_CREATE 0
|
||||
#define CALLING_OVERHEAD_TIMER_IDENT 0
|
||||
#define CALLING_OVERHEAD_TIMER_DELETE 0
|
||||
#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 0
|
||||
#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 6
|
||||
#define CALLING_OVERHEAD_TIMER_RESET 0
|
||||
#define CALLING_OVERHEAD_TIMER_CANCEL 0
|
||||
#define CALLING_OVERHEAD_SEMAPHORE_CREATE 0
|
||||
#define CALLING_OVERHEAD_SEMAPHORE_IDENT 0
|
||||
#define CALLING_OVERHEAD_SEMAPHORE_DELETE 0
|
||||
#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 0
|
||||
#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 0
|
||||
|
||||
#define CALLING_OVERHEAD_EVENT_SEND 0
|
||||
#define CALLING_OVERHEAD_EVENT_RECEIVE 0
|
||||
#define CALLING_OVERHEAD_SIGNAL_CATCH 0
|
||||
#define CALLING_OVERHEAD_SIGNAL_SEND 0
|
||||
#define CALLING_OVERHEAD_PARTITION_CREATE 0
|
||||
#define CALLING_OVERHEAD_PARTITION_IDENT 0
|
||||
#define CALLING_OVERHEAD_PARTITION_DELETE 0
|
||||
#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 0
|
||||
#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 0
|
||||
#define CALLING_OVERHEAD_REGION_CREATE 0
|
||||
#define CALLING_OVERHEAD_REGION_IDENT 0
|
||||
#define CALLING_OVERHEAD_REGION_DELETE 0
|
||||
#define CALLING_OVERHEAD_REGION_GET_SEGMENT 0
|
||||
#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 0
|
||||
#define CALLING_OVERHEAD_PORT_CREATE 0
|
||||
#define CALLING_OVERHEAD_PORT_IDENT 0
|
||||
#define CALLING_OVERHEAD_PORT_DELETE 0
|
||||
#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 0
|
||||
#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 0
|
||||
|
||||
#define CALLING_OVERHEAD_IO_INITIALIZE 0
|
||||
#define CALLING_OVERHEAD_IO_OPEN 0
|
||||
#define CALLING_OVERHEAD_IO_CLOSE 0
|
||||
#define CALLING_OVERHEAD_IO_READ 0
|
||||
#define CALLING_OVERHEAD_IO_WRITE 0
|
||||
#define CALLING_OVERHEAD_IO_CONTROL 0
|
||||
#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 0
|
||||
#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 0
|
||||
#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 0
|
||||
#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 0
|
||||
#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 0
|
||||
#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 0
|
||||
#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -0,0 +1,27 @@
|
||||
/* PMC901 specific configuration values */
|
||||
#ifndef __PMC901_CONFIG__
|
||||
#define __PMC901_CONFIG__
|
||||
/* The following define the PMC960 bus regions */
|
||||
/* Bus configuration */
|
||||
#define RP_CONFIG_REGS BUS_WIDTH(32)
|
||||
#define FLASH BUS_WIDTH(8)
|
||||
#define DRAM BUS_WIDTH(32)
|
||||
#define UART_LED BUS_WIDTH(8)
|
||||
#define DEFAULT BUS_WIDTH(32)
|
||||
|
||||
/* Region Configuration */
|
||||
#define REGION_0_CONFIG RP_CONFIG_REGS
|
||||
#define REGION_2_CONFIG DEFAULT
|
||||
#define REGION_4_CONFIG DEFAULT
|
||||
#define REGION_6_CONFIG DEFAULT
|
||||
#define REGION_8_CONFIG DEFAULT
|
||||
#define REGION_A_CONFIG DRAM
|
||||
#define REGION_C_CONFIG UART_LED
|
||||
#define REGION_E_CONFIG DEFAULT
|
||||
/* #define REGION_BOOT_CONFIG (FLASH | BYTE_ORDER)*/
|
||||
#define REGION_BOOT_CONFIG (DRAM)
|
||||
|
||||
/* #define DRAM_BASE 0xfed00000 */
|
||||
#define DRAM_BASE 0xa0000000
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,55 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
PGM=${ARCH}/shmsupp.rel
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
C_PIECES=addrconv getcfg lock mpisr
|
||||
C_FILES=$(C_PIECES:%=%.c)
|
||||
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
|
||||
|
||||
H_FILES=
|
||||
|
||||
SRCS=$(C_FILES) $(H_FILES)
|
||||
OBJS=$(C_O_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
DEFINES +=
|
||||
CPPFLAGS +=
|
||||
CFLAGS +=
|
||||
|
||||
LD_PATHS +=
|
||||
LD_LIBS +=
|
||||
LDFLAGS +=
|
||||
|
||||
#
|
||||
# Add your list of files to delete here. The config files
|
||||
# already know how to delete some stuff, so you may want
|
||||
# to just run 'make clean' first to see what gets missed.
|
||||
# 'make clobber' already includes 'make clean'
|
||||
#
|
||||
|
||||
CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
${PGM}: ${SRCS} ${OBJS}
|
||||
$(make-rel)
|
||||
|
||||
all: ${ARCH} $(SRCS) $(PGM)
|
||||
|
||||
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
|
||||
install: all
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/* Shm_Convert_address
|
||||
*
|
||||
* This routine takes into account the peculiar short VME address
|
||||
* of the CVME961 board. The CVME961 maps short address space
|
||||
* 0xffffxxxx to 0xb400xxxx.
|
||||
*
|
||||
* Input parameters:
|
||||
* address - address to convert
|
||||
*
|
||||
* Output parameters:
|
||||
* returns - converted address
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1997.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may in
|
||||
* the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <bsp.h>
|
||||
#include "shm.h"
|
||||
|
||||
void *Shm_Convert_address(
|
||||
void *address
|
||||
)
|
||||
{
|
||||
rtems_unsigned32 workaddr = (rtems_unsigned32) address;
|
||||
|
||||
if ( workaddr >= 0xffff0000 )
|
||||
workaddr = (workaddr & 0xffff) | 0xb4000000;
|
||||
return ( (rtems_unsigned32 *)workaddr );
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/* void Shm_Get_configuration( localnode, &shmcfg )
|
||||
*
|
||||
* This routine initializes, if necessary, and returns a pointer
|
||||
* to the Shared Memory Configuration Table for the Cyclone CVME961.
|
||||
*
|
||||
* INPUT PARAMETERS:
|
||||
* localnode - local node number
|
||||
* shmcfg - address of pointer to SHM Config Table
|
||||
*
|
||||
* OUTPUT PARAMETERS:
|
||||
* *shmcfg - pointer to SHM Config Table
|
||||
*
|
||||
* NOTES: CVME961 target system has onboard dual-ported memory. This
|
||||
* file uses the USE_ONBOARD_RAM macro to determine if this
|
||||
* RAM is to be used as the SHM. If so (i.e. USE_ONBOARD_RAM
|
||||
* is set to 1), it is assumed that the master node's dual
|
||||
* ported memory will be used and that it is configured
|
||||
* correctly. The node owning the memory CANNOT access it
|
||||
* using a local address. The "if" insures that the MASTER
|
||||
* node uses a local address to access the dual-ported memory.
|
||||
*
|
||||
* The interprocessor interrupt used on the CVME961 is generated
|
||||
* by the VIC068. The ICMS capablities of the VIC068 are used
|
||||
* to generate interprocessor interrupts for up to eight nodes.
|
||||
*
|
||||
* The following table illustrates the configuration limitations:
|
||||
*
|
||||
* BUS MAX
|
||||
* MODE ENDIAN NODES
|
||||
* ========= ====== =======
|
||||
* POLLED LITTLE 2+
|
||||
* INTERRUPT LITTLE 2-8
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1997.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may in
|
||||
* the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include "shm.h"
|
||||
|
||||
#define USE_ONBOARD_RAM 0 /* use onboard (1) or VME RAM */
|
||||
/* for SHM communications */
|
||||
|
||||
#define INTERRUPT 1 /* CVME961 target supports both */
|
||||
#define POLLING 0 /* polling and interrupt modes */
|
||||
|
||||
|
||||
shm_config_table BSP_shm_cfgtbl;
|
||||
|
||||
void Shm_Get_configuration(
|
||||
rtems_unsigned32 localnode,
|
||||
shm_config_table **shmcfg
|
||||
)
|
||||
{
|
||||
#if ( USE_ONBOARD_RAM == 1 )
|
||||
if ( Shm_RTEMS_MP_Configuration->node == MASTER )
|
||||
BSP_shm_cfgtbl.base = (rtems_unsigned32 *)0x00300000;
|
||||
else
|
||||
BSP_shm_cfgtbl.base = (rtems_unsigned32 *)0x10300000;
|
||||
#else
|
||||
BSP_shm_cfgtbl.base = (rtems_unsigned32 *)0x20000000;
|
||||
#endif
|
||||
|
||||
BSP_shm_cfgtbl.length = 1 * MEGABYTE;
|
||||
BSP_shm_cfgtbl.format = SHM_LITTLE;
|
||||
|
||||
BSP_shm_cfgtbl.cause_intr = Shm_Cause_interrupt;
|
||||
|
||||
#ifdef NEUTRAL_BIG
|
||||
BSP_shm_cfgtbl.convert = (void *)CPU_swap_u32;
|
||||
#else
|
||||
BSP_shm_cfgtbl.convert = NULL_CONVERT;
|
||||
#endif
|
||||
|
||||
#if (POLLING==1)
|
||||
BSP_shm_cfgtbl.poll_intr = POLLED_MODE;
|
||||
BSP_shm_cfgtbl.Intr.address = NO_INTERRUPT;
|
||||
BSP_shm_cfgtbl.Intr.value = NO_INTERRUPT;
|
||||
BSP_shm_cfgtbl.Intr.length = NO_INTERRUPT;
|
||||
#else
|
||||
BSP_shm_cfgtbl.poll_intr = INTR_MODE;
|
||||
BSP_shm_cfgtbl.Intr.address =
|
||||
(rtems_unsigned32 *) (0xffff0021|((localnode-1) << 12));
|
||||
/* use ICMS0 */
|
||||
BSP_shm_cfgtbl.Intr.value = 1;
|
||||
BSP_shm_cfgtbl.Intr.length = BYTE;
|
||||
#endif
|
||||
|
||||
*shmcfg = &BSP_shm_cfgtbl;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/* Shared Memory Lock Routines
|
||||
*
|
||||
* This shared memory locked queue support routine need to be
|
||||
* able to lock the specified locked queue. Interrupts are
|
||||
* disabled while the queue is locked to prevent preemption
|
||||
* and deadlock when two tasks poll for the same lock.
|
||||
* previous level.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1997.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may in
|
||||
* the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <bsp.h>
|
||||
#include <shm.h>
|
||||
|
||||
/*
|
||||
* Shm_Initialize_lock
|
||||
*
|
||||
* Initialize the lock for the specified locked queue.
|
||||
*/
|
||||
|
||||
void Shm_Initialize_lock(
|
||||
Shm_Locked_queue_Control *lq_cb
|
||||
)
|
||||
{
|
||||
lq_cb->lock = LQ_UNLOCKED;
|
||||
}
|
||||
|
||||
/* void _Shm_Lock( &lq_cb )
|
||||
*
|
||||
* This shared memory locked queue support routine locks the
|
||||
* specified locked queue. It disables interrupts to prevent
|
||||
* a deadlock condition.
|
||||
*/
|
||||
|
||||
void Shm_Lock(
|
||||
Shm_Locked_queue_Control *lq_cb
|
||||
)
|
||||
{
|
||||
rtems_unsigned32 isr_level, oldlock;
|
||||
|
||||
rtems_interrupt_disable( isr_level );
|
||||
Shm_isrstat = isr_level;
|
||||
while ( 1 ) {
|
||||
atomic_modify( SHM_LOCK_VALUE, &lq_cb->lock, oldlock );
|
||||
if ( !(oldlock & SHM_LOCK_VALUE) )
|
||||
return;
|
||||
delay( 28 ); /* delay 28 microseconds */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Shm_Unlock
|
||||
*
|
||||
* Unlock the lock for the specified locked queue.
|
||||
*/
|
||||
|
||||
void Shm_Unlock(
|
||||
Shm_Locked_queue_Control *lq_cb
|
||||
)
|
||||
{
|
||||
rtems_unsigned32 isr_level;
|
||||
|
||||
lq_cb->lock = SHM_UNLOCK_VALUE;
|
||||
isr_level = Shm_isrstat;
|
||||
rtems_interrupt_enable( isr_level );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/* Shm_isr_cvme961()
|
||||
*
|
||||
* NOTE: This routine is not used when in polling mode. Either
|
||||
* this routine OR Shm_clockisr is used in a particular system.
|
||||
*
|
||||
* There must be sufficient time after the IACK (read at
|
||||
* 0xb600000x) for the VIC068 to clear the interrupt request
|
||||
* before the interrupt request is cleared from IPND (sf0).
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1997.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may in
|
||||
* the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <bsp.h>
|
||||
#include "shm.h"
|
||||
|
||||
rtems_isr Shm_isr_cvme961(
|
||||
rtems_vector_number vector
|
||||
)
|
||||
{
|
||||
rtems_unsigned32 vic_vector;
|
||||
|
||||
/* enable_tracing(); */
|
||||
vic_vector = (*(volatile rtems_unsigned8 *)0xb6000007);
|
||||
/* reset intr by reading */
|
||||
/* vector at IPL=3 */
|
||||
Shm_Interrupt_count += 1;
|
||||
rtems_multiprocessing_announce();
|
||||
(*(volatile rtems_unsigned8 *)0xa000005f) = 0; /* clear ICMS0 */
|
||||
i960_clear_intr( 6 );
|
||||
|
||||
}
|
||||
|
||||
/* void _Shm_setvec( )
|
||||
*
|
||||
* This driver routine sets the SHM interrupt vector to point to the
|
||||
* driver's SHM interrupt service routine.
|
||||
*
|
||||
* NOTE: See pp. 21-22, 36-39 of the CVME961 Manual for more info.
|
||||
*
|
||||
* Input parameters: NONE
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*/
|
||||
|
||||
void Shm_setvec()
|
||||
{
|
||||
rtems_unsigned32 isrlevel;
|
||||
|
||||
rtems_interrupt_disable( isrlevel );
|
||||
/* set SQSIO4 CTL REG for */
|
||||
/* VME slave address */
|
||||
(*(rtems_unsigned8 *)0xc00000b0) =
|
||||
(Shm_RTEMS_MP_Configuration->node - 1) | 0x10;
|
||||
set_vector( Shm_isr_cvme961, 6, 1 );
|
||||
/* set ICMS Bector Base Register */
|
||||
(*(rtems_unsigned8 *)0xa0000053) = 0x60; /* XINT6 vector is 0x62 */
|
||||
/* set ICMS Intr Control Reg */
|
||||
(*(rtems_unsigned8 *)0xa0000047) = 0xeb; /* ICMS0 enabled, IPL=0 */
|
||||
(*(rtems_unsigned8 *)0xa000005f) = 0; /* clear ICMS0 */
|
||||
rtems_interrupt_enable( isrlevel );
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@:@srcdir@/../../../shared
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
PGM=${ARCH}/startup.rel
|
||||
IPGM=${ARCH}/startup.indv
|
||||
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
# OLD:C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec
|
||||
# we assume to get the following sources from bsplib/shared
|
||||
C_PIECES=bspstart bsppost bspclean bsplibc main sbrk setvec kkprintf frmstr nmi XtInt
|
||||
C_FILES=$(C_PIECES:%=%.c)
|
||||
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
|
||||
|
||||
# C individual source names, if any, go here -- minus the .c
|
||||
CI_PIECES=cntrltbl flttbl intrtbl prcb sctns fault nulsystbl systbl rom_cntrltbl rom_prcb rom_ibr
|
||||
CI_FILES=$(CI_PIECES:%=%.c)
|
||||
CI_O_FILES=$(CI_PIECES:%=${ARCH}/%.o)
|
||||
|
||||
H_FILES=
|
||||
|
||||
# Assembly source names, if any, go here -- minus the .s
|
||||
S_PIECES=
|
||||
S_FILES=$(S_PIECES:%=%.s)
|
||||
S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o)
|
||||
|
||||
# Assembly individual source names, if any, go here -- minus the .s
|
||||
SI_PIECES=rxgen_romld asmfault asmstub ihandler
|
||||
SI_FILES=$(SI_PIECES:%=%.s)
|
||||
SI_O_FILES=$(SI_FILES:%.s=${ARCH}/%.o)
|
||||
|
||||
SRCS=$(C_FILES) $(H_FILES) $(S_FILES)
|
||||
OBJS=$(C_O_FILES) $(S_O_FILES)
|
||||
|
||||
ISRCS=$(CI_FILES) $(H_FILES) $(SI_FILES)
|
||||
IOBJS=$(CI_O_FILES) $(SI_O_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
DEFINES +=
|
||||
CPPFLAGS +=
|
||||
CFLAGS +=
|
||||
|
||||
LD_PATHS +=
|
||||
LD_LIBS +=
|
||||
LDFLAGS +=
|
||||
|
||||
#
|
||||
# Add your list of files to delete here. The config files
|
||||
# already know how to delete some stuff, so you may want
|
||||
# to just run 'make clean' first to see what gets missed.
|
||||
# 'make clobber' already includes 'make clean'
|
||||
#
|
||||
|
||||
CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
${PGM}: ${SRCS} ${OBJS}
|
||||
$(make-rel)
|
||||
|
||||
${IPGM}: ${ISRCS} ${IOBJS}
|
||||
touch ${IPGM}
|
||||
|
||||
all: ${ARCH} $(SRCS) $(PGM) $(ISRCS) $(IPGM)
|
||||
$(INSTALL) $(srcdir)/linkcmds ${PROJECT_RELEASE}/lib
|
||||
i960-rtems-strip --strip-debug ${ARCH}/rom_ibr.o
|
||||
|
||||
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
|
||||
install: all
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/*-------------------------------------*/
|
||||
/* asmfault.h */
|
||||
/* Last change : 3.11.94 */
|
||||
/*-------------------------------------*/
|
||||
#ifndef _ASMFAULT_H_
|
||||
#define _ASMFAULT_H_
|
||||
|
||||
/* Fault handler start point.
|
||||
*/
|
||||
extern void faultHndlEntry(void);
|
||||
|
||||
#endif
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* asmfault.s
|
||||
* Last change : 31. 1.95
|
||||
*/
|
||||
|
||||
.text
|
||||
.globl _faultHndlEntry
|
||||
|
||||
.text
|
||||
|
||||
_faultHndlEntry :
|
||||
/* Raise priority. */
|
||||
ldconst 0x1F0000, r4
|
||||
ldconst 0xFFFFFFFF, r5
|
||||
modpc r4, r4, r5
|
||||
/* Where to keep state of the faulted code. */
|
||||
ldconst _faultBuffer, r3
|
||||
/* Save global registers. */
|
||||
stq g0, 64+0(r3)
|
||||
stq g4, 64+16(r3)
|
||||
stq g8, 64+32(r3)
|
||||
stt g12, 64+48(r3)
|
||||
/* Faulted code's fp (g15) is our pfp. */
|
||||
st pfp, 64+60(r3)
|
||||
/* Make sure locals are in stack. */
|
||||
flushreg
|
||||
/* g3 = & previosFrame[0] */
|
||||
andnot 0xF, pfp, g3
|
||||
/* Save local registers of faulted procedure. */
|
||||
ldq 0(g3), r4
|
||||
stq r4, 0(r3)
|
||||
ldq 16(g3), r4
|
||||
stq r4, 16(r3)
|
||||
ldq 32(g3), r4
|
||||
stq r4, 32(r3)
|
||||
ldq 48(g3), r4
|
||||
stq r4, 48(r3)
|
||||
/* To handling. */
|
||||
mov fp, g0
|
||||
mov r3, g1
|
||||
callx _faultTblHandler
|
||||
/* This point will never be reached ... */
|
||||
|
||||
/* End of file */
|
||||
@@ -0,0 +1,34 @@
|
||||
/*-------------------------------------*/
|
||||
/* asmstub.h */
|
||||
/* Last change : 20. 1.95 */
|
||||
/*-------------------------------------*/
|
||||
#ifndef _ASMSTUB_H_
|
||||
#define _ASMSTUB_H_
|
||||
|
||||
#include "prcb.h"
|
||||
|
||||
/* Reset Processor taking Start Point and Prcb
|
||||
* as parameters.
|
||||
*/
|
||||
extern void asm_exit(void (* start)(void), struct PRCB * prcb);
|
||||
/* Call SYSCTL instruction.
|
||||
*/
|
||||
extern void asm_sysctl(unsigned int cmd, unsigned int a1, unsigned int a2);
|
||||
/* Alter a bit in the interrupt pending register.
|
||||
*/
|
||||
extern void asm_ipend(unsigned int iNmbr, unsigned int toSet);
|
||||
/* Alter a bit in the interrupt mask register.
|
||||
*/
|
||||
extern void asm_imask(unsigned int iNmbr, unsigned int toSet);
|
||||
/* Call MODPC instruction.
|
||||
*/
|
||||
extern int asm_modpc(unsigned int val, unsigned int mask);
|
||||
/* Change a cached interrupt vector.
|
||||
*/
|
||||
extern void asm_ivector(unsigned int vctr, void (* hndl)(void));
|
||||
|
||||
#endif
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
#######################################
|
||||
# asmstub.s #
|
||||
# Last change : 20. 1.95 #
|
||||
#######################################
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# PURPOSE: resets processor
|
||||
#
|
||||
# ARGUMENTS: g0 = start point
|
||||
# g1 = prcb
|
||||
#
|
||||
# RETURNS: none
|
||||
########################################################################
|
||||
|
||||
.text
|
||||
.globl _asm_exit
|
||||
|
||||
.text
|
||||
_asm_exit:
|
||||
ldconst 0x300, g2
|
||||
# ldconst _start, g1
|
||||
# ldconst _ram_prcb, g2
|
||||
sysctl g2, g0, g1
|
||||
ret
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# PURPOSE: execute sysctl instruction
|
||||
#
|
||||
# ARGUMENTS: g0 = message type (0x300 for reinitialize)
|
||||
# g1 = depends on type (inst addr for reinitialize)
|
||||
# g2 = depends on type (prcb addr for reinitialize)
|
||||
#
|
||||
# RETURNS: none
|
||||
########################################################################
|
||||
|
||||
.text
|
||||
.globl _asm_sysctl
|
||||
|
||||
.text
|
||||
_asm_sysctl:
|
||||
b _asm_sysctl
|
||||
sysctl g0, g1, g2
|
||||
ret
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# PURPOSE: alter a bit in the interrupt pending register
|
||||
#
|
||||
# ARGUMENTS: g0 = interrupt number
|
||||
# g1 = 1 to set, 0 to clear
|
||||
#
|
||||
# RETURNS: none
|
||||
########################################################################
|
||||
|
||||
.text
|
||||
.globl _asm_ipend
|
||||
|
||||
.text
|
||||
_asm_ipend:
|
||||
chkbit 0, g1
|
||||
alterbit g0, sf0, sf0
|
||||
ret
|
||||
########################################################################
|
||||
#
|
||||
# PURPOSE: alter a bit in the interrupt mask register
|
||||
#
|
||||
# ARGUMENTS: g0 = interrupt number
|
||||
# g1 = 1 to set, 0 to clear
|
||||
#
|
||||
# RETURNS: none
|
||||
########################################################################
|
||||
|
||||
.text
|
||||
.globl _asm_imask
|
||||
|
||||
.text
|
||||
_asm_imask:
|
||||
chkbit 0, g1
|
||||
alterbit g0, sf1, sf1
|
||||
ret
|
||||
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# PURPOSE: get the value of the interrupt mask register
|
||||
#
|
||||
# ARGUMENTS: none
|
||||
#
|
||||
# RETURNS: value of IMASK reg
|
||||
########################################################################
|
||||
|
||||
.text
|
||||
.globl _asm_get_imask
|
||||
|
||||
.text
|
||||
_asm_get_imask:
|
||||
mov sf1, g0
|
||||
ret
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# PURPOSE: modify process-controls register
|
||||
#
|
||||
# ARGUMENTS: g0 = value masked/stored in PC reg
|
||||
# g1 = mask of bits to be modified
|
||||
#
|
||||
# RETURNS: g0 = initial value of PC reg
|
||||
########################################################################
|
||||
|
||||
.text
|
||||
.globl _asm_modpc
|
||||
|
||||
.text
|
||||
_asm_modpc:
|
||||
modpc g1, g1, g0
|
||||
ret
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# PURPOSE: change a cached interrupt vector
|
||||
#
|
||||
# ARGUMENTS: g0 = interrupt number
|
||||
# g1 = new interrupt vector
|
||||
#
|
||||
# RETURNS: none
|
||||
########################################################################
|
||||
|
||||
.text
|
||||
.globl _asm_ivector
|
||||
|
||||
.text
|
||||
_asm_ivector:
|
||||
addo 1, g0, g0
|
||||
st g1, [g0 * 4]
|
||||
ret
|
||||
|
||||
###############
|
||||
# End of file #
|
||||
###############
|
||||
@@ -0,0 +1,180 @@
|
||||
/* bsp_start()
|
||||
*
|
||||
* This routine starts the application. It includes application,
|
||||
* board, and monitor specific initialization and configuration.
|
||||
* The generic CPU dependent initialization has been performed
|
||||
* before this routine is invoked.
|
||||
*
|
||||
* INPUT: NONE
|
||||
*
|
||||
* OUTPUT: NONE
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1997.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may in
|
||||
* the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
#include <rtems/libio.h>
|
||||
|
||||
#include <libcsupport.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include "i960RP.h"
|
||||
#include <rtems/libio.h>
|
||||
|
||||
#ifdef STACK_CHECKER_ON
|
||||
#include <stackchk.h>
|
||||
#endif
|
||||
|
||||
#define HEAP_SIZE 1024*1024*2
|
||||
|
||||
/*
|
||||
* The original table from the application and our copy of it with
|
||||
* some changes.
|
||||
*/
|
||||
|
||||
extern int putnum(unsigned int);
|
||||
|
||||
extern rtems_configuration_table Configuration;
|
||||
extern void bsp_postdriver_hook(void); /* defined in shared directory */
|
||||
|
||||
rtems_configuration_table BSP_Configuration;
|
||||
|
||||
rtems_cpu_table Cpu_table;
|
||||
|
||||
char *rtems_progname;
|
||||
unsigned int top_of_used_memory;
|
||||
|
||||
/*
|
||||
* Function: bsp_pretasking_hook
|
||||
* Created: 95/03/10
|
||||
*
|
||||
* Description:
|
||||
* BSP pretasking hook. Called just before drivers are initialized.
|
||||
* Used to setup libc and install any BSP extensions.
|
||||
*
|
||||
* NOTES:
|
||||
* Must not use libc (to do io) from here, since drivers are
|
||||
* not yet initialized.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
bsp_pretasking_hook(void)
|
||||
{
|
||||
|
||||
extern int end;
|
||||
rtems_unsigned32 heap_start;
|
||||
|
||||
*(unsigned char *)(0x120f) = 0xd;
|
||||
/* heap_start = (rtems_unsigned32) &end; */
|
||||
heap_start = (rtems_unsigned32) top_of_used_memory;
|
||||
if (heap_start & (CPU_ALIGNMENT-1))
|
||||
heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
|
||||
|
||||
bsp_libc_init((void *) heap_start, 64 * 1024, 0);
|
||||
|
||||
|
||||
#ifdef STACK_CHECKER_ON
|
||||
/*
|
||||
* Initialize the stack bounds checker
|
||||
* We can either turn it on here or from the app.
|
||||
*/
|
||||
|
||||
*(unsigned char *)(0x120f) = 0xe;
|
||||
Stack_check_Initialize();
|
||||
#endif
|
||||
|
||||
#ifdef RTEMS_DEBUG
|
||||
rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
|
||||
#endif
|
||||
*(unsigned char *)(0x120f) = 0xf;
|
||||
}
|
||||
|
||||
|
||||
/* we need to have the top of memory remembered later to start libc_init with
|
||||
the correct values
|
||||
*/
|
||||
int rx_boot_card( int argc, char **argv, char **environp)
|
||||
{
|
||||
extern int end;
|
||||
top_of_used_memory = (rtems_unsigned32) &end + 0x1000;
|
||||
if ((argc > 0) && argv && argv[0])
|
||||
rtems_progname = argv[0];
|
||||
else
|
||||
rtems_progname = "RTEMS/RP";
|
||||
|
||||
boot_card(argc, argv);
|
||||
|
||||
}
|
||||
|
||||
bsp_start(void)
|
||||
{
|
||||
|
||||
*(unsigned int *)OIMR_ADDR = 0xff; /* Mask all primary PCI Interrupts*/
|
||||
Prcb = get_prcb();
|
||||
Ctl_tbl = Prcb->control_tbl;
|
||||
|
||||
*(unsigned char *)(0x120f) = 8;
|
||||
/*
|
||||
* we do not use the pretasking_hook.
|
||||
*/
|
||||
|
||||
Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
|
||||
Cpu_table.postdriver_hook = bsp_postdriver_hook;
|
||||
Cpu_table.do_zero_of_workspace = TRUE;
|
||||
Cpu_table.interrupt_stack_size = 8192;
|
||||
Cpu_table.extra_mpci_receive_server_stack = 0;
|
||||
Cpu_table.Prcb = Prcb;
|
||||
|
||||
/* just trying to get along */
|
||||
Cpu_table.stack_allocate_hook = 0;
|
||||
Cpu_table.stack_free_hook = 0;
|
||||
|
||||
/*
|
||||
* Add 1 region for the RTEMS Malloc
|
||||
*/
|
||||
|
||||
BSP_Configuration.RTEMS_api_configuration->maximum_regions++;
|
||||
|
||||
/*
|
||||
* Add 1 extension for newlib libc
|
||||
*/
|
||||
|
||||
#ifdef RTEMS_NEWLIB
|
||||
BSP_Configuration.maximum_extensions++;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Add another extension if using the stack checker
|
||||
*/
|
||||
|
||||
#ifdef STACK_CHECKER_ON
|
||||
BSP_Configuration.maximum_extensions++;
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Tell libio how many fd's we want and allow it to tweak config
|
||||
*/
|
||||
|
||||
*(unsigned char *)(0x120f) = 0x09;
|
||||
|
||||
BSP_Configuration.work_space_start = (void *) top_of_used_memory;
|
||||
top_of_used_memory += (BSP_Configuration.work_space_size + 0x1000);
|
||||
|
||||
|
||||
*(unsigned char *)(0x120f) = 0x0a;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/*-------------------------------------*/
|
||||
/* cntrltbl.c */
|
||||
/* Last change : 7.10.94 */
|
||||
/*-------------------------------------*/
|
||||
#include "i960RP.h"
|
||||
#include "cntrltbl.h"
|
||||
/*-------------------------------------*/
|
||||
/* Control Table.
|
||||
*/
|
||||
/* Interrupt Map Registers Initial.
|
||||
*/
|
||||
#define IMAP0 0x4321
|
||||
#define IMAP1 0x8765
|
||||
#define IMAP2 0xA90000
|
||||
#define ICON (VECTOR_CACHE | MSK_UNCHNG | I_ENABLE)
|
||||
|
||||
|
||||
/* Bus configuration */
|
||||
#define RP_CONFIG_REGS BUS_WIDTH_32
|
||||
#define FLASH BUS_WIDTH_8
|
||||
#define DRAM BUS_WIDTH_32
|
||||
#define UART_LED BUS_WIDTH_8
|
||||
#define DEFAULT BUS_WIDTH_32
|
||||
|
||||
/* Region Configuration */
|
||||
#define REGION_0_CONFIG RP_CONFIG_REGS
|
||||
#define REGION_2_CONFIG DEFAULT
|
||||
#define REGION_4_CONFIG DEFAULT
|
||||
#define REGION_6_CONFIG DEFAULT
|
||||
#define REGION_8_CONFIG DEFAULT
|
||||
#define REGION_A_CONFIG DRAM
|
||||
#define REGION_C_CONFIG UART_LED
|
||||
|
||||
#define REGION_E_CONFIG DEFAULT
|
||||
#define REGION_BOOT_CONFIG DRAM
|
||||
|
||||
/* Trace Control Initial. */
|
||||
#define TC 0
|
||||
|
||||
/*Bus Control Initial value */
|
||||
#define BCON CONF_TBL_VALID
|
||||
|
||||
|
||||
|
||||
ControlTblEntry controlTbl[] = {
|
||||
/* --group 0 -- */
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
/* --group 1 -- */
|
||||
IMAP0,
|
||||
IMAP1,
|
||||
IMAP2,
|
||||
ICON,
|
||||
/* --group 2 -- */
|
||||
REGION_0_CONFIG,
|
||||
0,
|
||||
REGION_2_CONFIG,
|
||||
0,
|
||||
/* --group 3 -- */
|
||||
REGION_4_CONFIG,
|
||||
0,
|
||||
REGION_6_CONFIG,
|
||||
0,
|
||||
/* --group 4 -- */
|
||||
REGION_8_CONFIG,
|
||||
0,
|
||||
REGION_A_CONFIG,
|
||||
0,
|
||||
/* --group 5 -- */
|
||||
REGION_C_CONFIG,
|
||||
0,
|
||||
REGION_BOOT_CONFIG,
|
||||
0,
|
||||
/* --group 6 -- */
|
||||
0, /* Reserved */
|
||||
0,
|
||||
TC,
|
||||
BCON
|
||||
};
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*-------------------------------------*/
|
||||
/* cntrltbl.h */
|
||||
/* Last change : 11. 1.95 */
|
||||
/*-------------------------------------*/
|
||||
#ifndef _CNTRLTBL_H_
|
||||
#define _CNTRLTBL_H_
|
||||
|
||||
/* Control Table Entry.
|
||||
*/
|
||||
typedef unsigned int ControlTblEntry;
|
||||
/* Control Table itself.
|
||||
*/
|
||||
extern ControlTblEntry controlTbl[];
|
||||
extern ControlTblEntry rom_controlTbl[];
|
||||
|
||||
/* Interrupt Registers Initial.
|
||||
*/
|
||||
#define IPB0 0
|
||||
#define IPB1 0
|
||||
#define DAB0 0
|
||||
#define DAB1 0
|
||||
|
||||
#define I_DISABLE (0x1<<10)
|
||||
#define I_ENABLE 0
|
||||
|
||||
#define MSK_UNCHNG 0
|
||||
#define MSK_CLEAR (0x1<<11)
|
||||
|
||||
#define VECTOR_CACHE (0x1<<13)
|
||||
|
||||
|
||||
|
||||
/* BreakPoint Control Register Initial.
|
||||
*/
|
||||
#define BPCON 0
|
||||
/* Bus Controller Mode Comstants.
|
||||
*/
|
||||
#define CONF_TBL_VALID 0x1
|
||||
#define PROTECT_RAM 0x2
|
||||
#define PROTECT_RAM_SUP 0x4
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
/*------------------------------------*/
|
||||
/* rom.ld */
|
||||
/* Last change : 19. 4.95 */
|
||||
/*------------------------------------*
|
||||
* To build ROM based i960 image.
|
||||
*------------------------------------*/
|
||||
|
||||
|
||||
MEMORY
|
||||
{
|
||||
dram : org = 0xa2000000, len = 120K
|
||||
}
|
||||
|
||||
|
||||
_bootAddr = 0xa0200000;
|
||||
_HEAP = 0xA0100000 ;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* Only monitor start point and fault handler
|
||||
* will live in ROM as far as text is concerned.
|
||||
* Only fault table will live in ROM as far as data
|
||||
* is concerned.
|
||||
*/
|
||||
romCode :
|
||||
{
|
||||
/* Make sure that the monitor start point
|
||||
* is the first location in EPROM.
|
||||
*/
|
||||
rommon.o960(.text)
|
||||
/* Procedures to copy code and
|
||||
* initialize bss in RAM.
|
||||
*/
|
||||
sctns.o960(.text)
|
||||
/* Make Sure Fault Table (and its handler's data)
|
||||
* live here so that they wouldn't get destroyed).
|
||||
*/
|
||||
asmfault.o960
|
||||
flttbl.o960
|
||||
/* 16 byte aligned PRCB.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
rom_prcb.o960(.data)
|
||||
/* 16 byte aligned Control Table.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
rom_cntrltbl.o960(.data)
|
||||
. = ALIGN(16);
|
||||
intrtbl.o960(.data)
|
||||
. = ALIGN(16);
|
||||
nulsystbl.o960(.data)
|
||||
. = ALIGN(16);
|
||||
/* I need this symbol to know where code which is
|
||||
* to be copied reside in ROM. Align it on a 16
|
||||
* boundary.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
_codeRomStart = .;
|
||||
} > dram
|
||||
|
||||
/* All the rest of the code will live in RAM.
|
||||
* Relocation are created as though code resides
|
||||
* in RAM, while code is placed right after romCode.
|
||||
* This is responsiblity of the ROM monitor to
|
||||
* copy code into ROM.
|
||||
*/
|
||||
ramCode : AT(ADDR(romCode) + SIZEOF(romCode))
|
||||
{
|
||||
/* RAM-based code section start.
|
||||
* I need this symbol to know where to copy code
|
||||
* at initialization time .
|
||||
*/
|
||||
_codeRamStart = .;
|
||||
/* RAM based fault recovery stuff.
|
||||
*/
|
||||
_faultStart = .;
|
||||
fault.o960
|
||||
_faultEnd = .;
|
||||
/* Check sum to gurantee that
|
||||
* the above section wasn't broken.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
_faultCheckSum = .;
|
||||
. += 4;
|
||||
/* Fault Buffer to keep the state of
|
||||
* the fauled procedure.
|
||||
*/
|
||||
_faultBuffer = .;
|
||||
. += 256;
|
||||
/* All the rest of the text goes here.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
*(.text)
|
||||
/* 16 byte aligned PRCB.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
prcb.o960(.data)
|
||||
/* 16 byte aligned Control Table.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
cntrltbl.o960(.data)
|
||||
. = ALIGN(16);
|
||||
systbl.o960(.data)
|
||||
/* All the rest of program defined data goes here.
|
||||
*/
|
||||
*(.data)
|
||||
/* RAM-based code section end.
|
||||
* I need this symbol to know where to copy code
|
||||
* at initialization time .
|
||||
*/
|
||||
_codeRamEnd = .;
|
||||
} > sram
|
||||
|
||||
/* RAM based uninitialized data.
|
||||
*/
|
||||
bss (NOLOAD) :
|
||||
{
|
||||
/* BSS section start. I need this symbol to
|
||||
* zero BSS on initialization.
|
||||
*/
|
||||
_bssStart = .;
|
||||
/* Supervisor Stack. Aligned on a 16 boundary.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
_svrStackPtr = .;
|
||||
. += 4K;
|
||||
/* Interrupt Stack. Aligned on a 16 boundary.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
_intStackPtr = .;
|
||||
. += 4K;
|
||||
/* Program defined BSS.
|
||||
*/
|
||||
*(.bss)
|
||||
/* Program defined COMMON.
|
||||
*/
|
||||
*(COMMON)
|
||||
/* BSS section end. I need this symbol to
|
||||
* zero BSS on initialization.
|
||||
*/
|
||||
_bssEnd = .;
|
||||
_bssStart_1 = .;
|
||||
_bssEnd_1 = .;
|
||||
} > dram
|
||||
|
||||
}
|
||||
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
@@ -0,0 +1,38 @@
|
||||
/* exit
|
||||
*
|
||||
* This routine is used to return control to the NINDY monitor
|
||||
* and is automatically invoked by the STDIO exit() routine.
|
||||
*
|
||||
* INPUT:
|
||||
* status - exit status
|
||||
*
|
||||
* OUTPUT: NONE
|
||||
*
|
||||
* NOTES: DOES NOT RETURN!!!
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1997.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may in
|
||||
* the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include "bsp.h"
|
||||
|
||||
void _exit( )
|
||||
{
|
||||
asm volatile( "mov 0,g0; \
|
||||
fmark ; \
|
||||
syncf ; \
|
||||
.word 0xfeedface ; \
|
||||
bx start" : : );
|
||||
/* The constant 0xfeedface is a magic word for break which
|
||||
* is defined by NINDY. The branch extended restarts the
|
||||
* application if the user types "go".
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,322 @@
|
||||
/*-------------------------------------*/
|
||||
/* fault.c */
|
||||
/* Last change : 13. 7.95 */
|
||||
/*-------------------------------------*/
|
||||
#include "prcb.h"
|
||||
#include "i960.h"
|
||||
#include "flttbl.h"
|
||||
#include "fault.h"
|
||||
#include "asmstub.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
extern void romFaultStart(void);
|
||||
|
||||
/*-------------------------------------*/
|
||||
/* Table of user-registered fault handler entry.
|
||||
*/
|
||||
typedef struct {
|
||||
UserFaultHandler hndl; /* Handler itself. */
|
||||
int cnt; /* Handler is valid for cnt times. */
|
||||
} UserFaultEntry;
|
||||
/* Table itself.
|
||||
*/
|
||||
static UserFaultEntry userFaultTable[] = {
|
||||
{0, 0}, /* Parallel */
|
||||
{0, 0}, /* Trace */
|
||||
{0, 0}, /* Operation */
|
||||
{0, 0}, /* Arithmetic */
|
||||
{0, 0}, /* Reserved */
|
||||
{0, 0}, /* Constraint */
|
||||
{0, 0}, /* Reserved */
|
||||
{0, 0}, /* Protection */
|
||||
{0, 0}, /* Reserved */
|
||||
{0, 0} /* Type */
|
||||
};
|
||||
/* Number of Faults.
|
||||
*/
|
||||
#define FaultNmbr (sizeof(userFaultTable)/sizeof(UserFaultEntry))
|
||||
|
||||
int faultRegister(int fault, UserFaultHandler hndl, int cnt)
|
||||
{
|
||||
static unsigned int faultNewCheckSum(void);
|
||||
int rsl = 0;
|
||||
|
||||
if (0 <= fault && fault <= FaultNmbr) {
|
||||
/* Register handler.
|
||||
*/
|
||||
userFaultTable[fault].hndl = hndl;
|
||||
userFaultTable[fault].cnt = cnt;
|
||||
/* Checksum has changed.
|
||||
*/
|
||||
faultCheckSum = faultNewCheckSum();
|
||||
rsl = 1;
|
||||
}
|
||||
return rsl;
|
||||
}
|
||||
int faultOk(int fault)
|
||||
{
|
||||
static unsigned int faultNewCheckSum(void);
|
||||
int rsl = 0;
|
||||
|
||||
if (0 <= fault && fault <= FaultNmbr) {
|
||||
/* Fault handler recovered successfully.
|
||||
* Can use it at least once more.
|
||||
*/
|
||||
userFaultTable[fault].cnt ++;
|
||||
/* Check sum has changed.
|
||||
*/
|
||||
#ifdef 0
|
||||
faultCheckSum = faultNewCheckSum();
|
||||
#endif
|
||||
faultCheckSum ++;
|
||||
rsl = 1;
|
||||
}
|
||||
return rsl;
|
||||
}
|
||||
void faultBad(int invokedFromRom,
|
||||
unsigned int inst, unsigned int * faultBuffer,
|
||||
unsigned int type, unsigned int sbtp)
|
||||
{
|
||||
static void faultInfo(int invokedFromRom,
|
||||
unsigned int inst, unsigned int * faultBuffer,
|
||||
unsigned int type, unsigned int sbtp);
|
||||
|
||||
/* Close the mem channel nicely.
|
||||
*/
|
||||
/* memChnlI960Fault();*/
|
||||
/* Give some panic message.
|
||||
*/
|
||||
faultInfo(invokedFromRom, inst, faultBuffer, type, sbtp);
|
||||
/* At this point RAM is repaired. Do
|
||||
* whatever you want.
|
||||
*/
|
||||
# ifdef 0
|
||||
if (OsfIsUp) {
|
||||
asm_exit(romFaultStart, & ram_prcb);
|
||||
}
|
||||
else {
|
||||
asm_exit(romStart, & ram_prcb);
|
||||
}
|
||||
# endif
|
||||
asm_exit(romFaultStart, & ram_prcb);
|
||||
}
|
||||
void faultGood(unsigned int inst, unsigned int * faultBuffer,
|
||||
unsigned int type, unsigned int sbtp)
|
||||
{
|
||||
static unsigned int faultNewCheckSum(void);
|
||||
|
||||
if (userFaultTable[type].hndl != 0 && userFaultTable[type].cnt > 0) {
|
||||
/* This is done to avoid the situation when
|
||||
* handler causes a fault and, thus, infinite recursion.
|
||||
*/
|
||||
userFaultTable[type].cnt --;
|
||||
/* Check sum has changed.
|
||||
*/
|
||||
#ifdef 0
|
||||
faultCheckSum = faultNewCheckSum();
|
||||
#endif
|
||||
faultCheckSum --;
|
||||
/* Invoke handler.
|
||||
*/
|
||||
(* userFaultTable[type].hndl)(inst, faultBuffer, type, sbtp);
|
||||
/* If this returns => fault is bad.
|
||||
*/
|
||||
}
|
||||
faultBad(0, inst, faultBuffer, type, sbtp);
|
||||
}
|
||||
static unsigned int faultNewCheckSum(void)
|
||||
{
|
||||
unsigned int * f = faultStart;
|
||||
unsigned int * l = faultEnd;
|
||||
unsigned int sum;
|
||||
|
||||
for (sum = 0; f < l; f ++) {
|
||||
sum += * f;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
static void faultInfo(int invokedFromRom,
|
||||
unsigned int inst, unsigned int * faultBuffer,
|
||||
unsigned int type, unsigned int sbtp)
|
||||
{
|
||||
char * typeStr;
|
||||
char * sbtpStr;
|
||||
static char * faultParallelSbtpStr(unsigned int);
|
||||
static char * faultTraceSbtpStr(unsigned int);
|
||||
static char * faultOperationSbtpStr(unsigned int);
|
||||
static char * faultArithmeticSbtpStr(unsigned int);
|
||||
static char * faultReservedSbtpStr(unsigned int);
|
||||
static char * faultConstraintSbtpStr(unsigned int);
|
||||
static char * faultProtectionSbtpStr(unsigned int);
|
||||
static char * faultTypeSbtpStr(unsigned int);
|
||||
static char * faultUnknownSbtpStr(unsigned int);
|
||||
static struct {
|
||||
char * name;
|
||||
char * (* sbtpStr)(unsigned int);
|
||||
} faultInfo[] = {
|
||||
{"Parallel", faultParallelSbtpStr},
|
||||
{"Trace", faultTraceSbtpStr},
|
||||
{"Operation", faultOperationSbtpStr},
|
||||
{"Arithmetic", faultArithmeticSbtpStr},
|
||||
{"Reserved", faultReservedSbtpStr},
|
||||
{"Constraint", faultConstraintSbtpStr},
|
||||
{"Reserved", faultReservedSbtpStr},
|
||||
{"Protection", faultProtectionSbtpStr},
|
||||
{"Reserved", faultReservedSbtpStr},
|
||||
{"Type", faultTypeSbtpStr},
|
||||
{"Unknown", faultUnknownSbtpStr}
|
||||
};
|
||||
unsigned int ix;
|
||||
|
||||
/* console_set_channel(CHANNEL_B);*/
|
||||
ix = type >= FaultNmbr ? FaultNmbr : type;
|
||||
typeStr = faultInfo[ix].name;
|
||||
sbtpStr = (* faultInfo[ix].sbtpStr)(sbtp);
|
||||
printf("\nFault at 0x%08x: %s[%s]\n",
|
||||
faultBuffer[IP_REGNUM], typeStr, sbtpStr);
|
||||
printf("Bad instruction: 0x%08x\n", inst);
|
||||
printf("AC=0x%08x PC=0x%08x\n",
|
||||
faultBuffer[ACW_REGNUM],
|
||||
faultBuffer[PCW_REGNUM]);
|
||||
printf("g0=0x%08x g1=0x%08x g2=0x%08x g3=0x%08x\n",
|
||||
faultBuffer[G0_REGNUM+0], faultBuffer[G0_REGNUM+1],
|
||||
faultBuffer[G0_REGNUM+2], faultBuffer[G0_REGNUM+3]);
|
||||
printf("g4=0x%08x g5=0x%08x g6=0x%08x g7=0x%08x\n",
|
||||
faultBuffer[G0_REGNUM+4], faultBuffer[G0_REGNUM+5],
|
||||
faultBuffer[G0_REGNUM+6], faultBuffer[G0_REGNUM+7]);
|
||||
printf("g8=0x%08x g9=0x%08x gA=0x%08x gB=0x%08x\n",
|
||||
faultBuffer[G0_REGNUM+8], faultBuffer[G0_REGNUM+9],
|
||||
faultBuffer[G0_REGNUM+10], faultBuffer[G0_REGNUM+11]);
|
||||
printf("gC=0x%08x gD=0x%08x gE=0x%08x gF=0x%08x\n",
|
||||
faultBuffer[G0_REGNUM+12], faultBuffer[G0_REGNUM+13],
|
||||
faultBuffer[G0_REGNUM+14], faultBuffer[G0_REGNUM+15]);
|
||||
printf("r0=0x%08x r1=0x%08x r2=0x%08x r3=0x%08x\n",
|
||||
faultBuffer[R0_REGNUM+0], faultBuffer[R0_REGNUM+1],
|
||||
faultBuffer[R0_REGNUM+2], faultBuffer[R0_REGNUM+3]);
|
||||
printf("r4=0x%08x r5=0x%08x r6=0x%08x r7=0x%08x\n",
|
||||
faultBuffer[R0_REGNUM+4], faultBuffer[R0_REGNUM+5],
|
||||
faultBuffer[R0_REGNUM+6], faultBuffer[R0_REGNUM+7]);
|
||||
printf("r8=0x%08x r9=0x%08x rA=0x%08x rB=0x%08x\n",
|
||||
faultBuffer[R0_REGNUM+8], faultBuffer[R0_REGNUM+9],
|
||||
faultBuffer[R0_REGNUM+10], faultBuffer[R0_REGNUM+11]);
|
||||
printf("rC=0x%08x rD=0x%08x rE=0x%08x rF=0x%08x\n",
|
||||
faultBuffer[R0_REGNUM+12], faultBuffer[R0_REGNUM+13],
|
||||
faultBuffer[R0_REGNUM+14], faultBuffer[R0_REGNUM+15]);
|
||||
if (invokedFromRom) {
|
||||
printf("RAM image damaged. No chance to recover\n");
|
||||
}
|
||||
else {
|
||||
printf("RAM image not damaged. Still no recovery\n");
|
||||
}
|
||||
}
|
||||
static char * faultParallelSbtpStr(unsigned int sbtp)
|
||||
{
|
||||
static char buf[10];
|
||||
|
||||
sprintf(buf, "%d", sbtp);
|
||||
return buf;
|
||||
}
|
||||
static char * faultTraceSbtpStr(unsigned int sbtp)
|
||||
{
|
||||
static char buf[256];
|
||||
int notEmpty;
|
||||
|
||||
buf[0] = '\0';
|
||||
notEmpty = 0;
|
||||
if (sbtp & 0x2) {
|
||||
strcat(buf, "Instruction");
|
||||
notEmpty = 1;
|
||||
}
|
||||
if (sbtp & 0x4) {
|
||||
if (notEmpty) strcat(buf, ":");
|
||||
strcat(buf, "Branch");
|
||||
notEmpty = 1;
|
||||
}
|
||||
if (sbtp & 0x8) {
|
||||
if (notEmpty) strcat(buf, ":");
|
||||
strcat(buf, "Call");
|
||||
notEmpty = 1;
|
||||
}
|
||||
if (sbtp & 0x10) {
|
||||
if (notEmpty) strcat(buf, ":");
|
||||
strcat(buf, "Return");
|
||||
notEmpty = 1;
|
||||
}
|
||||
if (sbtp & 0x20) {
|
||||
if (notEmpty) strcat(buf, ":");
|
||||
strcat(buf, "Prereturn");
|
||||
notEmpty = 1;
|
||||
}
|
||||
if (sbtp & 0x40) {
|
||||
if (notEmpty) strcat(buf, ":");
|
||||
strcat(buf, "Supervisor");
|
||||
notEmpty = 1;
|
||||
}
|
||||
if (sbtp & 0x80) {
|
||||
if (notEmpty) strcat(buf, ":");
|
||||
strcat(buf, "Breakpoint");
|
||||
notEmpty = 1;
|
||||
}
|
||||
if (! notEmpty) {
|
||||
strcat(buf, "Unknown");
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
static char * faultOperationSbtpStr(unsigned int sbtp)
|
||||
{
|
||||
char * rsl;
|
||||
|
||||
if (sbtp == 0x1) rsl = "Invalid Opcode";
|
||||
else if (sbtp == 0x2) rsl = "Unimplemented";
|
||||
else if (sbtp == 0x3) rsl = "Unaligned";
|
||||
else if (sbtp == 0x4) rsl = "Invalid Operand";
|
||||
else rsl = "Unknown";
|
||||
return rsl;
|
||||
}
|
||||
static char * faultArithmeticSbtpStr(unsigned int sbtp)
|
||||
{
|
||||
char * rsl;
|
||||
|
||||
if (sbtp == 0x1) rsl = "Integer Overflow";
|
||||
else if (sbtp == 0x2) rsl = "Arithmetic Zero-Divide";
|
||||
else rsl = "Unknown";
|
||||
return rsl;
|
||||
}
|
||||
static char * faultReservedSbtpStr(unsigned int sbtp)
|
||||
{
|
||||
return "Unknown";
|
||||
}
|
||||
static char * faultConstraintSbtpStr(unsigned int sbtp)
|
||||
{
|
||||
char * rsl;
|
||||
|
||||
if (sbtp == 0x1) rsl = "Constraint Range";
|
||||
else if (sbtp == 0x2) rsl = "Priveleged";
|
||||
else rsl = "Unknown";
|
||||
return rsl;
|
||||
}
|
||||
static char * faultProtectionSbtpStr(unsigned int sbtp)
|
||||
{
|
||||
char * rsl;
|
||||
|
||||
if (sbtp == 0x1) rsl = "Length";
|
||||
else rsl = "Unknown";
|
||||
return rsl;
|
||||
}
|
||||
static char * faultTypeSbtpStr(unsigned int sbtp)
|
||||
{
|
||||
char * rsl;
|
||||
|
||||
if (sbtp == 0x1) rsl = "Type Mismatch";
|
||||
else rsl = "Unknown";
|
||||
return rsl;
|
||||
}
|
||||
static char * faultUnknownSbtpStr(unsigned int sbtp)
|
||||
{
|
||||
return "Unknown";
|
||||
}
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*-------------------------------------*/
|
||||
/* fault.h */
|
||||
/* Last change : 2.11.94 */
|
||||
/*-------------------------------------*/
|
||||
#ifndef _FAULT_H_
|
||||
#define _FAULT_H_
|
||||
|
||||
/* (RAM-based) Fault Handler.
|
||||
* Is invoked when there is no chance to repair current state.
|
||||
*/
|
||||
extern void faultBad(int invokedFromRom,
|
||||
unsigned int inst, unsigned int * faultBuffer,
|
||||
unsigned int type, unsigned int sbtp);
|
||||
/* (RAM-based) Fault Handler.
|
||||
* Is invoked when there is a chance to repair current state.
|
||||
*/
|
||||
extern void faultGood(unsigned int instr, unsigned int * faultBuffer,
|
||||
unsigned int type, unsigned int sbtp);
|
||||
/* Some addresses that are defined in rom.ld.
|
||||
*/
|
||||
extern unsigned int faultCheckSum;
|
||||
|
||||
extern unsigned int faultBuffer[];
|
||||
|
||||
extern unsigned int faultStart[];
|
||||
extern unsigned int faultEnd[];
|
||||
/* Interface for user to register fault handlers of his own.
|
||||
* Fault names.
|
||||
*/
|
||||
#define ParallelFLT 0
|
||||
#define TraceFLT 1
|
||||
#define OperationFLT 2
|
||||
#define ArithmeticFLT 3
|
||||
#define ConstraintFLT 5
|
||||
#define ProtectionFLT 7
|
||||
#define TypeFLT 9
|
||||
/* User-registered fault handler.
|
||||
*/
|
||||
typedef void (* UserFaultHandler)(unsigned int inst, unsigned int * faultBuf,
|
||||
unsigned int type, unsigned int sbtp);
|
||||
/* Register user-defined fault handler. The third argument is
|
||||
* how many times this fault handler will be valid. This to avoid
|
||||
* the situation when handler is bad and it causes a fault itself.
|
||||
*/
|
||||
extern int faultRegister(int fault, UserFaultHandler, int cnt);
|
||||
/* Validate handler for one more time.
|
||||
*/
|
||||
extern int faultOk(int fault);
|
||||
|
||||
#endif
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*-------------------------------------*/
|
||||
/* faultret.h */
|
||||
/* Last change : 3.11.94 */
|
||||
/*-------------------------------------*/
|
||||
#ifndef _FAULTRET_H_
|
||||
#define _FAULTRET_H_
|
||||
|
||||
/* Return to the point where fault happened.
|
||||
* Fault state keeps all registers.
|
||||
*/
|
||||
extern void faultRet(unsigned int * faultState);
|
||||
|
||||
#endif
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
/*-------------------------------------*/
|
||||
/* flttbl.c */
|
||||
/* Last change : 3.11.94 */
|
||||
/*-------------------------------------*/
|
||||
#include "i960.h"
|
||||
#include "string.h"
|
||||
#include "sctns.h"
|
||||
#include "fault.h"
|
||||
#include "asmfault.h"
|
||||
#include "flttbl.h"
|
||||
/*-------------------------------------*/
|
||||
/* Fault Table. It (as well as all the rest of the
|
||||
* code of this file will always stay in ROM, so
|
||||
* that it wouldn't be destroyed by silly user code.
|
||||
* Thus, at least faults will be always caugth,
|
||||
*/
|
||||
FaultTblEntry faultTbl[] = {
|
||||
{faultHndlEntry + LOCAL_FH, LOCAL_FW}, /* Parallel */
|
||||
{faultHndlEntry + LOCAL_FH, LOCAL_FW}, /* Trace */
|
||||
{faultHndlEntry + LOCAL_FH, LOCAL_FW}, /* Operation */
|
||||
{faultHndlEntry + LOCAL_FH, LOCAL_FW}, /* Arithmetic */
|
||||
{0, 0}, /* Reserved */
|
||||
{faultHndlEntry + LOCAL_FH, LOCAL_FW}, /* Constraint */
|
||||
{0, 0}, /* Reserved */
|
||||
{faultHndlEntry + LOCAL_FH, LOCAL_FW}, /* Protection */
|
||||
{0, 0}, /* Reserved */
|
||||
{faultHndlEntry + LOCAL_FH, LOCAL_FW} /* Type */
|
||||
};
|
||||
|
||||
void fltTblInit(void)
|
||||
{
|
||||
static unsigned int fltTblCheckSum(void);
|
||||
|
||||
faultCheckSum = fltTblCheckSum();
|
||||
}
|
||||
static unsigned int fltTblCheckSum(void)
|
||||
{
|
||||
unsigned int * f = faultStart;
|
||||
unsigned int * l = faultEnd;
|
||||
unsigned int sum;
|
||||
|
||||
for (sum = 0; f < l; f ++) {
|
||||
sum += * f;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
void faultTblHandler(unsigned int * fp, unsigned int * faultBuffer)
|
||||
{
|
||||
unsigned int * ip;
|
||||
struct typeWord {
|
||||
unsigned int sbtp : 8;
|
||||
unsigned int : 8;
|
||||
unsigned int type : 8;
|
||||
unsigned int : 8;
|
||||
} tw;
|
||||
unsigned int type;
|
||||
unsigned int sbtp;
|
||||
unsigned int ac;
|
||||
unsigned int pc;
|
||||
unsigned int inst;
|
||||
|
||||
char nib;
|
||||
unsigned int i;
|
||||
|
||||
/* Address of faulting instruction.
|
||||
*/
|
||||
ip = (unsigned int *) fp[-1];
|
||||
/* Type/Subtype word.
|
||||
*/
|
||||
|
||||
/* put address of faulting instruction to console */
|
||||
kkprintf("Fault: %x\n", ip);
|
||||
|
||||
tw = * (struct typeWord *) & fp[-2];
|
||||
/* Type and subtype.
|
||||
*/
|
||||
type = tw.type;
|
||||
sbtp = tw.sbtp;
|
||||
/* Arithmetic controls.
|
||||
*/
|
||||
ac = fp[-3];
|
||||
/* Process controls.
|
||||
*/
|
||||
pc = fp[-4];
|
||||
/* Global and local registers are in faultBuffer
|
||||
* already. Save the rest. Change RIP to IP.
|
||||
*/
|
||||
faultBuffer[IP_REGNUM] = (unsigned int) ip;
|
||||
faultBuffer[ACW_REGNUM] = ac;
|
||||
faultBuffer[PCW_REGNUM] = pc;
|
||||
/* Bad instruction itself. We do
|
||||
* this here since it may be repaired (by copying from PROM).
|
||||
*/
|
||||
inst = * ip;
|
||||
/* Now, to handling.
|
||||
*/
|
||||
if (faultCheckSum != fltTblCheckSum()) {
|
||||
/* RAM-based fault repair stuff
|
||||
* is broken. No chance to recover.
|
||||
* Repair RAM memory which is
|
||||
* destroyed by silly user.
|
||||
*/
|
||||
copyCodeToRom();
|
||||
/* And call RAM-based fault handler.
|
||||
*/
|
||||
faultBad(1, inst, faultBuffer, type, sbtp);
|
||||
}
|
||||
else {
|
||||
/* There exist a chance to recover.
|
||||
*/
|
||||
faultGood(inst, faultBuffer, type, sbtp);
|
||||
}
|
||||
}
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*-------------------------------------*/
|
||||
/* fltbl.h */
|
||||
/* Last change : 3.11.94 */
|
||||
/*-------------------------------------*/
|
||||
#ifndef _FLTTBL_H_
|
||||
#define _FLTTBL_H_
|
||||
|
||||
/* FaultTable Entry.
|
||||
*/
|
||||
typedef struct {
|
||||
void (* hndl)(void); /* Fault Handle */
|
||||
unsigned int type; /* Fault Table Type */
|
||||
} FaultTblEntry;
|
||||
/* Fault Handler Type.
|
||||
*/
|
||||
#define LOCAL_FH 0
|
||||
#define SYSTEM_FH 0x10
|
||||
|
||||
#define LOCAL_FW 0
|
||||
#define SYSTEM_FW 0x027F
|
||||
/* FaultTable Itself.
|
||||
*/
|
||||
extern FaultTblEntry faultTbl[];
|
||||
/* To initialize fault handling.
|
||||
*/
|
||||
extern void faultTblInit(void);
|
||||
/* Fault handler. Invoked from low-level handler.
|
||||
*/
|
||||
extern void faultTblHandler(unsigned int * fp,
|
||||
unsigned int * faultBuffer);
|
||||
|
||||
#endif
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,43 @@
|
||||
|
||||
/* frmstr.h
|
||||
* Interface to procedures used to implement
|
||||
* the printf group.
|
||||
*/
|
||||
|
||||
#ifndef _FRMSTR_H_
|
||||
#define _FRMSTR_H_
|
||||
|
||||
#ifdef __i960
|
||||
|
||||
typedef int ArgType;
|
||||
typedef unsigned int ArgType_U;
|
||||
|
||||
#else
|
||||
|
||||
typedef long ArgType;
|
||||
typedef unsigned long ArgType_U;
|
||||
|
||||
#endif
|
||||
|
||||
/* Format a string.
|
||||
*/
|
||||
extern int format_string(const char * frmt, ArgType * args, char * buffer);
|
||||
/* Get arguments from formatted string.
|
||||
*/
|
||||
extern int unformat_string(const char * fmt, int ** argp, const char * buffer);
|
||||
|
||||
/* Definitions for control characters.
|
||||
*/
|
||||
#define BELL ('G' & 0x1f)
|
||||
#define BACKSPACE '\b'
|
||||
#define DELETE 0x7f
|
||||
#define KILL ('U' - 'A' + 1)
|
||||
#define XON ('Q' & 0x1f)
|
||||
#define XOFF ('S' & 0x1f)
|
||||
#define CNTRL_C 0x3
|
||||
|
||||
#endif
|
||||
|
||||
/* End of File
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*-------------------------------------*/
|
||||
/* i960.h */
|
||||
/* Last change : 3.11.94 */
|
||||
/*-------------------------------------*/
|
||||
#ifndef _I960_H_
|
||||
#define _I960_H_
|
||||
|
||||
#define REGISTER_SIZE 4
|
||||
#define NUM_REGS 40
|
||||
|
||||
#define R0_REGNUM 0 /* First local register */
|
||||
#define SP_REGNUM 1 /* Contains address of top of stack */
|
||||
#define RIP_REGNUM 2 /* Return instruction pointer (local r2) */
|
||||
#define R15_REGNUM 15 /* Last local register */
|
||||
#define G0_REGNUM 16 /* First global register */
|
||||
#define G13_REGNUM 29 /* g13 - holds struct return address */
|
||||
#define G14_REGNUM 30 /* g14 - ptr to arg block / leafproc return address */
|
||||
#define FP_REGNUM 31 /* Contains address of executing stack frame */
|
||||
#define PCW_REGNUM 32 /* process control word */
|
||||
#define ACW_REGNUM 33 /* arithmetic control word */
|
||||
#define TCW_REGNUM 34 /* trace control word */
|
||||
#define IP_REGNUM 35 /* instruction pointer */
|
||||
#define FP0_REGNUM 36 /* First floating point register */
|
||||
|
||||
#define REGISTER_BYTES ((36*4) + (4*10))
|
||||
|
||||
#endif
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
@@ -0,0 +1,20 @@
|
||||
/*-------------------------------------*/
|
||||
/* ihandler.h */
|
||||
/* Last change : 12.10.94 */
|
||||
/*-------------------------------------*/
|
||||
#ifndef _IHANDLER_H_
|
||||
#define _IHANDLER_H_
|
||||
|
||||
/* Interrupt Handler for NMI.
|
||||
*/
|
||||
extern void nmiHandler(void);
|
||||
/* Interrupt Handlers for Dedicated Interrupts.
|
||||
*/
|
||||
extern void intr5Handler(void);
|
||||
extern void intr6Handler(void);
|
||||
|
||||
#endif
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
#######################################
|
||||
# ihandler.s #
|
||||
# Last change : 8.11.94 #
|
||||
#######################################
|
||||
|
||||
.text
|
||||
.globl _nmiHandler
|
||||
.globl _intr5Handler
|
||||
.globl _intr6Handler
|
||||
.globl _clockHandler
|
||||
|
||||
.text
|
||||
|
||||
# NMI Handler
|
||||
_nmiHandler :
|
||||
ldconst 64, r4
|
||||
addo sp, r4, sp
|
||||
|
||||
stq g0, -64(sp)
|
||||
stq g4, -48(sp)
|
||||
stq g8, -32(sp)
|
||||
stt g12, -16(sp)
|
||||
|
||||
callx _nmi_isr
|
||||
|
||||
ldq -64(sp), g0
|
||||
ldq -48(sp), g4
|
||||
ldq -32(sp), g8
|
||||
ldt -16(sp), g12
|
||||
|
||||
ret
|
||||
_clockHandler :
|
||||
ldconst 64, r4
|
||||
addo sp, r4, sp
|
||||
|
||||
stq g0, -64(sp)
|
||||
stq g4, -48(sp)
|
||||
stq g8, -32(sp)
|
||||
stt g12, -16(sp)
|
||||
|
||||
callx _Clock_isr
|
||||
|
||||
ldq -64(sp), g0
|
||||
ldq -48(sp), g4
|
||||
ldq -32(sp), g8
|
||||
ldt -16(sp), g12
|
||||
#
|
||||
#
|
||||
ret
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/*-------------------------------------*/
|
||||
/* intrtbl.c */
|
||||
/* Last change : 12.10.94 */
|
||||
/*-------------------------------------*/
|
||||
#include "ihandler.h"
|
||||
#include "intrtbl.h"
|
||||
/*-------------------------------------*/
|
||||
|
||||
|
||||
/* Interrupt Table. Dedicated Interrupts are cached.
|
||||
* So NMI handler has to be defined here.
|
||||
*/
|
||||
InterruptTbl interruptTbl = {
|
||||
0, /* Pending Priorities */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* Pending Interrupts */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 8 - 15 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 16 - 23 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 24 - 31 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 32 - 39 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 40 - 47 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 48 - 55 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 56 - 63 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 64 - 71 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 72 - 79 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 80 - 87 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 88 - 95 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 96 - 103 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 104 - 111 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 112 - 119 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 120 - 127 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 128 - 135 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 136 - 143 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 144 - 151 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 152 - 159 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 160 - 167 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 168 - 175 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 176 - 183 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 184 - 191 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 192 - 199 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 200 - 207 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 208 - 215 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 216 - 223 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 224 - 231 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 232 - 239 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* 240 - 247 */
|
||||
nmiHandler + NORMAL_IH, /* 248 : NMI handler */
|
||||
0, 0, 0, 0, 0, 0, 0, /* 249 - 255 */
|
||||
|
||||
};
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*-------------------------------------*/
|
||||
/* intrtbl.h */
|
||||
/* Last change : 12.10.94 */
|
||||
/*-------------------------------------*/
|
||||
#ifndef _INTRTBL_H_
|
||||
#define _INTRTBL_H_
|
||||
|
||||
/* Interrupt Handler.
|
||||
*/
|
||||
typedef void (* IntrHndl)(void);
|
||||
/* Interrupt Table.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int pendPrty; /* Pending Priorities */
|
||||
unsigned int pendIntr[8]; /* Pending Interrupts */
|
||||
IntrHndl intrHndl[248]; /* Interrupt Handlers */
|
||||
} InterruptTbl;
|
||||
/* Interrupt Handler Type.
|
||||
*/
|
||||
#define NORMAL_IH 0
|
||||
#define IN_CACHE_IH 0x10
|
||||
/* Interrupt Table Itself.
|
||||
*/
|
||||
extern InterruptTbl interruptTbl;
|
||||
|
||||
#endif
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
a safe version of printf that might be useful for debugging parts that
|
||||
are known to have problems e.g. with printf() e.t.c.
|
||||
*/
|
||||
#include <_ansi.h>
|
||||
#ifdef _HAVE_STDC
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
char kkBuf[1024];
|
||||
/* Routine to do "console" in fully polled mode */
|
||||
void static kkputs( const char *);
|
||||
format_string(char * fmt, va_list ap, char * kkBuf);
|
||||
#ifdef _HAVE_STDC
|
||||
void
|
||||
kkprintf (const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, fmt);
|
||||
format_string (fmt, *ap+4, kkBuf);
|
||||
kkputs(kkBuf);
|
||||
va_end (ap);
|
||||
}
|
||||
void mkvisable()
|
||||
{
|
||||
kkputs("Hello");
|
||||
}
|
||||
#else
|
||||
void
|
||||
kkprintf(fmt, va_alist)
|
||||
char * fmt;
|
||||
va_dcl
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap);
|
||||
format_string(fmt, ap, kkBuf);
|
||||
kkputs(kkBuf);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
extern int DBGConsole_make_sync;
|
||||
void
|
||||
kkputs( const char * buf)
|
||||
{
|
||||
volatile unsigned int * consoleOP;
|
||||
unsigned char c;
|
||||
consoleOP = (unsigned int *) 0x1318; /* Outbound Message 0 */
|
||||
while (( c = *buf++) != 0){
|
||||
while( DBGConsole_make_sync && (*consoleOP != 0))
|
||||
;
|
||||
*consoleOP = (unsigned int)c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* we have got an error during build for 'isatty()' wo/ good reason
|
||||
we temporarily use this fix....
|
||||
*/
|
||||
isatty(int fd)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
/*------------------------------------*/
|
||||
/* rom.ld */
|
||||
/* Last change : 19. 4.95 */
|
||||
/*------------------------------------*
|
||||
* To build ROM based i960 image.
|
||||
*------------------------------------*/
|
||||
|
||||
|
||||
MEMORY
|
||||
{
|
||||
config : org = 0xFeffFF30, len = 0xd0
|
||||
eprom : org = 0xfec00000, len = 1024K
|
||||
}
|
||||
|
||||
|
||||
_bootAddr = 0xa0200000;
|
||||
/*_HEAP = 0xA0100000 ; */
|
||||
_rom_ibr_cksum = -(_romStart + _rom_prcb);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
prcb :
|
||||
{
|
||||
rom_ibr.o
|
||||
} > config
|
||||
|
||||
/* Only monitor start point and fault handler
|
||||
* will live in ROM as far as text is concerned.
|
||||
* Only fault table will live in ROM as far as data
|
||||
* is concerned.
|
||||
*/
|
||||
romCode :
|
||||
{
|
||||
/* Make sure that the monitor start point
|
||||
* is the first location in EPROM.
|
||||
*/
|
||||
rxgen_romld.o(.text)
|
||||
/* Procedures to copy code and
|
||||
* initialize bss in RAM.
|
||||
*/
|
||||
sctns.o(.text)
|
||||
/* Make Sure Fault Table (and its handler's data)
|
||||
* live here so that they wouldn't get destroyed).
|
||||
*/
|
||||
asmfault.o
|
||||
ihandler.o
|
||||
. = ALIGN(16);
|
||||
flttbl.o
|
||||
/* 16 byte aligned PRCB.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
rom_prcb.o(.data)
|
||||
. = ALIGN(16);
|
||||
rom_cntrltbl.o(.data)
|
||||
. = ALIGN(16);
|
||||
intrtbl.o(.data)
|
||||
. = ALIGN(16);
|
||||
nulsystbl.o(.data)
|
||||
. = ALIGN(16);
|
||||
/* I need this symbol to know where code which is
|
||||
* to be copied reside in ROM. Align it on a 16
|
||||
* boundary.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
_codeRomStart = .;
|
||||
} > eprom
|
||||
|
||||
/* All the rest of the code will live in RAM.
|
||||
* Relocation are created as though code resides
|
||||
* in RAM, while code is placed right after romCode.
|
||||
* This is responsiblity of the ROM monitor to
|
||||
* copy code into ROM.
|
||||
*/
|
||||
ramCode : AT(ADDR(romCode) + SIZEOF(romCode))
|
||||
{
|
||||
/* RAM-based code section start.
|
||||
* I need this symbol to know where to copy code
|
||||
* at initialization time .
|
||||
*/
|
||||
_codeRamStart = .;
|
||||
/* RAM based fault recovery stuff.
|
||||
*/
|
||||
_faultStart = .;
|
||||
asmstub.o
|
||||
fault.o
|
||||
_faultEnd = .;
|
||||
/* Check sum to gurantee that
|
||||
* the above section wasn't broken.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
_faultCheckSum = .;
|
||||
. += 4;
|
||||
/* Fault Buffer to keep the state of
|
||||
* the fauled procedure.
|
||||
*/
|
||||
_faultBuffer = .;
|
||||
. += 256;
|
||||
/* All the rest of the text goes here.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
*(.text)
|
||||
/* NEW TEST TEST TEST TEST */
|
||||
. = ALIGN (16);
|
||||
|
||||
*(.eh_fram)
|
||||
. = ALIGN (16);
|
||||
|
||||
/*
|
||||
* C++ constructors
|
||||
*/
|
||||
__CTOR_LIST__ = .;
|
||||
LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
|
||||
*(.ctors)
|
||||
LONG(0)
|
||||
__CTOR_END__ = .;
|
||||
__DTOR_LIST__ = .;
|
||||
LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
|
||||
*(.dtors)
|
||||
LONG(0)
|
||||
__DTOR_END__ = .;
|
||||
etext = ALIGN( 0x10 ) ;
|
||||
/* END NEW TEST TEST TEST */
|
||||
/* 16 byte aligned PRCB.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
prcb.o(.data)
|
||||
/* 16 byte aligned Control Table.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
cntrltbl.o(.data)
|
||||
. = ALIGN(16);
|
||||
systbl.o(.data)
|
||||
/* All the rest of program defined data goes here.
|
||||
*/
|
||||
*(.data)
|
||||
/* RAM-based code section end.
|
||||
* I need this symbol to know where to copy code
|
||||
* at initialization time .
|
||||
*/
|
||||
_codeRamEnd = .;
|
||||
} > eprom
|
||||
|
||||
/* RAM based uninitialized data.
|
||||
*/
|
||||
bss (NOLOAD) :
|
||||
{
|
||||
/* BSS section start. I need this symbol to
|
||||
* zero BSS on initialization.
|
||||
*/
|
||||
/* Heap. Aligned on a 64 boundary */
|
||||
/* . = ALIGN(64);
|
||||
_heap_initial = .;
|
||||
. += 64K;*/
|
||||
/* Supervisor Stack. Aligned on a 16 boundary.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
_svrStackPtr = .;
|
||||
. += 16K;
|
||||
/* Interrupt Stack. Aligned on a 16 boundary.
|
||||
*/
|
||||
. = ALIGN(16);
|
||||
_intStackPtr = .;
|
||||
. += 16K;
|
||||
/* Program defined BSS.
|
||||
*/
|
||||
_bssStart = .;
|
||||
_bss_start = .;
|
||||
*(.bss)
|
||||
/* Program defined COMMON.
|
||||
*/
|
||||
*(COMMON)
|
||||
_end = .;
|
||||
/* BSS section end. I need this symbol to
|
||||
* zero BSS on initialization.
|
||||
*/
|
||||
_bssEnd = .;
|
||||
_bssStart_1 = .;
|
||||
_bssEnd_1 = .;
|
||||
} > eprom
|
||||
|
||||
}
|
||||
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
@@ -0,0 +1,24 @@
|
||||
/*-------------------------------------*/
|
||||
/* main.h */
|
||||
/* Last change : 2. 2.95 */
|
||||
/*-------------------------------------*/
|
||||
#ifndef _MAIN_H_
|
||||
#define _MAIN_H_
|
||||
|
||||
/* ROM monitor main function(s).
|
||||
* Gets control from rommon.s.
|
||||
*/
|
||||
extern void romMain(void);
|
||||
extern void romFaultMain(void);
|
||||
extern void romTestMain(void);
|
||||
|
||||
extern char * mainRevisionStr(void);
|
||||
extern char * mainBuildStr(void);
|
||||
|
||||
extern unsigned int bootAddr[];
|
||||
|
||||
#endif
|
||||
/*-------------*/
|
||||
/* End of file */
|
||||
/*-------------*/
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user