Exemplo n.º 1
0
void _io_pcb_shm_tx_isr
    (
        /* [IN] the info structure */
        pointer     handle
    )
{
    IO_PCB_SHM_INFO_STRUCT_PTR     info_ptr;
    IO_PCB_STRUCT_PTR              pcb_ptr;
    IO_PCB_SHM_BUFFER_STRUCT_PTR   bd_ptr;
    IO_PCB_FRAGMENT_STRUCT_PTR     frag_ptr;
    uint_16                        num_frags;
    uint_32                        cntrl;

    info_ptr = (IO_PCB_SHM_INFO_STRUCT_PTR)handle;
    _int_disable();

    while (info_ptr->TXENTRIES < info_ptr->TX_LENGTH) {

        /* Get the address of the Tx descriptor */
        bd_ptr = &info_ptr->TX_RING_PTR[info_ptr->TXLAST];
        _DCACHE_INVALIDATE_LINE(bd_ptr);
        pcb_ptr = (IO_PCB_STRUCT_PTR) _bsp_ptov(bd_ptr->PACKET_PTR);
        cntrl = bd_ptr->CONTROL;

        /* Make sure the buffer is released by remote CPU */
        if (cntrl != IO_PCB_SHM_BUFFER_ALOCATED) {
            break;
        }

       // Have to restore virtual addresses to free fragments
       num_frags = pcb_ptr->NUMBER_OF_FRAGMENTS;
       for(frag_ptr = (IO_PCB_FRAGMENT_STRUCT_PTR) &(pcb_ptr->FRAGMENTS[0]); num_frags; num_frags--, frag_ptr++)
       {
            frag_ptr->FRAGMENT = _bsp_ptov(frag_ptr->FRAGMENT);
       }

        /* Free PCB */
        _io_pcb_free(pcb_ptr);

        /* Update info */
        info_ptr->TX_PACKETS++;
        info_ptr->TXLAST = NEXT_INDEX(info_ptr->TXLAST, info_ptr->TX_LENGTH);
        info_ptr->TXENTRIES++;

    }

    /* Check if there is more to send */
    _io_pcb_shm_tx(handle);

    /* Enable Interrupts */
    _int_enable();

}
Exemplo n.º 2
0
_mqx_int _io_pcb_shm_write
    (
        /* [IN] the file descriptor */
        FILE_DEVICE_STRUCT_PTR  fd_ptr,

        /* [IN] the pcb address from which to write data */
        IO_PCB_STRUCT_PTR       pcb_ptr
    )
{
    IO_PCB_SHM_INFO_STRUCT_PTR info_ptr;

    info_ptr = fd_ptr->DEV_DATA_PTR;


    _queue_enqueue((QUEUE_STRUCT_PTR)((pointer)&info_ptr->WRITE_QUEUE),
        (QUEUE_ELEMENT_STRUCT_PTR)((pointer)&pcb_ptr->QUEUE));
    _DCACHE_FLUSH_MLINES(pcb_ptr, sizeof(IO_PCB_STRUCT));
    _io_pcb_shm_tx((pointer)info_ptr);

    return(MQX_OK);
}
Exemplo n.º 3
0
_mqx_int _io_pcb_shm_write
    (
        /* [IN] the file descriptor */
        FILE_DEVICE_STRUCT_PTR  fd_ptr,

        /* [IN] the pcb address from which to read data */
        char            *data_ptr,

        /* [IN] the number of characters to input */
        _mqx_int        num
    )
{
    IO_PCB_SHM_INFO_STRUCT_PTR info_ptr = fd_ptr->DEV_DATA_PTR;
    IO_PCB_STRUCT_PTR pcb_ptr = (IO_PCB_STRUCT_PTR)data_ptr;

    _queue_enqueue((QUEUE_STRUCT_PTR)((void *)&info_ptr->WRITE_QUEUE),
        (QUEUE_ELEMENT_STRUCT_PTR)((void *)&pcb_ptr->QUEUE));
    _DCACHE_FLUSH_MLINES(pcb_ptr, sizeof(IO_PCB_STRUCT));
    _io_pcb_shm_tx((void *)info_ptr);

    return(MQX_OK);
}