Commit Graph

129 Commits

Author SHA1 Message Date
hathach
190acc1fb0 add aligned(4) for cdc_line_coding_t 2023-04-28 11:12:03 +07:00
Jean-Baptiste Theou
8f47976639 cdc: fix line_coding aligment
While calling tud_cdc_n_get_line_coding, the structure is copied into
the destination.

Dump of assembler code for function tud_cdc_n_get_line_coding:
   0x000193f4 <+0>:	mov.w	r2, #2112	@ 0x840
0x000193f8 <+4>:	ldr	r3, [pc, #20]	@ (0x19410
<tud_cdc_n_get_line_coding+28>)
   0x000193fa <+6>:	mla	r0, r2, r0, r3
=> 0x000193fe <+10>:	ldr.w	r3, [r0, #6]
   0x00019402 <+14>:	str	r3, [r1, #0]

On some platform (tested on LPC55S28), the address needs to be 4-bytes
aligned. Without this, the address is

(gdb) p &_cdcd_itf.line_coding
$3 = (cdc_line_coding_t *) 0x40100006 <_cdcd_itf+6>

which leads to a HardFault. With this fix

(gdb) p &_cdcd_itf.line_coding
$5 = (cdc_line_coding_t *) 0x40100008 <_cdcd_itf+8>

and the function can be called properly

Signed-off-by: Jean-Baptiste Theou <jb@thing.com>
2023-04-27 15:48:15 -10:00
hathach
3623ba1884 fix trailing space and new line
temporarily disable codespell
2023-03-17 16:12:49 +07:00
hathach
498989ee00 use tu_static instead of static _fuzz_thread 2023-02-22 16:23:40 +07:00
hathach
03ec49450d rename maros from FUZZ to _FUZZ, change TU_STATIC to static _fuzz_thread 2023-02-22 11:47:09 +07:00
Nathaniel Brough
18c3095346 fix: Change all static variables to thread when fuzzing 2023-01-20 15:45:31 -08:00
hathach
15a02d04df fix incorrect rx buf in cdc 2022-12-22 21:35:55 +07:00
hathach
88e6da7273 use OSAL_MUTEX_REQUIRED to replace CFG_FIFO_MUTEX/TUSB_OPT_MUTEX
add macro to swallow mutex API in order to simplify code with mutex
2022-12-15 18:03:01 +07:00
hathach
19400c8556 fix typo, add -Wno-error=unreachable-code for fuzz due to latest cdc changes 2022-12-08 10:30:22 +07:00
Tomas Rezucha
603effbb77 cdc: Fix autoflush for FIFO < MPS 2022-12-06 07:49:26 +01:00
hathach
4f6e770eda add more warning option, also fix -Wconversion with rp2040
-Wuninitialized, -Wunused,  -Wredundant-decls
2022-06-24 19:46:19 +07:00
hathach
8b9cf152a0 rhport argument in usbd_ API() is not used (always use the initialized port)
remove the usage of TUD_OPT_RHPORT in class driver
2022-06-02 16:51:17 +07:00
hathach
d10326cb4e rename TUSB_OPT_DEVICE_ENABLED to CFG_TUD_ENABLED
TUSB_OPT_DEVICE_ENABLED still usable for backward compatible
2022-02-25 18:35:21 +07:00
hathach
a994540860 fix nrf easy dma race condition 2021-11-23 09:36:28 +07:00
hathach
7596cb3079 update some sense warning from -Wconversion 2021-10-15 15:54:32 +07:00
hathach
5811122cfd change usbh open driver to have max_len and return driver len 2021-06-28 17:39:57 +07:00
hathach
9736e54734 include clean up 2021-05-27 17:40:39 +07:00
Reinhard Panhuber
de933c45bc Remove all remainings with peek_at 2021-04-30 14:56:14 +02:00
Reinhard Panhuber
a1efd41649 Merge remote-tracking branch 'upstream/master' into edpt_ISO_xfer 2021-04-03 09:50:08 +02:00
hathach
31373fd55c use !tu_fifo_empty() instead of tu_fifo_count() 2021-03-12 12:55:18 +07:00
HiFiPhile
5caad485f1 Add fifo empty check.
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2021-03-11 20:36:46 +01:00
hathach
794083b647 Merge branch 'master' into edpt_ISO_xfer 2021-03-10 17:10:49 +07:00
HiFiPhile
7fc99a9e11 Call One time tu_fifo_write_n on cdcd_xfer_cb
Signed-off-by: HiFiPhile <admin@hifiphile.com>
2021-03-10 10:19:45 +01:00
Reinhard Panhuber
7e56f46957 Extend FIFO mutex to use separate write and read mutexes.
Adjust all USB drivers using FIFO and mutexes.
2021-03-04 13:52:14 +01:00
amit verma
07a04255da initial break request handling 2021-02-25 23:13:21 +05:30
hathach
4b4f880785 add tud_ready() check in tud_cdc_n_write_flush()
other clean up
2020-11-23 23:40:13 +07:00
Ha Thach
308028e17c Merge branch 'master' into cdc_without_dtr 2020-11-23 23:25:55 +07:00
hathach
dd07fecc5f migrate cdc_device to new control_xfer_cb 2020-11-19 21:26:06 +07:00
Jan Dümpelmann
54e29e9ff4 Implementation of the discussed changes
- remove usbd_edpt_xfer_abort
- rename tu_fifo_change_mode to tu_fifo_set_mode
- remove CFG_TUD_CDC_CLEAR_AT_CONNECTION definition
- remove auto fifo clear at connection event
- add tud_cdc_n_write_clear function
2020-11-18 09:42:50 +01:00
Jan Dümpelmann
af9f0f1cd6 Merge remote-tracking branch 'hathach/master' into cdc_without_dtr 2020-11-04 17:11:01 +01:00
hathach
6fcd540cb6 enable cdc auto flush on write()
if there is enough data in the fifo
2020-11-02 16:50:46 +07:00
hathach
23e6ee2ea2 cdc device: claim endpoint before checking fifo availability
- add pre-check to reduce mutex lock in usbd_edpt_claim
2020-09-14 22:14:31 +07:00
hathach
801f8b5b38 update claim edpt for hid and midi 2020-09-10 23:32:08 +07:00
hathach
ed6d48b81e typo 2020-09-09 16:45:54 +07:00
hathach
fe1b5dfa23 clean up 2020-09-09 16:29:45 +07:00
hathach
33f0a18523 update cdc edpt read 2020-09-09 16:25:31 +07:00
hathach
8b9893cada introduce optional usbd_edpt_claim, usbd_edpt_release which can be used to gain exclusive access to usbd_edpt_xfer 2020-09-09 15:48:11 +07:00
Jan Dümpelmann
9cc22b635c Add functionality to abort an ongoing transfer 2020-09-04 15:40:23 +02:00
Jan Dümpelmann
4071e490e2 New function to modify fifo overwritability 2020-09-03 17:21:32 +02:00
Jan Dümpelmann
fd6cf9010b Turn transmit fifo overwritable in no DTR mode 2020-09-03 17:03:13 +02:00
Jan Dümpelmann
d9eaa54e14 Remove connected check for write flushing 2020-09-03 16:40:53 +02:00
hathach
a1b7e767af improve midi
- fix #436 tud_midi_rx_cb() not invoked
- fix xfer_cb() not handle ep in
- add ZLP if needed
2020-08-24 14:31:46 +07:00
Ha Thach
e5d622b749 Merge pull request #434 from gh2o/master
Add TX callback to CDC device
2020-08-21 11:14:06 +07:00
Gavin Li
72183c7bb4 Slight optimization for cdc tx refill 2020-08-20 09:59:23 -07:00
Gavin Li
15b063beb2 Smarter CDC TX refill logic 2020-08-20 02:20:01 -07:00
hathach
706413f751 add tud_speed_get()
- define both fs and hs configuration descriptor
- rename CFG_TUD_CDC_EPSIZE to CFG_TUD_CDC_EP_BUFSIZE with default size of 64 for FS, and 512 for HS
2020-07-16 00:44:09 +07:00
hathach
12a145b27d fix dfu-rt to response to SET_INTERFACE and DFU_GETSTATUS
fix #450
2020-07-01 01:33:02 +07:00
Gavin Li
7ae47a9397 Call tud_cdc_tx_cb right after flush to keep tx fifo full 2020-06-20 22:12:10 -07:00
Gavin Li
8fe887198b Add tx callback to cdc device
Useful for continuous transmission of data, which is difficult currently
because there is no notification of tx completion.
2020-06-18 01:13:44 -07:00
hathach
fb214f7cf7 rename to drv_len to be consistent 2020-05-28 13:57:49 +07:00