/* * The sd3078 has write protection * and we can choose whether or not to use it. * Write protection is turned off by default.
*/ #define WRITE_PROTECT_EN 0
/* * In order to prevent arbitrary modification of the time register, * when modification of the register, * the "write" bit needs to be written in a certain order. * 1. set WRITE1 bit * 2. set WRITE2 bit * 3. set WRITE3 bit
*/ staticvoid sd3078_enable_reg_write(struct regmap *regmap)
{
regmap_update_bits(regmap, SD3078_REG_CTRL2, KEY_WRITE1, KEY_WRITE1);
regmap_update_bits(regmap, SD3078_REG_CTRL1, KEY_WRITE2, KEY_WRITE2);
regmap_update_bits(regmap, SD3078_REG_CTRL1, KEY_WRITE3, KEY_WRITE3);
}
#if WRITE_PROTECT_EN /* * In order to prevent arbitrary modification of the time register, * we should disable the write function. * when disable write, * the "write" bit needs to be clear in a certain order. * 1. clear WRITE2 bit * 2. clear WRITE3 bit * 3. clear WRITE1 bit
*/ staticvoid sd3078_disable_reg_write(struct regmap *regmap)
{
regmap_update_bits(regmap, SD3078_REG_CTRL1, KEY_WRITE2, 0);
regmap_update_bits(regmap, SD3078_REG_CTRL1, KEY_WRITE3, 0);
regmap_update_bits(regmap, SD3078_REG_CTRL2, KEY_WRITE1, 0);
} #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.