From bbada1d3e6dba5b339c7cd4129e5df7b3203c11b Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 23 Dec 2019 18:54:06 +0700 Subject: adding lookup table for debugging add msc scsi command list --- src/common/tusb_common.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/common') diff --git a/src/common/tusb_common.h b/src/common/tusb_common.h index f76abca88..5700c1282 100644 --- a/src/common/tusb_common.h +++ b/src/common/tusb_common.h @@ -231,6 +231,29 @@ void tu_print_mem(void const *buf, uint16_t count, uint8_t indent); #define TU_LOG2_LOCATION() TU_LOG1_LOCATION() #endif + +typedef struct +{ + uint32_t key; + char const * data; +}lookup_entry_t; + +typedef struct +{ + uint16_t count; + lookup_entry_t const* items; +} lookup_table_t; + +static inline char const* lookup_find(lookup_table_t const* p_table, uint32_t key) +{ + for(uint16_t i=0; icount; i++) + { + if (p_table->items[i].key == key) return p_table->items[i].data; + } + + return NULL; +} + #endif // CFG_TUSB_DEBUG #ifndef TU_LOG1 -- cgit v1.3.1