/** ################################################################### ** THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT. ** Filename : FLASH1.h ** Project : ProcessorExpert ** Processor : MK20DN32VLF5 ** Component : FLASH_LDD ** Version : Component 01.095, Driver 01.11, CPU db: 3.00.000 ** Compiler : CodeWarrior ARM C Compiler ** Date/Time : 2014-02-28, 11:16, # CodeGen: 3 ** Abstract : ** This embedded component implements an access to an on-chip flash memory. ** Using this component the flash memory could be written to, erased, ** read from. Some other services would be provided, if they are supported ** by hardware, e.g. changes of the flash memory protection state. ** Settings : ** Component name : FLASH1 ** Device : FTFL ** Use user memory areas : yes ** User memory areas : 1 ** User area 0 : ** Name : CalibrationZone ** Allocate : yes ** Address : 248 ** Size : 256 ** Restrict range check to user areas : no ** Interrupt service : Disabled ** Write batch size : Minimal ** Erase batch size : Minimal ** Read batch size : Unlimited ** Safe launch and wait : yes ** Safe routine location : Defined statically by the component ** Interruptable wait loop : no ** Initialization : ** Enabled in init. code : yes ** Auto initialization : yes ** Event mask : ** OnOperationComplete : Enabled ** OnError : Disabled ** CPU clock/configuration selection : ** Clock configuration 0 : This component enabled ** Clock configuration 1 : This component disabled ** Clock configuration 2 : This component disabled ** Clock configuration 3 : This component disabled ** Clock configuration 4 : This component disabled ** Clock configuration 5 : This component disabled ** Clock configuration 6 : This component disabled ** Clock configuration 7 : This component disabled ** Contents : ** Init - LDD_TDeviceData* FLASH1_Init(LDD_TUserData *UserDataPtr); ** Deinit - void FLASH1_Deinit(LDD_TDeviceData *DeviceDataPtr); ** Read - LDD_TError FLASH1_Read(LDD_TDeviceData *DeviceDataPtr, LDD_FLASH_TAddress... ** Write - LDD_TError FLASH1_Write(LDD_TDeviceData *DeviceDataPtr, LDD_TData *FromPtr,... ** Erase - LDD_TError FLASH1_Erase(LDD_TDeviceData *DeviceDataPtr, LDD_FLASH_TAddress... ** EraseBlock - LDD_TError FLASH1_EraseBlock(LDD_TDeviceData *DeviceDataPtr,... ** VerifyErasedBlock - LDD_TError FLASH1_VerifyErasedBlock(LDD_TDeviceData *DeviceDataPtr,... ** GetOperationStatus - LDD_FLASH_TOperationStatus FLASH1_GetOperationStatus(LDD_TDeviceData... ** Main - void FLASH1_Main(LDD_TDeviceData *DeviceDataPtr); ** ** Copyright : 1997 - 2012 Freescale, Inc. All Rights Reserved. ** ** http : www.freescale.com ** mail : support@freescale.com ** ###################################################################*/ #ifndef __FLASH1_H #define __FLASH1_H /* MODULE FLASH1. */ /* Include shared modules, which are used for whole project */ #include "PE_Types.h" #include "PE_Error.h" #include "PE_Const.h" #include "IO_Map.h" /* Include inherited beans */ #include "FTFL_PDD.h" #include "FMC_PDD.h" #include "PE_LDD.h" #include "Cpu.h" /* Parameters of the flash memory blocks used by the component - general format */ #define FLASH1_BLOCK0_ADDRESS 0x00LU #define FLASH1_BLOCK0_SIZE 0x8000LU #define FLASH1_BLOCK0_ERASABLE_UNIT_SIZE 0x0400LU #define FLASH1_BLOCK0_PROT_UNIT_SIZE 0x0400LU /* Parameters of the flash memory blocks used by the component - CPU specific format */ #define FLASH1_PFLASH_ADDRESS 0x00LU #define FLASH1_PFLASH_SIZE 0x8000LU #define FLASH1_PFLASH_ERASABLE_UNIT_SIZE 0x0400LU #define FLASH1_PFLASH_PROT_UNIT_SIZE 0x0400LU /* User flash memory areas' parameters */ #define FLASH1_USER_AREA0_CalibrationZone_ADDRESS 0xF8LU #define FLASH1_USER_AREA0_CalibrationZone_SIZE 0x0100LU #define FLASH1_ERASABLE_UNIT_SIZE 0x0400LU #define FLASH1_ERASABLE_UNIT_MASK 0x03FFLU #define FLASH1_WRITE_UNIT_SIZE 0x04LU #define FLASH1_WRITE_UNIT_MASK 0x03LU /* Peripheral base address of a device allocated by the component. This constant can be used directly in PDD macros. */ #define FLASH1_PRPH_BASE_ADDRESS 0x40020000U /* Device data structure pointer used when auto initialization property is enabled. This constant can be passed as a first parameter to all component's methods. */ #define FLASH1_DeviceData ((LDD_TDeviceData *)PE_LDD_GetDeviceStructure(PE_LDD_COMPONENT_FLASH1_ID)) /* Methods configuration constants - generated for all enabled component's methods */ #define FLASH1_Init_METHOD_ENABLED #define FLASH1_Deinit_METHOD_ENABLED #define FLASH1_Read_METHOD_ENABLED #define FLASH1_Write_METHOD_ENABLED #define FLASH1_Erase_METHOD_ENABLED #define FLASH1_EraseBlock_METHOD_ENABLED #define FLASH1_VerifyErasedBlock_METHOD_ENABLED #define FLASH1_GetOperationStatus_METHOD_ENABLED #define FLASH1_Main_METHOD_ENABLED /* Events configuration constants - generated for all enabled component's events */ #define FLASH1_OnOperationComplete_EVENT_ENABLED LDD_TDeviceData* FLASH1_Init(LDD_TUserData *UserDataPtr); /* ** =================================================================== ** Method : FLASH1_Init (component FLASH_LDD) ** ** Description : ** Initializes the device. Allocates memory for the device data ** structure, allocates interrupt vectors and sets interrupt ** priority, sets pin routing, sets timing, etc. If the "Enable ** in init. code" property is set to "yes" () value then the device is also enabled(see the ** description of the Enable() method). In this case the ** Enable() method is not necessary and needn't to be generated. ** This method can be called only once. Before the second call ** of Init() the Deinit() must be called first. ** Parameters : ** NAME - DESCRIPTION ** * UserDataPtr - Pointer to the user or ** RTOS specific data. This pointer will be ** passed as an event or callback parameter. ** Returns : ** --- - Device data structure pointer. ** =================================================================== */ void FLASH1_Deinit(LDD_TDeviceData *DeviceDataPtr); /* ** =================================================================== ** Method : FLASH1_Deinit (component FLASH_LDD) ** ** Description : ** Deinitializes the device. Switches off the device, frees the ** device data structure memory, interrupts vectors, etc. ** Parameters : ** NAME - DESCRIPTION ** * DeviceDataPtr - Device data structure ** pointer returned by method. ** Returns : Nothing ** =================================================================== */ LDD_TError FLASH1_Write(LDD_TDeviceData *DeviceDataPtr, LDD_TData *FromPtr, LDD_FLASH_TAddress ToAddress, LDD_FLASH_TDataSize Size); /* ** =================================================================== ** Method : FLASH1_Write (component FLASH_LDD) ** ** Description : ** This method sets up a flash memory write operation. The ** operation itself is performing by defined batches (tproperty ** ) by periodical calling the component’s ** Main method in the user application (higher level OS service) ** or by the component’s ISR, if an component’s interrupt ** service is enabled. ** Parameters : ** NAME - DESCRIPTION ** * DeviceDataPtr - Device data structure ** pointer returned by method. ** * FromPtr - Pointer to data to be written to ** the flash memory ** ToAddress - Address to the flash memory ** the input data would be written to ** Size - Size of the input data to be written to ** the flash memory ** Returns : ** --- - Error code ** ERR_OK - OK ** ERR_DISABLED - Component is disabled ** ERR_SPEED - This device does not work in ** the active clock configuration ** ERR_BUSY - Some flash memory operation is ** already in progress ** ERR_PARAM_ADDRESS - Desired flash memory ** area is out of allowed range ** ERR_NOTAVAIL - When Safe launch and wait ** mode is enabled (property Safe launch and ** wait) and safe routine location is defined ** in runtime (property Safe routine location) ** and the safe routine location has not been ** specified yet (the SetSafeRoutineLocation ** method has not been used to define the ** location the safe routine will be copied to). ** =================================================================== */ LDD_TError FLASH1_Read(LDD_TDeviceData *DeviceDataPtr, LDD_FLASH_TAddress FromAddress, LDD_TData *ToPtr, LDD_FLASH_TDataSize Size); /* ** =================================================================== ** Method : FLASH1_Read (component FLASH_LDD) ** ** Description : ** This method sets up a flash memory read operation. The ** operation itself is performing by defined batches (property ** ) by periodical calling the component’s ** Main method in the user application (higher level OS service). ** Parameters : ** NAME - DESCRIPTION ** * DeviceDataPtr - Device data structure ** pointer returned by method. ** FromAddress - Address to the flash ** memory the output data would be read from ** * ToPtr - Pointer to a location the data would ** be written to ** Size - Size of the data to be read from the ** flash memory ** Returns : ** --- - Error code ** ERR_OK - OK ** ERR_DISABLED - Component is disabled ** ERR_SPEED - This device does not work in ** the active clock configuration ** ERR_BUSY - Some flash memory operation is ** already in progress ** ERR_PARAM_ADDRESS - Desired flash memory ** area is out of allowed range ** =================================================================== */ LDD_TError FLASH1_Erase(LDD_TDeviceData *DeviceDataPtr, LDD_FLASH_TAddress FromAddress, LDD_FLASH_TDataSize Size); /* ** =================================================================== ** Method : FLASH1_Erase (component FLASH_LDD) ** ** Description : ** This method sets up a flash memory erase operation. The ** operation itself is performing by defined batches (property ** ) by periodical calling the component’s ** Main method in the user application (higher level OS service) ** or by the component’s ISR, if an component’s interrupt ** service is enabled. ** Parameters : ** NAME - DESCRIPTION ** * DeviceDataPtr - Device data structure ** pointer returned by method. ** FromAddress - Address of the flash ** memory area (the first erase sector is the ** sector the given address belongs to) to be ** erased. ** Size - Size of the flash memory area (in bytes) ** to be erased. The flash memory is erased by ** the erase sectors. The first erased sector ** is a sector the address specified by the ** input parameter Address belongs to. The ** last erased sector is a sector the address ** calculated like an addition of the address ** specified by the input parameter Address ** and the size specified by the input ** parameter Size belongs to. ** Returns : ** --- - Error code ** ERR_OK - OK ** ERR_DISABLED - Component is disabled ** ERR_SPEED - This device does not work in ** the active clock configuration ** ERR_BUSY - Some flash memory operation is ** already in progress ** ERR_PARAM_ADDRESS - Desired flash memory ** area is out of allowed range or is not ** aligned to erasable units' bounderies ** ERR_NOTAVAIL - When Safe launch and wait ** mode is enabled (property Safe launch and ** wait) and safe routine location is defined ** in runtime (property Safe routine location) ** and the safe routine location has not been ** specified yet (the SetSafeRoutineLocation ** method has not been used to define the ** location the safe routine will be copied to). ** =================================================================== */ LDD_TError FLASH1_EraseBlock(LDD_TDeviceData *DeviceDataPtr, LDD_FLASH_TAddress Address); /* ** =================================================================== ** Method : FLASH1_EraseBlock (component FLASH_LDD) ** ** Description : ** This method sets up a flash memory block erase operation. ** The block erase operation is performed to the flash memory's ** block specified by the Address parameter. ** Parameters : ** NAME - DESCRIPTION ** * DeviceDataPtr - Device data structure ** pointer returned by method. ** Address - Address of the flash memory block ** (the flash memory block the given address ** belongs to) to be erased ** Returns : ** --- - Error code ** ERR_OK - OK ** ERR_DISABLED - Component is disabled ** ERR_SPEED - This device does not work in ** the active clock configuration ** ERR_BUSY - Some flash memory operation is ** already in progress ** ERR_PARAM_ADDRESS - Desired flash memory ** area is out of allowed range or is not ** aligned to write units' bounderies ** ERR_NOTAVAIL - When Safe launch and wait ** mode is enabled (property Safe launch and ** wait) and safe routine location is defined ** in runtime (property Safe routine location) ** and the safe routine location has not been ** specified yet (the SetSafeRoutineLocation ** method has not been used to define the ** location the safe routine will be copied to). ** =================================================================== */ LDD_TError FLASH1_VerifyErasedBlock(LDD_TDeviceData *DeviceDataPtr, LDD_FLASH_TAddress Address); /* ** =================================================================== ** Method : FLASH1_VerifyErasedBlock (component FLASH_LDD) ** ** Description : ** This method sets up a flash memory verify erased block ** operation. The verification operation is performed to the ** flash memory's block specified by the Address parameter. ** Parameters : ** NAME - DESCRIPTION ** * DeviceDataPtr - Device data structure ** pointer returned by method. ** Address - Address of the flash memory block ** (the flash memory block the given address ** belongs to) to be verified ** Returns : ** --- - Error code ** ERR_OK - OK ** ERR_DISABLED - Component is disabled ** ERR_SPEED - This device does not work in ** the active clock configuration ** ERR_BUSY - Some flash memory operation is ** already in progress ** ERR_PARAM_ADDRESS - Desired flash memory ** area is out of allowed range or is not ** aligned to write units' bounderies ** ERR_NOTAVAIL - When Safe launch and wait ** mode is enabled (property Safe launch and ** wait) and safe routine location is defined ** in runtime (property Safe routine location) ** and the safe routine location has not been ** specified yet (the SetSafeRoutineLocation ** method has not been used to define the ** location the safe routine will be copied to). ** =================================================================== */ LDD_FLASH_TOperationStatus FLASH1_GetOperationStatus(LDD_TDeviceData *DeviceDataPtr); /* ** =================================================================== ** Method : FLASH1_GetOperationStatus (component FLASH_LDD) ** ** Description : ** Returns a status of current (last) flash memory operation. ** Parameters : ** NAME - DESCRIPTION ** * DeviceDataPtr - Device data structure ** pointer returned by method. ** Returns : ** --- - Current flash memory operation status. See ** the LDD_FLASH_TOperationStatus type's ** description for details. ** =================================================================== */ void FLASH1_Main(LDD_TDeviceData *DeviceDataPtr); /* ** =================================================================== ** Method : FLASH1_Main (component FLASH_LDD) ** ** Description : ** This method is used to perform one batch of a flash memory ** operation operation. This method is used to perform batches ** of all flash memory operations (Write, Read, Erase, ** EraseBlock, VerifyErasedBlock) when the component works in ** the polled mode (interrupt service is disabled - property ** ). This method performs batches of the ** read flash memory operation, when the component works in the ** interrupt triggered mode (interrupt service is enabled). ** This method is enabled only if the component works in the ** polled mode or if the Read method is enabled. ** Parameters : ** NAME - DESCRIPTION ** * DeviceDataPtr - Device data structure ** pointer returned by method. ** Returns : Nothing ** =================================================================== */ /* END FLASH1. */ #endif /* ifndef __FLASH1_H */ /* ** ################################################################### ** ** This file was created by Processor Expert 10.0 [05.03] ** for the Freescale Kinetis series of microcontrollers. ** ** ################################################################### */