[PATCH] osmo-bts[master]: osmo-bts-sysmo eeprom.c Restore ability to read/write EEPROM

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Keith Whyte gerrit-no-reply at lists.osmocom.org
Fri Mar 30 07:57:40 UTC 2018


Hello Vadim Yanitskiy, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/7572

to look at the new patch set (#2).

osmo-bts-sysmo eeprom.c Restore ability to read/write EEPROM

This commit restores ability to read write to the
SuperFemto EEPROM.

Because of pointer arithmetic,
ADDRESS + (pointer - pointer) does not give the same
result as ADDRESS + (int - int)

Fixes: 7cf144b27d75fadfb4ec65019985bb10660a066a

Change-Id: Iaa7318387ad7bb248c261b1f428019244039e7d2
---
M src/osmo-bts-sysmo/eeprom.c
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/72/7572/2

diff --git a/src/osmo-bts-sysmo/eeprom.c b/src/osmo-bts-sysmo/eeprom.c
index a7f3d77..b48d159 100644
--- a/src/osmo-bts-sysmo/eeprom.c
+++ b/src/osmo-bts-sysmo/eeprom.c
@@ -495,7 +495,7 @@
         case EEPROM_HDR_V2:
         {
             // Get a copy of the EEPROM section
-            err = eeprom_read( EEPROM_CFG_START_ADDR + ((uint32_t*)&ee.cfg.v1.sysInfo - (uint32_t*)&ee), sizeof(ee.cfg.v1.sysInfo), (char *)&ee.cfg.v1.sysInfo );
+            err = eeprom_read( EEPROM_CFG_START_ADDR + ((uint)&ee.cfg.v1.sysInfo - (uint)&ee), sizeof(ee.cfg.v1.sysInfo), (char *)&ee.cfg.v1.sysInfo );
             if ( err != sizeof(ee.cfg.v1.sysInfo) )
             {
                 PERROR( "Error while reading the EEPROM content (%d)\n", err );
@@ -602,7 +602,7 @@
             ee.cfg.v1.sysInfo.u16Crc = eeprom_crc( (uint8_t *)&ee.cfg.v1.sysInfo.u32Time, sizeof(ee.cfg.v1.sysInfo) - 2 * sizeof(uint16_t) );
 
             // Write it to the EEPROM
-            err = eeprom_write( EEPROM_CFG_START_ADDR + ((uint32_t*)&ee.cfg.v1.sysInfo - (uint32_t*)&ee), sizeof(ee.cfg.v1.sysInfo), (const char *) &ee.cfg.v1.sysInfo );
+            err = eeprom_write( EEPROM_CFG_START_ADDR + ((uint)&ee.cfg.v1.sysInfo - (uint)&ee), sizeof(ee.cfg.v1.sysInfo), (const char *) &ee.cfg.v1.sysInfo );
             if ( err != sizeof(ee.cfg.v1.sysInfo) )
             {
                 PERROR( "Error while writing to the EEPROM (%d)\n", err );
@@ -660,7 +660,7 @@
     	case EEPROM_HDR_V2:
         {
             // Get a copy of the EEPROM section 
-            err = eeprom_read( EEPROM_CFG_START_ADDR + ((uint32_t*)&ee.cfg.v1.rfClk - (uint32_t*)&ee), sizeof(ee.cfg.v1.rfClk), (char *)&ee.cfg.v1.rfClk );
+            err = eeprom_read( EEPROM_CFG_START_ADDR + ((uint)&ee.cfg.v1.rfClk - (uint)&ee), sizeof(ee.cfg.v1.rfClk), (char *)&ee.cfg.v1.rfClk );
             if ( err != sizeof(ee.cfg.v1.rfClk) )
             {
                 PERROR( "Error while reading the EEPROM content (%d)\n", err );
@@ -755,7 +755,7 @@
             ee.cfg.v1.rfClk.u16Crc = eeprom_crc( (uint8_t *)&ee.cfg.v1.rfClk.u32Time, sizeof(ee.cfg.v1.rfClk) - 2 * sizeof(uint16_t) );
 
             // Write it to the EEPROM
-            err = eeprom_write( EEPROM_CFG_START_ADDR + ((uint32_t*)&ee.cfg.v1.rfClk - (uint32_t*)&ee), sizeof(ee.cfg.v1.rfClk), (const char *) &ee.cfg.v1.rfClk );
+            err = eeprom_write( EEPROM_CFG_START_ADDR + ((uint)&ee.cfg.v1.rfClk - (uint)&ee), sizeof(ee.cfg.v1.rfClk), (const char *) &ee.cfg.v1.rfClk );
             if ( err != sizeof(ee.cfg.v1.rfClk) )
             {
                 PERROR( "Error while writing to the EEPROM (%d)\n", err );
@@ -1099,7 +1099,7 @@
             pCfgTxCal->u16Crc = eeprom_crc( (uint8_t *)&pCfgTxCal->u32Time, size - 2 * sizeof(uint16_t) );
 
             // Write it to the EEPROM
-            err = eeprom_write( EEPROM_CFG_START_ADDR + ((uint32_t*)pCfgTxCal - (uint32_t*)&ee), size, (const char *)pCfgTxCal );
+            err = eeprom_write( EEPROM_CFG_START_ADDR + ((uint)pCfgTxCal - (uint)&ee), size, (const char *)pCfgTxCal );
             if ( err != size )
             {
                 PERROR( "Error while writing to the EEPROM (%d)\n", err );
@@ -1592,7 +1592,7 @@
             pCfgRxCal->u16Crc = eeprom_crc( (uint8_t *)&pCfgRxCal->u32Time, size - 2 * sizeof(uint16_t) );
 
             // Write it to the EEPROM
-            err = eeprom_write( EEPROM_CFG_START_ADDR + ((uint32_t*)pCfgRxCal - (uint32_t*)&ee), size, (const char *)pCfgRxCal );
+            err = eeprom_write( EEPROM_CFG_START_ADDR + ((uint)pCfgRxCal - (uint)&ee), size, (const char *)pCfgRxCal );
             if ( err != size )
             {
                 PERROR( "Error while writing to the EEPROM (%d)\n", err );

-- 
To view, visit https://gerrit.osmocom.org/7572
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iaa7318387ad7bb248c261b1f428019244039e7d2
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Keith Whyte <keith at rhizomatica.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Keith Whyte <keith at rhizomatica.org>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>



More information about the gerrit-log mailing list