IntFLASH
 
 
 Bean IntFLASH
 
Internal FLASH

Methods are user callable functions/subroutines that are means of controlling the bean functions.

Methods:

  • Methods for Freescale HCS12, HCS12X and 56800 derivatives.
    • DisableEvent - This method disables all the events.

        ANSIC prototype: byte DisableEvent(void)
      • Return value:byte - Error code, possible codes:
        • ERR_OK - OK
        • ERR_SPEED - This device does not work in the active speed mode


    • EnableEvent - This method enables all the events.

        ANSIC prototype: byte EnableEvent(void)
      • Return value:byte - Error code, possible codes:
        • ERR_OK - OK
        • ERR_SPEED - This device does not work in the active speed mode

    • SetWait - Method changes the wait status of writing or erasing methods.

        ANSIC prototype: void SetWait(bool Wait)
      • Wait:bool - TRUE - methods wait till the FLASH write or erase operation is finished, FALSE - methods do not wait for the end of write or erase operation.

    • Busy - Method returns the status of the FLASH device

        ANSIC prototype: bool Busy(byte Block)
      • Block:byte - Block number. Not used for Freescale 56800 derivates.
      • Return value:bool - TRUE/FALSE - FLASH is busy/ready

    • EraseFlash - Erases entire memory array of the selected Flash block.

        ANSIC prototype: byte EraseFlash(byte Block)
      • Block:byte - Block number. Not used for Freescale 56800 derivates except for the Program_Boot_Flash on 56F83xx and 56F81xx derivatives.
      • Return value:byte - Error code, possible codes:
        • ERR_OK - OK
        • ERR_NOTAVAIL - Desired program/erase operation is not available
        • ERR_RANGE - Block number is out of range
        • ERR_SPEED - This device does not work in the active speed mode
        • ERR_BUSY - Device is busy

    • EraseVerify - Verifies entire memory array of the selected Flash block whether it is erased.

        ANSIC prototype: byte EraseVerify(byte Block,bool *Blank)
      • Block:byte - Block number. Not used for Freescale 56800 derivates except for the Program_Boot_Flash on 56F83xx and 56F81xx derivatives.
      • Blank: Pointer to bool - TRUE = Flash block verifies as erased, FALSE = block is not erased.
      • Return value:byte - Error code, possible codes:
        • ERR_OK - OK
        • ERR_NOTAVAIL - Desired program/erase operation is not available
        • ERR_RANGE - Block number is out of range
        • ERR_SPEED - This device does not work in the active speed mode
        • ERR_BUSY - Device is busy

  • Methods for Freescale HCS12/HCS12X/HCS08 and 56800 derivatives.
    • EraseSector - Erases the sector to which address Addr belongs.

        ANSIC prototype: byte EraseSector(dword Addr)
      • Addr:dword - Address in FLASH.
      • Return value:byte - Error code, possible codes:
        • ERR_OK - OK
        • ERR_NOTAVAIL - Desired program/erase operation is not available
        • ERR_RANGE - Address is out of range
        • ERR_SPEED - This device does not work in the active speed mode
        • ERR_BUSY - Device is busy

  • Methods for Freescale HCS12, HCS12X, 56F83xx, 56F81xx and 56F80xx derivatives.
    • SetGlobalProtection - Method makes entire memory array of the selected FLASH protected or unprotected. The protection state changes are active till system reset.

        ANSIC prototype: byte SetGlobalProtection(bool ProtectAll)
      • ProtectAll:bool - TRUE - The whole flash memory array of the selected flash is protected; FALSE - The whole flash memory array of the selected flash is unprotected.
      • Return value:byte - Error code, possible codes:
        • ERR_OK - OK
        • ERR_NOTAVAIL - Desired program/erase operation is not available
        • ERR_VALUE - Read value is not equal to written value
        • ERR_SPEED - This device does not work in the active speed mode

  • Methods for Freescale HCS12/HCS12X derivatives.
    • SetProtection - Method allows write into the protection register. Please see Flash Block User Guide.

        ANSIC prototype: byte SetProtection(bool ProtectType,byte ProtectHigh,byte ProtectLow,byte Block)
      • ProtectType:bool - Possible values: 0 or 1. Depend on CPU type. Two meanings are possible.
        First:
        • 0 = whole Flash array is protected. In this case other parameters are don't care.
        • 1 = protection size depend on ProtectHigh and ProtectLow parameters.
        Second:
        • 0 = ProtectHigh and ProtectLow parameters define range to be protected .
        • 1 = ProtectHigh and ProtectLow parameters define range to be unprotected .
      • ProtectHigh:byte - Flash higher address range protection. Possible values:
        • 0 - 3 - defines range (size of range depend on CPU type)
        • 4 - Protection disabled
      • ProtectLow:byte - Flash lower address range protection. Possible values:
        • 0 - 3 - defines range (size of range depend on CPU type)
        • 4 - Protection disabled
      • Block:byte - Flash block number. The number of blocks depends on CPU type. When the CPU has only one block, the value is don't care.
      • Return value:byte - Error code, possible codes:
        • ERR_OK - OK
        • ERR_NOTAVAIL - Requested value not available
        • ERR_RANGE – The value is out of range
        • ERR_VALUE - Parameter of incorrect value
        • ERR_SPEED - This device does not work in the active speed mode

  • SetByteFlash - Writes a byte to an address in FLASH.

      ANSIC prototype: byte SetByteFlash(dword Addr,byte Data)
    • Addr:dword - Address to FLASH.
    • Data:byte - Data to write.
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_NOTAVAIL - Desired program/erase operation is not available
      • ERR_RANGE - Address is out of range
      • ERR_VALUE - Read value is not equal to written value
      • ERR_SPEED - This device does not work in the active speed mode
      • ERR_BUSY - Device is busy

  • GetByteFlash - Gets byte from an address in FLASH.

      ANSIC prototype: byte GetByteFlash(dword Addr,byte *Data)
    • Addr:dword - Address to FLASH.
    • Data: Pointer to byte - A pointer to the returned 8-bit data.
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_RANGE - Address is out of range
      • ERR_BUSY - Device is busy

  • SetWordFlash - Writes a word to an address in FLASH.

      ANSIC prototype: byte SetWordFlash(dword Addr,word Data)
    • Addr:dword - Address to FLASH.
    • Data:word - Data to write.
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_NOTAVAIL - Desired program/erase operation is not available
      • ERR_RANGE - Address is out of range
      • ERR_VALUE - Read value is not equal to written value
      • ERR_SPEED - This device does not work in the active speed mode
      • ERR_BUSY - Device is busy

  • GetWordFlash - Gets a word from an address in FLASH.

      ANSIC prototype: byte GetWordFlash(dword Addr,word *Data)
    • Addr:dword - Address to FLASH.
    • Data: Pointer to word - A pointer to the returned 16-bit data.
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_NOTAVAIL - Desired program/erase operation is not available
      • ERR_RANGE - Address is out of range
      • ERR_BUSY - Device is busy

  • SetLongFlash - Writes a long word to an address in FLASH.

      ANSIC prototype: byte SetLongFlash(dword Addr,dword Data)
    • Addr:dword - Address to FLASH.
    • Data:dword - Data to write.
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_NOTAVAIL - Desired program/erase operation is not available
      • ERR_RANGE – The address is out of range
      • ERR_VALUE – The read value is not equal to the written value
      • ERR_SPEED - This device does not work in the active speed mode
      • ERR_BUSY - Device is busy

  • GetLongFlash - Gets a long word from an address in FLASH.

      ANSIC prototype: byte GetLongFlash(dword Addr,dword *Data)
    • Addr:dword - Address to FLASH.
    • Data: Pointer to dword - A pointer to the returned 32-bit data.
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_NOTAVAIL - Desired program/erase operation is not available
      • ERR_RANGE – The address is out of range
      • ERR_BUSY - Device is busy

  • SetBytePage - Writes a byte to an address of the virtual page.
    This method is only available when Virtual page property is enabled.

      ANSIC prototype: byte SetBytePage(word Index,byte Data)
    • Index:word - Index to virtual page.
    • Data:byte - Data to write.
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_RANGE - Index is out of range

  • GetBytePage - Gets a byte from an address in the virtual page. This method is only available when Virtual page property is enabled.

      ANSIC prototype: byte GetBytePage(word Index,byte *Data)
    • Index:word - Index to a virtual page.
    • Data: Pointer to byte - A pointer to the returned 8-bit data.
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_RANGE - Index is out of range

  • SetWordPage - Writes a word to an address in the virtual page. This method is only available when Virtual page property is enabled.

      ANSIC prototype: byte SetWordPage(word Index,word Data)
    • Index:word - Index to virtual page.
    • Data:word - Data to write.
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_RANGE - Index is out of range

  • GetWordPage - Gets a word from an address in the virtual page. This method is only available when Virtual page property is enabled.

      ANSIC prototype: byte GetWordPage(word Index,word *Data)
    • Index:word - Index to virtual page.
    • Data: Pointer to word - A pointer to the returned 16-bit data.
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_RANGE - Index is out of range

  • SetLongPage - Writes a long word to an address in the virtual page. This method is only available when Virtual page property is enabled.

      ANSIC prototype: byte SetLongPage(word Index,dword Data)
    • Index:word - Index to virtual page.
    • Data:dword - Data to write.
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_RANGE - Index is out of range

  • GetLongPage - Gets a long word from an address in the virtual page. This method is only available when Virtual page property is enabled.

      ANSIC prototype: byte GetLongPage(word Index,dword *Data)
    • Index:word - Index to virtual page.
    • Data: Pointer to dword - A pointer to the returned 32-bit data.
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_RANGE - Index is out of range

  • Methods for Freescale HCS12/HCS12X/HCS08 derivatives.
    • RestoreToFlash - Use exactly this method in the OnRestoreBuffer event to write the data back to FLASH. This method is only available when the Write method item is set to "Safe write ..." value. It could be called more then once to write all data required by OnRestoreBuffer, but every byte of the flash sector may be written only once.

        ANSIC prototype: byte RestoreToFlash(dword Addr,byte *Data,word Size)
      • Addr:dword - Address to FLASH.
      • Data: Pointer to byte - A pointer to the data to write.
      • Size:word - The size of the buffer to restore.
      • Return value:byte - Error code, possible codes:
        • ERR_OK - OK
        • ERR_NOTAVAIL - Requested value not available
        • ERR_VALUE - Parameter of incorrect value
        • ERR_RANGE – The value is out of range

  • SetPage - Writes a virtual page to an address in FLASH. This method is only available when Virtual page property is enabled.

      ANSIC prototype: byte SetPage(dword Addr)
    • Addr:dword - Address in FLASH.
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_NOTAVAIL - Desired program/erase operation is not available
      • ERR_RANGE – The address is out of range
      • ERR_VALUE – The read value is not equal to the written value
      • ERR_SPEED - This device does not work in the active speed mode
      • ERR_BUSY - Device is busy

  • GetPage - Gets the virtual page from FLASH. This method is only available when Virtual page property is enabled.

      ANSIC prototype: byte GetPage(dword Addr)
    • Addr:dword - Address in FLASH.
    • Return value:byte - Error code, possible codes:
      • ERR_OK - OK
      • ERR_RANGE – The address is out of range
      • ERR_BUSY - Device is busy


Note: Some methods can be implemented as macros.



Processor ExpertTM and Embedded BeansTM are registered trademarks of UNIS, Ltd.
©1997-2005, UNIS, Ltd.