📄 usbd_24x0.h
字号:
/* * A EEEE SSSS OOO PPPP * A A E S O O P P * AAAAA EEEE SSSS O O PPPP * A A E S O O P * A A EEEE SSSS OOO P * * An Entertainment Solution On a Platform (AESOP) is a completely Open Source * based graphical user environment and suite of applications for PDAs and other * devices running Linux. It is included in various embedded Linux distributions * such as OpenZaurus - http://www.aesop-embedded.org * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Title : usbd_24x0.h * Author : * Created date : 2005. 06. 26. 23:08:22 KST * Description : * * $Revision: 1.1.1.1 $ * $Log: usbd_24x0.h,v $ * Revision 1.1.1.1 2005/06/27 17:04:30 linuxpark * Initial import. * * * */ #ident "@(*) $Header: /cvsroot/aesop-embedded/u-boot-aesop/board/aesop2440/usbd_24x0.h,v 1.1.1.1 2005/06/27 17:04:30 linuxpark Exp $"/* * Copyright (c) 2005 * Junyoung Song, kernelproject.org <jun0song@kornet.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */#ifndef __USBD_24X0_H__#define __USBD_24X0_H__/* Function Address Register */#define ADDR_UPDATE 0x80/* Power Management Register */#define DISABLE_SUSPEND 0x00#define ENABLE_SUSPEND 0x01#define SUSPEND_MODE 0x02a#define MCU_RESUME 0x04#define USB_RESET 0x08#define ISO_UPDATE (1<<7)/* Index Register */#define INDEX_EP0 0x00#define INDEX_EP1 0x01#define INDEX_EP2 0x02#define INDEX_EP3 0x03#define INDEX_EP4 0x04/* MAXP Register */#define FIFO_SIZE_0 0x00#define FIFO_SIZE_8 0x01#define FIFO_SIZE_16 0x02#define FIFO_SIZE_32 0x04#define FIFO_SIZE_64 0x08/* ENDPOINT0 */#define EP0_OUT_PKT_READY 0x01#define EP0_IN_PKT_READY 0x02#define EP0_SENT_STALL 0x04#define EP0_DATA_END 0x08#define EP0_SETUP_END 0x10#define EP0_SEND_STALL 0x20#define EP0_SERVICED_OUT_PKT_RDY 0x40#define EP0_SERVICED_SETUP_END 0x80#define EP0_WR_BITS 0xc0/* EP_INT_REG / EP_INT_EN_REG */#define EP0_INT 0x01#define EP1_INT 0x02#define EP2_INT 0x04#define EP3_INT 0x08#define EP4_INT 0x10/* USB_INT_REG / USB_INT_EN_REG */#define SUSPEND_INT 0x01#define RESUME_INT 0x02#define RESET_INT 0x04/* IN_CSR1 */#define EPI_IN_PKT_READY 0x01#define EPI_UNDER_RUN 0x04#define EPI_FIFO_FLUSH 0x08#define EPI_SEND_STALL 0x10#define EPI_SENT_STALL 0x20#define EPI_CDT 0x40#define EPI_WR_BITS (EPI_FIFO_FLUSH|EPI_IN_PKT_READY|EPI_CDT)/* IN_CSR2 */#define EPI_IN_DMA_INT_MASK (1<<4)#define EPI_MODE_IN (1<<5)#define EPI_MODE_OUT (0<<5)#define EPI_ISO (1<<6)#define EPI_BULK (0<<6)#define EPI_AUTO_SET (1<<7)/* OUT_CSR1 */#define EPO_OUT_PKT_READY 0x01 #define EPO_OVER_RUN 0x04 #define EPO_DATA_ERROR 0x08 #define EPO_FIFO_FLUSH 0x10#define EPO_SEND_STALL 0x20 #define EPO_SENT_STALL 0x40#define EPO_CDT 0x80 #define EPO_WR_BITS (EPO_FIFO_FLUSH|EPO_SEND_STALL|EPO_CDT)/* OUT_CSR2 */#define EPO_OUT_DMA_INT_MASK (1<<5)#define EPO_ISO (1<<6)#define EPO_BULK (0<<6)#define EPO_AUTO_CLR (1<<7)/* USB DMA control register */#define UDMA_IN_RUN_OB (1<<7)#define UDMA_IGNORE_TTC (1<<7)#define UDMA_DEMAND_MODE (1<<3)#define UDMA_OUT_RUN_OB (1<<2)#define UDMA_OUT_DMA_RUN (1<<2)#define UDMA_IN_DMA_RUN (1<<1)#define UDMA_DMA_MODE_EN (1<<0)/* endpoint packet size */#define EP0_PKT_SIZE 8#define EP1_PKT_SIZE 64#define EP2_PKT_SIZE 64/* endpoint buffer size */#define EP0_BUFF_SIZE 256#define BULK_BUFF_SIZE 512/* USBD Interrupt Flags */#define USBD_INT_EP0 0x01#define USBD_INT_EP1 0x02#define USBD_INT_EP2 0x04#define USBD_INT_RESET 0x08typedef enum {IDLE, SETUP, TRANS} ep0_state;typedef struct usbd_ep0_instance { ep0_state state; unsigned char length; unsigned char buff_ptr; unsigned char buff[EP0_BUFF_SIZE];} usbd_ep0_instance;/* Function Prototypes */void usbd_24x0_init_gpio(void);int usbd_24x0_check_vbus(void);int usbd_24x0_init_usb(void);void usbd_24x0_connect(void);void usbd_24x0_disconnect(void);int usbd_24x0_chk_int(void);void usbd_24x0_ep0_handler(usbd_ep0_instance *);void usbd_24x0_ep0_in_process(usbd_ep0_instance *);void usbd_24x0_clr_ep0_out_pkt_rdy(void);void usbd_24x0_clr_ep0_outpktrdy_dataend(void);void usbd_24x0_init_usb_reset(void);void usbd_24x0_set_address(unsigned char);unsigned char usbd_24x0_read_fifo(unsigned char *, unsigned char);void usbd_24x0_write_fifo(unsigned char *, unsigned char, unsigned char);void usbd_24x0_clr_ep1_sent_stall(void);void usbd_24x0_set_ep1_send_stall(void);void usbd_24x0_clr_ep2_sent_stall(void);void usbd_24x0_clr_ep2_out_pkt_ready(void);void usbd_24x0_set_ep2_send_stall(void);int usbd_24x0_get_cbw(unsigned char *);int usbd_24x0_isr_ep2_chk(void);int usbd_24x0_chk_ep2_stall(void);int usbd_24x0_chk_ep1_busy(void);int usbd_24x0_chk_ep1_stall(void);void usbd_24x0_set_ep1_in_pkt_ready(void);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -