/* Function that handles the received data when the i.MX is used in Slave mode. If the requested address size is 1 or 2 bytes, it does nothing. If the requested address size is 4 bytes, then it writes to the memory location of the i.MX. */
int32_t imx6_slave_receive(const imx_i2c_request_t *rq)
/* Function that handles the received data when the i.MX is used in Slave mode. If the requested address size is 1 or 2 bytes, it does nothing. If the requested address size is 4 bytes, then it writes to the memory location of the i.MX. */
int32_t imx6_slave_receive(const imx_i2c_request_t *rq)
{
    int32_t ret = 0;
    uint32_t data_address;
    uint32_t r_data = 0;
    uint8_t addr_sz = rq->reg_addr_sz;
    s_masterDidWrite = true;
    if(addr_sz == 4)
    {
        data_address = (uint32_t) ((rq->buffer[0] << 24) | (rq->buffer[1] << 16) |
                       (rq->buffer[2] << 8) | rq->buffer[3]);
        r_data = (rq->buffer[addr_sz+3] << 24) | (rq->buffer[addr_sz+2] << 16) |
                 (rq->buffer[addr_sz+1] << 8) | rq->buffer[addr_sz];
        writel(r_data, data_address);
    }
    return ret;
}