Ejemplo n.º 1
0
int main()
{
	log_init(1, "emu86.log");

        mem_init();

/*	load_rom("../rom/wdbios.rom", 0xc8000, 8192, "a39b2b1c3e298b3599995c353d16c3ad");*/
	load_rom("../rom/basicc11.f6", 0xf6000, 8192, "69e2bd1d08c893cbf841607c8749d5bd");
	load_rom("../rom/basicc11.f8", 0xf8000, 8192, "5f85ff5ea352c1ec11b084043fbb549e");
	load_rom("../rom/basicc11.fa", 0xfa000, 8192, "04a285d5dc8d86c60679e8f3c779dcc4");
	load_rom("../rom/basicc11.fc", 0xfc000, 8192, "b086a6980fc5736098269e62b59726ef");
	load_rom("../rom/pc081682.bin", 0xfe000, 8192, "1584aeaadebba4bc95783f1fa0fa3db8");

        cpu_init();
        pit_init();
        pic_init();
        dma_init();
        ppi_init();
        fdc_init();

        initscr();
        cbreak();
        noecho();
        nodelay(stdscr, TRUE);
        keypad(stdscr, TRUE);
	

	mainloop();
	endwin();
	return 0;
}
Ejemplo n.º 2
0
/** @brief Function for main application entry.
 */
int main(void)
{  
    gpiote_init();
    ppi_init();
    timer2_init();

    // Enable interrupt on Timer
    NVIC_EnableIRQ(TIMER2_IRQn);
    __enable_irq();

    // Enabling constant latency as indicated by PAN 11 "HFCLK: Base current with HFCLK 
    // running is too high" found at Product Anomaly document found at
    // https://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF51822/#Downloads
    //
    // @note This example does not go to low power mode therefore constant latency is not needed.
    //       However this setting will ensure correct behaviour when routing TIMER events through 
    //       PPI (shown in this example) and low power mode simultaneously.
    NRF_POWER->TASKS_CONSTLAT = 1;

    // Start the timer.
    NRF_TIMER2->TASKS_START = 1;
    while (true)
    {
        // Do nothing.
    }
}
Ejemplo n.º 3
0
static int __init ppi_adc_init(void) {
    int ret;
    
    ret = dma_init();
    if(ret) {
        return ret;
    }

    ret = ppi_init();
    if(ret) {
        dma_close();
        return ret;
    }
    
    ret = device_init();
    if(ret) {
        ppi_close();
        dma_close();
        return ret;
    }

    /* Disable everything */
    disable_dma(CH_PPI);
    bfin_write_PPI_CONTROL(bfin_read_PPI_CONTROL() & (~PORT_EN));

    SSYNC();

    return 0;
}
Ejemplo n.º 4
0
/**
 * @brief Function for application main entry.
 */
int main(void)
{
    gpiote_init();
    bsp_configuration();
    ppi_init();
    timer2_init();

    // Enabling constant latency as indicated by PAN 11 "HFCLK: Base current with HFCLK 
    // running is too high" found at Product Anomaly document found at
    // https://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF51822/#Downloads
    //
    // @note This example does not go to low power mode therefore constant latency is not needed.
    //       However this setting will ensure correct behaviour when routing TIMER events through 
    //       PPI (shown in this example) and low power mode simultaneously.
    NRF_POWER->TASKS_CONSTLAT = 1;

    // Enable interrupt on Timer 2.
    NVIC_EnableIRQ(TIMER2_IRQn);
    __enable_irq();

    // Workaround for PAN-73: Use of an EVENT from any TIMER module to trigger a TASK in GPIOTE or 
    // RTC using the PPI could fail under certain conditions.
    *(uint32_t *)0x4000AC0C = 1;    
    // Start the timer.
    NRF_TIMER2->TASKS_START = 1;

    while (true)
    {
        // Do nothing.
    }
}
Ejemplo n.º 5
0
void led_start(void)
{
    ppi_init();
    timer1_init();
    gpiote_init();

    NRF_TIMER1->TASKS_START = 1;
}
/**@brief   Function for starting flashing the LED.
 * @details This will start the TIMER1 and enable the GPIOTE task that toggles the LED.
 *          The PPI and GPIOTE configurations done by this app will make this action result in the
 *          flashing of the LED.
 * @pre Can only be called after the SoftDevice is enabled - uses nrf_soc API
 */
void led_start(void)
{
    nrf_gpio_cfg_output(ADVERTISING_LED);

    ppi_init();
    timer1_init();
    gpiote_init();

    NRF_TIMER1->TASKS_START = 1;
}
Ejemplo n.º 7
0
/**
 * @brief Function for application main entry.
 */
int main(void)
{
    timer0_init(); // Timer used to blink the LEDs.
    timer1_init(); // Timer to generate events on even number of seconds.
    timer2_init(); // Timer to generate events on odd number of seconds.
    ppi_init();    // PPI to redirect the event to timer start/stop tasks.

    uint32_t err_code;
    const app_uart_comm_params_t comm_params =
     {
         RX_PIN_NUMBER,
         TX_PIN_NUMBER,
         RTS_PIN_NUMBER,
         CTS_PIN_NUMBER,
         APP_UART_FLOW_CONTROL_ENABLED,
         false,
         UART_BAUDRATE_BAUDRATE_Baud115200
     };

    APP_UART_FIFO_INIT(&comm_params,
                    UART_RX_BUF_SIZE,
                    UART_TX_BUF_SIZE,
                    uart_error_handle,
                    APP_IRQ_PRIORITY_LOW,
                    err_code);

    APP_ERROR_CHECK(err_code);

    // Enabling constant latency as indicated by PAN 11 "HFCLK: Base current with HFCLK 
    // running is too high" found at Product Anomaly document found at
    // https://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF51822/#Downloads
    //
    // @note This example does not go to low power mode therefore constant latency is not needed.
    //       However this setting will ensure correct behaviour when routing TIMER events through 
    //       PPI (shown in this example) and low power mode simultaneously.
    NRF_POWER->TASKS_CONSTLAT = 1;
    
    // Start clock.
    nrf_drv_timer_enable(&timer0);
    nrf_drv_timer_enable(&timer1);
    nrf_drv_timer_enable(&timer2);

    // Loop and increment the timer count value and capture value into LEDs. @note counter is only incremented between TASK_START and TASK_STOP.
    while (true)
    {

        printf("Current count: %d\n\r", (int)nrf_drv_timer_capture(&timer0,NRF_TIMER_CC_CHANNEL0));

        /* increment the counter */
        nrf_drv_timer_increment(&timer0);

        nrf_delay_ms(100);
    }
}
Ejemplo n.º 8
0
/**
 * @brief Function for application main entry.
 */
int main(void)
{
    gpiote_init();                  // Configure a GPIO to toggle on a GPIOTE task.
    timer0_init();                  // Use TIMER0 to generate events every 200 ms.
    ppi_init();                     // Use a PPI channel to connect the event to the task automatically.

    NRF_TIMER0->TASKS_START = 1;    // Start event generation.

    while (true)
    {
        // Do Nothing - GPIO can be toggled without software intervention.
    }
}
Ejemplo n.º 9
0
/**
 * @brief Function for application main entry.
 */
int main(void)
{
    gpiote_init();
    ppi_init();
    timer1_init();

    NVIC_EnableIRQ(GPIOTE_IRQn);
    __enable_irq();

    while (true)
    {
        // Do nothing.
    }
}
Ejemplo n.º 10
0
int main(void)
{
  /* Intitialization */
  gpiote_init();
  ppi_init();
  timer2_init();

  /* Enable interrupt on Timer 2*/
  NVIC_EnableIRQ(TIMER2_IRQn);
  __enable_irq();

  /* Start clock */
  NRF_TIMER2->TASKS_START = 1;
  while (true)
  {
  }
}
Ejemplo n.º 11
0
void pwmout_init(pwmout_t* obj, PinName pin) {
    // determine the channel
    uint8_t pwmOutSuccess = 0;
    PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);

    MBED_ASSERT(pwm != (PWMName)NC);

        
    if(PWM_taken[(uint8_t)pwm]){
        for(uint8_t i = 1; !pwmOutSuccess && (i<NO_PWMS) ;i++){
            if(!PWM_taken[i]){
                pwm           = (PWMName)i;
                PWM_taken[i]  = 1;
                pwmOutSuccess = 1;
            }
        }
    }
    else{
        pwmOutSuccess           = 1;
        PWM_taken[(uint8_t)pwm] = 1;
    }
    
    if(!pwmOutSuccess){
        error("PwmOut pin mapping failed. All available PWM channels are in use.");
    }
    
    obj->pwm = pwm;
    obj->pin = pin;
    
    gpiote_init(pin,(uint8_t)pwm);
    ppi_init((uint8_t)pwm);
    
    if(pwm == 0){
        NRF_POWER->TASKS_CONSTLAT = 1;
    }
    
    timer_init((uint8_t)pwm);
    
    //default to 20ms: standard for servos, and fine for e.g. brightness control
    pwmout_period_ms(obj, 20);
    pwmout_write    (obj, 0);
    
}
Ejemplo n.º 12
0
ret_code_t nrf_drv_csense_init(nrf_drv_csense_config_t const * p_config, nrf_drv_csense_event_handler_t event_handler)
{
    ASSERT(m_csense.module_state == NRF_DRV_STATE_UNINITIALIZED);
    ASSERT(p_config->output_pin <= NUMBER_OF_PINS);

    ret_code_t err_code;

    if(p_config == NULL)
    {
        return NRF_ERROR_INVALID_PARAM;
    }

    if(event_handler == NULL)
    {
        return NRF_ERROR_INVALID_PARAM;
    }

    m_csense.busy = false;

#if USE_COMP == 0
    m_csense.output_pin = p_config->output_pin;
    nrf_gpio_cfg_output(m_csense.output_pin);
    nrf_gpio_pin_set(m_csense.output_pin);
#endif //COMP_PRESENT

    m_csense.event_handler = event_handler;

#if USE_COMP
    err_code = comp_init();
    if(err_code != NRF_SUCCESS)
    {
        return err_code;
    }
    err_code = timer_init();
    if(err_code != NRF_SUCCESS)
    {
        return err_code;
    }
    err_code = ppi_init();
    if(err_code != NRF_SUCCESS)
    {
        return err_code;
    }
#else
#ifdef ADC_PRESENT
    err_code = adc_init();
    if(err_code != NRF_SUCCESS)
    {
        return err_code;
    }
#elif defined(SAADC_PRESENT)
    err_code = saadc_init();
    if(err_code != NRF_SUCCESS)
    {
        return err_code;
    }
#endif //ADC_PRESENT
#endif //USE_COMP

    m_csense.module_state = NRF_DRV_STATE_INITIALIZED;

    return NRF_SUCCESS;
}