📄 usb_bsp.h
字号:
/*
*********************************************************************************************************
* Micrium, Inc.
* 949 Crestview Circle
* Weston, FL 33327-1848
*
* uC/USB-Bulk
*
* (c) Copyright 2003 - 2004, Micrium, Inc.
* All rights reserved.
*
*********************************************************************************************************
---------------------------------------------------------------------------------------------------------
File : USB_bsp.h
Purpose : This file defines the macros used to access the SL811HS registers via its Avalon bus interface.
-------- END-OF-HEADER --------------------------------------------------------------------------------
*/
#include "system.h"
#include "sys/alt_irq.h"
#include "USB_Private.h"
#include "SL811HS_reg.h"
/*
*********************************************************************************************************
* Constants
*********************************************************************************************************
*/
/* These are the addresses of the registers on the SL811HS's */
/* Avalon bus interface. These registers are used for all reads */
/* and writes to the SL811HS */
#define USB_ADDR_REG (*(USB_U32 *)USB_BASE)
#define USB_DATA_REG (*(USB_U32 *)(USB_BASE + 4))
#define USB_CTRL_REG (*(USB_U32 *)(USB_BASE + 8))
/*
*********************************************************************************************************
* Register Access Macros
*********************************************************************************************************
*/
/* This macro can be used to write to a register on the SL811HS */
#define USB_REG_WR(Location, Data) \
USB_ADDR_REG = (Location); \
USB_DATA_REG = (Data)
/* This macro can be used to read from a register on the SL811HS */
#define USB_REG_RD(Location, Data) \
USB_ADDR_REG = (Location); \
(Data) = USB_DATA_REG
/* This macro can be used to reset the SL811HS */
#define USB_RESET() \
USB_CTRL_REG = 0x0008; \
USB_CTRL_REG = 0x0000
/*
********************************************************************************************************
* Prototypes
********************************************************************************************************
*/
USB_U8 USB_Reg_Wr_Buf(USB_U8 *pData, USB_U8 reg_addr, USB_U8 num_bytes);
void USB_Reg_Rd_Buf(USB_U8 *pData, USB_U8 reg_addr, USB_U8 num_bytes);
void USB_SL811HS_Init(void);
void USB_ISR_EP0(void);
void USB_ISR_Function(void);
void USB_ISR_Reset(void);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -