Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/nick-nhusb]: src/sys Provide a USETWD macro for use with USB words desig...



details:   https://anonhg.NetBSD.org/src/rev/230a96a399f4
branches:  nick-nhusb
changeset: 334070:230a96a399f4
user:      skrll <skrll%NetBSD.org@localhost>
date:      Wed Dec 03 22:40:54 2014 +0000

description:
Provide a USETWD macro for use with USB words designated
initialisers.

diffstat:

 sys/arch/mips/adm5120/dev/ahci.c    |  17 ++++++++---------
 sys/dev/ic/sl811hs.c                |  20 ++++++++------------
 sys/dev/usb/ehci.c                  |  13 ++++++-------
 sys/dev/usb/ohci.c                  |  15 +++++++--------
 sys/dev/usb/uhci.c                  |  20 ++++++++------------
 sys/dev/usb/usb.h                   |   3 ++-
 sys/dev/usb/xhci.c                  |  17 ++++++++---------
 sys/external/bsd/dwc2/dwc2.c        |  11 +++++------
 sys/rump/dev/lib/libugenhc/ugenhc.c |  13 +++++++------
 9 files changed, 59 insertions(+), 70 deletions(-)

diffs (truncated from 414 to 300 lines):

diff -r b426e140880d -r 230a96a399f4 sys/arch/mips/adm5120/dev/ahci.c
--- a/sys/arch/mips/adm5120/dev/ahci.c  Wed Dec 03 22:33:56 2014 +0000
+++ b/sys/arch/mips/adm5120/dev/ahci.c  Wed Dec 03 22:40:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ahci.c,v 1.12.6.8 2014/12/03 14:18:07 skrll Exp $      */
+/*     $NetBSD: ahci.c,v 1.12.6.9 2014/12/03 22:40:54 skrll Exp $      */
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.12.6.8 2014/12/03 14:18:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.12.6.9 2014/12/03 22:40:54 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -554,11 +554,10 @@
 usb_config_descriptor_t ahci_confd = {
        .bLength = USB_CONFIG_DESCRIPTOR_SIZE,
        .bDescriptorType = UDESC_CONFIG,
-       .wTotalLength = {
-               USB_CONFIG_DESCRIPTOR_SIZE +
-               USB_INTERFACE_DESCRIPTOR_SIZE +
-               USB_ENDPOINT_DESCRIPTOR_SIZE,
-       },
+       .wTotalLength = USETWD(
+           USB_CONFIG_DESCRIPTOR_SIZE +
+           USB_INTERFACE_DESCRIPTOR_SIZE +
+           USB_ENDPOINT_DESCRIPTOR_SIZE),
        .bNumInterface = 1,
        .bConfigurationValue = 1,
        .iConfiguration = 0,
@@ -583,7 +582,7 @@
        .bDescriptorType = UDESC_ENDPOINT,
        .bEndpointAddress = UE_DIR_IN | AHCI_INTR_ENDPT,
        .bmAttributes = UE_INTERRUPT,
-       .wMaxPacketSize = {8},
+       .wMaxPacketSize = USETWD(8),
        .bInterval = 255
 };
 
@@ -591,7 +590,7 @@
        .bDescLength = USB_HUB_DESCRIPTOR_SIZE,
        .bDescriptorType = UDESC_HUB,
        .bNbrPorts = 2,
-       .wHubCharacteristics = { 0, 0 },
+       .wHubCharacteristics = USETWD(0),
        .bPwrOn2PwrGood = 0,
        .bHubContrCurrent = 0,
        .DeviceRemovable = { 0x00 },
