nrhw: add board descriptor hw_type support

(cherry picked from commit f51b3b4fc3)
This commit is contained in:
Rene Straub 2020-06-15 13:33:46 +02:00 committed by Marcel Reichmuth
parent bae7f8b879
commit f6dba79871
3 changed files with 18 additions and 3 deletions

View File

@ -30,6 +30,8 @@
* Fixed wrong sizeof type in GetPartition()
* Changed 64 bit type to "long long" from struct
* Added BD_VerifySha1Hmac() function
* 20200615 rs Added BD_Hw_Type tag
*
*****************************************************************************/
/**
@ -160,7 +162,8 @@ typedef enum _BD_Tags
BD_BOM_Patch = 33, /**< "UInt8" -> Hardware BOM patch of the equipment (BOM changes, same PCB, not SW relevant) */
BD_Prod_Variant_Name = 34, /**< "String" -> Product variant */
BD_Hw_Type = 35, /*<< "UInt16" -> Hardware Type, e.g. 24 for HW24, 26 for HW26 */
BD_Ui_Adapter_Type = 4096, /**< "UInt16" -> IV OG2 UI adapterboard type (0 = not present) */
BD_Voltage = 4098, /**< "UInt8" -> Primary Voltage (1=12-60V, 2=40-160V, 3=24-60V, 4=?, 5=12-24V) */
@ -181,10 +184,10 @@ typedef enum _BD_Tags
BD_Patch = 4126, /**< "UInt8" -> Board patch level (after production) */
BD_Pd_Phy2 = 4127, /**< "String" -> */
PD_SerDes = 4128, /**< "UInt16" -> SERDES Configuration (e.g. NB1800) */
PD_Shield = 4129, /**< "UInt16" -> Assembled Shield (0=COM/IO, 1=DualCAN) */
PD_Shield = 4129, /**< "UInt16" -> Assembled Shield (0=COM/IO, 1=DualCAN), 2=CAN/GNSS, 3=DualCAN Passive */
/* project specific tags */
BD_BootPart = 32768, /**< "UInt8" */
BD_BootPart = 32768, /**< "UInt8" */
BD_None_Type = 65535, /**< "Void" -> None */
}

View File

@ -17,6 +17,7 @@
* code cleanup (tabs/indentation)
* 20110211 rs partition table handling
* 20190330 rs cleanup after years of chaotic development
* 20200615 rs added bd_get_hw_type()
*
*****************************************************************************/
#include <common.h>
@ -217,6 +218,16 @@ int bd_get_variantname(char *variantname, size_t len)
return 0;
}
void bd_get_hw_type(int* type)
{
uint16_t hwtype = 0;
if ( !_get_uint16( BD_Hw_Type, 0, &hwtype) )
debug("%s() no Hw Type found\n", __func__);
*type = hwtype;
}
void bd_get_hw_version(int* ver, int* rev)
{
uint8_t hwver = 0;

View File

@ -17,6 +17,7 @@ int bd_get_context(BD_Context *bdctx, uint32_t i2caddress, uint32_t offset);
int bd_get_prodname(char *prodname, size_t len);
int bd_get_variantname(char *variantname, size_t len);
void bd_get_hw_type(int* type);
void bd_get_hw_version(int* ver, int* rev);
void bd_get_hw_patch(int* patch);
int bd_get_mac(int index, uint8_t *macaddr, size_t len);