⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usb_regs.c

📁 STR912的usb例程
💻 C
📖 第 1 页 / 共 3 页
字号:
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
* File Name          : usb_regs.c
* Author             : MCD Application Team
* Date First Issued  : 2/6/2006
* Description        : Interface functions to USB cell registers
********************************************************************************
* History:
* 2/6/2006:  Beta Version V0.1
********************************************************************************
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*******************************************************************************/
#include "USB_lib.h"

/*******************************************************************************
* Function Name  : SetCNTR
* Description    : Sets the CNTR (Control Register)
* Input          : wRegValue = register value
* Output         : None
* Return         : None
*******************************************************************************/
void SetCNTR(WORD wRegValue)
{
  _SetCNTR(wRegValue);
}

/*******************************************************************************
* Function Name  : GetCNTR
* Description    : Gets the CNTR
* Input          : None
* Output         : None
* Return         : CNTR value
*******************************************************************************/
WORD GetCNTR(void)
{
  return(_GetCNTR());
}

/*******************************************************************************
* Function Name  : SetISTR
* Description    : Sets the ISTR
* Input          : wRegValue = register value
* Output         : None
* Return         : None
*******************************************************************************/
void SetISTR(WORD wRegValue)
{
  _SetISTR(wRegValue);
}

/*******************************************************************************
* Function Name  : GetISTR
* Description    : Gets the ISTR (Interrupt Status Register)
* Input          : None
* Output         : None
* Return         : ISTR register value
*******************************************************************************/
WORD GetISTR(void)
{
  return(_GetISTR());
}

/*******************************************************************************
* Function Name  : GetFNR
* Description    : Gets the FNR (Frame Number Register)
* Input          : None
* Output         : None
* Return         : FNR regiter value
*******************************************************************************/
WORD GetFNR(void)
{
  return(_GetFNR());
}

/*******************************************************************************
* Function Name  : SetDADDR
* Description    : Sets the DADDR (Device Address Register)
* Input          : wRegValue = register value
* Output         : None
* Return         : None
*******************************************************************************/
void SetDADDR(WORD wRegValue)
{
  _SetDADDR(wRegValue);
}

/*******************************************************************************
* Function Name  : GetDADDR
* Description    : Gets the DADDR (Device Address Register)
* Input          : None
* Output         : None
* Return         : DADDR register value
*******************************************************************************/
WORD GetDADDR(void)
{
  return(_GetDADDR());
}

/*******************************************************************************
* Function Name  : SetBTABLE
* Description    : Sets the BTABLE (Buffer Table Register)
* Input          : BTABLE value
* Output         : None
* Return         : None
*******************************************************************************/
void SetBTABLE(WORD wRegValue)
{
  _SetBTABLE(wRegValue);
}

/*******************************************************************************
* Function Name  : GetBTABLE
* Description    : Gets the BTABLE (Buffer Table Register)
* Input          : None
* Output         : None
* Return         : BTABLE value
*******************************************************************************/
WORD GetBTABLE(void)
{
  return(_GetBTABLE());
}

/*******************************************************************************
* Function Name  : SetENDPOINT
* Description    : Sets the Endpoint Register
* Input          : bEpNum = endpoint Number[0:9], wRegValue= register value
* Output         : None
* Return         : None
*******************************************************************************/
void SetENDPOINT(BYTE bEpNum, WORD wRegValue)
{
  _SetENDPOINT(bEpNum,wRegValue);
}

/*******************************************************************************
* Function Name  : GetENDPOINT
* Description    : Gets the Endpoint Register value
* Input          : bEpNum = endpoint number[0:9]
* Output         : None
* Return         : Endpoint register value
*******************************************************************************/
WORD GetENDPOINT(BYTE bEpNum)
{
  return(_GetENDPOINT(bEpNum));
}

/*******************************************************************************
* Function Name  : SetEPtype
* Description    : Sets the Endpoint Type
* Input          : - bEpNum = endpoint number[0:9]
*                  - wType  = endpint type:  EP_BULK,EP_CONTROL,EP_ISOCHRONOUS
*                  EP_INTERRUPT
* Output         : None
* Return         : None
*******************************************************************************/
void SetEPType(BYTE bEpNum, WORD wType)
{
  _SetEPType(bEpNum, wType);
}

/*******************************************************************************
* Function Name  : GetEPtype
* Description    : Gets the Endpoint type
* Input          : bEpNum = endpoint number[0:9]
* Output         : None
* Return         : Endpoint type: EP_BULK,EP_CONTROL,EP_ISOCHRONOUS
*                  EP_INTERRUPT
*******************************************************************************/
WORD GetEPType(BYTE bEpNum)
{
  return(_GetEPType(bEpNum));
}

/*******************************************************************************
* Function Name  : SetEPTxStatus
* Description    : Sets the endpoint Tx status
* Input          : - bEpNum = endpoint number[0:9]
*                  - wState = Tx status: EP_TX_DIS,EP_TX_STALL,EP_TX_NAK,EP_TX_VALID
* Output         : None
* Return         : None
*******************************************************************************/
void SetEPTxStatus(BYTE bEpNum, WORD wState)
{
  _SetEPTxStatus(bEpNum,wState);
}

