Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/flipperdevices/libusb_stm32.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Filimonchuk <dmitrystu@gmail.com>2022-06-06 09:35:18 +0300
committerGitHub <noreply@github.com>2022-06-06 09:35:18 +0300
commitea56bf469ebbff47679be893bd2728e57ea20f4c (patch)
tree9c077470ef608c53cc4012cc17bf1f8b60bde1fd
parent624dbab1c5e2d4484d63320a5767e9d18be52068 (diff)
parent8b2fcc8c621cafce6754c5958b000130d9f67667 (diff)
Merge pull request #114 from via/via/tx-const
All ep_write functions take const buffer pointer.
-rw-r--r--inc/usbd_core.h4
-rw-r--r--src/usbd_stm32f103_devfs.c2
-rw-r--r--src/usbd_stm32f103_devfs_asm.S2
-rw-r--r--src/usbd_stm32f105_otgfs.c4
-rw-r--r--src/usbd_stm32f429_otgfs.c4
-rw-r--r--src/usbd_stm32f429_otghs.c4
-rw-r--r--src/usbd_stm32f446_otgfs.c4
-rw-r--r--src/usbd_stm32f446_otghs.c4
-rw-r--r--src/usbd_stm32l052_devfs.c4
-rw-r--r--src/usbd_stm32l052_devfs_asm.S2
-rw-r--r--src/usbd_stm32l100_devfs.c2
-rw-r--r--src/usbd_stm32l100_devfs_asm.S2
-rw-r--r--src/usbd_stm32l433_devfs.c4
-rw-r--r--src/usbd_stm32l476_otgfs.c4
-rw-r--r--src/usbd_stm32wb55_devfs.c4
15 files changed, 25 insertions, 25 deletions
diff --git a/inc/usbd_core.h b/inc/usbd_core.h
index 032dfb6..587509f 100644
--- a/inc/usbd_core.h
+++ b/inc/usbd_core.h
@@ -270,7 +270,7 @@ typedef int32_t (*usbd_hw_ep_read)(uint8_t ep, void *buf, uint16_t blen);
* \param blen size of data will be written
* \return number of written bytes
*/
-typedef int32_t (*usbd_hw_ep_write)(uint8_t ep, void *buf, uint16_t blen);
+typedef int32_t (*usbd_hw_ep_write)(uint8_t ep, const void *buf, uint16_t blen);
/** Stalls and unstalls endpoint
* \param ep endpoint address
@@ -419,7 +419,7 @@ inline static void usbd_reg_event(usbd_device *dev, uint8_t evt, usbd_evt_callba
* \param dev dev usb device \ref _usbd_device
* \copydetails usbd_hw_ep_write
*/
-inline static int32_t usbd_ep_write(usbd_device *dev, uint8_t ep, void *buf, uint16_t blen) {
+inline static int32_t usbd_ep_write(usbd_device *dev, uint8_t ep, const void *buf, uint16_t blen) {
return dev->driver->ep_write(ep, buf, blen);
}
diff --git a/src/usbd_stm32f103_devfs.c b/src/usbd_stm32f103_devfs.c
index 0ed54d4..8601994 100644
--- a/src/usbd_stm32f103_devfs.c
+++ b/src/usbd_stm32f103_devfs.c
@@ -421,7 +421,7 @@ static void pma_write(const uint8_t *buf, uint16_t blen, pma_rec *tx) {
}
}
-static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
+static int32_t ep_write(uint8_t ep, const void *buf, uint16_t blen) {
pma_table *tbl = EPT(ep);
volatile uint16_t *reg = EPR(ep);
switch (*reg & (USB_EPTX_STAT | USB_EP_T_FIELD | USB_EP_KIND)) {
diff --git a/src/usbd_stm32f103_devfs_asm.S b/src/usbd_stm32f103_devfs_asm.S
index c6daba2..6a3ec49 100644
--- a/src/usbd_stm32f103_devfs_asm.S
+++ b/src/usbd_stm32f103_devfs_asm.S
@@ -493,7 +493,7 @@ _ep_read:
.thumb_func
.type _ep_write, %function
-/* int32_t ep_write(uint8_t ep, void *buf, uint16_t blen)
+/* int32_t ep_write(uint8_t ep, const void *buf, uint16_t blen)
* R0 -> endpoint
* R1 -> *buffer
* R2 -> data length
diff --git a/src/usbd_stm32f105_otgfs.c b/src/usbd_stm32f105_otgfs.c
index 54530da..90ddf09 100644
--- a/src/usbd_stm32f105_otgfs.c
+++ b/src/usbd_stm32f105_otgfs.c
@@ -341,7 +341,7 @@ static int32_t ep_read(uint8_t ep, void* buf, uint16_t blen) {
return (len < blen) ? len : blen;
}
-static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
+static int32_t ep_write(uint8_t ep, const void *buf, uint16_t blen) {
uint32_t len, tmp;
ep &= 0x7F;
volatile uint32_t* fifo = EPFIFO(ep);
@@ -359,7 +359,7 @@ static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
/* push data to FIFO */
tmp = 0;
for (int idx = 0; idx < blen; idx++) {
- tmp |= (uint32_t)((uint8_t*)buf)[idx] << ((idx & 0x03) << 3);
+ tmp |= (uint32_t)((const uint8_t*)buf)[idx] << ((idx & 0x03) << 3);
if ((idx & 0x03) == 0x03 || (idx + 1) == blen) {
*fifo = tmp;
tmp = 0;
diff --git a/src/usbd_stm32f429_otgfs.c b/src/usbd_stm32f429_otgfs.c
index 1633e04..ea1b3b4 100644
--- a/src/usbd_stm32f429_otgfs.c
+++ b/src/usbd_stm32f429_otgfs.c
@@ -338,7 +338,7 @@ static int32_t ep_read(uint8_t ep, void* buf, uint16_t blen) {
return (len < blen) ? len : blen;
}
-static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
+static int32_t ep_write(uint8_t ep, const void *buf, uint16_t blen) {
uint32_t len, tmp;
ep &= 0x7F;
volatile uint32_t* fifo = EPFIFO(ep);
@@ -356,7 +356,7 @@ static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
/* push data to FIFO */
tmp = 0;
for (int idx = 0; idx < blen; idx++) {
- tmp |= (uint32_t)((uint8_t*)buf)[idx] << ((idx & 0x03) << 3);
+ tmp |= (uint32_t)((const uint8_t*)buf)[idx] << ((idx & 0x03) << 3);
if ((idx & 0x03) == 0x03 || (idx + 1) == blen) {
*fifo = tmp;
tmp = 0;
diff --git a/src/usbd_stm32f429_otghs.c b/src/usbd_stm32f429_otghs.c
index ba21948..fa0b1d6 100644
--- a/src/usbd_stm32f429_otghs.c
+++ b/src/usbd_stm32f429_otghs.c
@@ -340,7 +340,7 @@ static int32_t ep_read(uint8_t ep, void* buf, uint16_t blen) {
return (len < blen) ? len : blen;
}
-static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
+static int32_t ep_write(uint8_t ep, const void *buf, uint16_t blen) {
uint32_t len, tmp;
ep &= 0x7F;
volatile uint32_t* fifo = EPFIFO(ep);
@@ -361,7 +361,7 @@ static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
/* push data to FIFO */
tmp = 0;
for (int idx = 0; idx < blen; idx++) {
- tmp |= (uint32_t)((uint8_t*)buf)[idx] << ((idx & 0x03) << 3);
+ tmp |= (uint32_t)((const uint8_t*)buf)[idx] << ((idx & 0x03) << 3);
if ((idx & 0x03) == 0x03 || (idx + 1) == blen) {
*fifo = tmp;
tmp = 0;
diff --git a/src/usbd_stm32f446_otgfs.c b/src/usbd_stm32f446_otgfs.c
index 7ffeb4f..32a78e4 100644
--- a/src/usbd_stm32f446_otgfs.c
+++ b/src/usbd_stm32f446_otgfs.c
@@ -331,7 +331,7 @@ static int32_t ep_read(uint8_t ep, void* buf, uint16_t blen) {
return (len < blen) ? len : blen;
}
-static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
+static int32_t ep_write(uint8_t ep, const void *buf, uint16_t blen) {
uint32_t len, tmp;
ep &= 0x7F;
volatile uint32_t* fifo = EPFIFO(ep);
@@ -349,7 +349,7 @@ static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
/* push data to FIFO */
tmp = 0;
for (int idx = 0; idx < blen; idx++) {
- tmp |= (uint32_t)((uint8_t*)buf)[idx] << ((idx & 0x03) << 3);
+ tmp |= (uint32_t)((const uint8_t*)buf)[idx] << ((idx & 0x03) << 3);
if ((idx & 0x03) == 0x03 || (idx + 1) == blen) {
*fifo = tmp;
tmp = 0;
diff --git a/src/usbd_stm32f446_otghs.c b/src/usbd_stm32f446_otghs.c
index d65d2e2..2473286 100644
--- a/src/usbd_stm32f446_otghs.c
+++ b/src/usbd_stm32f446_otghs.c
@@ -331,7 +331,7 @@ static int32_t ep_read(uint8_t ep, void* buf, uint16_t blen) {
return (len < blen) ? len : blen;
}
-static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
+static int32_t ep_write(uint8_t ep, const void *buf, uint16_t blen) {
uint32_t len, tmp;
ep &= 0x7F;
volatile uint32_t* fifo = EPFIFO(ep);
@@ -349,7 +349,7 @@ static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
/* push data to FIFO */
tmp = 0;
for (int idx = 0; idx < blen; idx++) {
- tmp |= (uint32_t)((uint8_t*)buf)[idx] << ((idx & 0x03) << 3);
+ tmp |= (uint32_t)((const uint8_t*)buf)[idx] << ((idx & 0x03) << 3);
if ((idx & 0x03) == 0x03 || (idx + 1) == blen) {
*fifo = tmp;
tmp = 0;
diff --git a/src/usbd_stm32l052_devfs.c b/src/usbd_stm32l052_devfs.c
index 462471b..b6b3689 100644
--- a/src/usbd_stm32l052_devfs.c
+++ b/src/usbd_stm32l052_devfs.c
@@ -344,7 +344,7 @@ static int32_t ep_read(uint8_t ep, void *buf, uint16_t blen) {
}
}
-static void pma_write(uint8_t *buf, uint16_t blen, pma_rec *tx) {
+static void pma_write(const uint8_t *buf, uint16_t blen, pma_rec *tx) {
uint16_t *pma = (void*)(USB_PMAADDR + tx->addr);
uint16_t tmp = 0;
tx->cnt = blen;
@@ -357,7 +357,7 @@ static void pma_write(uint8_t *buf, uint16_t blen, pma_rec *tx) {
}
}
-static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
+static int32_t ep_write(uint8_t ep, const void *buf, uint16_t blen) {
pma_table *tbl = EPT(ep);
volatile uint16_t *reg = EPR(ep);
switch (*reg & (USB_EPTX_STAT | USB_EP_T_FIELD | USB_EP_KIND)) {
diff --git a/src/usbd_stm32l052_devfs_asm.S b/src/usbd_stm32l052_devfs_asm.S
index 1b3bcb0..06ba240 100644
--- a/src/usbd_stm32l052_devfs_asm.S
+++ b/src/usbd_stm32l052_devfs_asm.S
@@ -475,7 +475,7 @@ _ep_read:
.thumb_func
.type _ep_write, %function
-/* int32_t ep_write(uint8_t ep, void *buf, uint16_t blen)
+/* int32_t ep_write(uint8_t ep, const void *buf, uint16_t blen)
* R0 -> endpoint
* R1 -> *buffer
* R2 -> data length
diff --git a/src/usbd_stm32l100_devfs.c b/src/usbd_stm32l100_devfs.c
index d64d7f5..6764bfb 100644
--- a/src/usbd_stm32l100_devfs.c
+++ b/src/usbd_stm32l100_devfs.c
@@ -331,7 +331,7 @@ static void pma_write(const uint8_t *buf, uint16_t blen, pma_rec *tx) {
}
}
-static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
+static int32_t ep_write(uint8_t ep, const void *buf, uint16_t blen) {
pma_table *tbl = EPT(ep);
volatile uint16_t *reg = EPR(ep);
switch (*reg & (USB_EPTX_STAT | USB_EP_T_FIELD | USB_EP_KIND)) {
diff --git a/src/usbd_stm32l100_devfs_asm.S b/src/usbd_stm32l100_devfs_asm.S
index 333afad..c968a2a 100644
--- a/src/usbd_stm32l100_devfs_asm.S
+++ b/src/usbd_stm32l100_devfs_asm.S
@@ -438,7 +438,7 @@ _ep_read:
.thumb_func
.type _ep_write, %function
-/* int32_t ep_write(uint8_t ep, void *buf, uint16_t blen)
+/* int32_t ep_write(uint8_t ep, const void *buf, uint16_t blen)
* R0 -> endpoint
* R1 -> *buffer
* R2 -> data length
diff --git a/src/usbd_stm32l433_devfs.c b/src/usbd_stm32l433_devfs.c
index c738c67..171ee24 100644
--- a/src/usbd_stm32l433_devfs.c
+++ b/src/usbd_stm32l433_devfs.c
@@ -335,7 +335,7 @@ static int32_t ep_read(uint8_t ep, void *buf, uint16_t blen) {
}
}
-static void pma_write(uint8_t *buf, uint16_t blen, pma_rec *tx) {
+static void pma_write(const uint8_t *buf, uint16_t blen, pma_rec *tx) {
uint16_t *pma = (void*)(USB_PMAADDR + tx->addr);
tx->cnt = blen;
while (blen > 1) {
@@ -346,7 +346,7 @@ static void pma_write(uint8_t *buf, uint16_t blen, pma_rec *tx) {
if (blen) *pma = *buf;
}
-static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
+static int32_t ep_write(uint8_t ep, const void *buf, uint16_t blen) {
pma_table *tbl = EPT(ep);
volatile uint16_t *reg = EPR(ep);
switch (*reg & (USB_EPTX_STAT | USB_EP_T_FIELD | USB_EP_KIND)) {
diff --git a/src/usbd_stm32l476_otgfs.c b/src/usbd_stm32l476_otgfs.c
index a0246b5..7aa54dc 100644
--- a/src/usbd_stm32l476_otgfs.c
+++ b/src/usbd_stm32l476_otgfs.c
@@ -364,7 +364,7 @@ static int32_t ep_read(uint8_t ep, void* buf, uint16_t blen) {
return (len < blen) ? len : blen;
}
-static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
+static int32_t ep_write(uint8_t ep, const void *buf, uint16_t blen) {
uint32_t len, tmp;
ep &= 0x7F;
volatile uint32_t* fifo = EPFIFO(ep);
@@ -382,7 +382,7 @@ static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
/* push data to FIFO */
tmp = 0;
for (int idx = 0; idx < blen; idx++) {
- tmp |= (uint32_t)((uint8_t*)buf)[idx] << ((idx & 0x03) << 3);
+ tmp |= (uint32_t)((const uint8_t*)buf)[idx] << ((idx & 0x03) << 3);
if ((idx & 0x03) == 0x03 || (idx + 1) == blen) {
*fifo = tmp;
tmp = 0;
diff --git a/src/usbd_stm32wb55_devfs.c b/src/usbd_stm32wb55_devfs.c
index 6381024..fd1142b 100644
--- a/src/usbd_stm32wb55_devfs.c
+++ b/src/usbd_stm32wb55_devfs.c
@@ -335,7 +335,7 @@ static int32_t ep_read(uint8_t ep, void *buf, uint16_t blen) {
}
}
-static void pma_write(uint8_t *buf, uint16_t blen, pma_rec *tx) {
+static void pma_write(const uint8_t *buf, uint16_t blen, pma_rec *tx) {
uint16_t *pma = (void*)(USB1_PMAADDR + tx->addr);
tx->cnt = blen;
while (blen > 1) {
@@ -346,7 +346,7 @@ static void pma_write(uint8_t *buf, uint16_t blen, pma_rec *tx) {
if (blen) *pma = *buf;
}
-static int32_t ep_write(uint8_t ep, void *buf, uint16_t blen) {
+static int32_t ep_write(uint8_t ep, const void *buf, uint16_t blen) {
pma_table *tbl = EPT(ep);
volatile uint16_t *reg = EPR(ep);
switch (*reg & (USB_EPTX_STAT | USB_EP_T_FIELD | USB_EP_KIND)) {