OpenOCD
jep106.c
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 
3 /***************************************************************************
4  * Copyright (C) 2015 Andreas Fritiofson *
5  * andreas.fritiofson@gmail.com *
6  ***************************************************************************/
7 
8 #ifdef HAVE_CONFIG_H
9 #include "config.h"
10 #endif
11 
12 #include "jep106.h"
13 #include "log.h"
14 
15 static const char * const jep106[][126] = {
16 #include "jep106.inc"
17 };
18 
19 const char *jep106_table_manufacturer(unsigned int bank, unsigned int id)
20 {
21  if (id < 1 || id > 126) {
22  LOG_DEBUG("BUG: Caller passed out-of-range JEP106 ID!");
23  return "<invalid>";
24  }
25 
26  /* index is zero based */
27  id--;
28 
29  if (bank >= ARRAY_SIZE(jep106) || jep106[bank][id] == 0)
30  return "<unknown>";
31 
32  return jep106[bank][id];
33 }
uint8_t bank
Definition: esirisc.c:135
static const char *const jep106[][126]
Definition: jep106.c:15
const char * jep106_table_manufacturer(unsigned int bank, unsigned int id)
Get the manufacturer name associated with a JEP106 ID.
Definition: jep106.c:19
#define LOG_DEBUG(expr ...)
Definition: log.h:109
char id[RTT_CB_MAX_ID_LENGTH]
Control block identifier.
Definition: rtt/rtt.c:32
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.
Definition: types.h:57