static int pmic_bus_write(const u8 addr, u8 data) { #ifdef CONFIG_MACH_SUN6I return p2wi_write(addr, data); #else return rsb_write(AXP223_RUNTIME_ADDR, addr, data); #endif }
static int axp_clrsetbits(uint8_t reg, uint8_t clr_mask, uint8_t set_mask) { uint8_t regval; int ret; ret = rsb_read(AXP803_RT_ADDR, reg); if (ret < 0) return ret; regval = (ret & ~clr_mask) | set_mask; return rsb_write(AXP803_RT_ADDR, reg, regval); }
int pmic_bus_write(u8 reg, u8 data) { #ifdef CONFIG_AXP152_POWER return i2c_write(AXP152_I2C_ADDR, reg, 1, &data, 1); #elif defined CONFIG_AXP209_POWER return i2c_write(AXP209_I2C_ADDR, reg, 1, &data, 1); #elif defined CONFIG_AXP221_POWER || defined CONFIG_AXP809_POWER || defined CONFIG_AXP818_POWER # ifdef CONFIG_MACH_SUN6I return p2wi_write(reg, data); # else return rsb_write(AXP223_RUNTIME_ADDR, reg, data); # endif #endif }
static int axp_write(uint8_t reg, uint8_t val) { return rsb_write(AXP803_RT_ADDR, reg, val); }
int main() { int i; rsb_init_array(&buffer, data_buffer); buffer.buffer_filled = write_signal; CreateThread(NULL, 0, ReaderThread, NULL, 0, NULL); for (i = 0; i < 26; i++) { rsb_write(&buffer, 'a' + i); if (i == 4) rsb_set_marker(&buffer); } rsb_restore_marker(&buffer); rsb_write(&buffer, '1'); rsb_write(&buffer, '2'); while(!rsb_is_empty(&buffer)) { Sleep(100); } rsb_write(&buffer, 'h'); rsb_write(&buffer, 'e'); rsb_write(&buffer, 'e'); rsb_write(&buffer, 'h'); while (rsb_length(&buffer) > 2) { Sleep(100); } rsb_restore_marker(&buffer); while(!rsb_is_empty(&buffer)) { Sleep(100); } rsb_clear_marker(&buffer); buffer.always_invoke = true; rsb_write(&buffer, 'h'); rsb_write(&buffer, 'e'); rsb_write(&buffer, 'e'); rsb_write(&buffer, 'h'); rsb_restore_marker(&buffer); while(!rsb_is_empty(&buffer)) { Sleep(100); } }