src/coffee_lake/dp.c
static void dp_aux_i2c_read(struct LilGpu* gpu, uint16_t addr, uint8_t len, uint8_t* buf) {
    AuxRequest req = {0};
    AuxResponse res = {0};
    req.request = DDI_AUX_I2C_READ | DDI_AUX_I2C_MOT;
    req.address = addr;
    req.size = 0;    
    dp_aux_cmd(gpu, req);

    for(size_t i = 0; i < len; i++) {
        req.size = 1;

        res = dp_aux_cmd(gpu, req);
        buf[i] = res.data[0];
    }

    req.request = DDI_AUX_I2C_READ;
    req.address = 0;
    req.size = 0;    
    dp_aux_cmd(gpu, req);
}
// TODO: Check res.reply for any NACKs or DEFERs, instead of assuming i2c success, same for dp_aux_i2c_write
Check res.reply for any NACKs or DEFERs, instead of assuming i2c success, same for dp_aux_i2c_write
Check res . reply for any NACKs or DEFERs instead of assuming i2c success same for dp_aux_i2c_write
static void dp_aux_i2c_read(struct LilGpu* gpu, uint16_t addr, uint8_t len, uint8_t* buf) {
    AuxRequest req = {0};
    AuxResponse res = {0};
    req.request = DDI_AUX_I2C_READ | DDI_AUX_I2C_MOT;
    req.address = addr;
    req.size = 0;    
    dp_aux_cmd(gpu, req);
    for(size_t i = 0; i < len; i++) {
        req.size = 1;
        res = dp_aux_cmd(gpu, req);
        buf[i] = res.data[0];
    }
    req.request = DDI_AUX_I2C_READ;
    req.address = 0;
    req.size = 0;    
    dp_aux_cmd(gpu, req);
}
static void dp_aux_i2c_read ( struct LilGpu * gpu , uint16_t addr , uint8_t len , uint8_t * buf ) { AuxRequest req = { 0 } ; AuxResponse res = { 0 } ; req . request = DDI_AUX_I2C_READ | DDI_AUX_I2C_MOT ; req . address = addr ; req . size = 0 ; dp_aux_cmd ( gpu , req ) ; for ( size_t i = 0 ; i < len ; i ++ ) { req . size = 1 ; res = dp_aux_cmd ( gpu , req ) ; buf [ i ] = res . data [ 0 ] ; } req . request = DDI_AUX_I2C_READ ; req . address = 0 ; req . size = 0 ; dp_aux_cmd ( gpu , req ) ; }
TODO: Check res.reply for any NACKs or DEFERs, instead of assuming i2c success, same for dp_aux_i2c_write
TODO : Check res . reply for any NACKs or DEFERs instead of assuming i2c success same for dp_aux_i2c_write