修复MB/GB宏定义BUG

This commit is contained in:
gb 2024-01-29 15:46:29 +08:00
parent 2f9cf45ec3
commit 7e9256347f
2 changed files with 5 additions and 5 deletions

View File

@ -7,8 +7,8 @@
#endif #endif
#define SIZE_KB(n) ((n) * 1024) #define SIZE_KB(n) ((n) * 1024)
#define SIZE_MB(n) SIZE_KB(n * 1024) #define SIZE_MB(n) SIZE_KB((n) * 1024)
#define SIZE_GB(n) SIZE_MB(n * 1024) #define SIZE_GB(n) SIZE_MB((n) * 1024)
#define SEC_2_MS(s) ((s) * 1000) #define SEC_2_MS(s) ((s) * 1000)
#define MSEC_2_US(ms) ((ms) * 1000) #define MSEC_2_US(ms) ((ms) * 1000)

View File

@ -98,12 +98,12 @@ async_usb_gadget::async_usb_gadget(std::function<FUNCTION_PROTO_COMMAND_HANDLE>
threads_.set_exception_handler(excep); threads_.set_exception_handler(excep);
unit_in_ = unit_out_ = global_info::page_size; // dev_->get_max_packet(); unit_in_ = unit_out_ = global_info::page_size; // dev_->get_max_packet();
// allocate 10MB for IO // allocate 1MB for IO
#ifdef MEM_POOL #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_); utils::to_log(LOG_LEVEL_DEBUG, "Prepare %u(%u * %u) for IO.\n", io_buf_->count() * unit_out_, io_buf_->count(), unit_in_);
#else #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_); dyn_mem_ptr buf = dyn_mem::memory(unit_out_);
if(buf) if(buf)