Ejemplo n.º 1
0
// For now the DSR does nothing. 
static void
ps2_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
{
    CYG_UNUSED_PARAM(cyg_vector_t, vector);
    CYG_UNUSED_PARAM(cyg_ucount32, count);
    CYG_UNUSED_PARAM(cyg_addrword_t, data);
}
Ejemplo n.º 2
0
Cyg_ErrNo
cyg_devio_select(cyg_io_handle_t handle, cyg_uint32 which, CYG_ADDRWORD info)
{
    CYG_UNUSED_PARAM(cyg_io_handle_t, handle);
    CYG_UNUSED_PARAM(cyg_uint32, which);
    CYG_UNUSED_PARAM(CYG_ADDRWORD, info);
    return -EDEVNOSUPP;
}
Ejemplo n.º 3
0
Cyg_ErrNo
cyg_devio_set_config(cyg_io_handle_t handle, cyg_uint32 key,
                     void* buf, cyg_uint32* len)
{
    CYG_UNUSED_PARAM(cyg_io_handle_t, handle);
    CYG_UNUSED_PARAM(cyg_uint32, key);
    CYG_UNUSED_PARAM(void*, buf);
    CYG_UNUSED_PARAM(cyg_uint32*, len);
    return -EDEVNOSUPP;
}
Ejemplo n.º 4
0
static void handler0(cyg_addrword_t data, cyg_code_t number, cyg_addrword_t info)
{
    CYG_TEST_INFO("handler 0 called");
    
    CYG_TEST_CHECK((cyg_addrword_t)123 == data, "handler given wrong data");
    
    // ignore machine specific stuff
    CYG_UNUSED_PARAM(cyg_code_t, number);
    CYG_UNUSED_PARAM(cyg_addrword_t, info);

    CYG_TEST_PASS_FINISH("Except 1 OK");
}
Ejemplo n.º 5
0
static cyg_uint32 isr0(cyg_vector_t vector, cyg_addrword_t data)
{
    CYG_UNUSED_PARAM(cyg_addrword_t, data);

    cyg_interrupt_acknowledge(vector);
    return 0;
}
Ejemplo n.º 6
0
// A dummy query routine. The implementation of this is specific to
// each device driver, so some device drivers may choose to do
// nothing.
size_t
cyg_flash_devfn_query_nop(struct cyg_flash_dev* dev, void* data, size_t len)
{
    CYG_UNUSED_PARAM(struct cyg_flash_dev*, dev);
    CYG_UNUSED_PARAM(void*, data);
    CYG_UNUSED_PARAM(size_t, len);
    return 0;
}
Ejemplo n.º 7
0
static void handler1(cyg_addrword_t data, cyg_code_t number, cyg_addrword_t info)
{
    CYG_TEST_INFO("handler 1 called");

    CYG_TEST_CHECK((cyg_addrword_t)&d0 == data, "handler given wrong data");

#ifdef CYGSEM_KERNEL_EXCEPTIONS_DECODE
    CYG_TEST_CHECK(number == CYGNUM_HAL_EXCEPTION_MAX, "handler given wrong number");
#else
    CYG_UNUSED_PARAM(cyg_code_t, number);
#endif

    CYG_TEST_CHECK((cyg_addrword_t)99 == info, "handler given wrong info");
}
Ejemplo n.º 8
0
int
cyg_flash_devfn_unlock_nop(struct cyg_flash_dev* dev, const cyg_flashaddr_t addr)
{
    CYG_UNUSED_PARAM(struct cyg_flash_dev*, dev);
    CYG_UNUSED_PARAM(cyg_flashaddr_t, addr);
#if defined(CYGHWR_IO_FLASH_BLOCK_LOCKING) && (1 < CYGHWR_IO_FLASH_DEVICE)
// If we've been built with locking, and there's more than one flash
// device in the system, then this is probably only being called because
// we can't tell what devices do and don't support locking, and for a _nop
// function this is the device that doesn't support locking. So we don't
// complain if we're asked to.
    return CYG_FLASH_ERR_OK;
#else
    return CYG_FLASH_ERR_DRV_WRONG_PART;
#endif
}
Ejemplo n.º 9
0
static cyg_uint32 isr1(cyg_vector_t vector, cyg_addrword_t data)
{
    CYG_UNUSED_PARAM(cyg_vector_t, vector);
    CYG_UNUSED_PARAM(cyg_addrword_t, data);
    return 0;
}
Ejemplo n.º 10
0
static cyg_uint32
ps2_isr(cyg_vector_t isr_vector, cyg_addrword_t isr_data)
{
    int             status;
    unsigned char   data;

    CYG_UNUSED_PARAM(cyg_addrword_t, isr_data);

    HAL_READ_UINT8(KC_STATUS, status);
    while (status & KC_STATUS_OUTB) {
        HAL_READ_UINT8(KC_OUTPUT, data);
        
        if (status & KC_STATUS_AUXB) {
            // Data from the mouse. This will be either an ACK for a
            // command, a resend request, or a byte for the current
            // packet. When a complete 8-byte packet has been received
            // it can be processed. When an ACK is received the next
            // byte for the current command should get sent, or on
            // completion the sending code can be woken up.
            //
            // The mouse can also send back other data, e.g. in response
            // to a determine-status request. These are disallowed
            // because there is no obvious way of separating out such
            // data from a current mouse packet being transferred.
            //
            // There may also be special bytes sent for disconnect and
            // reconnect. It is not clear how to distinguish those
            // from packet data either.
            if (ps2_command_mouse_waiting_for_ack && ((KC_MOUSE_ACK == data) || (KC_MOUSE_RESEND == data))) {
                int tmp;
                
                if (KC_MOUSE_ACK == data) {
                    // Is there another byte to be sent?
                    ps2_command_index++;
                    if (ps2_command_index < ps2_command_length) {
                        // Send the next byte for the current command
                        do {
                            HAL_READ_UINT8(KC_STATUS, tmp);
                        } while (tmp & KC_STATUS_INPB);
                        HAL_WRITE_UINT8(KC_CONTROL, KC_CONTROL_WRITE_AUX);
                        do {
                            HAL_READ_UINT8(KC_STATUS, tmp);
                        } while (tmp & KC_STATUS_INPB);
                        HAL_WRITE_UINT8(KC_INPUT, ps2_command[ps2_command_index]);
                    } else {
                        // The whole command has been sent and acknowledged.
                        // Allow the polling thread to resume.
                        ps2_command_index   = 0;
                        ps2_command_length  = 0;
                        ps2_command         = NULL;
                        ps2_command_ack     = 1;
                        ps2_command_mouse_waiting_for_ack = 0;
                    }
                } else {
                    // A resend request for the current byte.
                    do {
                        HAL_READ_UINT8(KC_STATUS, tmp);
                    } while (tmp & KC_STATUS_INPB);
                    HAL_WRITE_UINT8(KC_CONTROL, KC_CONTROL_WRITE_AUX);
                    do {
                        HAL_READ_UINT8(KC_STATUS, tmp);
                    } while (tmp & KC_STATUS_INPB);
                    HAL_WRITE_UINT8(KC_INPUT, ps2_command[ps2_command_index]);
                }
            } else {
                ps2mou_buffer[ps2mou_buffer_index++] = data;
                if (ps2mou_packet_size == ps2mou_buffer_index) {
                    // A complete packet has been received.
                    ps2mou_synaptics_translate();
                    ps2mou_buffer_index = 0;    // Ready for the next packet
                }
            }
        } else {
            // Data from the keyboard. Usually this will be a scancode.
            // There are a number of other possibilities such as
            // echo replies, resend requests, and acks.
            if ((KC_KBD_ACK == data) && (NULL != ps2_command) && !ps2_command_mouse_waiting_for_ack) {
                // Send the next byte for the current command, or
                // else we have completed.
                ps2_command_index++;
                if (ps2_command_index < ps2_command_length) {
                    int tmp;
                    do {
                        HAL_READ_UINT8(KC_STATUS, tmp);
                    } while (tmp & KC_STATUS_INPB);
                    HAL_WRITE_UINT8(KC_INPUT, ps2_command[ps2_command_index]);
                } else {
                    ps2_command_index   = 0;
                    ps2_command_length  = 0;
                    ps2_command         = NULL;
                    ps2_command_ack     = 1;
                }
            } else if ((KC_KBD_RESEND == data) && (NULL != ps2_command) && !ps2_command_mouse_waiting_for_ack) {
                int tmp;
                do {
                    HAL_READ_UINT8(KC_STATUS, tmp);
                } while (tmp & KC_STATUS_INPB);
                HAL_WRITE_UINT8(KC_INPUT, ps2_command[ps2_command_index]);
            } else {
                if (((ps2kbd_scancode_buffer_head + 1) % PS2KBD_SCANCODE_BUFSIZE) == ps2kbd_scancode_buffer_tail) {
                    // Already full. The data has to be discarded.
                } else {
                    ps2kbd_scancode_buffer[ps2kbd_scancode_buffer_head] = data;
                    ps2kbd_scancode_buffer_head = (ps2kbd_scancode_buffer_head + 1) % PS2KBD_SCANCODE_BUFSIZE;
                }
            }
        }

        // Just in case the keyboard controller is fast enough to send another byte,
        // go around again.
        HAL_READ_UINT8(KC_STATUS, status);
    }

    // The interrupt has been fully handled. For now there is no point
    // in running a DSR.
    cyg_drv_interrupt_acknowledge(isr_vector);
    return CYG_ISR_HANDLED;
}
Ejemplo n.º 11
0
static void entry0( CYG_ADDRWORD data )
{
#ifdef EXCEPTION_DATA_ACCESS
    cyg_code_t n;
#endif
    cyg_exception_handler_t *old_handler, *old_handler1;
    cyg_addrword_t old_data, old_data1;

    CYG_UNUSED_PARAM(CYG_ADDRESS, data);

    cyg_exception_set_handler(
        CYGNUM_HAL_EXCEPTION_MAX, 
        &handler1,
        (cyg_addrword_t)&d0,
        &old_handler,
        &old_data);

    cyg_exception_set_handler(
        CYGNUM_HAL_EXCEPTION_MAX, 
        &handler1,
        (cyg_addrword_t)&d0,
        &old_handler1,
        &old_data1);
    
    CYG_TEST_CHECK(old_handler1 == &handler1,
        "register exception: old_handler not the one previously registered");
    CYG_TEST_CHECK(old_data1 == (cyg_addrword_t)&d0,
        "register exception: old_data not those previously registered");

    cyg_exception_call_handler(
        cyg_thread_self(),
        CYGNUM_HAL_EXCEPTION_MAX,
        (cyg_addrword_t)99);

    CYG_TEST_INFO("handler 1 returned");

    cyg_exception_clear_handler(CYGNUM_HAL_EXCEPTION_MAX);
    cyg_exception_clear_handler(CYGNUM_HAL_EXCEPTION_MAX);

#ifdef EXCEPTION_DATA_ACCESS

#if 0
#elif defined(CYGPKG_HAL_POWERPC_SIM)
    // The exception generated by the SIM is not recognized by GDB.
    // PR 19945 workaround.
    CYG_TEST_NA("Not applicable to PowerPC SIM");
#endif

    for(n = CYGNUM_HAL_EXCEPTION_MIN; n <= CYGNUM_HAL_EXCEPTION_MAX; n++) {
        cyg_exception_set_handler(
            n,
            handler0,
            (cyg_addrword_t)123, 
            &old_handler1,
            &old_data1);
    }

    CYG_TEST_PASS("Attempting to provoke exception");

    cause_exception();

    CYG_TEST_FAIL_FINISH("Couldn't cause exception");
#else // EXCEPTION_DATA_ACCESS
    CYG_TEST_NA("Platform does not support data exceptions");
#endif
}