Просмотр исходного кода

Update RAW HID TX buffer to be in DMAMEM

Decided to go ahead and move the TX Buffer there as well
Did a quick check in earlier test program to echo the contents back.

The other test program was already setup to receive data on the HID and does hex dump of buffer which looks correct.  So far so good.
teensy4-core
Kurt Eckhardt 5 лет назад
Родитель
Сommit
5554edbdf5
1 измененных файлов: 2 добавлений и 1 удалений
  1. +2
    -1
      teensy4/usb_rawhid.c

+ 2
- 1
teensy4/usb_rawhid.c Просмотреть файл



#define TX_NUM 4 #define TX_NUM 4
static transfer_t tx_transfer[TX_NUM] __attribute__ ((used, aligned(32))); static transfer_t tx_transfer[TX_NUM] __attribute__ ((used, aligned(32)));
static uint8_t txbuffer[RAWHID_TX_SIZE * TX_NUM];
DMAMEM static uint8_t txbuffer[RAWHID_TX_SIZE * TX_NUM];
static uint8_t tx_head=0; static uint8_t tx_head=0;


#define RX_NUM 4 #define RX_NUM 4
} }
uint8_t *txdata = txbuffer + (tx_head * RAWHID_TX_SIZE); uint8_t *txdata = txbuffer + (tx_head * RAWHID_TX_SIZE);
memcpy(txdata, buffer, RAWHID_TX_SIZE); memcpy(txdata, buffer, RAWHID_TX_SIZE);
arm_dcache_flush_delete(txdata, SEREMU_TX_SIZE);
usb_prepare_transfer(xfer, txdata, RAWHID_TX_SIZE, 0); usb_prepare_transfer(xfer, txdata, RAWHID_TX_SIZE, 0);
usb_transmit(RAWHID_TX_ENDPOINT, xfer); usb_transmit(RAWHID_TX_ENDPOINT, xfer);
if (++tx_head >= TX_NUM) tx_head = 0; if (++tx_head >= TX_NUM) tx_head = 0;

Загрузка…
Отмена
Сохранить