Changeset 58563585 in mainline for uspace/lib/usbdev/src/request.c


Ignore:
Timestamp:
2016-08-31T11:15:39Z (9 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
10cb47e
Parents:
7a67416
Message:

code review and cstyle cleanup (no change in functionality)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/src/request.c

    r7a67416 r58563585  
    5050 * @see usb_pipe_control_write
    5151 *
    52  * @param pipe Pipe used for the communication.
     52 * @param pipe         Pipe used for the communication.
    5353 * @param request_type Request type (standard/class/vendor).
    54  * @param recipient Request recipient (e.g. device or endpoint).
    55  * @param request Actual request (e.g. GET_DESCRIPTOR).
    56  * @param value Value of @c wValue field of setup packet
    57  *      (must be in USB endianness).
    58  * @param index Value of @c wIndex field of setup packet
    59  *      (must be in USB endianness).
    60  * @param data Data to be sent during DATA stage
    61  *      (expected to be in USB endianness).
    62  * @param data_size Size of the @p data buffer (in native endianness).
     54 * @param recipient    Request recipient (e.g. device or endpoint).
     55 * @param request      Actual request (e.g. GET_DESCRIPTOR).
     56 * @param value        Value of @c wValue field of setup packet
     57 *                     (must be in USB endianness).
     58 * @param index        Value of @c wIndex field of setup packet
     59 *                     (must be in USB endianness).
     60 * @param data         Data to be sent during DATA stage
     61 *                     (expected to be in USB endianness).
     62 * @param data_size     Size of the @p data buffer (in native endianness).
     63 *
    6364 * @return Error code.
    6465 * @retval EBADMEM @p pipe is NULL.
    6566 * @retval EBADMEM @p data is NULL and @p data_size is not zero.
    6667 * @retval ERANGE Data buffer too large.
     68 *
    6769 */
    6870int usb_control_request_set(usb_pipe_t *pipe,
     
    100102}
    101103
    102  /** Generic wrapper for GET requests using standard control request format.
    103   *
    104   * @see usb_pipe_control_read
    105   *
    106   * @param pipe Pipe used for the communication.
    107   * @param request_type Request type (standard/class/vendor).
    108   * @param recipient Request recipient (e.g. device or endpoint).
    109   * @param request Actual request (e.g. GET_DESCRIPTOR).
    110   * @param value Value of @c wValue field of setup packet
    111   *     (must be in USB endianness).
    112   * @param index Value of @c wIndex field of setup packet
    113   *     (must be in USB endianness).
    114   * @param data Buffer where to store data accepted during the DATA stage.
    115   *     (they will come in USB endianness).
    116   * @param data_size Size of the @p data buffer
    117   *     (in native endianness).
    118   * @param actual_data_size Actual size of transfered data
    119   *     (in native endianness).
    120   * @return Error code.
    121   * @retval EBADMEM @p pipe is NULL.
    122   * @retval EBADMEM @p data is NULL and @p data_size is not zero.
    123   * @retval ERANGE Data buffer too large.
    124   */
     104/** Generic wrapper for GET requests using standard control request format.
     105 *
     106 * @see usb_pipe_control_read
     107 *
     108 * @param pipe             Pipe used for the communication.
     109 * @param request_type     Request type (standard/class/vendor).
     110 * @param recipient        Request recipient (e.g. device or endpoint).
     111 * @param request          Actual request (e.g. GET_DESCRIPTOR).
     112 * @param value            Value of @c wValue field of setup packet
     113 *                         (must be in USB endianness).
     114 * @param index            Value of @c wIndex field of setup packet
     115 *                         (must be in USB endianness).
     116 * @param data             Buffer where to store data accepted during
     117 *                         the DATA stage (they will come in USB endianness).
     118 * @param data_size        Size of the @p data buffer
     119 *                         (in native endianness).
     120 * @param actual_data_size Actual size of transfered data
     121 *                         (in native endianness).
     122 *
     123 * @return Error code.
     124 * @retval EBADMEM @p pipe is NULL.
     125 * @retval EBADMEM @p data is NULL and @p data_size is not zero.
     126 * @retval ERANGE Data buffer too large.
     127 *
     128 */
    125129int usb_control_request_get(usb_pipe_t *pipe,
    126130    usb_request_type_t request_type, usb_request_recipient_t recipient,
     
    209213{
    210214        if (request_type == USB_REQUEST_TYPE_STANDARD) {
    211                 if ((recipient == USB_REQUEST_RECIPIENT_DEVICE) && (index != 0))
    212                 {
     215                if ((recipient == USB_REQUEST_RECIPIENT_DEVICE) && (index != 0)) {
    213216                        return EINVAL;
    214217                }
     
    234237{
    235238        if (request_type == USB_REQUEST_TYPE_STANDARD) {
    236                 if ((recipient == USB_REQUEST_RECIPIENT_DEVICE) && (index != 0))
    237                 {
     239                if ((recipient == USB_REQUEST_RECIPIENT_DEVICE) && (index != 0)) {
    238240                        return EINVAL;
    239241                }
     
    271273        }
    272274
    273         /* The wValue field specifies the descriptor type in the high byte
     275        /*
     276         * The wValue field specifies the descriptor type in the high byte
    274277         * and the descriptor index in the low byte. USB 1.1 spec p. 189
    275278         */
Note: See TracChangeset for help on using the changeset viewer.