2023-08-21 16:48:00 +08:00

145 lines
11 KiB
C

/*******************************************************************************
* Library : Flash Data Library T04 (PicoFDL)
*
* File Name : $Source: pfdl.h $
* Lib. Version : $RL78_FDL_LIB_VERSION_T04_REN: V1.05 $
* Mod. Revision : $Revision: 1.8 $
* Mod. Date : $Date: 2013/06/10 22:04:41JST $
* Device(s) : RL78
* Description : C language API definition of the Flash Data Library
*******************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only
* intended for use with Renesas products. No other uses are authorized. This
* software is owned by Renesas Electronics Corporation and is protected under
* all applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software
* and to discontinue the availability of this software. By using this software,
* you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011-2013 Renesas Electronics Corporation. All rights reserved.
*******************************************************************************/
#ifndef __PFDL_H_INCLUDED
#define __PFDL_H_INCLUDED
/*================================================================================================*/
/* include files list */
/*================================================================================================*/
#include "pfdl_types.h"
#define FLASH_START_ADDRESS (0xF1000) /* Start address of data flash */
#define TARGET_BLOCK (0) /* Block number of target(0 ~ 3) */
#define BLOCK_SIZE (0x400) /* Block size */
//#define WRITE_SIZE (1) /* Size of data to be written at once */
#define MAX_VALUE (0xFF) /* Maximum value of writing */
#define MAX_ADDRESS ((TARGET_BLOCK + 1) * BLOCK_SIZE - 1) /* Maximum address of writing */
#define PFDL_NG (1) /* Failure to Data Flash */
#define FDL_FRQ (32) /* Setting frequency (MHz) */
#define FDL_VOL (0x00) /* Voltage mode */
uint8_t WriteDataflash(uint8_t* buffer,uint32_t Addr,uint16_t lenth);
uint8_t WriteDataflash1(uint8_t* buffer,uint32_t Addr,uint16_t lenth);
void ReadFlashData(uint8_t* buffer,uint32_t Addr,uint16_t lenth);
/* ---------------------------------------------------------------------------------------------------------------*/
/* Block type: standard function */
/* ---------------------------------------------------------------------------------------------------------------*/
/* Purpose: Unconditional activation of the Data Flash Library. */
/* Based on the descriptor data: */
/* - the flash firmware will be initialized for data-flash access only */
/* - the internal timing and low-voltage capability will be configured according to the descriptor */
/* After successful initialization the data flash clock is ON and the PFDL is ready to use. */
/* */
/* CAUTION: */
/* Due to the code size minimization no plausibility checks are done by the PicoFDL. */
/* Neither configuration, frequency range nor data flash size will be checked by the library. */
/* */
/* Input: address of the PFDL descriptor variable (RAM only) */
/* Output: - */
/* Return: PFDL status */
/* ---------------------------------------------------------------------------------------------------------------*/
extern pfdl_status_t __far PFDL_Open(__near pfdl_descriptor_t* descriptor_pstr);
/* ---------------------------------------------------------------------------------------------------------------*/
/* Block type: standard function */
/* ---------------------------------------------------------------------------------------------------------------*/
/* Purpose: Disable data flash access unconditionally. */
/* If any command is just executed, PFDL_Close will stop it immediately. */
/* After return the data flash clock is switched OFF. */
/* Input: - */
/* Output: - */
/* Return: - */
/* ---------------------------------------------------------------------------------------------------------------*/
extern void __far PFDL_Close(void);
/* ---------------------------------------------------------------------------------------------------------------*/
/* Block type: standard function */
/* ---------------------------------------------------------------------------------------------------------------*/
/* Purpose: Initiating execution of the PFDL request related to the data flash. */
/* The corresponding request variable has to be parametrized before. */
/* */
/* request_pstr->index_u16 : byte-index or block-number within PFDL-pool */
/* request_pstr->data_pu08 : start address of the RAM data that should be read/written */
/* request_pstr->bytecount_u16 : number of bytes has to be read/written */
/* request_pstr->command_enu : command code */
/* */
/* CAUTION: */
/* Due to the code size minimization no plausibility checks are done by the PFDL. */
/* */
/* Input: &request_pstr - pointer to PFDL request variable */
/* Output: - */
/* Return: status of the request */
/* ---------------------------------------------------------------------------------------------------------------*/
extern pfdl_status_t __far PFDL_Execute(__near pfdl_request_t* request_pstr);
/* ---------------------------------------------------------------------------------------------------------------*/
/* Block type: standard function */
/* ---------------------------------------------------------------------------------------------------------------*/
/* Purpose: Continuation of command execution and status update of requests being under execution. */
/* Input: - */
/* Output: - */
/* Return: PFDL status = */
/* PFDL_IDLE - no request is processed by PFDL, PFDL is ready to receive new requests */
/* PFDL_OK - processed request/command finished without problems */
/* PFDL_BUSY - request/command is still being processed */
/* other - flash or firmware related errors */
/* ---------------------------------------------------------------------------------------------------------------*/
extern pfdl_status_t __far PFDL_Handler(void);
/* ---------------------------------------------------------------------------------------------------------------*/
/* Block type: standard function */
/* ---------------------------------------------------------------------------------------------------------------*/
/* Purpose: Returns the start address of the library version string */
/* */
/* Input: - */
/* Output: - */
/* Return: starting address of the zero-terminated version string */
/* ---------------------------------------------------------------------------------------------------------------*/
extern __far pfdl_u08* __far PFDL_GetVersionString(void);
#endif