Example #1
0
void host_buffer_release( wiced_buffer_t buffer, wwd_buffer_dir_t direction )
{
    wiced_assert( "Error: Invalid buffer\n", buffer != NULL );

    if ( direction == WWD_NETWORK_TX )
    {
        NX_PACKET *nx_buffer = (NX_PACKET *) buffer;

        /* TCP transmit packet isn't returned immediately to the pool. The stack holds the packet temporarily
         * until ACK is received. Otherwise, the same packet is used for re-transmission.
         * Return prepend pointer to the original location which the stack expects (the start of IP header).
         * For other packets, resetting prepend pointer isn't required.
         */
        if ( nx_buffer->nx_packet_length > sizeof(wwd_buffer_header_t) + WWD_SDPCM_HEADER_TX_LENGTH + WICED_ETHERNET_SIZE )
        {
            if ( host_buffer_add_remove_at_front( &buffer, sizeof(wwd_buffer_header_t) + WWD_SDPCM_HEADER_TX_LENGTH + WICED_ETHERNET_SIZE ) != WWD_SUCCESS )
            {
                WPRINT_NETWORK_DEBUG(("Could not move packet pointer\r\n"));
            }
        }

        if ( NX_SUCCESS != nx_packet_transmit_release( nx_buffer ) )
        {
            WPRINT_NETWORK_ERROR(("Could not release packet - leaking buffer\n"));
        }
    }
    else
    {
        NX_PACKET *nx_buffer = (NX_PACKET *) buffer;
        if ( NX_SUCCESS != nx_packet_release( nx_buffer ) )
        {
            WPRINT_NETWORK_ERROR(("Could not release packet - leaking buffer\n"));
        }
    }
}
Example #2
0
/*@only@*//*@null@*/wwd_result_t wwd_bus_read_frame( wiced_buffer_t* buffer )
{
    uint32_t intstatus;
    void *p0 = NULL;
    uint16_t *hwtag;

    intstatus = read_intstatus();

    /* Handle DMA interrupts */
    if (intstatus & I_XI) {
        dma_tx_reclaim();
    }


    if ( rxactive_dma( ) == 0 )
    {
        refill_dma( );
        if ( rxactive_dma( ) != 0 )
        {
            int_enab();
        }
    }


        /* Handle DMA errors */
    if (intstatus & I_ERRORS) {
        refill_dma( );
        WPRINT_WWD_DEBUG(("RX errors: intstatus: 0x%x\n", (unsigned int)intstatus));
    }
    /* Handle DMA receive interrupt */
    p0 = read_dma_packet( &hwtag );
    if ( p0  == NULL)
    {

        if ( rxactive_dma( ) != 0 )
        {
            int_enab();
        }

        return WWD_NO_PACKET_TO_RECEIVE;
    }

    *buffer = p0;

    host_buffer_add_remove_at_front( buffer, - (int)sizeof(wwd_buffer_header_t) );
    wwd_sdpcm_update_credit((uint8_t*)hwtag);

    refill_dma( );
    /* where are buffers from dma_rx and dma_getnextrxp created? */

    return WWD_SUCCESS;



}
Example #3
0
/* Device data transfer functions */
wwd_result_t wwd_bus_send_buffer( wiced_buffer_t buffer )
{
    host_buffer_add_remove_at_front(&buffer, sizeof(wwd_buffer_header_t));
    dma_tx_data( buffer, host_buffer_get_current_piece_size( buffer ) );
    return WWD_SUCCESS;
}