static void updateIrqLines() {
  if (shouldTriggerIrq == 1) {
    shouldTriggerIrq = 0;
    info("IRQ ON");
    ppmWriteNet(irqHandle, 1);
    bhmWaitDelay(10.0);
    ppmWriteNet(irqHandle, 0);

    info("IRQ OFF");
  }
}
Example #2
0
static void sendErrorInterrupt(Uns32 chNum)
{
    if (isBitSet(chReg->EEI.value, chNum))
    {
        ppmWriteNet(handles.errorInterrupt, 1);
    }
}
Example #3
0
//
// Write the Interrupt if the value changes
//
void write_Interrupt(Uns32 value) {
    if (state.Interrupt != value) {
        state.Interrupt = value;
        if (BHM_DIAG_HIGH) bhmMessage("I", PREFIX, "Setting Interrupt=%d @ %eUS", state.Interrupt, bhmGetCurrentTime());
        ppmWriteNet(handles.Interrupt, state.Interrupt);
    }
}
void loop() {

  while (1) {

    while (regs.STATE == RADIO_STATE_STATE_Disabled) {
      bhmWaitEvent(txenEventHandle);
    }

    if (regs.STATE == RADIO_STATE_STATE_TxRu) {
      bhmWaitDelay( 90.0 ); // in uS
      info("READY EVENT!!!");
      stateTransit(READY); // idle state
      regs.EVENTS_READY = 1;
      ppmWriteNet(ppiNotificationHandle, RADIO_PERIPHERAL_ID);
    } else if (regs.STATE == RADIO_STATE_STATE_TxIdle) {
      // ?
    } else if (regs.STATE == RADIO_STATE_STATE_Tx) {
      stateTransit(ADDRESS); // address sent state
      regs.EVENTS_ADDRESS = 1;
      ppmWriteNet(ppiNotificationHandle, RADIO_PERIPHERAL_ID);
      bhmWaitDelay( 20.0 ); // in uS
      stateTransit(PAYLOAD); // payload sent state
      bhmWaitDelay( 170.0 ); // in uS
      regs.EVENTS_PAYLOAD = 1;
      ppmWriteNet(ppiNotificationHandle, RADIO_PERIPHERAL_ID);
      bhmWaitDelay( 20.0 ); // in uS
      stateTransit(END); // end state
      regs.EVENTS_END = 1;
      ppmWriteNet(ppiNotificationHandle, RADIO_PERIPHERAL_ID);
    } else if (regs.STATE == RADIO_STATE_STATE_TxDisable) {

      stateTransit(FULLY_DISABLED); // fully disabled state
      regs.EVENTS_DISABLED = 1;
      ppmWriteNet(ppiNotificationHandle, RADIO_PERIPHERAL_ID);
    }

    updateIrqLines();

    bhmWaitDelay( 1.0 ); // in uS
  }

}
Example #5
0
static void sendDMADoneInterrupt(Uns32 chNum)
{
    if (tcdReg[chNum].TCD_CSR.bits.INTMAJOR == 1)
    {
        if (diagnosticLevel >= 2)
            bhmMessage("I", periphName, "Send DMA Interrupt for channel = %d", chNum);

        ppmWriteNet(tcdReg[chNum].dmaInterrupt, 1);
        setBits(&(chReg->INT.value), chNum, 1, "INT");
    }
}
Example #6
0
void update(void)
{
    Bool f = (int_level & int_enabled) && 1;
    static Bool current = 0;
    if(DIAG_HIGH) {
        bhmMessage("I", "PL011_UPDATE", "Int %d->%d (level 0x%02x enabled 0x%02x)", current, f, int_level, int_enabled);
    }
    if (f != current) {
        current = f;
        if(DIAG_HIGH) {
            bhmMessage("I", "PL011_INT", "%d", current);
        }
        ppmWriteNet(handles.irq, current);
    }
}
//
// Update the interrupt line according to the IntStatus register
//
static void updateInterrupt() {

    Bool interruptActive = (RVAL(IntStatus) != 0);

    // Has interrupt changed?
    if (interruptState != interruptActive) {

        ppmWriteNet(handles.Interrupt, interruptActive);
        interruptState = interruptActive;

        if (DIAG_HIGH) {
            bhmMessage(
                "I", PREFIX"_INT",
                "Interrupt %s",
                interruptState ? "set" : "cleared"
            );
        }
    }
}
//
// Nothing writes to this yet
//
void writeInt(Uns32 v) {
    if (intPortHandle) {
        ppmWriteNet(intPortHandle, v);
    }
}