Author SHA1 Message Date
MightyPork c4efa5ddaa Enable double buffered mode in USB 2018-03-04 16:35:00 +01:00
4 changed files with 5 additions and 18 deletions
+1 -1
View File
@@ -109,7 +109,7 @@ extern uint32_t SystemCoreClock;
#define configQUEUE_REGISTRY_SIZE 0
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configENABLE_BACKWARD_COMPATIBILITY 0
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_COUNTING_SEMAPHORES 0
#define configUSE_TIMERS 0
#define configTIMER_TASK_PRIORITY TSK_TIMERS_PRIO // above normal
+2 -4
View File
@@ -29,12 +29,10 @@ void TF_WriteImpl(TinyFrame *tf, const uint8_t *buff, uint32_t len)
const uint16_t chunksize = (uint16_t) MIN(total, CHUNK);
// this is an attempt to speed it up a little by removing a couple levels of indirection
assert_param(HAL_OK == HAL_PCD_EP_Transmit(hUsbDeviceFS.pData, CDC_IN_EP, (uint8_t *) buff, chunksize));
HAL_PCD_EP_Transmit(hUsbDeviceFS.pData, CDC_IN_EP, (uint8_t *) "AAAAHELLODOLLY123", 17);
// assert_param(HAL_OK == HAL_PCD_EP_Transmit(hUsbDeviceFS.pData, CDC_IN_EP, (uint8_t *) buff, chunksize));
// USBD_LL_Transmit(&hUsbDeviceFS, CDC_IN_EP, (uint8_t *) buff, chunksize);
// assert_param(USBD_OK == CDC_Transmit_FS((uint8_t *) buff, chunksize));
assert_param(USBD_OK == CDC_Transmit_FS((uint8_t *) buff, chunksize));
buff += chunksize;
total -= chunksize;
+1 -1
View File
@@ -313,7 +313,7 @@ void USBD_CDC_TransmitDone(USBD_HandleTypeDef *pdev)
assert_param(semVcomTxReadyHandle != NULL);
assert_param(inIRQ());
// if (uxSemaphoreGetCount(semVcomTxReadyHandle) == 2) return;
if (uxSemaphoreGetCount(semVcomTxReadyHandle) == 1) return;
portBASE_TYPE taskWoken = pdFALSE;
assert_param(xSemaphoreGiveFromISR(semVcomTxReadyHandle, &taskWoken) == pdTRUE);
+1 -12
View File
@@ -47,13 +47,12 @@
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include <platform/hw_utils.h>
#include <utils/malloc_safe.h>
#include "platform.h"
#include "usbd_def.h"
#include "usbd_core.h"
#include "usbd_msc.h"
#include "usbd_cdc.h"
#include "utils/malloc_safe.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
@@ -336,9 +335,6 @@ void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd)
* @param pdev: Device handle
* @retval USBD Status
*/
extern void PCD_WritePMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes);
USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
{
#if PLAT_USB_OTGFS
@@ -405,8 +401,6 @@ USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
buf1addr = (ptr += 64);
buf2addr = (ptr += 64);
uint32_t addr_begin = buf1addr;
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , CDC_IN_EP , PCD_DBL_BUF, buf1addr | (buf2addr << 16)); // 64
buf1addr = (ptr += 64);
@@ -417,11 +411,6 @@ USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
(void)ptr;
#endif
const uint8_t buf[256] = {};
PCD_WritePMA(((PCD_HandleTypeDef*)pdev->pData)->Instance, (uint8_t *) &buf[0], (uint16_t) addr_begin, 256);
hw_configure_sparse_pins('B', 0b111, NULL, LL_GPIO_MODE_OUTPUT, LL_GPIO_OUTPUT_PUSHPULL);
return USBD_OK;
}