⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flash_api.h

📁 摩托罗拉08单片机flash程序 采用CodeWarrior开发
💻 H
字号:
/*==================================================================*
 *                                                
 * Copyright (c) 2002, Motorola Inc.
 * Motorola Application Note
 *
 * File name    : flash_api.h
 * Author       : Mauricio Capistran-Garza
 * Department   : Guadalajara - SPS
 *
 * Description  : It contains all API function declarations.
 *
 * History      :
 *
 *==================================================================*/

#ifndef __FLASH_API_H__
#define __FLASH_API_H__


/********************************************************************
    DEFINES
 ********************************************************************/
/* MCU used */
#ifndef MC68HC908JL3
  #ifndef MC68HC908GR8
    #ifndef MC68HC908KX8
      #ifndef MC68HC908JB8
        #define MC68HC908JL3   /* Default MCU used */
      #endif
    #endif
  #endif
#endif

/* Frequency of operation */
#ifndef OSC
    #define OSC	      0x04         /* Default freqnency op = 1Mhz */  
#endif




#define ReadRange VerifyRange

#define FAIL      0x00
#define SUCCESS   0x01

#include "MCU_constants.h"   // This file contains the defines
                             // for all the MCUHC908 used
                             // in this API.

/********************************************************************
    FUNCTION PROTOTYPES
 ********************************************************************/
 
/********************************************************************
 * ReadByte: It reads a byte from the communication port
 *           and returns it.
 *
 * Parameters:       None.
 *
 * Entry Conditions: None.
 *
 * Exit Conditions:  None.
 *
 * Return:           The byte received.
 *
 * Remarks:          The function will not exit until a byte 
 *                   is received.
 */

Byte ReadByte(void);

/********************************************************************
 * TransmitByte: It sends a byte out the communication port.
 *
 * Parameters:       _data: the byte to be sent.
 *
 * Entry Conditions: None.
 *
 * Exit Conditions:  None.
 *
 * Return:           The byte received.
 *
 * Remarks:          The function will not exit until a byte 
 *                   is received.
 */

void TransmitByte(Byte _data);

/********************************************************************
 * TransmitRange: It reads a range of FLASH memory and sends
 *                it out the communication port
 *
 * Parameters:       _*ini: pointer to the starting address
 *                          of the range.
 *                   _num: number of bytes to transmit.
 *
 * Entry Conditions: None.
 *
 * Exit Conditions:  The checksum is stored in _ini;
 *
 * Return:           SUCCESS or FAIL
 *
 * Remarks:          _num must be less to or equal to 64
 */

Byte TransmitRange(Word *_ini, Byte  _num);


/********************************************************************
 * ProgramRange: Programs a range of FLASH.
 *
 * Parameters:       _*ini: pointer to the starting address
 *                          of the range.
 *                   _num: length of the range.
 *
 * Entry Conditions: DATA contains the data to be programmed
 *
 * Exit Conditions:  None.
 *
 * Return:           None.
 *
 * Remarks:          _num must be less to or equal to 64
 */

void ProgramRange(Word *_ini, Byte  _num);

/********************************************************************
 * ProgramRangeX: Programs a range of FLASH after verifying
 *                the range is blank. If it isn't blank it
 *                doesn't programs and returns FAIL.
 *
 * Parameters:       _*ini: pointer to the starting address
 *                          of the range.
 *                   _num: length of the range.
 *
 * Entry Conditions: DATA contains the data to be programmed
 *
 * Exit Conditions:  None.
 *
 * Return:           SUCCESS or FAIL.
 *
 * Remarks:          _num must be less to or equal to 64
 */

 Byte ProgramRangeX(Word *_ini, Byte  _num);

/********************************************************************
 * VerifyRange: Verifies a range of FLASH against the data
 *              contained in DATA. It can also be used to
 *              read a range of FLASH into RAM.
 *
 * Parameters:       _*ini: pointer to the starting address
 *                          of the range.
 *                   _num: length of the range.
 *
 * Entry Conditions: DATA contains the data to be verified.
 *
 * Exit Conditions:  DATA is overwritten with contents of FLASH.
 *                   The checksum is stored in _ini;
 *
 * Return:           The byte received.
 *
 * Remarks:          _num must be less to or equal to 64
 */

Byte VerifyRange(Word *_ini, Byte  _num);

/********************************************************************
 * ErasePage: It erases a PAGE of FLASH
 *
 * Parameters:       *_page: pointer to any address within
 *                           the PAGE to be erased.
 *
 * Entry Conditions: None.
 *
 * Exit Conditions:  Interrupts are disabled.
 *
 * Return:           None.
 *
 * Remarks:          All bytes within that PAGE will be driven
 *                   to 0xFF
 */
 
void ErasePage(Word *_page);

/********************************************************************
 * ErasePageX: It erases a PAGE of FLASH but leaves the state
 *             of the interrupts as it was before calling it.
 *
 * Parameters:       *_page: pointer to any address within
 *                           the PAGE to be erased.
 *
 * Entry Conditions: None.
 *
 * Exit Conditions:  None.
 *
 * Return:           None.
 *
 * Remarks:          All bytes within that PAGE will be driven
 *                   to 0xFF.
 *                   Interrupts are disabled during the erasing
 *                   of the flash, but are restored to its 
 *                   original state before exiting the function.
 */

void ErasePageX (Word *_page);

/********************************************************************
 * EraseFlash: It erases the entire FLASH.
 *
 * Parameters:       None.
 *
 * Entry Conditions: None.
 *
 * Exit Conditions:  None.
 *
 * Return:           None.
 *
 * Remarks:          All bytes will be driven to 0xFF. 
 *                   No code in FLASH will be executed after
 *                   this function has been called.
 */

void EraseFlash(void);

#endif   // __FLASH_API_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -