示例#1
0
externC void
hal_variant_IRQ_init(void)
{
  // Mask off everything. This guarantees that we can safely install a handler on the decrementer
  // later on
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_IRQ0);
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_IRQ1);
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_IRQ2);
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_IRQ3);
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_IRQ4);
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_IRQ5);
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_IRQ6);
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_IRQ7);
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_LVL0);
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_LVL1);
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_LVL2);
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_LVL3);
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_LVL4);
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_LVL5);
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_LVL6);
  HAL_INTERRUPT_MASK(CYGNUM_HAL_INTERRUPT_SIU_LVL7);
  
#ifdef CYGSEM_HAL_POWERPC_MPC5XX_IMB3_ARBITER  
  HAL_INTERRUPT_ATTACH(CYGNUM_HAL_INTERRUPT_SIU_LVL7, hal_arbitration_imb3, &imb3_data_head, 0);
  HAL_INTERRUPT_UNMASK(CYGNUM_HAL_INTERRUPT_SIU_LVL7);
#endif

#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) \
     || defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT)
  // GDB-CTRLC
  // Install a default arbiter for serial interrupts. This allows
  // to make a boot monitor simply turn on the required Rx interrupt
  // and still be delivered the necessary default isr. Without this,
  // redboot would be informed of a level interrupt on the SIU instead
  // of the Rx interrupt that really happened.
  // Make sure the interrupts are set up on the correct level
  sci_arbiter.priority = CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI;
  sci_arbiter.data    = 0;
  sci_arbiter.arbiter = hal_arbitration_isr_sci;

  hal_mpc5xx_install_arbitration_isr(&sci_arbiter);
  HAL_INTERRUPT_SET_LEVEL(CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX, CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI);	
  HAL_INTERRUPT_SET_LEVEL(CYGNUM_HAL_INTERRUPT_IMB3_SCI0_RX, CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI);	
#endif
}
示例#2
0
static bool mpc555_serial_init(struct cyg_devtab_entry * tab)
{
   serial_channel * chan = (serial_channel *)tab->priv;
   mpc555_serial_info * mpc555_chan = (mpc555_serial_info *)chan->dev_priv;

   if(!mpc555_serial_config_port(chan, &chan->config, true))
     return false;

   (chan->callbacks->serial_init)(chan);  // Really only required for interrupt driven devices
   if(chan->out_cbuf.len != 0)
   { 
     arbiter.priority = CYGNUM_HAL_ISR_SOURCE_PRIORITY_QSCI;
     arbiter.data     = 0;
     arbiter.arbiter  = hal_arbitration_isr_qsci;
     
     // Install the arbitration isr, Make sure that is is not installed twice
     hal_mpc5xx_remove_arbitration_isr(&arbiter);
     hal_mpc5xx_install_arbitration_isr(&arbiter); 

     // Create the Tx interrupt, do not enable it yet
     cyg_drv_interrupt_create(mpc555_chan->tx_interrupt_num,
                              mpc555_chan->tx_interrupt_priority,
                              (cyg_addrword_t)chan,   //  Data item passed to interrupt handler
                              mpc555_serial_tx_ISR,
                              mpc555_serial_tx_DSR,
                              &mpc555_chan->tx_interrupt_handle,
                              &mpc555_chan->tx_interrupt);
     cyg_drv_interrupt_attach(mpc555_chan->tx_interrupt_handle);

     // Create the Rx interrupt, this can be safely unmasked now
     cyg_drv_interrupt_create(mpc555_chan->rx_interrupt_num,
                              mpc555_chan->rx_interrupt_priority,
                              (cyg_addrword_t)chan,
                              mpc555_serial_rx_ISR,
                              mpc555_serial_rx_DSR,
                              &mpc555_chan->rx_interrupt_handle,
                              &mpc555_chan->rx_interrupt);
     cyg_drv_interrupt_attach(mpc555_chan->rx_interrupt_handle);
     cyg_drv_interrupt_unmask(mpc555_chan->rx_interrupt_num);
    }

    return true;
}