From 7e9256347ff77fa0e6b393395f01ed930732b397 Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Mon, 29 Jan 2024 15:46:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DMB/GB=E5=AE=8F=E5=AE=9A?= =?UTF-8?q?=E4=B9=89BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/base/plat_types.h | 4 ++-- usb/usb_io.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/base/plat_types.h b/sdk/base/plat_types.h index 664b7fe..b475182 100644 --- a/sdk/base/plat_types.h +++ b/sdk/base/plat_types.h @@ -7,8 +7,8 @@ #endif #define SIZE_KB(n) ((n) * 1024) -#define SIZE_MB(n) SIZE_KB(n * 1024) -#define SIZE_GB(n) SIZE_MB(n * 1024) +#define SIZE_MB(n) SIZE_KB((n) * 1024) +#define SIZE_GB(n) SIZE_MB((n) * 1024) #define SEC_2_MS(s) ((s) * 1000) #define MSEC_2_US(ms) ((ms) * 1000) diff --git a/usb/usb_io.cpp b/usb/usb_io.cpp index 7a034d6..4f2ee37 100644 --- a/usb/usb_io.cpp +++ b/usb/usb_io.cpp @@ -98,12 +98,12 @@ async_usb_gadget::async_usb_gadget(std::function threads_.set_exception_handler(excep); unit_in_ = unit_out_ = global_info::page_size; // dev_->get_max_packet(); - // allocate 10MB for IO + // allocate 1MB for IO #ifdef MEM_POOL - io_buf_ = new dyn_mem_pool(256, unit_out_); + io_buf_ = new dyn_mem_pool(SIZE_MB(1) / unit_out_, unit_out_); utils::to_log(LOG_LEVEL_DEBUG, "Prepare %u(%u * %u) for IO.\n", io_buf_->count() * unit_out_, io_buf_->count(), unit_in_); #else - for(int i = 0; i < SIZE_MB(10) / unit_out_; ++i) + for(int i = 0; i < SIZE_MB(1) / unit_out_; ++i) { dyn_mem_ptr buf = dyn_mem::memory(unit_out_); if(buf)