From 456ce5cd31bb52d9c47388f72af197f45bffaf8e Mon Sep 17 00:00:00 2001 From: arendst Date: Sat, 17 Feb 2024 15:08:55 +0000 Subject: [PATCH] Solidified Code updated --- .../src/solidify/solidified_i2c_driver.h | 390 +++++++++++------- 1 file changed, 238 insertions(+), 152 deletions(-) diff --git a/lib/libesp32/berry_tasmota/src/solidify/solidified_i2c_driver.h b/lib/libesp32/berry_tasmota/src/solidify/solidified_i2c_driver.h index e4ff81021..3b29d8c76 100644 --- a/lib/libesp32/berry_tasmota/src/solidify/solidified_i2c_driver.h +++ b/lib/libesp32/berry_tasmota/src/solidify/solidified_i2c_driver.h @@ -6,135 +6,6 @@ extern const bclass be_class_I2C_Driver; -/******************************************************************** -** Solidified function: read32 -********************************************************************/ -be_local_closure(I2C_Driver_read32, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 7]) { /* constants */ - /* K0 */ be_nested_str(wire), - /* K1 */ be_nested_str(read_bytes), - /* K2 */ be_nested_str(addr), - /* K3 */ be_const_int(0), - /* K4 */ be_const_int(1), - /* K5 */ be_const_int(2), - /* K6 */ be_const_int(3), - }), - &be_const_str_read32, - &be_const_str_solidified, - ( &(const binstruction[20]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x88100102, // 0002 GETMBR R4 R0 K2 - 0x5C140200, // 0003 MOVE R5 R1 - 0x541A0003, // 0004 LDINT R6 4 - 0x7C080800, // 0005 CALL R2 4 - 0x940C0503, // 0006 GETIDX R3 R2 K3 - 0x54120017, // 0007 LDINT R4 24 - 0x380C0604, // 0008 SHL R3 R3 R4 - 0x94100504, // 0009 GETIDX R4 R2 K4 - 0x5416000F, // 000A LDINT R5 16 - 0x38100805, // 000B SHL R4 R4 R5 - 0x000C0604, // 000C ADD R3 R3 R4 - 0x94100505, // 000D GETIDX R4 R2 K5 - 0x54160007, // 000E LDINT R5 8 - 0x38100805, // 000F SHL R4 R4 R5 - 0x000C0604, // 0010 ADD R3 R3 R4 - 0x94100506, // 0011 GETIDX R4 R2 K6 - 0x000C0604, // 0012 ADD R3 R3 R4 - 0x80040600, // 0013 RET 1 R3 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: write8 -********************************************************************/ -be_local_closure(I2C_Driver_write8, /* name */ - be_nested_proto( - 9, /* nstack */ - 3, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ - /* K0 */ be_nested_str(wire), - /* K1 */ be_nested_str(write), - /* K2 */ be_nested_str(addr), - /* K3 */ be_const_int(1), - }), - &be_const_str_write8, - &be_const_str_solidified, - ( &(const binstruction[ 8]) { /* code */ - 0x880C0100, // 0000 GETMBR R3 R0 K0 - 0x8C0C0701, // 0001 GETMET R3 R3 K1 - 0x88140102, // 0002 GETMBR R5 R0 K2 - 0x5C180200, // 0003 MOVE R6 R1 - 0x5C1C0400, // 0004 MOVE R7 R2 - 0x58200003, // 0005 LDCONST R8 K3 - 0x7C0C0A00, // 0006 CALL R3 5 - 0x80040600, // 0007 RET 1 R3 - }) - ) -); -/*******************************************************************/ - - -/******************************************************************** -** Solidified function: read12 -********************************************************************/ -be_local_closure(I2C_Driver_read12, /* name */ - be_nested_proto( - 7, /* nstack */ - 2, /* argc */ - 2, /* varg */ - 0, /* has upvals */ - NULL, /* no upvals */ - 0, /* has sup protos */ - NULL, /* no sub protos */ - 1, /* has constants */ - ( &(const bvalue[ 6]) { /* constants */ - /* K0 */ be_nested_str(wire), - /* K1 */ be_nested_str(read_bytes), - /* K2 */ be_nested_str(addr), - /* K3 */ be_const_int(2), - /* K4 */ be_const_int(0), - /* K5 */ be_const_int(1), - }), - &be_const_str_read12, - &be_const_str_solidified, - ( &(const binstruction[12]) { /* code */ - 0x88080100, // 0000 GETMBR R2 R0 K0 - 0x8C080501, // 0001 GETMET R2 R2 K1 - 0x88100102, // 0002 GETMBR R4 R0 K2 - 0x5C140200, // 0003 MOVE R5 R1 - 0x58180003, // 0004 LDCONST R6 K3 - 0x7C080800, // 0005 CALL R2 4 - 0x940C0504, // 0006 GETIDX R3 R2 K4 - 0x54120003, // 0007 LDINT R4 4 - 0x380C0604, // 0008 SHL R3 R3 R4 - 0x94100505, // 0009 GETIDX R4 R2 K5 - 0x000C0604, // 000A ADD R3 R3 R4 - 0x80040600, // 000B RET 1 R3 - }) - ) -); -/*******************************************************************/ - - /******************************************************************** ** Solidified function: write_bit ********************************************************************/ @@ -189,6 +60,99 @@ be_local_closure(I2C_Driver_write_bit, /* name */ /*******************************************************************/ +/******************************************************************** +** Solidified function: read32 +********************************************************************/ +be_local_closure(I2C_Driver_read32, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 7]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(read_bytes), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(0), + /* K4 */ be_const_int(1), + /* K5 */ be_const_int(2), + /* K6 */ be_const_int(3), + }), + &be_const_str_read32, + &be_const_str_solidified, + ( &(const binstruction[20]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x88100102, // 0002 GETMBR R4 R0 K2 + 0x5C140200, // 0003 MOVE R5 R1 + 0x541A0003, // 0004 LDINT R6 4 + 0x7C080800, // 0005 CALL R2 4 + 0x940C0503, // 0006 GETIDX R3 R2 K3 + 0x54120017, // 0007 LDINT R4 24 + 0x380C0604, // 0008 SHL R3 R3 R4 + 0x94100504, // 0009 GETIDX R4 R2 K4 + 0x5416000F, // 000A LDINT R5 16 + 0x38100805, // 000B SHL R4 R4 R5 + 0x000C0604, // 000C ADD R3 R3 R4 + 0x94100505, // 000D GETIDX R4 R2 K5 + 0x54160007, // 000E LDINT R5 8 + 0x38100805, // 000F SHL R4 R4 R5 + 0x000C0604, // 0010 ADD R3 R3 R4 + 0x94100506, // 0011 GETIDX R4 R2 K6 + 0x000C0604, // 0012 ADD R3 R3 R4 + 0x80040600, // 0013 RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: read13 +********************************************************************/ +be_local_closure(I2C_Driver_read13, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(read_bytes), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(2), + /* K4 */ be_const_int(0), + /* K5 */ be_const_int(1), + }), + &be_const_str_read13, + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x88100102, // 0002 GETMBR R4 R0 K2 + 0x5C140200, // 0003 MOVE R5 R1 + 0x58180003, // 0004 LDCONST R6 K3 + 0x7C080800, // 0005 CALL R2 4 + 0x940C0504, // 0006 GETIDX R3 R2 K4 + 0x54120004, // 0007 LDINT R4 5 + 0x380C0604, // 0008 SHL R3 R3 R4 + 0x94100505, // 0009 GETIDX R4 R2 K5 + 0x000C0604, // 000A ADD R3 R3 R4 + 0x80040600, // 000B RET 1 R3 + }) + ) +); +/*******************************************************************/ + + /******************************************************************** ** Solidified function: read24 ********************************************************************/ @@ -237,9 +201,9 @@ be_local_closure(I2C_Driver_read24, /* name */ /******************************************************************** -** Solidified function: read8 +** Solidified function: read14 ********************************************************************/ -be_local_closure(I2C_Driver_read8, /* name */ +be_local_closure(I2C_Driver_read14, /* name */ be_nested_proto( 7, /* nstack */ 2, /* argc */ @@ -249,22 +213,29 @@ be_local_closure(I2C_Driver_read8, /* name */ 0, /* has sup protos */ NULL, /* no sub protos */ 1, /* has constants */ - ( &(const bvalue[ 4]) { /* constants */ + ( &(const bvalue[ 6]) { /* constants */ /* K0 */ be_nested_str(wire), - /* K1 */ be_nested_str(read), + /* K1 */ be_nested_str(read_bytes), /* K2 */ be_nested_str(addr), - /* K3 */ be_const_int(1), + /* K3 */ be_const_int(2), + /* K4 */ be_const_int(0), + /* K5 */ be_const_int(1), }), - &be_const_str_read8, + &be_const_str_read14, &be_const_str_solidified, - ( &(const binstruction[ 7]) { /* code */ + ( &(const binstruction[12]) { /* code */ 0x88080100, // 0000 GETMBR R2 R0 K0 0x8C080501, // 0001 GETMET R2 R2 K1 0x88100102, // 0002 GETMBR R4 R0 K2 0x5C140200, // 0003 MOVE R5 R1 0x58180003, // 0004 LDCONST R6 K3 0x7C080800, // 0005 CALL R2 4 - 0x80040400, // 0006 RET 1 R2 + 0x940C0504, // 0006 GETIDX R3 R2 K4 + 0x54120005, // 0007 LDINT R4 6 + 0x380C0604, // 0008 SHL R3 R3 R4 + 0x94100505, // 0009 GETIDX R4 R2 K5 + 0x000C0604, // 000A ADD R3 R3 R4 + 0x80040600, // 000B RET 1 R3 }) ) ); @@ -350,9 +321,80 @@ be_local_closure(I2C_Driver_init, /* name */ /******************************************************************** -** Solidified function: read13 +** Solidified function: write8 ********************************************************************/ -be_local_closure(I2C_Driver_read13, /* name */ +be_local_closure(I2C_Driver_write8, /* name */ + be_nested_proto( + 9, /* nstack */ + 3, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(write), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(1), + }), + &be_const_str_write8, + &be_const_str_solidified, + ( &(const binstruction[ 8]) { /* code */ + 0x880C0100, // 0000 GETMBR R3 R0 K0 + 0x8C0C0701, // 0001 GETMET R3 R3 K1 + 0x88140102, // 0002 GETMBR R5 R0 K2 + 0x5C180200, // 0003 MOVE R6 R1 + 0x5C1C0400, // 0004 MOVE R7 R2 + 0x58200003, // 0005 LDCONST R8 K3 + 0x7C0C0A00, // 0006 CALL R3 5 + 0x80040600, // 0007 RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: read8 +********************************************************************/ +be_local_closure(I2C_Driver_read8, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 4]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(read), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(1), + }), + &be_const_str_read8, + &be_const_str_solidified, + ( &(const binstruction[ 7]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x88100102, // 0002 GETMBR R4 R0 K2 + 0x5C140200, // 0003 MOVE R5 R1 + 0x58180003, // 0004 LDCONST R6 K3 + 0x7C080800, // 0005 CALL R2 4 + 0x80040400, // 0006 RET 1 R2 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: read12 +********************************************************************/ +be_local_closure(I2C_Driver_read12, /* name */ be_nested_proto( 7, /* nstack */ 2, /* argc */ @@ -370,7 +412,7 @@ be_local_closure(I2C_Driver_read13, /* name */ /* K4 */ be_const_int(0), /* K5 */ be_const_int(1), }), - &be_const_str_read13, + &be_const_str_read12, &be_const_str_solidified, ( &(const binstruction[12]) { /* code */ 0x88080100, // 0000 GETMBR R2 R0 K0 @@ -380,7 +422,49 @@ be_local_closure(I2C_Driver_read13, /* name */ 0x58180003, // 0004 LDCONST R6 K3 0x7C080800, // 0005 CALL R2 4 0x940C0504, // 0006 GETIDX R3 R2 K4 - 0x54120004, // 0007 LDINT R4 5 + 0x54120003, // 0007 LDINT R4 4 + 0x380C0604, // 0008 SHL R3 R3 R4 + 0x94100505, // 0009 GETIDX R4 R2 K5 + 0x000C0604, // 000A ADD R3 R3 R4 + 0x80040600, // 000B RET 1 R3 + }) + ) +); +/*******************************************************************/ + + +/******************************************************************** +** Solidified function: read16 +********************************************************************/ +be_local_closure(I2C_Driver_read16, /* name */ + be_nested_proto( + 7, /* nstack */ + 2, /* argc */ + 2, /* varg */ + 0, /* has upvals */ + NULL, /* no upvals */ + 0, /* has sup protos */ + NULL, /* no sub protos */ + 1, /* has constants */ + ( &(const bvalue[ 6]) { /* constants */ + /* K0 */ be_nested_str(wire), + /* K1 */ be_nested_str(read_bytes), + /* K2 */ be_nested_str(addr), + /* K3 */ be_const_int(2), + /* K4 */ be_const_int(0), + /* K5 */ be_const_int(1), + }), + &be_const_str_read16, + &be_const_str_solidified, + ( &(const binstruction[12]) { /* code */ + 0x88080100, // 0000 GETMBR R2 R0 K0 + 0x8C080501, // 0001 GETMET R2 R2 K1 + 0x88100102, // 0002 GETMBR R4 R0 K2 + 0x5C140200, // 0003 MOVE R5 R1 + 0x58180003, // 0004 LDCONST R6 K3 + 0x7C080800, // 0005 CALL R2 4 + 0x940C0504, // 0006 GETIDX R3 R2 K4 + 0x54120007, // 0007 LDINT R4 8 0x380C0604, // 0008 SHL R3 R3 R4 0x94100505, // 0009 GETIDX R4 R2 K5 0x000C0604, // 000A ADD R3 R3 R4 @@ -397,19 +481,21 @@ be_local_closure(I2C_Driver_read13, /* name */ be_local_class(I2C_Driver, 3, NULL, - be_nested_map(11, + be_nested_map(13, ( (struct bmapnode*) &(const bmapnode[]) { - { be_const_key(read32, -1), be_const_closure(I2C_Driver_read32_closure) }, - { be_const_key(write8, 6), be_const_closure(I2C_Driver_write8_closure) }, - { be_const_key(name, -1), be_const_var(2) }, - { be_const_key(addr, 8), be_const_var(1) }, - { be_const_key(read12, -1), be_const_closure(I2C_Driver_read12_closure) }, - { be_const_key(wire, 10), be_const_var(0) }, - { be_const_key(read13, -1), be_const_closure(I2C_Driver_read13_closure) }, - { be_const_key(read24, -1), be_const_closure(I2C_Driver_read24_closure) }, - { be_const_key(read8, -1), be_const_closure(I2C_Driver_read8_closure) }, - { be_const_key(init, -1), be_const_closure(I2C_Driver_init_closure) }, { be_const_key(write_bit, -1), be_const_closure(I2C_Driver_write_bit_closure) }, + { be_const_key(addr, -1), be_const_var(1) }, + { be_const_key(read32, -1), be_const_closure(I2C_Driver_read32_closure) }, + { be_const_key(read13, -1), be_const_closure(I2C_Driver_read13_closure) }, + { be_const_key(read16, -1), be_const_closure(I2C_Driver_read16_closure) }, + { be_const_key(read14, -1), be_const_closure(I2C_Driver_read14_closure) }, + { be_const_key(read24, 12), be_const_closure(I2C_Driver_read24_closure) }, + { be_const_key(name, 4), be_const_var(2) }, + { be_const_key(write8, -1), be_const_closure(I2C_Driver_write8_closure) }, + { be_const_key(wire, 8), be_const_var(0) }, + { be_const_key(read8, -1), be_const_closure(I2C_Driver_read8_closure) }, + { be_const_key(read12, -1), be_const_closure(I2C_Driver_read12_closure) }, + { be_const_key(init, -1), be_const_closure(I2C_Driver_init_closure) }, })), (bstring*) &be_const_str_I2C_Driver );