kopia lustrzana https://github.com/sq8vps/vp-digi
fix kiss rx bug
rodzic
52133c1a45
commit
55c83b046c
18
.project
18
.project
|
@ -26,5 +26,21 @@
|
|||
</natures>
|
||||
<linkedResources>
|
||||
|
||||
</linkedResources>
|
||||
<link>
|
||||
<name>USB_Device_Library/usbd_core.c</name>
|
||||
<type>1</type>
|
||||
<location>PARENT-2-PROJECT_LOC/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c</location>
|
||||
</link><link>
|
||||
<name>USB_Device_Library/usbd_ctlreq.c</name>
|
||||
<type>1</type>
|
||||
<location>PARENT-2-PROJECT_LOC/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c</location>
|
||||
</link><link>
|
||||
<name>USB_Device_Library/usbd_ioreq.c</name>
|
||||
<type>1</type>
|
||||
<location>PARENT-2-PROJECT_LOC/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c</location>
|
||||
</link><link>
|
||||
<name>USB_Device_Library/usbd_cdc.c</name>
|
||||
<type>1</type>
|
||||
<location>PARENT-2-PROJECT_LOC/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c</location>
|
||||
</link></linkedResources>
|
||||
</projectDescription>
|
||||
|
|
|
@ -79,6 +79,7 @@ ProjectManager.PreviousToolchain=SW4STM32
|
|||
ProjectManager.ProjectBuild=false
|
||||
ProjectManager.ProjectFileName=F103C8T6_DIGI_USB.ioc
|
||||
ProjectManager.ProjectName=F103C8T6_DIGI_USB
|
||||
ProjectManager.RegisterCallBack=
|
||||
ProjectManager.StackSize=0x400
|
||||
ProjectManager.TargetToolchain=SW4STM32
|
||||
ProjectManager.ToolChainLocation=
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<targetDefinitions>
|
||||
<board id="f103c8t6_digi_usb">
|
||||
<name>F103C8T6_DIGI_USB</name>
|
||||
<dbgIF>SWD</dbgIF>
|
||||
<dbgIF>JTAG</dbgIF>
|
||||
<dbgDEV>ST-Link</dbgDEV>
|
||||
<mcuId>stm32f103c8tx</mcuId>
|
||||
</board>
|
||||
|
|
|
@ -50,6 +50,7 @@ typedef struct
|
|||
uint16_t buftxrd, buftxwr; //tx buffer indexes
|
||||
Uart_mode mode; //uart mode
|
||||
uint8_t enabled;
|
||||
uint32_t kissTimer;
|
||||
} Uart;
|
||||
|
||||
Uart uart1, uart2;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/*
|
||||
This file is part of VP-Digi.
|
||||
|
||||
|
@ -34,6 +34,8 @@ GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with VP-Digi. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MAIN_H
|
||||
#define __MAIN_H
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F1xx_HAL_CONF_H
|
||||
|
@ -29,10 +29,10 @@
|
|||
|
||||
/* ########################## Module Selection ############################## */
|
||||
/**
|
||||
* @brief This is the list of modules to be used in the HAL driver
|
||||
* @brief This is the list of modules to be used in the HAL driver
|
||||
*/
|
||||
|
||||
#define HAL_MODULE_ENABLED
|
||||
|
||||
#define HAL_MODULE_ENABLED
|
||||
/*#define HAL_ADC_MODULE_ENABLED */
|
||||
/*#define HAL_CRYP_MODULE_ENABLED */
|
||||
/*#define HAL_CAN_MODULE_ENABLED */
|
||||
|
@ -80,9 +80,9 @@
|
|||
/**
|
||||
* @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (when HSE is used as system clock source, directly or through the PLL).
|
||||
* (when HSE is used as system clock source, directly or through the PLL).
|
||||
*/
|
||||
#if !defined (HSE_VALUE)
|
||||
#if !defined (HSE_VALUE)
|
||||
#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
|
||||
#endif /* HSE_VALUE */
|
||||
|
||||
|
@ -93,7 +93,7 @@
|
|||
/**
|
||||
* @brief Internal High Speed oscillator (HSI) value.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (when HSI is used as system clock source, directly or through the PLL).
|
||||
* (when HSI is used as system clock source, directly or through the PLL).
|
||||
*/
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE ((uint32_t)8000000) /*!< Value of the Internal oscillator in Hz*/
|
||||
|
@ -102,7 +102,7 @@
|
|||
/**
|
||||
* @brief Internal Low Speed oscillator (LSI) value.
|
||||
*/
|
||||
#if !defined (LSI_VALUE)
|
||||
#if !defined (LSI_VALUE)
|
||||
#define LSI_VALUE 40000U /*!< LSI Typical Value in Hz */
|
||||
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
|
||||
The real value may vary depending on the variations
|
||||
|
@ -126,9 +126,9 @@
|
|||
/* ########################### System Configuration ######################### */
|
||||
/**
|
||||
* @brief This is the HAL system configuration section
|
||||
*/
|
||||
#define VDD_VALUE ((uint32_t)3300) /*!< Value of VDD in mv */
|
||||
#define TICK_INT_PRIORITY ((uint32_t)0) /*!< tick interrupt priority (lowest by default) */
|
||||
*/
|
||||
#define VDD_VALUE ((uint32_t)3300) /*!< Value of VDD in mv */
|
||||
#define TICK_INT_PRIORITY ((uint32_t)0) /*!< tick interrupt priority (lowest by default) */
|
||||
#define USE_RTOS 0
|
||||
#define PREFETCH_ENABLE 1
|
||||
|
||||
|
@ -158,7 +158,7 @@
|
|||
|
||||
/* ########################## Assert Selection ############################## */
|
||||
/**
|
||||
* @brief Uncomment the line below to expanse the "assert_param" macro in the
|
||||
* @brief Uncomment the line below to expanse the "assert_param" macro in the
|
||||
* HAL drivers code
|
||||
*/
|
||||
/* #define USE_FULL_ASSERT 1U */
|
||||
|
@ -175,7 +175,7 @@
|
|||
#define MAC_ADDR4 0
|
||||
#define MAC_ADDR5 0
|
||||
|
||||
/* Definition of the Ethernet driver buffers size and count */
|
||||
/* Definition of the Ethernet driver buffers size and count */
|
||||
#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
|
||||
#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
|
||||
#define ETH_RXBUFNB ((uint32_t)8) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
|
||||
|
@ -183,9 +183,9 @@
|
|||
|
||||
/* Section 2: PHY configuration section */
|
||||
|
||||
/* DP83848_PHY_ADDRESS Address*/
|
||||
/* DP83848_PHY_ADDRESS Address*/
|
||||
#define DP83848_PHY_ADDRESS 0x01U
|
||||
/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
|
||||
/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
|
||||
#define PHY_RESET_DELAY ((uint32_t)0x000000FF)
|
||||
/* PHY Configuration delay */
|
||||
#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFF)
|
||||
|
@ -197,7 +197,7 @@
|
|||
|
||||
#define PHY_BCR ((uint16_t)0x00) /*!< Transceiver Basic Control Register */
|
||||
#define PHY_BSR ((uint16_t)0x01) /*!< Transceiver Basic Status Register */
|
||||
|
||||
|
||||
#define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */
|
||||
#define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */
|
||||
#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */
|
||||
|
@ -212,7 +212,7 @@
|
|||
#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */
|
||||
#define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */
|
||||
#define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */
|
||||
|
||||
|
||||
/* Section 4: Extended PHY Registers */
|
||||
#define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
|
|
@ -38,11 +38,11 @@
|
|||
* @brief For Usb device.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup USBD_CDC_IF USBD_CDC_IF
|
||||
* @brief Usb VCP device module
|
||||
* @{
|
||||
*/
|
||||
*/
|
||||
|
||||
/** @defgroup USBD_CDC_IF_Exported_Defines USBD_CDC_IF_Exported_Defines
|
||||
* @brief Defines.
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __USBD_DESC__C__
|
||||
#define __USBD_DESC__C__
|
||||
|
@ -41,7 +41,7 @@
|
|||
* @brief Usb device descriptors module.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup USBD_DESC_Exported_Constants USBD_DESC_Exported_Constants
|
||||
* @brief Constants.
|
||||
* @{
|
||||
|
|
|
@ -25,7 +25,7 @@ uint8_t callSsid = 0;
|
|||
|
||||
const uint8_t dest[7] = {130, 160, 156, 172, 96, 98, 96}; //APNV01-0
|
||||
|
||||
const uint8_t *versionString = (const uint8_t*)"VP-Digi v. 1.2.2\r\nThe open-source standalone APRS digipeater controller and KISS TNC\r\n";
|
||||
const uint8_t *versionString = (const uint8_t*)"VP-Digi v. 1.2.3\r\nThe open-source standalone APRS digipeater controller and KISS TNC\r\n";
|
||||
|
||||
uint8_t autoReset = 0;
|
||||
uint32_t autoResetTimer = 0;
|
||||
|
|
|
@ -16,6 +16,7 @@ along with VP-Digi. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/
|
||||
|
||||
#include "drivers/uart.h"
|
||||
#include "drivers/systick.h"
|
||||
#include "terminal.h"
|
||||
#include "ax25.h"
|
||||
#include "common.h"
|
||||
|
@ -66,7 +67,6 @@ uint8_t Uart_txKiss(uint8_t *buf, uint16_t len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static volatile void uart_handleInterrupt(Uart *port)
|
||||
{
|
||||
if(port->port->SR & USART_SR_RXNE) //byte received
|
||||
|
@ -81,6 +81,8 @@ static volatile void uart_handleInterrupt(Uart *port)
|
|||
|
||||
port->bufrxidx %= UARTBUFLEN;
|
||||
|
||||
if(port->mode == MODE_KISS)
|
||||
port->kissTimer = ticks + 500; //set timeout to 5s in KISS mode
|
||||
}
|
||||
if(port->port->SR & USART_SR_IDLE) //line is idle, end of data reception
|
||||
{
|
||||
|
@ -88,14 +90,16 @@ static volatile void uart_handleInterrupt(Uart *port)
|
|||
if(port->bufrxidx == 0)
|
||||
return; //no data, stop
|
||||
|
||||
if((port->bufrx[0] == 0xc0) /*&& (port->bufrx[1] == 0x00)*/ && (port->bufrx[port->bufrxidx - 1] == 0xc0)) //data starts and ends with 0xc0, this is a KISS frame
|
||||
if((port->bufrx[0] == 0xc0) && (port->bufrx[port->bufrxidx - 1] == 0xc0)) //data starts with 0xc0 and ends with 0xc0 - this is a KISS frame
|
||||
{
|
||||
port->rxflag = DATA_KISS;
|
||||
port->kissTimer = 0;
|
||||
}
|
||||
|
||||
if(((port->bufrx[port->bufrxidx - 1] == '\r') || (port->bufrx[port->bufrxidx - 1] == '\n'))) //data ends with \r or \n, process as data
|
||||
{
|
||||
port->rxflag = DATA_TERM;
|
||||
port->kissTimer = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -111,6 +115,13 @@ static volatile void uart_handleInterrupt(Uart *port)
|
|||
port->port->CR1 &= ~USART_CR1_TXEIE;
|
||||
}
|
||||
}
|
||||
|
||||
if((port->kissTimer > 0) && (ticks >= port->kissTimer)) //KISS timer timeout
|
||||
{
|
||||
port->kissTimer = 0;
|
||||
port->bufrxidx = 0;
|
||||
memset(port->bufrx, 0, UARTBUFLEN);
|
||||
}
|
||||
}
|
||||
|
||||
void USART1_IRQHandler(void) __attribute__ ((interrupt));
|
||||
|
@ -251,6 +262,7 @@ void uart_init(Uart *port, USART_TypeDef *uart, uint32_t baud)
|
|||
port->buftxwr = 0;
|
||||
port->mode = MODE_KISS;
|
||||
port->enabled = 0;
|
||||
port->kissTimer = 0;
|
||||
memset(port->bufrx, 0, UARTBUFLEN);
|
||||
memset(port->buftx, 0, UARTBUFLEN);
|
||||
}
|
||||
|
|
28
Src/main.c
28
Src/main.c
|
@ -178,7 +178,7 @@ void handleFrame(void)
|
|||
|
||||
term_sendMonitor((uint8_t*)"(AX.25) Frame received [", 0); //show which modem received the frame: [FP] (flat and preemphasized), [FD] (flat and deemphasized - in flat audio input mode)
|
||||
//[F_] (only flat), [_P] (only preemphasized) or [_D] (only deemphasized - in flat audio input mode)
|
||||
uint8_t t[3] = {0};
|
||||
uint8_t t[2] = {0};
|
||||
if(modemReceived & 1)
|
||||
{
|
||||
t[0] = 'F';
|
||||
|
@ -195,7 +195,7 @@ void handleFrame(void)
|
|||
else
|
||||
t[1] = '_';
|
||||
|
||||
term_sendMonitor(t, 3);
|
||||
term_sendMonitor(t, 2);
|
||||
term_sendMonitor((uint8_t*)"], signal level ", 0);
|
||||
term_sendMonitorNumber(ax25.sLvl);
|
||||
term_sendMonitor((uint8_t*)"%: ", 0);
|
||||
|
@ -297,10 +297,13 @@ int main(void)
|
|||
|
||||
/* Infinite loop */
|
||||
/* USER CODE BEGIN WHILE */
|
||||
|
||||
static uint32_t usbKissTimer = 0;
|
||||
while (1)
|
||||
{
|
||||
/* USER CODE END WHILE */
|
||||
/* USER CODE BEGIN 3 */
|
||||
|
||||
/* USER CODE BEGIN 3 */
|
||||
Wdog_reset();
|
||||
|
||||
if(ax25.frameReceived)
|
||||
|
@ -316,18 +319,31 @@ int main(void)
|
|||
if(USBint) //USB "interrupt"
|
||||
{
|
||||
USBint = 0; //clear
|
||||
|
||||
if(USBmode == MODE_KISS) //is USB in KISS mode?
|
||||
usbKissTimer = ticks + 500; //set timeout to 5s
|
||||
|
||||
term_handleSpecial(TERM_USB); //handle special characters (e.g. backspace)
|
||||
if((usbcdcdata[0] == 0xc0) && /*(usbcdcdata[1] == 0x00) &&*/ (usbcdcdata[usbcdcidx - 1] == 0xc0)) //probably a KISS frame
|
||||
{
|
||||
USBrcvd = DATA_KISS;
|
||||
usbKissTimer = 0;
|
||||
}
|
||||
|
||||
if(((usbcdcdata[usbcdcidx - 1] == '\r') || (usbcdcdata[usbcdcidx - 1] == '\n'))) //proabably a command
|
||||
{
|
||||
USBrcvd = DATA_TERM;
|
||||
usbKissTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if((usbKissTimer > 0) && (ticks >= usbKissTimer)) //USB KISS timer timeout
|
||||
{
|
||||
usbcdcidx = 0;
|
||||
memset(usbcdcdata, 0, UARTBUFLEN);
|
||||
usbKissTimer = 0;
|
||||
}
|
||||
|
||||
|
||||
if(USBrcvd != DATA_NOTHING)
|
||||
{
|
||||
|
@ -373,7 +389,7 @@ void SystemClock_Config(void)
|
|||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
|
||||
|
||||
/** Initializes the CPU, AHB and APB busses clocks
|
||||
/** Initializes the CPU, AHB and APB busses clocks
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
|
@ -386,7 +402,7 @@ void SystemClock_Config(void)
|
|||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/** Initializes the CPU, AHB and APB busses clocks
|
||||
/** Initializes the CPU, AHB and APB busses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
|
||||
|
@ -447,7 +463,7 @@ void Error_Handler(void)
|
|||
* @retval None
|
||||
*/
|
||||
void assert_failed(uint8_t *file, uint32_t line)
|
||||
{
|
||||
{
|
||||
/* USER CODE BEGIN 6 */
|
||||
/* User can add his own implementation to report the file name and line number,
|
||||
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
|
||||
|
|
|
@ -72,7 +72,7 @@ void HAL_MspInit(void)
|
|||
|
||||
/* System interrupt init*/
|
||||
|
||||
/** NONJTRST: Full SWJ (JTAG-DP + SW-DP) but without NJTRST
|
||||
/** NONJTRST: Full SWJ (JTAG-DP + SW-DP) but without NJTRST
|
||||
*/
|
||||
__HAL_AFIO_REMAP_SWJ_NONJTRST();
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ extern PCD_HandleTypeDef hpcd_USB_FS;
|
|||
/* USER CODE END EV */
|
||||
|
||||
/******************************************************************************/
|
||||
/* Cortex-M3 Processor Interruption and Exception Handlers */
|
||||
/* Cortex-M3 Processor Interruption and Exception Handlers */
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* @brief This function handles Non maskable interrupt.
|
||||
|
|
|
@ -27,7 +27,7 @@ uint8_t termBuf[TERMBUFLEN]; //terminal mode TX buffer
|
|||
uint16_t termBufIdx = 0; //terminal mode TX buffer index
|
||||
|
||||
|
||||
static uint16_t spLastIdx[3] = {0, 0, 0}; //index buffer was "special" terminal cases
|
||||
uint16_t spLastIdx[3] = {0, 0, 0}; //index buffer was "special" terminal cases
|
||||
|
||||
/**
|
||||
* @brief Handle "special" terminal cases like backspace or local echo
|
||||
|
|
|
@ -67,7 +67,7 @@ void MX_USB_DEVICE_Init(void)
|
|||
/* USER CODE BEGIN USB_DEVICE_Init_PreTreatment */
|
||||
|
||||
/* USER CODE END USB_DEVICE_Init_PreTreatment */
|
||||
|
||||
|
||||
/* Init Device Library, add supported class and start the library. */
|
||||
if (USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS) != USBD_OK)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f1xx.h"
|
||||
|
@ -173,7 +173,7 @@ static void PCD_ResetCallback(PCD_HandleTypeDef *hpcd)
|
|||
#else
|
||||
void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd)
|
||||
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||
{
|
||||
{
|
||||
USBD_SpeedTypeDef speed = USBD_SPEED_FULL;
|
||||
|
||||
if ( hpcd->Init.speed != PCD_SPEED_FULL)
|
||||
|
@ -354,8 +354,8 @@ USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev)
|
|||
hal_status = HAL_PCD_DeInit(pdev->pData);
|
||||
|
||||
usb_status = USBD_Get_USB_Status(hal_status);
|
||||
|
||||
return usb_status;
|
||||
|
||||
return usb_status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -367,11 +367,11 @@ USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev)
|
|||
{
|
||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
||||
|
||||
|
||||
hal_status = HAL_PCD_Start(pdev->pData);
|
||||
|
||||
|
||||
usb_status = USBD_Get_USB_Status(hal_status);
|
||||
|
||||
|
||||
return usb_status;
|
||||
}
|
||||
|
||||
|
@ -388,7 +388,7 @@ USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev)
|
|||
hal_status = HAL_PCD_Stop(pdev->pData);
|
||||
|
||||
usb_status = USBD_Get_USB_Status(hal_status);
|
||||
|
||||
|
||||
return usb_status;
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uin
|
|||
hal_status = HAL_PCD_EP_Open(pdev->pData, ep_addr, ep_mps, ep_type);
|
||||
|
||||
usb_status = USBD_Get_USB_Status(hal_status);
|
||||
|
||||
|
||||
return usb_status;
|
||||
}
|
||||
|
||||
|
@ -422,12 +422,12 @@ USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
|||
{
|
||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
||||
|
||||
|
||||
hal_status = HAL_PCD_EP_Close(pdev->pData, ep_addr);
|
||||
|
||||
|
||||
usb_status = USBD_Get_USB_Status(hal_status);
|
||||
|
||||
return usb_status;
|
||||
return usb_status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -440,12 +440,12 @@ USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
|||
{
|
||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
||||
|
||||
|
||||
hal_status = HAL_PCD_EP_Flush(pdev->pData, ep_addr);
|
||||
|
||||
|
||||
usb_status = USBD_Get_USB_Status(hal_status);
|
||||
|
||||
return usb_status;
|
||||
|
||||
return usb_status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -458,12 +458,12 @@ USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
|||
{
|
||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
||||
|
||||
|
||||
hal_status = HAL_PCD_EP_SetStall(pdev->pData, ep_addr);
|
||||
|
||||
usb_status = USBD_Get_USB_Status(hal_status);
|
||||
|
||||
return usb_status;
|
||||
|
||||
return usb_status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -476,12 +476,12 @@ USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_add
|
|||
{
|
||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
||||
|
||||
hal_status = HAL_PCD_EP_ClrStall(pdev->pData, ep_addr);
|
||||
|
||||
|
||||
hal_status = HAL_PCD_EP_ClrStall(pdev->pData, ep_addr);
|
||||
|
||||
usb_status = USBD_Get_USB_Status(hal_status);
|
||||
|
||||
return usb_status;
|
||||
return usb_status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -493,14 +493,14 @@ USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_add
|
|||
uint8_t USBD_LL_IsStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
||||
{
|
||||
PCD_HandleTypeDef *hpcd = (PCD_HandleTypeDef*) pdev->pData;
|
||||
|
||||
|
||||
if((ep_addr & 0x80) == 0x80)
|
||||
{
|
||||
return hpcd->IN_ep[ep_addr & 0x7F].is_stall;
|
||||
return hpcd->IN_ep[ep_addr & 0x7F].is_stall;
|
||||
}
|
||||
else
|
||||
{
|
||||
return hpcd->OUT_ep[ep_addr & 0x7F].is_stall;
|
||||
return hpcd->OUT_ep[ep_addr & 0x7F].is_stall;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -514,12 +514,12 @@ USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_a
|
|||
{
|
||||
HAL_StatusTypeDef hal_status = HAL_OK;
|
||||
USBD_StatusTypeDef usb_status = USBD_OK;
|
||||
|
||||
|
||||
hal_status = HAL_PCD_SetAddress(pdev->pData, dev_addr);
|
||||
|
||||
|
||||
usb_status = USBD_Get_USB_Status(hal_status);
|
||||
|
||||
return usb_status;
|
||||
|
||||
return usb_status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -527,7 +527,7 @@ USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_a
|
|||
* @param pdev: Device handle
|
||||
* @param ep_addr: Endpoint number
|
||||
* @param pbuf: Pointer to data to be sent
|
||||
* @param size: Data size
|
||||
* @param size: Data size
|
||||
* @retval USBD status
|
||||
*/
|
||||
USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t *pbuf, uint16_t size)
|
||||
|
@ -536,10 +536,10 @@ USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev, uint8_t ep_addr, u
|
|||
USBD_StatusTypeDef usb_status = USBD_OK;
|
||||
|
||||
hal_status = HAL_PCD_EP_Transmit(pdev->pData, ep_addr, pbuf, size);
|
||||
|
||||
|
||||
usb_status = USBD_Get_USB_Status(hal_status);
|
||||
|
||||
return usb_status;
|
||||
|
||||
return usb_status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -556,10 +556,10 @@ USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev, uint8_t ep_a
|
|||
USBD_StatusTypeDef usb_status = USBD_OK;
|
||||
|
||||
hal_status = HAL_PCD_EP_Receive(pdev->pData, ep_addr, pbuf, size);
|
||||
|
||||
|
||||
usb_status = USBD_Get_USB_Status(hal_status);
|
||||
|
||||
return usb_status;
|
||||
|
||||
return usb_status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -95,19 +95,18 @@
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
||||
* @brief Private functions declaration.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
static void Get_SerialNum(void);
|
||||
static void IntToUnicode(uint32_t value, uint8_t * pbuf, uint8_t len);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
*/
|
||||
|
||||
/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes
|
||||
* @brief Private functions declaration for FS.
|
||||
|
@ -199,7 +198,7 @@ __ALIGN_BEGIN uint8_t USBD_LangIDDesc[USB_LEN_LANGID_STR_DESC] __ALIGN_END =
|
|||
__ALIGN_BEGIN uint8_t USBD_StrDesc[USBD_MAX_STR_DESC_SIZ] __ALIGN_END;
|
||||
|
||||
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
|
||||
#pragma data_alignment=4
|
||||
#pragma data_alignment=4
|
||||
#endif
|
||||
__ALIGN_BEGIN uint8_t USBD_StringSerial[USB_SIZ_STRING_SERIAL] __ALIGN_END = {
|
||||
USB_SIZ_STRING_SERIAL,
|
||||
|
@ -332,8 +331,8 @@ uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *leng
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @brief Create the serial number string descriptor
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void Get_SerialNum(void)
|
||||
|
@ -354,9 +353,9 @@ static void Get_SerialNum(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Convert Hex 32Bits value into char
|
||||
* @brief Convert Hex 32Bits value into char
|
||||
* @param value: value to convert
|
||||
* @param pbuf: pointer to the buffer
|
||||
* @param pbuf: pointer to the buffer
|
||||
* @param len: buffer length
|
||||
* @retval None
|
||||
*/
|
||||
|
|
Ładowanie…
Reference in New Issue