source: rtems/c/src/lib/libbsp/powerpc/score603e/irq/FPGA.c @ 978eba3

4.9
Last change on this file since 978eba3 was 978eba3, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 30, 2008 at 11:17:15 PM

2008-09-30 Jennifer Averett <jennifer.averett@…>

  • Makefile.am, preinstall.am, PCI_bus/universe.c, console/console.c, include/bsp.h, irq/FPGA.c, irq/irq.c, startup/Hwr_init.c, startup/bspstart.c, startup/vmeintr.c: Modifications required to run on hardware. Some cleanup.
  • include/irq-config.h: New file.
  • startup/spurious.c: Removed.
  • Property mode set to 100644
File size: 2.8 KB
RevLine 
[f5e7b4c3]1/*  FPGA.c -- Bridge for second and subsequent generations
[9c448e1]2 *
[f5e7b4c3]3 *  COPYRIGHT (c) 1989-2001.
[9c448e1]4 *  On-Line Applications Research Corporation (OAR).
5 *
6 *  The license and distribution terms for this file may in
7 *  the file LICENSE in this distribution or at
[b14e2f2]8 *  http://www.rtems.com/license/LICENSE.
[9c448e1]9 *
[6771a9e7]10 *  $Id$
[9c448e1]11 */
[9396d1e4]12
[9c448e1]13#include <bsp.h>
14#include <string.h>
15#include <fcntl.h>
16#include <assert.h>
17
[1ae05bf]18#include <rtems/libio.h>
19#include <rtems/libcsupport.h>
[50f93fb]20#include <rtems/bspIo.h>
[1ae05bf]21
[9c448e1]22/*
23 *  initialize FPGA
24 */
[6771a9e7]25void initialize_PCI_bridge (void)
[9c448e1]26{
[978eba3]27  /* Note: Accept DINKs setup of the PCI Bridge and don't
28   *       change anything.
29   */
30  printk("initialize_PCI_bridge: \n");
[9c448e1]31}
32
33void set_irq_mask(
[dac4208]34  uint16_t         value
[9c448e1]35)
36{
[dac4208]37  uint16_t          *loc;
[9c448e1]38
[dac4208]39  loc = (uint16_t*)SCORE603E_FPGA_MASK_DATA;
[9c448e1]40
41  *loc = value;
42}
43
[6771a9e7]44uint16_t         get_irq_mask(voi)
[9c448e1]45{
[dac4208]46  uint16_t          *loc;
47  uint16_t          value;
[9c448e1]48
[dac4208]49  loc =  (uint16_t*)SCORE603E_FPGA_MASK_DATA;
[9c448e1]50
51  value = *loc;
52
53  return value;
54}
55
[6128a4a]56void unmask_irq(
[dac4208]57  uint16_t         irq_idx
[9c448e1]58)
59{
[dac4208]60  uint16_t         value;
61  uint32_t         mask_idx = irq_idx;
[9c448e1]62
63  value = get_irq_mask();
64
65#if (HAS_PMC_PSC8)
66  switch (irq_idx + Score_IRQ_First ) {
67    case SCORE603E_85C30_4_IRQ:
68    case SCORE603E_85C30_2_IRQ:
69    case SCORE603E_85C30_5_IRQ:
70    case SCORE603E_85C30_3_IRQ:
71      mask_idx = SCORE603E_PCI_IRQ_0 - Score_IRQ_First;
72      break;
73    default:
74      break;
75  }
76#endif
77
[6128a4a]78  value &= (~(0x1 << mask_idx));
[9c448e1]79  set_irq_mask( value );
80}
81
[6771a9e7]82void init_irq_data_register(void)
[9c448e1]83{
[dac4208]84  uint32_t         index;
85  uint32_t         i;
[9c448e1]86
87  set_irq_mask( 0xffff );
88
89  /*
90   * Clear any existing interupts from the vector data register.
91   */
92  for (i=0; i<20; i++) {
93    index =  (*SCORE603E_FPGA_VECT_DATA);
94    if ( (index&0x10) != 0x10 )
95      break;
96  }
97}
98
[dac4208]99uint16_t         read_and_clear_PMC_irq(
100  uint16_t            irq
[6128a4a]101)
[9c448e1]102{
[dac4208]103  uint16_t            status_word = irq;
[9c448e1]104
[f309cda]105  status_word = (*BSP_PMC_STATUS_ADDRESS);
[9c448e1]106
107  return status_word;
108}
109
[40e7ae2]110bool Is_PMC_IRQ(
[dac4208]111  uint32_t           pmc_irq,
112  uint16_t           status_word
[9c448e1]113)
114{
[3551166d]115  bool result = false;
[9c448e1]116
117  switch(pmc_irq) {
118    case SCORE603E_85C30_4_IRQ:
[3551166d]119      result = Is_PMC_85C30_4_IRQ( status_word ) ? true : false;
[9c448e1]120      break;
121    case SCORE603E_85C30_2_IRQ:
[3551166d]122      result = Is_PMC_85C30_2_IRQ( status_word ) ? true : false;
[9c448e1]123      break;
124    case SCORE603E_85C30_5_IRQ:
[3551166d]125      result = Is_PMC_85C30_5_IRQ( status_word ) ? true : false;
[9c448e1]126      break;
127    case SCORE603E_85C30_3_IRQ:
[3551166d]128      result = Is_PMC_85C30_3_IRQ( status_word ) ? true : false;
[9c448e1]129      break;
130    default:
131      assert( 0 );
132      break;
133  }
134
135  return result;
136}
137
[6771a9e7]138uint16_t         read_and_clear_irq(void)
[9c448e1]139{
[dac4208]140  uint16_t            irq;
[9c448e1]141
142  irq = (*SCORE603E_FPGA_VECT_DATA);
143
144  if ((irq & 0xffff0) != 0x10) {
[50f93fb]145    printk( "ERROR:: no irq data\n");
[9c448e1]146    return (irq | 0x80);
147  }
148
149  irq &=0xf;
150
151  return irq;
152}
Note: See TracBrowser for help on using the repository browser.