product/n1sdp/module/n1sdp_dmc620/src/dimm_spd.c
static int spd_read(
    struct mod_cdns_i2c_master_api_polled *i2c_api,
    int address,
    uint8_t *spd_data)
{
    char data[2] = {0};
    int i;
    int status;

    status = i2c_api->write(
        (FWK_ID_ELEMENT(FWK_MODULE_IDX_CDNS_I2C, 0)),
        WRITE_PAGE0,
        data,
        SPD_W_TRANSFER_SIZE,
        SPD_STOP);
    if (status != FWK_SUCCESS) {
        return status;
    }

    for (i = SPD_PAGE0_START; i <= MAX_SPD_PAGE0; i++) {
        status = i2c_api->read(
            (FWK_ID_ELEMENT(FWK_MODULE_IDX_CDNS_I2C, 0)),
            address,
            (char *)&spd_data[i],
            SPD_R_TRANSFER_SIZE);
        if (status != FWK_SUCCESS) {
            return status;
        }
    }

    status = i2c_api->write(
        (FWK_ID_ELEMENT(FWK_MODULE_IDX_CDNS_I2C, 0)),
        WRITE_PAGE1,
        data,
        SPD_W_TRANSFER_SIZE,
        SPD_STOP);
    if (status != FWK_SUCCESS) {
        return status;
    }

    for (i = SPD_PAGE1_START; i <= MAX_SPD_PAGE1; i++) {
        status = i2c_api->read(
            (FWK_ID_ELEMENT(FWK_MODULE_IDX_CDNS_I2C, 0)),
            address,
            (char *)&spd_data[i],
            SPD_R_TRANSFER_SIZE);
        if (status != FWK_SUCCESS) {
            return status;
        }
    }

    return FWK_SUCCESS;
}
/*
 * Internal APIs used by SPD functions
 */
Internal APIs used by SPD functions
Internal APIs used by SPD functions
static int spd_read(
    struct mod_cdns_i2c_master_api_polled *i2c_api,
    int address,
    uint8_t *spd_data)
{
    char data[2] = {0};
    int i;
    int status;
    status = i2c_api->write(
        (FWK_ID_ELEMENT(FWK_MODULE_IDX_CDNS_I2C, 0)),
        WRITE_PAGE0,
        data,
        SPD_W_TRANSFER_SIZE,
        SPD_STOP);
    if (status != FWK_SUCCESS) {
        return status;
    }
    for (i = SPD_PAGE0_START; i <= MAX_SPD_PAGE0; i++) {
        status = i2c_api->read(
            (FWK_ID_ELEMENT(FWK_MODULE_IDX_CDNS_I2C, 0)),
            address,
            (char *)&spd_data[i],
            SPD_R_TRANSFER_SIZE);
        if (status != FWK_SUCCESS) {
            return status;
        }
    }
    status = i2c_api->write(
        (FWK_ID_ELEMENT(FWK_MODULE_IDX_CDNS_I2C, 0)),
        WRITE_PAGE1,
        data,
        SPD_W_TRANSFER_SIZE,
        SPD_STOP);
    if (status != FWK_SUCCESS) {
        return status;
    }
    for (i = SPD_PAGE1_START; i <= MAX_SPD_PAGE1; i++) {
        status = i2c_api->read(
            (FWK_ID_ELEMENT(FWK_MODULE_IDX_CDNS_I2C, 0)),
            address,
            (char *)&spd_data[i],
            SPD_R_TRANSFER_SIZE);
        if (status != FWK_SUCCESS) {
            return status;
        }
    }
    return FWK_SUCCESS;
}
static int spd_read ( struct mod_cdns_i2c_master_api_polled * i2c_api , int address , uint8_t * spd_data ) { char data [ 2 ] = { 0 } ; int i ; int status ; status = i2c_api -> write ( ( FWK_ID_ELEMENT ( FWK_MODULE_IDX_CDNS_I2C , 0 ) ) , WRITE_PAGE0 , data , SPD_W_TRANSFER_SIZE , SPD_STOP ) ; if ( status != FWK_SUCCESS ) { return status ; } for ( i = SPD_PAGE0_START ; i <= MAX_SPD_PAGE0 ; i ++ ) { status = i2c_api -> read ( ( FWK_ID_ELEMENT ( FWK_MODULE_IDX_CDNS_I2C , 0 ) ) , address , ( char * ) & spd_data [ i ] , SPD_R_TRANSFER_SIZE ) ; if ( status != FWK_SUCCESS ) { return status ; } } status = i2c_api -> write ( ( FWK_ID_ELEMENT ( FWK_MODULE_IDX_CDNS_I2C , 0 ) ) , WRITE_PAGE1 , data , SPD_W_TRANSFER_SIZE , SPD_STOP ) ; if ( status != FWK_SUCCESS ) { return status ; } for ( i = SPD_PAGE1_START ; i <= MAX_SPD_PAGE1 ; i ++ ) { status = i2c_api -> read ( ( FWK_ID_ELEMENT ( FWK_MODULE_IDX_CDNS_I2C , 0 ) ) , address , ( char * ) & spd_data [ i ] , SPD_R_TRANSFER_SIZE ) ; if ( status != FWK_SUCCESS ) { return status ; } } return FWK_SUCCESS ; }
Internal APIs used by SPD functions
Internal APIs used by SPD functions