/******************************************************************************
* file include/pd_cpld.h
* author YuLiang
* version 1.0.0
* date 31-July-2023
* brief This file provides all the headers of the cpld functions.
******************************************************************************
* Attention
*
*
© COPYRIGHT(c) 2023 LandPower
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of LandPower nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
#ifndef _PD_CPLD_H_
#define _PD_CPLD_H_
/* Includes ------------------------------------------------------------------*/
/* Define --------------------------------------------------------------------*/
#define CPLD_REG_V0 0x0
#define CPLD_REG_V1 0x1
#define CPLD_REG_STAT 0x3
#define CPLD_REG_SYNC 0xb
#define CPLD_REG_WDG_EN 0xd
#define CPLD_REG_WDG_TM 0xe
#define CPLD_REG_WDG_CLR 0xf
#define CPLD_REG_MAX CPLD_REG_WDG_CLR
/* Exported types ------------------------------------------------------------*/
/* 设备配置的滤波类型. */
typedef enum
{
CPLD_SYNC_PT = 0,
CPLD_SYNC_OUTSIDE = 2
} CPLD_SYNC_E;
/* CPLD 版本结构体. */
typedef struct
{
uint16_t year;
uint8_t month;
uint8_t day;
} cpld_version_t;
/* Exported macro ------------------------------------------------------------*/
/* Extern global variables ---------------------------------------------------*/
/* Extern functions ----------------------------------------------------------*/
extern int32_t cpld_handle_init(void);
extern int32_t cpld_read(uint16_t addr, uint16_t len, uint16_t *data);
extern int32_t cpld_write(uint16_t addr, uint16_t len, uint16_t *data);
#endif
/************************ (C) COPYRIGHT LandPower ***** END OF FILE ****************/