PERFORCE change 132431 for review

Hans Petter Selasky hselasky at FreeBSD.org
Thu Jan 3 13:46:37 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=132431

Change 132431 by hselasky at hselasky_laptop001 on 2008/01/03 21:46:14

	
	Add some need structures to the USS820 header file, mostly
	copied from the AT9100 driver.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/uss820_dci.h#4 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/uss820_dci.h#4 (text+ko) ====

@@ -27,6 +27,8 @@
 #ifndef _USS820_DCI_H_
 #define	_USS820_DCI_H_
 
+#define	USS820_EP_MAX 8			/* maximum number of endpoints */
+
 #define	USS820_TXDAT 0x00		/* Transmit FIFO data */
 
 #define	USS820_TXCNTL 0x01		/* Transmit FIFO byte count low */
@@ -250,4 +252,127 @@
 #define	USS820_UNK1 0x1f		/* Unknown */
 #define	USS820_UNK1_UNKNOWN 0xFF
 
+#define	USS820_GET_REG(sc,reg) \
+  ((reg) << (sc)->sc_reg_shift)
+
+#define	USS820_WRITE_SHARED_1(sc, reg, data) do {	\
+    USS820_WRITE_1(sc, USS820_PEND, 1);			\
+    USS820_WRITE_1(sc, reg, data);			\
+    USS820_WRITE_1(sc, USS820_PEND, 0);			\
+} while (0)
+
+#define	USS820_READ_1(sc, reg) \
+  bus_space_read_1((sc)->sc_io_tag, (sc)->sc_io_hdl, \
+    USS820_GET_REG(sc,reg))
+
+#define	USS820_WRITE_1(sc, reg, data)	\
+  bus_space_write_1((sc)->sc_io_tag, (sc)->sc_io_hdl, \
+    USS820_GET_REG(sc,reg), data)
+
+struct uss820_dci_td;
+
+typedef uint8_t (uss820_dci_cmd_t)(struct uss820_dci_td *td);
+
+struct uss820_dci_td {
+	bus_space_tag_t io_tag;
+	bus_space_handle_t io_hdl;
+	struct uss820_dci_td *obj_next;
+	uss820_dci_cmd_t *func;
+	struct usbd_page_cache *pc;
+	uint32_t offset;
+	uint32_t remainder;
+	uint16_t max_packet_size;
+	uint8_t	rx_stat_reg;
+	uint8_t	rx_flag_reg;
+	uint8_t	tx_flag_reg;
+	uint8_t	rx_fifo_reg;
+	uint8_t	tx_fifo_reg;
+	uint8_t	rx_count_low_reg;
+	uint8_t	rx_count_high_reg;
+	uint8_t	tx_count_low_reg;
+	uint8_t	tx_count_high_reg;
+	uint8_t	rx_cntl_reg;
+	uint8_t	tx_cntl_reg;
+	uint8_t	ep_reg;
+	uint8_t	ep_index;
+	uint8_t	error:1;
+	uint8_t	alt_next:1;
+	uint8_t	short_pkt:1;
+	uint8_t	support_multi_buffer:1;
+	uint8_t	did_stall:1;
+};
+
+struct uss820_std_temp {
+	uss820_dci_cmd_t *func;
+	struct usbd_page_cache *pc;
+	struct uss820_dci_td *td;
+	struct uss820_dci_td *td_next;
+	uint32_t len;
+	uint32_t offset;
+	uint16_t max_frame_size;
+	uint8_t	short_pkt;
+	/*
+         * short_pkt = 0: transfer should be short terminated
+         * short_pkt = 1: transfer should not be short terminated
+         */
+	uint8_t	setup_alt_next;
+};
+
+struct uss820_dci_config_desc {
+	usb_config_descriptor_t confd;
+	usb_interface_descriptor_t ifcd;
+	usb_endpoint_descriptor_t endpd;
+} __packed;
+
+union uss820_hub_temp {
+	uWord	wValue;
+	usb_port_status_t ps;
+};
+
+struct uss820_flags {
+	uint8_t	change_connect:1;
+	uint8_t	change_suspend:1;
+	uint8_t	status_suspend:1;	/* set if suspended */
+	uint8_t	status_vbus:1;		/* set if present */
+	uint8_t	status_bus_reset:1;	/* set if reset complete */
+	uint8_t	clocks_off:1;
+	uint8_t	port_powered:1;
+	uint8_t	port_enabled:1;
+	uint8_t	d_pulled_up:1;
+	uint8_t	mcsr_feat:1;
+};
+
+struct uss820_dci_softc {
+	struct usbd_bus sc_bus;
+	union uss820_hub_temp sc_hub_temp;
+	LIST_HEAD(, usbd_xfer) sc_interrupt_list_head;
+	struct usbd_std_root_transfer sc_root_ctrl;
+	struct usbd_std_root_transfer sc_root_intr;
+	struct usbd_config_td sc_config_td;
+
+	struct resource *sc_io_res;
+	struct resource *sc_irq_res;
+	void   *sc_intr_hdl;
+	bus_size_t sc_io_size;
+	bus_space_tag_t sc_io_tag;
+	bus_space_handle_t sc_io_hdl;
+
+	uint8_t	sc_rt_addr;		/* root HUB address */
+	uint8_t	sc_dv_addr;		/* device address */
+	uint8_t	sc_conf;		/* root HUB config */
+	uint8_t	sc_reg_shift;
+
+	uint8_t	sc_hub_idata[1];
+
+	struct uss820_flags sc_flags;
+};
+
+/* prototypes */
+
+usbd_status_t uss820_dci_init(struct uss820_dci_softc *sc);
+void	uss820_dci_uninit(struct uss820_dci_softc *sc);
+void	uss820_dci_suspend(struct uss820_dci_softc *sc);
+void	uss820_dci_resume(struct uss820_dci_softc *sc);
+void	uss820_dci_interrupt(struct uss820_dci_softc *sc);
+
 #endif					/* _USS820_DCI_H_ */


More information about the p4-projects mailing list