You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.0 KiB

4 months ago
/**
******************************************************************************
* @copyright Copyright (C), 2016-2022, ConvenientPower. Co., Ltd.
* @file drv_mtp.h
* @version 1.0
* @author qing.cheng
* @date 2022-11-12
* @brief Header file of DRV_MTP_H module.
******************************************************************************
*/
#ifndef _DRV_MTP_H_
#define _DRV_MTP_H_
#include "core_comm.h"
#include "mtp_define.h"
#include "drv_clock.h"
#define TSU // 2ns -
#define TPRAM 10 // 2us -
#define TCERH 1000000// 200ms ~ 300ms
#define TPOAM 10 // 2us -
#define TPEL 1 // 40ns -
#define THD // 2ns -
#define TPGHF 150// 30us 50us
#define TKH // 20-50ns -
#define TKQ // - 38-98ns
#define TCERH_24M 1000000// 200ms ~ 300ms
#define TCERH_6M 250000// 200ms ~ 300ms
/*
* @brief drv_mtp_write_word
* @param addr:mtp write addr
* @param len write data len
* @param *value data buf
* @param bks memory block select:
1'b0: select main block
1'b1: select infromation block
* @note
* @retval
*/
void drv_mtp_word_write(uint32_t addr, int len, uint32_t *value, uint8_t bks);
/*
* @brief drv_mtp_word_read
* @param addr
* @note
* @retval
*/
uint32_t drv_mtp_word_read(uint32_t addr);
/*
* @brief drv_mtp_word_read
* @param bks memory block select:
1'b0: select main block
1'b1: select infromation block
* @note
* @retval
*/
void drv_mtp_chip_erase(uint8_t bks);
/*
* @brief drv_mtp_sector_erase
* @param addr
* @parambks
1'b0: select main block
1'b1: select infromation block
* @note
* @retval
*/
void drv_mtp_sector_erase(uint32_t addr, uint8_t bks);
/*
* @brief drv_mtp_trim_password
* @param null
* @note
* @retval null
*/
void drv_mtp_trim_password(void);
/*
* @brief drv_mtp_crc_check
* @param null
* @note
* @retval 0:crc check fail;1:crc check sucess
*/
uint8_t drv_mtp_crc_check(uint32_t mtp_addr, uint32_t len_addr);
#endif