diff -r b426e140880d -r 230a96a399f4 sys/dev/ic/sl811hs.c
--- a/sys/dev/ic/sl811hs.c      Wed Dec 03 22:33:56 2014 +0000
+++ b/sys/dev/ic/sl811hs.c      Wed Dec 03 22:40:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sl811hs.c,v 1.47.6.7 2014/12/03 14:18:07 skrll Exp $   */
+/*     $NetBSD: sl811hs.c,v 1.47.6.8 2014/12/03 22:40:55 skrll Exp $   */
 
 /*
  * Not (c) 2007 Matthew Orgass
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.47.6.7 2014/12/03 14:18:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.47.6.8 2014/12/03 22:40:55 skrll Exp $");
 
 #include "opt_slhci.h"
 
@@ -2957,11 +2957,10 @@
        .confd = {
                .bLength = USB_CONFIG_DESCRIPTOR_SIZE,
                .bDescriptorType = UDESC_CONFIG,
-               .wTotalLength = {
-                       USB_CONFIG_DESCRIPTOR_SIZE +
-                       USB_INTERFACE_DESCRIPTOR_SIZE +
-                       USB_ENDPOINT_DESCRIPTOR_SIZE
-               },
+               .wTotalLength = USETWD(
+                   USB_CONFIG_DESCRIPTOR_SIZE +
+                   USB_INTERFACE_DESCRIPTOR_SIZE +
+                   USB_ENDPOINT_DESCRIPTOR_SIZE),
                .bNumInterface = 1,
                .bConfigurationValue = 1,
                .iConfiguration = 0,
@@ -2984,7 +2983,7 @@
                .bDescriptorType = UDESC_ENDPOINT,
                .bEndpointAddress = UE_DIR_IN | ROOT_INTR_ENDPT,
                .bmAttributes = UE_INTERRUPT,
-               .wMaxPacketSize = {240, 0},
+               .wMaxPacketSize = USETWD(240),
                .bInterval = 255
        }
 };
@@ -2993,10 +2992,7 @@
        .bDescLength = USB_HUB_DESCRIPTOR_SIZE,
        .bDescriptorType = UDESC_HUB,
        .bNbrPorts = 1,
-       .wHubCharacteristics = {
-               UHD_PWR_INDIVIDUAL | UHD_OC_NONE,
-               0
-       },
+       .wHubCharacteristics = USETWD(UHD_PWR_INDIVIDUAL | UHD_OC_NONE),
        .bPwrOn2PwrGood = 50,
        .bHubContrCurrent = 0,
        .DeviceRemovable = { 0x00 },
diff -r b426e140880d -r 230a96a399f4 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Wed Dec 03 22:33:56 2014 +0000
+++ b/sys/dev/usb/ehci.c        Wed Dec 03 22:40:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.234.2.10 2014/12/03 13:19:38 skrll Exp $ */
+/*     $NetBSD: ehci.c,v 1.234.2.11 2014/12/03 22:40:55 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.10 2014/12/03 13:19:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.11 2014/12/03 22:40:55 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -2286,11 +2286,10 @@
 Static const usb_config_descriptor_t ehci_confd = {
        .bLength = USB_CONFIG_DESCRIPTOR_SIZE,
        .bDescriptorType = UDESC_CONFIG,
-       .wTotalLength = {
+       .wTotalLength = USETWD(
                USB_CONFIG_DESCRIPTOR_SIZE +
                USB_INTERFACE_DESCRIPTOR_SIZE +
-               USB_ENDPOINT_DESCRIPTOR_SIZE
-       },
+               USB_ENDPOINT_DESCRIPTOR_SIZE),
        .bNumInterface = 1,
        .bConfigurationValue = 1,
        .iConfiguration = 0,
@@ -2315,7 +2314,7 @@
        .bDescriptorType = UDESC_ENDPOINT,
        .bEndpointAddress = UE_DIR_IN | EHCI_INTR_ENDPT,
        .bmAttributes = UE_INTERRUPT,
-       .wMaxPacketSize = {8, 0},
+       .wMaxPacketSize = USETWD(8),
        .bInterval = 12
 };
 
@@ -2323,7 +2322,7 @@
        .bDescLength = USB_HUB_DESCRIPTOR_SIZE,
        .bDescriptorType = UDESC_HUB,
        .bNbrPorts = 0,
-       .wHubCharacteristics = {0,0},
+       .wHubCharacteristics = USETWD(0),
        .bPwrOn2PwrGood = 0,
        .bHubContrCurrent = 0,
        .DeviceRemovable = {""},
diff -r b426e140880d -r 230a96a399f4 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Wed Dec 03 22:33:56 2014 +0000
+++ b/sys/dev/usb/ohci.c        Wed Dec 03 22:40:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.254.2.9 2014/12/03 13:19:38 skrll Exp $     */
+/*     $NetBSD: ohci.c,v 1.254.2.10 2014/12/03 22:40:55 skrll Exp $    */
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.9 2014/12/03 13:19:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.10 2014/12/03 22:40:55 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2414,11 +2414,10 @@
 Static const usb_config_descriptor_t ohci_confd = {
        .bLength = USB_CONFIG_DESCRIPTOR_SIZE,
        .bDescriptorType = UDESC_CONFIG,
-       .wTotalLength = {
-               USB_CONFIG_DESCRIPTOR_SIZE +
-               USB_INTERFACE_DESCRIPTOR_SIZE +
-               USB_ENDPOINT_DESCRIPTOR_SIZE
-       },
+       .wTotalLength = USETWD(
+           USB_CONFIG_DESCRIPTOR_SIZE +
+           USB_INTERFACE_DESCRIPTOR_SIZE +
+           USB_ENDPOINT_DESCRIPTOR_SIZE),
        .bNumInterface = 1,
        .bConfigurationValue = 1,
        .iConfiguration = 0,
@@ -2443,7 +2442,7 @@
        .bDescriptorType = UDESC_ENDPOINT,
        .bEndpointAddress = UE_DIR_IN | OHCI_INTR_ENDPT,
        .bmAttributes = UE_INTERRUPT,
-       .wMaxPacketSize = {8, 0},
+       .wMaxPacketSize = USETWD(8),
        .bInterval = 255,
 };
 
