Exemplo n.º 1
0
static void getChars(void *user)
{
    Uns8 c;

    while(1) {
        double d = DEFAULT_RX_DELAY;

        //
        // keep getting chars till we fill the fifo
        //
        bhmWaitDelay(d);
        while (!Rx.full) {
            Int32 bytes = readInput(&c, 1);
            if (bytes > 0) {
                //
                // We have got a char, so insert to buffer
                //
                fifoPush(&Rx, c);
                eval_interrupts();
            }
            bhmWaitDelay(d);
        }
        if (!Rx.empty) {
            eval_interrupts();
        }
    }
}
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
  }

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

    info("IRQ OFF");
  }
}
Exemplo n.º 4
0
int main(int argc, char **argv) {

    ppmDocNodeP Root1_node = ppmDocAddSection(0, "Root");
    {
        ppmDocNodeP doc2_node = ppmDocAddSection(Root1_node, "Description");
        ppmDocAddText(doc2_node, "Graphics card");
        ppmDocNodeP doc_12_node = ppmDocAddSection(Root1_node, "Licensing");
        ppmDocAddText(doc_12_node, "Open Source Apache 2.0");
        ppmDocNodeP doc_22_node = ppmDocAddSection(Root1_node, "Limitations");
        ppmDocAddText(doc_22_node, "This model has sufficient functionality to allow a Linux Kernel to Boot on the MIPS:MALTA platform. \n\
           The VGA peripheral utilises memory mapping.\n\
           This requires the use of ICM memory for the frame buffers, which currently may stop its use in SystemC TLM2 platforms.");
        ppmDocNodeP doc_32_node = ppmDocAddSection(Root1_node, "Reference");
        ppmDocAddText(doc_32_node, "cirrus CL GD 5446.pdf Version 2.0 November 1996");
    }

    // diagnostic levels > 3 are passed to the semihost library
    diagLevel = bhmGetDiagnosticLevel();

    if(ImperasTestModeTimeout(&ImperasTestTimeout)) {
        bhmCreateThread(ImperasTestModeTimeoutThread, 0, "ImperasTestModeTimeoutThread", &(testStack[TEST_STACK_SIZE]));
    }

    ISAconfigConnection(ISA_PORT_NAME);

    char title[32];
    char* titleP = 0;
    if (bhmStringAttribute("title", title, sizeof(title))) {
        titleP = title;
    }

    ds = displayInit(titleP);
    vs = cirrusInit( VGA_RAM_SIZE, RAM_PORT_NAME, CIRRUS_ID_CLGD5446);
    vgaDisplay(vs, ds);

    Uns32 delay = 200;
    bhmIntegerAttribute(SCAN_DELAY_ATTRIBUTE, &delay);
    pciInit();

    if (BHM_DIAG_LOW) {
        bhmCreateThread(endSimulation, 0, "end", STACK_TOP(endStack));
        bhmMessage("I", PREFIX, "Starting. Diagnostic level:%d. Scan delay:%d", diagLevel, delay);
    }

    while(1) {
        bhmWaitDelay(delay);
        updateDisplay();
        updates++;
    }
    return 0;
}
Exemplo n.º 5
0
//
// The polling process that gets characters
//
void getChars(void *user)
{
    while(1) {
        double d = DEFAULT_RX_DELAY;

        bhmWaitDelay(d);
        if (can_receive()) {
            Uns8 c;
            if (bhmSerRead(channel, &c, 1)) {
                bhmTriggerEvent(charReceived);
                receiveByte(c);
            }
        }
    }
}
Exemplo n.º 6
0
static void ImperasTestModeTimeoutThread(void *user) {
    bhmWaitDelay(ImperasTestTimeout*1000000); // timeout in seconds
    bhmFinish();
}