mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-11-20 08:15:20 +00:00
Merge pull request #553 from zhouzi88/swl-5235
onlp_sfp_dev_read/write API
This commit is contained in:
@@ -85,7 +85,7 @@ int onlp_sfpi_dev_readb(int port, uint8_t devaddr, uint8_t addr);
|
||||
int onlp_sfpi_dev_writeb(int port, uint8_t devaddr, uint8_t addr, uint8_t value);
|
||||
|
||||
/**
|
||||
* @brief Read a byte from an address on the given SFP port's bus.
|
||||
* @brief Read a word from an address on the given SFP port's bus.
|
||||
* @param port The port number.
|
||||
* @param devaddr The device address.
|
||||
* @param addr The address.
|
||||
@@ -94,10 +94,23 @@ int onlp_sfpi_dev_writeb(int port, uint8_t devaddr, uint8_t addr, uint8_t value)
|
||||
int onlp_sfpi_dev_readw(int port, uint8_t devaddr, uint8_t addr);
|
||||
|
||||
/**
|
||||
* @brief Write a byte to an address on the given SFP port's bus.
|
||||
* @brief Write a word to an address on the given SFP port's bus.
|
||||
*/
|
||||
int onlp_sfpi_dev_writew(int port, uint8_t devaddr, uint8_t addr, uint16_t value);
|
||||
|
||||
/**
|
||||
* @brief Read from an address on the given SFP port's bus.
|
||||
* @param port The port number.
|
||||
* @param devaddr The device address.
|
||||
* @param addr The address.
|
||||
* @returns The data if successful, error otherwise.
|
||||
*/
|
||||
int onlp_sfpi_dev_read(int port, uint8_t devaddr, uint8_t addr, uint8_t* rdata, int size);
|
||||
|
||||
/**
|
||||
* @brief Write to an address on the given SFP port's bus.
|
||||
*/
|
||||
int onlp_sfpi_dev_write(int port, uint8_t devaddr, uint8_t addr, uint8_t* data, int size);
|
||||
|
||||
/**
|
||||
* @brief Read the SFP DOM EEPROM.
|
||||
|
||||
@@ -431,3 +431,19 @@ onlp_sfp_dev_writew_locked__(int port, uint8_t devaddr, uint8_t addr, uint16_t v
|
||||
return onlp_sfpi_dev_writew(port, devaddr, addr, value);
|
||||
}
|
||||
ONLP_LOCKED_API4(onlp_sfp_dev_writew, int, port, uint8_t, devaddr, uint8_t, addr, uint16_t, value);
|
||||
|
||||
int
|
||||
onlp_sfp_dev_read_locked__(int port, uint8_t devaddr, uint8_t addr, uint8_t* rdata, int size)
|
||||
{
|
||||
ONLP_SFP_PORT_VALIDATE_AND_MAP(port);
|
||||
return onlp_sfpi_dev_read(port, devaddr, addr, rdata, size);
|
||||
}
|
||||
ONLP_LOCKED_API5(onlp_sfp_dev_read, int, port, uint8_t, devaddr, uint8_t, addr, uint8_t*, rdata, int, size);
|
||||
|
||||
int
|
||||
onlp_sfp_dev_write_locked__(int port, uint8_t devaddr, uint8_t addr, uint8_t* data, int size)
|
||||
{
|
||||
ONLP_SFP_PORT_VALIDATE_AND_MAP(port);
|
||||
return onlp_sfpi_dev_write(port, devaddr, addr, data, size);
|
||||
}
|
||||
ONLP_LOCKED_API5(onlp_sfp_dev_write, int, port, uint8_t, devaddr, uint8_t, addr, uint8_t*, data, int, size);
|
||||
|
||||
@@ -44,3 +44,5 @@ __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_dev_readb(int port, uint8_t devaddr, ui
|
||||
__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_dev_writeb(int port, uint8_t devaddr, uint8_t addr, uint8_t value));
|
||||
__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_dev_readw(int port, uint8_t devaddr, uint8_t addr));
|
||||
__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_dev_writew(int port, uint8_t devaddr, uint8_t addr, uint16_t value));
|
||||
__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_dev_read(int port, uint8_t devaddr, uint8_t addr, uint8_t *rdata, int size));
|
||||
__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_dev_write(int port, uint8_t devaddr, uint8_t addr, uint8_t* data, int size));
|
||||
|
||||
Reference in New Issue
Block a user