adding lookup table for debugging

add msc scsi command list
This commit is contained in:
hathach
2019-12-23 18:54:06 +07:00
parent 94e70f9b01
commit bbada1d3e6
4 changed files with 57 additions and 5 deletions

View File

@@ -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