summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-01-15 18:42:39 +0700
committerhathach <[email protected]>2024-01-15 19:02:02 +0700
commit1f2901e8b12258c953e3c338897f188c98b5eaed (patch)
tree1008da9d72f1e6b8688f253418004986d884cee0 /src/class
parentd192868d62b56ef2eab9300bf0698a77e4e01cd3 (diff)
fix conflict of BIT() macro
Diffstat (limited to 'src/class')
-rw-r--r--src/class/cdc/cdc_host.c2
-rw-r--r--src/class/cdc/serial/ch34x.h11
2 files changed, 5 insertions, 8 deletions
diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c
index 0cc35da52..ca5bfff04 100644
--- a/src/class/cdc/cdc_host.c
+++ b/src/class/cdc/cdc_host.c
@@ -1358,7 +1358,7 @@ static int32_t ch341_set_baudrate (cdch_interface_t* p_cdc, uint32_t baud_rate,
* inverted.
*/
if ( p_cdc->ch34x.version > 0x27 ) {
- val = (val | BIT(7));
+ val = (val | TU_BIT(7));
}
return ch341_write_reg ( p_cdc, CH341_REG_DIVISOR << 8 | CH341_REG_PRESCALER, val, complete_cb, user_data );
diff --git a/src/class/cdc/serial/ch34x.h b/src/class/cdc/serial/ch34x.h
index 94e18b252..4a5e61bbd 100644
--- a/src/class/cdc/serial/ch34x.h
+++ b/src/class/cdc/serial/ch34x.h
@@ -29,7 +29,7 @@
#include <stdint.h>
-#define BIT(nr) ( (uint32_t)1 << (nr) )
+//#define BIT(nr) ( (uint32_t)1 << (nr) )
#define CH34X_BUFFER_SIZE 2
@@ -93,20 +93,17 @@
#define CH341_LCR_CS6 0x01
#define CH341_LCR_CS5 0x00
-#define CH341_QUIRK_LIMITED_PRESCALER BIT(0)
-#define CH341_QUIRK_SIMULATE_BREAK BIT(1)
+#define CH341_QUIRK_LIMITED_PRESCALER TU_BIT(0)
+#define CH341_QUIRK_SIMULATE_BREAK TU_BIT(1)
#define CH341_CLKRATE 48000000
#define CH341_CLK_DIV(ps, fact) (1 << (12 - 3 * (ps) - (fact)))
#define CH341_MIN_RATE(ps) (CH341_CLKRATE / (CH341_CLK_DIV((ps), 1) * 512))
/* Supported range is 46 to 3000000 bps. */
-#define CH341_MIN_BPS DIV_ROUND_UP(CH341_CLKRATE, CH341_CLK_DIV(0, 0) * 256)
+#define CH341_MIN_BPS TU_DIV_CEIL(CH341_CLKRATE, CH341_CLK_DIV(0, 0) * 256)
#define CH341_MAX_BPS (CH341_CLKRATE / (CH341_CLK_DIV(3, 0) * 2))
-#define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
-#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
-
// error codes
#define EINVAL 22 /* Invalid argument */