/*******************************************************************************
* Function Name  : SetEPRxStatus
* Description    : Sets the endpoint Rx status
* Input          : - bEpNum = endpoint number[0:9]
*                  - wState = Rx status: EP_RX_DIS,EP_RX_STALL,EP_RX_NAK,EP_RX_VALID
* Output         : None
* Return         : None
*******************************************************************************/
void SetEPRxStatus(BYTE bEpNum, WORD wState)
{
  _SetEPRxStatus(bEpNum,wState);
}

/*******************************************************************************
* Function Name  : GetEPTxStatus
* Description    : Gets the endpoint Tx Status
* Input          : bEpNum = endpoint number[0:9]
* Output         : None
* Return         : Enpointx Tx Status: EP_TX_DIS,EP_TX_STALL,EP_TX_NAK,EP_TX_VALID
*******************************************************************************/
WORD GetEPTxStatus(BYTE bEpNum)
{
  return(_GetEPTxStatus(bEpNum));
}

/*******************************************************************************
* Function Name  : GetEPRxStatus
* Description    : Gets the endpoint Rx Status
* Input          : bEpNum = endpoint number[0:9]
* Output         : None
* Return         : Enpointx Rx Status: EP_RX_DIS,EP_RX_STALL,EP_RX_NAK,EP_RX_VALID
*******************************************************************************/
WORD GetEPRxStatus(BYTE bEpNum)
{
  return(_GetEPRxStatus(bEpNum));
}

/*******************************************************************************
* Function Name  : SetEPTxValid
* Description    : Sets the Endpoint Tx Status as valid
* Input          : bEpNum = endpoint number[0:9]
* Output         : None
* Return         : None
*******************************************************************************/
void SetEPTxValid(BYTE bEpNum)
{
  _SetEPTxStatus(bEpNum, EP_TX_VALID);
}

/*******************************************************************************
* Function Name  : SetEPRxStatus
* Description    : Sets the Endpoint Rx Status as valid
* Input          : bEpNum = endpoint number[0:9]
* Output         : None
* Return         : None
*******************************************************************************/
void SetEPRxValid(BYTE bEpNum)
{
  _SetEPRxStatus(bEpNum, EP_RX_VALID);
}

/*******************************************************************************
* Function Name  : SetEP_KIND
* Description    : Sets the Endpoint EP_KIND bit
* Input          : bEpNum = endpoint number[0:9]
* Output         : None
* Return         : None
*******************************************************************************/
void SetEP_KIND(BYTE bEpNum)
{
  _SetEP_KIND(bEpNum);
}

/*******************************************************************************
* Function Name  : ClearEP_KIND
* Description    : Clears the Endpoint EP_KIND bit
* Input          : bEpNum = endpoint number[0:9]
* Output         : None
* Return         : None
*******************************************************************************/
void ClearEP_KIND(BYTE bEpNum)
{
  _ClearEP_KIND(bEpNum);
}

/*******************************************************************************
* Function Name  : Clear_Status_Out
* Description    : Clears the Status_Out bit (= EP_KIND bit)
* Input          : bEpNum = endpoint number[0:9]
* Output         : None
* Return         : None
*******************************************************************************/
void Clear_Status_Out(BYTE bEpNum)
{
   _ClearEP_KIND(bEpNum);
}

/*******************************************************************************
* Function Name  : Set_Status_Out
* Description    : Sets the Status_Out bit (=EP_KIND bit)
* Input          : bEpNum = endpoint number[0:9]
* Output         : None
* Return         : None
*******************************************************************************/
void Set_Status_Out(BYTE bEpNum)
{
  _SetEP_KIND(bEpNum);
}

/*******************************************************************************
* Function Name  : SetEPDoubleBuff
* Description    : Sets the DBL_BUF bit (=EP_KIND bit)
* Input          : bEpNum = endpoint number[0:9]
* Output         : None
* Return         : None
*******************************************************************************/
void SetEPDoubleBuff(BYTE bEpNum)
{
   _SetEP_KIND(bEpNum);
}

/*******************************************************************************
* Function Name  : ClearEPDoubleBuff
* Description    : Clears the DBL_BUF bit (=EP_KIND bit)
* Input          : bEpNum = endpoint number[0:9]
* Output         : None
* Return         : None
*******************************************************************************/
void ClearEPDoubleBuff(BYTE bEpNum)
{
   _ClearEP_KIND(bEpNum);
}

/*******************************************************************************
* Function Name  : GetTxStallStatus
* Description    : checks if endpoint Tx status== STALL
* Input          : bEpNum: endpoint number[0:9]
* Output         : None
* Return         : TRUE or FALSE
*******************************************************************************/
BOOL GetTxStallStatus(BYTE bEpNum)
{
  return(_GetTxStallStatus(bEpNum));
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -