Example #1
0
rtems_status_code bsp_interrupt_facility_initialize(void)
{
    rtems_vector_number i = 0;
    uint32_t processor_id = ppc_processor_id();

    if (ppc_exc_set_handler(ASM_EXT_VECTOR, qoriq_external_exception_handler)) {
        return RTEMS_IO_ERROR;
    }

    if (processor_id == 0) {
        /* Core 0 must do the basic initialization */

        pic_reset();

        for (i = BSP_INTERRUPT_VECTOR_MIN; i <= BSP_INTERRUPT_VECTOR_MAX; ++i) {
            volatile uint32_t *base = (volatile uint32_t *) &qoriq.pic;
            int offs = vpr_and_dr_offsets [i] << 2;
            volatile uint32_t *vpr = base + offs;

            *vpr = VPR_MSK | VPR_P | VPR_PRIORITY(1) | VPR_VECTOR(i);

            if (!pic_is_ipi(i)) {
                volatile uint32_t *dr = base + offs + 4;

                *dr = 0x1;
            }
        }

        qoriq.pic.mer03 = 0xf;
        qoriq.pic.mer47 = 0xf;
        qoriq.pic.svr = SPURIOUS;
        qoriq.pic.gcr = GCR_M;

        pic_global_timer_init();
    }

    qoriq.pic.ctpr = 0;

    for (i = BSP_INTERRUPT_VECTOR_MIN; i <= BSP_INTERRUPT_VECTOR_MAX; ++i) {
        qoriq.pic.iack;
        qoriq.pic.eoi = 0;
        qoriq.pic.whoami;
    }

    return RTEMS_SUCCESSFUL;
}
Example #2
0
rtems_status_code bsp_interrupt_facility_initialize(void)
{
    rtems_vector_number i = 0;
    uint32_t processor_id = ppc_processor_id();

#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER
    if (ppc_exc_set_handler(ASM_EXT_VECTOR, qoriq_external_exception_handler)) {
        return RTEMS_IO_ERROR;
    }
#endif

    if (processor_id == 0) {
        /* Core 0 must do the basic initialization */

        pic_reset();

        for (i = BSP_INTERRUPT_VECTOR_MIN; i <= BSP_INTERRUPT_VECTOR_MAX; ++i) {
            volatile qoriq_pic_src_cfg *src_cfg = get_src_cfg(i);

            src_cfg->vpr = VPR_MSK | VPR_P | VPR_PRIORITY(1) | VPR_VECTOR(i);

            if (!pic_is_ipi(i)) {
                src_cfg->dr = 0x1;
            }
        }

        qoriq.pic.mer03 = 0xf;
        qoriq.pic.mer47 = 0xf;
        qoriq.pic.svr = SPURIOUS;
        qoriq.pic.gcr = GCR_M;

        pic_global_timer_init();
    }

    qoriq.pic.ctpr = 0;

    for (i = BSP_INTERRUPT_VECTOR_MIN; i <= BSP_INTERRUPT_VECTOR_MAX; ++i) {
        qoriq.pic.iack;
        qoriq.pic.eoi = 0;
        qoriq.pic.whoami;
    }

    return RTEMS_SUCCESSFUL;
}