1.1 --- a/pkg/devices/lib/i2c/src/x1600.cc Tue Oct 24 17:20:58 2023 +0200
1.2 +++ b/pkg/devices/lib/i2c/src/x1600.cc Tue Oct 24 17:22:51 2023 +0200
1.3 @@ -166,11 +166,13 @@
1.4 // Initialise a channel.
1.5
1.6 I2c_x1600_channel::I2c_x1600_channel(l4_addr_t start,
1.7 - Cpm_x1600_chip *cpm,
1.8 - uint32_t frequency)
1.9 + enum Clock_identifiers clock,
1.10 + Cpm_x1600_chip *cpm,
1.11 + uint32_t frequency)
1.12 : _cpm(cpm), _frequency(frequency)
1.13 {
1.14 _regs = new Hw::Mmio_register_block<32>(start);
1.15 + _cpm->start_clock(clock);
1.16 }
1.17
1.18 // Enable the channel.
1.19 @@ -687,13 +689,10 @@
1.20 I2c_x1600_chip::get_channel(uint8_t channel)
1.21 {
1.22 l4_addr_t block = _start + channel * I2c_block_offset;
1.23 - enum Clock_identifiers bits[] = {Clock_i2c0, Clock_i2c1};
1.24 + enum Clock_identifiers clocks[] = {Clock_i2c0, Clock_i2c1};
1.25
1.26 if (channel < 2)
1.27 - {
1.28 - _cpm->start_clock(bits[channel]);
1.29 - return new I2c_x1600_channel(block, _cpm, _frequency);
1.30 - }
1.31 + return new I2c_x1600_channel(block, clocks[channel], _cpm, _frequency);
1.32 else
1.33 throw -L4_EINVAL;
1.34 }
1.35 @@ -707,11 +706,6 @@
1.36 return (void *) new I2c_x1600_chip(start, end, static_cast<Cpm_x1600_chip *>(cpm), frequency);
1.37 }
1.38
1.39 -void x1600_i2c_disable(void *i2c_channel)
1.40 -{
1.41 - static_cast<I2c_x1600_channel *>(i2c_channel)->disable();
1.42 -}
1.43 -
1.44 void *x1600_i2c_get_channel(void *i2c, uint8_t channel)
1.45 {
1.46 return static_cast<I2c_x1600_chip *>(i2c)->get_channel(channel);
1.47 @@ -773,8 +767,3 @@
1.48 {
1.49 return static_cast<I2c_x1600_channel *>(i2c_channel)->failed();
1.50 }
1.51 -
1.52 -void x1600_i2c_stop(void *i2c_channel)
1.53 -{
1.54 - static_cast<I2c_x1600_channel *>(i2c_channel)->stop();
1.55 -}