kopia lustrzana https://github.com/espressif/esp-idf
41 wiersze
1.5 KiB
C
41 wiersze
1.5 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include "regi2c_ctrl.h"
|
|
|
|
/* Analog function control register */
|
|
#define ANA_CONFIG_REG 0x6000E044
|
|
#define ANA_CONFIG_S (8)
|
|
#define ANA_CONFIG_M (0x3FF)
|
|
/* Clear to enable APLL */
|
|
#define I2C_APLL_M (BIT(14))
|
|
/* Clear to enable BBPLL */
|
|
#define I2C_BBPLL_M (BIT(17))
|
|
|
|
/* ROM functions which read/write internal control bus */
|
|
uint8_t rom_i2c_readReg(uint8_t block, uint8_t host_id, uint8_t reg_add);
|
|
uint8_t rom_i2c_readReg_Mask(uint8_t block, uint8_t host_id, uint8_t reg_add, uint8_t msb, uint8_t lsb);
|
|
void rom_i2c_writeReg(uint8_t block, uint8_t host_id, uint8_t reg_add, uint8_t data);
|
|
void rom_i2c_writeReg_Mask(uint8_t block, uint8_t host_id, uint8_t reg_add, uint8_t msb, uint8_t lsb, uint8_t data);
|
|
|
|
/* Convenience macros for the above functions, these use register definitions
|
|
* from i2c_apll.h/i2c_bbpll.h header files.
|
|
*/
|
|
#define I2C_WRITEREG_MASK_RTC(block, reg_add, indata) \
|
|
rom_i2c_writeReg_Mask(block, block##_HOSTID, reg_add, reg_add##_MSB, reg_add##_LSB, indata)
|
|
|
|
#define I2C_READREG_MASK_RTC(block, reg_add) \
|
|
rom_i2c_readReg_Mask(block, block##_HOSTID, reg_add, reg_add##_MSB, reg_add##_LSB)
|
|
|
|
#define I2C_WRITEREG_RTC(block, reg_add, indata) \
|
|
rom_i2c_writeReg(block, block##_HOSTID, reg_add, indata)
|
|
|
|
#define I2C_READREG_RTC(block, reg_add) \
|
|
rom_i2c_readReg(block, block##_HOSTID, reg_add)
|