root / host / include / uhd / transport / usb_zero_copy.hpp @ 38746242
History | View | Annotate | Download (2.5 kB)
| 1 |
//
|
|---|---|
| 2 |
// Copyright 2010 Ettus Research LLC
|
| 3 |
//
|
| 4 |
// This program is free software: you can redistribute it and/or modify
|
| 5 |
// it under the terms of the GNU General Public License as published by
|
| 6 |
// the Free Software Foundation, either version 3 of the License, or
|
| 7 |
// (at your option) any later version.
|
| 8 |
//
|
| 9 |
// This program is distributed in the hope that it will be useful,
|
| 10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
// GNU General Public License for more details.
|
| 13 |
//
|
| 14 |
// You should have received a copy of the GNU General Public License
|
| 15 |
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 16 |
//
|
| 17 |
|
| 18 |
#ifndef INCLUDED_UHD_TRANSPORT_USB_ZERO_COPY_HPP
|
| 19 |
#define INCLUDED_UHD_TRANSPORT_USB_ZERO_COPY_HPP
|
| 20 |
|
| 21 |
#include <uhd/config.hpp> |
| 22 |
#include <uhd/types/usb_descriptor.hpp> |
| 23 |
#include <uhd/transport/zero_copy.hpp> |
| 24 |
#include <boost/shared_ptr.hpp> |
| 25 |
|
| 26 |
namespace uhd { namespace transport { |
| 27 |
|
| 28 |
/*!
|
| 29 |
* A zero copy usb transport provides an efficient way to handle data.
|
| 30 |
* by avoiding the extra copy when recv() or send() is called on the handle.
|
| 31 |
* Rather, the zero copy transport gives the caller memory references.
|
| 32 |
* The caller informs the transport when it is finished with the reference.
|
| 33 |
*
|
| 34 |
* On linux systems, the zero copy transport can use a kernel packet ring.
|
| 35 |
* If no platform specific solution is available, make returns a boost asio
|
| 36 |
* implementation that wraps functionality around standard send/recv calls.
|
| 37 |
*/
|
| 38 |
class UHD_API usb_zero_copy : public virtual zero_copy_if { |
| 39 |
public:
|
| 40 |
typedef boost::shared_ptr<usb_zero_copy> sptr;
|
| 41 |
|
| 42 |
/*!
|
| 43 |
* Make a new zero copy usb transport:
|
| 44 |
* This transport is for sending and receiving between the host
|
| 45 |
* and a pair of USB bulk transfer endpoints.
|
| 46 |
* The primary usage for this transport is data transactions.
|
| 47 |
* The underlying implementation may be platform specific.
|
| 48 |
*
|
| 49 |
* \param descriptor a USB descriptor identifying the device
|
| 50 |
* \param rx_endpoint an integer specifiying an IN endpoint number
|
| 51 |
* \param tx_endpoint an integer specifiying an OUT endpoint number
|
| 52 |
* \param buff_size total number of bytes of buffer space to allocate
|
| 53 |
* \param block_size number of bytes allocated for each I/O transaction
|
| 54 |
*/
|
| 55 |
static sptr make(usb_descriptor_t descriptor,
|
| 56 |
unsigned int rx_endpoint, |
| 57 |
unsigned int tx_endpoint, |
| 58 |
size_t buff_size = 0,
|
| 59 |
size_t block_size = 0);
|
| 60 |
}; |
| 61 |
|
| 62 |
}} //namespace
|
| 63 |
|
| 64 |
#endif /* INCLUDED_UHD_TRANSPORT_USB_ZERO_COPY_HPP */ |