summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-12-23 18:54:06 +0700
committerhathach <[email protected]>2019-12-23 18:54:06 +0700
commitbbada1d3e6dba5b339c7cd4129e5df7b3203c11b (patch)
treede9ef9a7d0bff897e84ec46853f21170900d250e /src/common
parent94e70f9b016edfcdea165674e17201fda88a089b (diff)
adding lookup table for debugging
add msc scsi command list
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tusb_common.h23
1 files changed, 23 insertions, 0 deletions
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; i<p_table->count; i++)
+ {
+ if (p_table->items[i].key == key) return p_table->items[i].data;
+ }
+
+ return NULL;
+}
+
#endif // CFG_TUSB_DEBUG
#ifndef TU_LOG1