diff -r b426e140880d -r 230a96a399f4 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Wed Dec 03 22:33:56 2014 +0000
+++ b/sys/dev/usb/uhci.c        Wed Dec 03 22:40:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci.c,v 1.264.4.9 2014/12/03 13:19:38 skrll Exp $     */
+/*     $NetBSD: uhci.c,v 1.264.4.10 2014/12/03 22:40:55 skrll Exp $    */
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.9 2014/12/03 13:19:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.10 2014/12/03 22:40:55 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -3346,11 +3346,10 @@
 const usb_config_descriptor_t uhci_confd = {
        .bLength = USB_CONFIG_DESCRIPTOR_SIZE,
        .bDescriptorType = UDESC_CONFIG,
-       .wTotalLength = {
-               USB_CONFIG_DESCRIPTOR_SIZE +
-               USB_INTERFACE_DESCRIPTOR_SIZE +
-               USB_ENDPOINT_DESCRIPTOR_SIZE
-       },
+       .wTotalLength = USETWD(
+           USB_CONFIG_DESCRIPTOR_SIZE +
+           USB_INTERFACE_DESCRIPTOR_SIZE +
+           USB_ENDPOINT_DESCRIPTOR_SIZE),
        .bNumInterface = 1,
        .bConfigurationValue = 1,
        .iConfiguration = 0,
@@ -3375,7 +3374,7 @@
        .bDescriptorType = UDESC_ENDPOINT,
        .bEndpointAddress = UE_DIR_IN | UHCI_INTR_ENDPT,
        .bmAttributes = UE_INTERRUPT,
-       .wMaxPacketSize = {8},
+       .wMaxPacketSize = USETWD(8),
        .bInterval = 255
 };
 
@@ -3383,10 +3382,7 @@
        .bDescLength = USB_HUB_DESCRIPTOR_SIZE,
        .bDescriptorType = UDESC_HUB,
        .bNbrPorts = 2,
-       .wHubCharacteristics = {
-               UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL,
-               0
-       },
+       .wHubCharacteristics = USETWD(UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL),
        .bPwrOn2PwrGood = 50,
        .bHubContrCurrent = 0,
        .DeviceRemovable = { 0x00 },
diff -r b426e140880d -r 230a96a399f4 sys/dev/usb/usb.h
--- a/sys/dev/usb/usb.h Wed Dec 03 22:33:56 2014 +0000
+++ b/sys/dev/usb/usb.h Wed Dec 03 22:40:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb.h,v 1.111.2.4 2014/12/03 14:18:07 skrll Exp $      */
+/*     $NetBSD: usb.h,v 1.111.2.5 2014/12/03 22:40:55 skrll Exp $      */
 /*     $FreeBSD: src/sys/dev/usb/usb.h,v 1.14 1999/11/17 22:33:46 n_hibma Exp $        */
 
 /*
@@ -78,6 +78,7 @@
 
 #define UGETW(w) ((w)[0] | ((w)[1] << 8))
 #define USETW(w,v) ((w)[0] = (uint8_t)(v), (w)[1] = (uint8_t)((v) >> 8))
+#define USETWD(val) { (uint8_t)(val), (uint8_t)((val) >> 8) }
 #define UGETDW(w) ((w)[0] | ((w)[1] << 8) | ((w)[2] << 16) | ((w)[3] << 24))
 #define USETDW(w,v) ((w)[0] = (uint8_t)(v), \
                     (w)[1] = (uint8_t)((v) >> 8), \
diff -r b426e140880d -r 230a96a399f4 sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c        Wed Dec 03 22:33:56 2014 +0000
+++ b/sys/dev/usb/xhci.c        Wed Dec 03 22:40:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci.c,v 1.28.2.9 2014/12/03 22:33:56 skrll Exp $      */
+/*     $NetBSD: xhci.c,v 1.28.2.10 2014/12/03 22:40:55 skrll Exp $     */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.28.2.9 2014/12/03 22:33:56 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.28.2.10 2014/12/03 22:40:55 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -2030,11 +2030,10 @@
 static const usb_config_descriptor_t xhci_confd = {
        .bLength = USB_CONFIG_DESCRIPTOR_SIZE,
        .bDescriptorType = UDESC_CONFIG,
-       .wTotalLength = {
-               USB_CONFIG_DESCRIPTOR_SIZE +
-               USB_INTERFACE_DESCRIPTOR_SIZE +
-               USB_ENDPOINT_DESCRIPTOR_SIZE
-       },
+       .wTotalLength = USETWD(



Home | Main Index | Thread Index | Old Index