bd: print debug messages

This commit is contained in:
Alexandre Bard 2021-05-31 10:20:45 +02:00
parent 5cdce0ed93
commit 73876e3f86
1 changed files with 20 additions and 20 deletions

View File

@ -160,27 +160,27 @@ int bd_get_context(BD_Context *bdctx, uint32_t i2caddress, uint32_t offset)
/* Read header bytes from beginning of EEPROM */
if (dm_i2c_read(chip, offset, bdHeader, BD_HEADER_LENGTH )) {
debug("%s() Can't read BD header from EEPROM\n", __func__);
printf("%s() Can't read BD header from EEPROM\n", __func__);
goto exit1;
}
/* Check whether this is a valid board descriptor (or empty EEPROM) */
rc = BD_CheckHeader( bdctx, bdHeader );
if (!rc) {
debug("%s() No valid board descriptor found\n", __func__);
printf("%s() No valid board descriptor found\n", __func__);
goto exit1;
}
/* Allocate memory for descriptor data and .. */
pBdData = malloc( bdctx->size );
if ( pBdData == NULL ) {
debug("%s() Can't allocate %d bytes\n", __func__, bdctx->size);
printf("%s() Can't allocate %d bytes\n", __func__, bdctx->size);
goto exit1;
}
/* .. read data from EEPROM */
if (dm_i2c_read(chip, offset+BD_HEADER_LENGTH, pBdData, bdctx->size)) {
debug("%s() Can't read data from EEPROM\n", __func__);
printf("%s() Can't read data from EEPROM\n", __func__);
goto exit1;
}
@ -189,7 +189,7 @@ int bd_get_context(BD_Context *bdctx, uint32_t i2caddress, uint32_t offset)
*/
rc = BD_ImportData( bdctx, pBdData );
if (!rc) {
debug("%s() Invalid board descriptor data\n", __func__);
printf("%s() Invalid board descriptor data\n", __func__);
goto exit1;
}
@ -207,7 +207,7 @@ exit1:
int bd_get_prodname(char *prodname, size_t len)
{
if ( !_get_string( BD_Prod_Name, 0, prodname, len) ) {
debug("%s() Product name not found\n", __func__);
printf("%s() Product name not found\n", __func__);
return -1;
}
@ -217,7 +217,7 @@ int bd_get_prodname(char *prodname, size_t len)
int bd_get_variantname(char *variantname, size_t len)
{
if ( !_get_string( BD_Prod_Variant_Name, 0, variantname, len) ) {
debug("%s() Variant name not found\n", __func__);
printf("%s() Variant name not found\n", __func__);
return -1;
}
@ -229,7 +229,7 @@ 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__);
printf("%s() no Hw Type found\n", __func__);
*type = hwtype;
}
@ -240,10 +240,10 @@ void bd_get_hw_version(int* ver, int* rev)
uint8_t hwrev = 0;
if ( !_get_uint8( BD_Hw_Ver, 0, &hwver) )
debug("%s() no Hw Version found\n", __func__);
printf("%s() no Hw Version found\n", __func__);
if ( !_get_uint8( BD_Hw_Rel, 0, &hwrev) )
debug("%s() no Hw Release found\n", __func__);
printf("%s() no Hw Release found\n", __func__);
*ver = hwver;
*rev = hwrev;
@ -254,7 +254,7 @@ void bd_get_hw_patch(int* patch)
uint8_t hwpatch = 0;
if ( !_get_uint8( BD_BOM_Patch, 0, &hwpatch) )
debug("%s() no Hw Patch found\n", __func__);
printf("%s() no Hw Patch found\n", __func__);
*patch = hwpatch;
}
@ -262,13 +262,13 @@ void bd_get_hw_patch(int* patch)
int bd_get_mac(int index, uint8_t *macaddr, size_t len)
{
if ( len != 6 ) {
debug("macaddr size must be 6 (is %ld)", len);
printf("macaddr size must be 6 (is %ld)", len);
return -1;
}
/* MAC address */
if ( !_get_mac( BD_Eth_Mac, index, macaddr) ) {
debug("%s() MAC addresss %d not found\n", __func__, index);
printf("%s() MAC addresss %d not found\n", __func__, index);
return -1;
}
@ -280,7 +280,7 @@ uint32_t bd_get_fpgainfo(void)
uint32_t fpgainfo = 0xFFFFFFFF;
if ( !_get_uint32( BD_Fpga_Info, 0, &fpgainfo) )
debug("%s() no FGPA Info found\n", __func__);
printf("%s() no FGPA Info found\n", __func__);
return fpgainfo;
}
@ -288,7 +288,7 @@ uint32_t bd_get_fpgainfo(void)
int bd_get_pd_dio(char *config, size_t len)
{
if ( !_get_string(BD_Pd_DIO, 0, config, len) ) {
debug("%s() no DIO info\n", __func__);
printf("%s() no DIO info\n", __func__);
return -1;
}
@ -298,7 +298,7 @@ int bd_get_pd_dio(char *config, size_t len)
int bd_get_pd_serial(char *config, size_t len)
{
if ( !_get_string(BD_Pd_Serial, 0, config, len) ) {
debug("%s() no serial port info\n", __func__);
printf("%s() no serial port info\n", __func__);
return -1;
}
@ -308,7 +308,7 @@ int bd_get_pd_serial(char *config, size_t len)
int bd_get_pd_module(uint32_t slot, char *config, size_t len)
{
if ( !_get_string(BD_Pd_Module0 + slot, 0, config, len) ) {
debug("%s() could not read module configuration on slot %d\n",
printf("%s() could not read module configuration on slot %d\n",
__func__, slot);
return -1;
}
@ -319,7 +319,7 @@ int bd_get_pd_module(uint32_t slot, char *config, size_t len)
int bd_get_sim_config(char* simconfig, size_t len)
{
if (!_get_string(BD_Pd_Sim, 0, simconfig, len)) {
debug("%s() no valid SIM config found\n", __func__);
printf("%s() no valid SIM config found\n", __func__);
return -1;
}
@ -329,7 +329,7 @@ int bd_get_sim_config(char* simconfig, size_t len)
int bd_get_devicetree(char* devicetreename, size_t len)
{
if (!_get_string(PD_Dev_Tree, 0, devicetreename, len)) {
debug("%s() no valid devicetree name found\n", __func__);
printf("%s() no valid devicetree name found\n", __func__);
return -1;
}
@ -341,7 +341,7 @@ int bd_get_shield(uint32_t shieldnr)
bd_uint16_t shield = 0;
if (!_get_uint16(PD_Shield, shieldnr, &shield) ) {
debug("%s() no shield populated\n", __func__);
printf("%s() no shield populated\n", __func__);
return -1;
}