Fixed screen brightness problems (tested on 1.0.0 and 2.0.0). Some refactoring.

This commit is contained in:
nwert
2018-06-15 23:28:27 +12:00
parent b2dd070d10
commit 694a8b5395
11 changed files with 157 additions and 107 deletions

View File

@@ -35,3 +35,16 @@ void exec_cfg(u32 *base, const cfg_op_t *ops, u32 num_ops)
base[ops[i].off] = ops[i].val;
}
#define CRC32C_POLY 0x82F63B78
u32 crc32c(const void *buf, u32 len)
{
const u8 *cbuf = (const u8 *)buf;
u32 crc = 0xFFFFFFFF;
while (len--)
{
crc ^= *cbuf++;
for (int i = 0; i < 8; i++)
crc = crc & 1 ? (crc >> 1) ^ CRC32C_POLY : crc >> 1;
}
return ~crc;
}