Commit a0dd57c4 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

remove unused functions, declarations and struct

parent 71116c8a
......@@ -173,93 +173,3 @@ int8_t eeprom_match_sfp(uint8_t i2cif, uint8_t i2c_addr, struct s_sfpinfo* sfp)
return 0;
}
int8_t eeprom_get_sfpinfo(uint8_t i2cif, uint8_t i2c_addr, uint32_t offset, struct s_sfpinfo *sfpinfo, uint16_t section_sz)
{
uint8_t *buf;
uint32_t i;
uint8_t checksum, sum;
buf = (uint8_t *)sfpinfo;
eeprom_read(i2cif, i2c_addr, offset, buf, section_sz * sizeof(struct s_sfpinfo));
//read checksum
eeprom_read(i2cif, i2c_addr, offset+section_sz*sizeof(struct s_sfpinfo), &checksum, 1);
//count checksum
sum = (uint8_t) (section_sz>>8 & 0xff);
sum = (uint8_t) ((uint16_t) sum + (section_sz & 0xff)) & 0xff;
for(i=0; i<section_sz*sizeof(struct s_sfpinfo); ++i)
sum = (uint8_t) ((uint16_t)sum + *(buf+i)) & 0xff;
if(sum == checksum)
{
mprintf("%s: checksum match\n", __FUNCTION__);
return 0;
}
else
{
mprintf("%s: checksum error, %x | %x\n", __FUNCTION__, sum, checksum);
return -1;
}
}
//int8_t access_eeprom(char *sfp_pn, int32_t *alpha, int32_t *deltaTx, int32_t *deltaRx)
//{
// uint16_t i;
// uint8_t j;
// uint16_t sfp_sz;
// int32_t sfp_adr;
// struct s_sfpinfo sfpinfo[SFPS_MAX];
//
// mi2c_init(WRPC_FMC_I2C);
//
// sfp_adr = eeprom_sfp_section(WRPC_FMC_I2C, FMC_EEPROM_ADR, 64*1024, &sfp_sz);
// if(sfp_adr == -1)
// {
// mprintf("FMC EEPROM not found\n");
// return -1;
// }
// else if(sfp_sz > SFPINFO_MAX)
// {
// //Ooops, there are too many of them, print warning
// mprintf("! Warning ! too many SFP entries (%d)\n", sfp_sz);
// sfp_sz = SFPINFO_MAX;
// }
// else if(sfp_sz == 0)
// {
// mprintf("EEPROM: could no find SFP section, staring with defaults\n");
// return -1;
// }
// mprintf("EEPROM: found SFP section at %d size %d\n", (uint32_t)sfp_adr, (uint32_t)sfp_sz);
//
// if( eeprom_get_sfpinfo(WRPC_FMC_I2C, FMC_EEPROM_ADR, sfp_adr, sfpinfo, sfp_sz))
// {
// mprintf("EEPROM ERROR\n");
// return -1;
// }
//
// for(i=0; i<sfp_sz; ++i)
// {
// for(j=0; j<16; ++j)
// {
// if(sfp_pn[j] != sfpinfo[i].pn[j])
// break;
// }
//
// if( j==16 ) //which means sfp_pn = sfpinfo[i].pn
// {
// mprintf("match SFP%d: pn=", i+1);
// for(j=0; j<16; ++j)
// mprintf("%c", sfpinfo[i].pn[j]);
// //mprintf(" alpha=%x deltaTx=%x deltaRx=%x\n", sfpinfo[i].alpha, sfpinfo[i].deltaTx, sfpinfo[i].deltaRx);
//
// *alpha = sfpinfo[i].alpha;
// *deltaTx = sfpinfo[i].deltaTx;
// *deltaRx = sfpinfo[i].deltaRx;
// }
// }
//
// return 0;
//}
......@@ -32,7 +32,5 @@ int eeprom_write(uint8_t i2cif, uint8_t i2c_addr, uint32_t offset, uint8_t *buf,
int32_t eeprom_sfpdb_erase(uint8_t i2cif, uint8_t i2c_addr);
int32_t eeprom_sfp_section(uint8_t i2cif, uint8_t i2c_addr, size_t size, uint16_t *section_sz);
int8_t eeprom_match_sfp(uint8_t i2cif, uint8_t i2c_addr, struct s_sfpinfo* sfp);
int8_t eeprom_get_sfpinfo(uint8_t i2cif, uint8_t i2c_addr, uint32_t offset, struct s_sfpinfo *sfpinfo, uint16_t section_sz);
int8_t access_eeprom(char *sfp_pn, int32_t *alpha, int32_t *deltaTx, int32_t *deltaRx);
#endif
......@@ -5,28 +5,11 @@
#include <stdint.h>
struct sfp_info {
char part_no[16];
int32_t delta_tx, delta_rx, alpha;
};
/* Returns 1 if there's a SFP transceiver inserted in the socket. */
int sfp_present();
/* Reads the part ID of the SFP from its configuration EEPROM */
int sfp_read_part_id(char *part_id);
/* SFP Database functions */
/* Adds an SFP to the DB */
int sfp_db_add(struct sfp_info *sinfo);
/* Searches for an SFP matching its' part_id */
struct sfp_info *sfp_db_lookup(const char *part_id);
struct sfp_info *sfp_db_get(int i);
void sfp_db_clear();
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment