Changeset 7943c43 in mainline for uspace/lib/c/generic/device/nic.c


Ignore:
Timestamp:
2012-01-16T22:45:38Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
32817cc, 3fe58d3c
Parents:
9117ef9b (diff), 3ea725e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/device/nic.c

    r9117ef9b r7943c43  
    4444#include <ipc/services.h>
    4545
    46 /** Send a packet through the device
    47  *
    48  * @param[in] dev_sess
    49  * @param[in] packet_id Id of the sent packet
    50  *
    51  * @return EOK If the operation was successfully completed
    52  *
    53  */
    54 int nic_send_message(async_sess_t *dev_sess, packet_id_t packet_id)
    55 {
    56         async_exch_t *exch = async_exchange_begin(dev_sess);
    57         int rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
    58             NIC_SEND_MESSAGE, packet_id);
    59         async_exchange_end(exch);
    60        
    61         return rc;
     46/** Send frame from NIC
     47 *
     48 * @param[in] dev_sess
     49 * @param[in] data     Frame data
     50 * @param[in] size     Frame size in bytes
     51 *
     52 * @return EOK If the operation was successfully completed
     53 *
     54 */
     55int nic_send_frame(async_sess_t *dev_sess, void *data, size_t size)
     56{
     57        async_exch_t *exch = async_exchange_begin(dev_sess);
     58       
     59        ipc_call_t answer;
     60        aid_t req = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
     61            NIC_SEND_MESSAGE, &answer);
     62        sysarg_t retval = async_data_write_start(exch, data, size);
     63       
     64        async_exchange_end(exch);
     65       
     66        if (retval != EOK) {
     67                async_wait_for(req, NULL);
     68                return retval;
     69        }
     70
     71        async_wait_for(req, &retval);
     72        return retval;
    6273}
    6374
Note: See TracChangeset for help on using the changeset viewer.