mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-22 17:12:55 +08:00
82 lines
3.2 KiB
C
82 lines
3.2 KiB
C
/******************************************************************************************************************************************
|
||
* <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>: SWM320_flash.c
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: ʹ<><CAB9>оƬ<D0BE><C6AC>IAP<41><50><EFBFBD>ܽ<EFBFBD>Ƭ<EFBFBD><C6AC>Flashģ<68><C4A3><EFBFBD><EFBFBD>EEPROM<4F><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ
|
||
* <20><><EFBFBD><EFBFBD>֧<EFBFBD><D6A7>: http://www.synwit.com.cn/e/tool/gbook/?bid=1
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
||
* <20>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD>: V1.1.0 2017<31><37>10<31><30>25<32><35>
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼:
|
||
*******************************************************************************************************************************************
|
||
* @attention
|
||
*
|
||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION
|
||
* REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, SYNWIT SHALL NOT BE HELD LIABLE
|
||
* FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
|
||
* OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONN-
|
||
* -ECTION WITH THEIR PRODUCTS.
|
||
*
|
||
* COPYRIGHT 2012 Synwit Technology
|
||
*******************************************************************************************************************************************/
|
||
#include "SWM320.h"
|
||
#include "SWM320_flash.h"
|
||
|
||
|
||
IAP_Cache_Reset_t IAP_Cache_Reset = (IAP_Cache_Reset_t)0x11000601;
|
||
IAP_Flash_Param_t IAP_Flash_Param = (IAP_Flash_Param_t)0x11000681;
|
||
IAP_Flash_Erase_t IAP_Flash_Erase = (IAP_Flash_Erase_t)0x11000781;
|
||
IAP_Flash_Write_t IAP_Flash_Write = (IAP_Flash_Write_t)0x11000801;
|
||
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: FLASH_Erase()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: Ƭ<><C6AC>Flash<73><68><EFBFBD><EFBFBD>
|
||
* <20><> <20><>: uint32_t addr <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>СΪ4K Byte
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>
|
||
******************************************************************************************************************************************/
|
||
void FLASH_Erase(uint32_t addr)
|
||
{
|
||
__disable_irq();
|
||
|
||
IAP_Flash_Erase(addr / 0x1000);
|
||
|
||
IAP_Cache_Reset();
|
||
|
||
__enable_irq();
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: FLASH_Write()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: Ƭ<><C6AC>Flashд<68><D0B4>
|
||
* <20><> <20><>: uint32_t addr д<><D0B4><EFBFBD><EFBFBD>ַ
|
||
* uint32_t buff[] Ҫд<D2AA><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
* uint32_t count Ҫд<D2AA><D0B4><EFBFBD><EFBFBD><EFBFBD>ݵĸ<DDB5><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>λ<EFBFBD><CEBB><EFBFBD>ұ<EFBFBD><D2B1><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>4<EFBFBD><34><EFBFBD><EFBFBD>
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: д<><D0B4><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD><DDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>4<EFBFBD><34><EFBFBD><EFBFBD>
|
||
******************************************************************************************************************************************/
|
||
void FLASH_Write(uint32_t addr, uint32_t buff[], uint32_t count)
|
||
{
|
||
__disable_irq();
|
||
|
||
IAP_Flash_Write(addr, (uint32_t)buff, count/4);
|
||
|
||
IAP_Cache_Reset();
|
||
|
||
__enable_irq();
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Flash_Param_at_120MHz()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <09><>Flash<73><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD>120MHz<48><7A>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
|
||
* <20><> <20><>: <20><>
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>
|
||
******************************************************************************************************************************************/
|
||
void Flash_Param_at_120MHz(void)
|
||
{
|
||
__disable_irq();
|
||
|
||
IAP_Flash_Param(0x48a, 0xabfc7a6e);
|
||
|
||
__enable_irq();
|
||
}
|