mirror of
https://github.com/DualTachyon/uv-k5-firmware.git
synced 2024-11-21 05:30:49 +08:00
Changed flash enums to mirror the original.
This commit is contained in:
parent
511a2351dc
commit
25769c44d8
@ -20,33 +20,33 @@
|
|||||||
#include "bsp/dp32g030/flash.h"
|
#include "bsp/dp32g030/flash.h"
|
||||||
|
|
||||||
enum FLASH_READ_MODE {
|
enum FLASH_READ_MODE {
|
||||||
FLASH_READ_MODE_1_CYCLE = FLASH_CFG_READ_MD_BITS_1_CYCLE,
|
FLASH_READ_MODE_1_CYCLE = FLASH_CFG_READ_MD_VALUE_1_CYCLE,
|
||||||
FLASH_READ_MODE_2_CYCLE = FLASH_CFG_READ_MD_BITS_2_CYCLE,
|
FLASH_READ_MODE_2_CYCLE = FLASH_CFG_READ_MD_VALUE_2_CYCLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum FLASH_READ_MODE FLASH_READ_MODE;
|
typedef enum FLASH_READ_MODE FLASH_READ_MODE;
|
||||||
|
|
||||||
enum FLASH_MASK_SELECTION {
|
enum FLASH_MASK_SELECTION {
|
||||||
FLASH_MASK_SELECTION_NONE = FLASH_MASK_SEL_BITS_NONE,
|
FLASH_MASK_SELECTION_NONE = FLASH_MASK_SEL_VALUE_NONE,
|
||||||
FLASH_MASK_SELECTION_2KB = FLASH_MASK_SEL_BITS_2KB,
|
FLASH_MASK_SELECTION_2KB = FLASH_MASK_SEL_VALUE_2KB,
|
||||||
FLASH_MASK_SELECTION_4KB = FLASH_MASK_SEL_BITS_4KB,
|
FLASH_MASK_SELECTION_4KB = FLASH_MASK_SEL_VALUE_4KB,
|
||||||
FLASH_MASK_SELECTION_8KB = FLASH_MASK_SEL_BITS_8KB,
|
FLASH_MASK_SELECTION_8KB = FLASH_MASK_SEL_VALUE_8KB,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum FLASH_MASK_SELECTION FLASH_MASK_SELECTION;
|
typedef enum FLASH_MASK_SELECTION FLASH_MASK_SELECTION;
|
||||||
|
|
||||||
enum FLASH_MODE {
|
enum FLASH_MODE {
|
||||||
FLASH_MODE_READ_AHB = FLASH_CFG_MODE_BITS_READ_AHB,
|
FLASH_MODE_READ_AHB = FLASH_CFG_MODE_VALUE_READ_AHB,
|
||||||
FLASH_MODE_PROGRAM = FLASH_CFG_MODE_BITS_PROGRAM,
|
FLASH_MODE_PROGRAM = FLASH_CFG_MODE_VALUE_PROGRAM,
|
||||||
FLASH_MODE_ERASE = FLASH_CFG_MODE_BITS_ERASE,
|
FLASH_MODE_ERASE = FLASH_CFG_MODE_VALUE_ERASE,
|
||||||
FLASH_MODE_READ_APB = FLASH_CFG_MODE_BITS_READ_APB,
|
FLASH_MODE_READ_APB = FLASH_CFG_MODE_VALUE_READ_APB,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum FLASH_MODE FLASH_MODE;
|
typedef enum FLASH_MODE FLASH_MODE;
|
||||||
|
|
||||||
enum FLASH_AREA {
|
enum FLASH_AREA {
|
||||||
FLASH_AREA_MAIN = FLASH_CFG_NVR_SEL_BITS_MAIN,
|
FLASH_AREA_MAIN = FLASH_CFG_NVR_SEL_VALUE_MAIN,
|
||||||
FLASH_AREA_NVR = FLASH_CFG_NVR_SEL_BITS_NVR,
|
FLASH_AREA_NVR = FLASH_CFG_NVR_SEL_VALUE_NVR,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum FLASH_AREA FLASH_AREA;
|
typedef enum FLASH_AREA FLASH_AREA;
|
||||||
|
@ -67,7 +67,7 @@ void overlay_FLASH_MaskLock(void)
|
|||||||
|
|
||||||
void overlay_FLASH_SetMaskSel(FLASH_MASK_SELECTION Mask)
|
void overlay_FLASH_SetMaskSel(FLASH_MASK_SELECTION Mask)
|
||||||
{
|
{
|
||||||
FLASH_MASK = (FLASH_MASK & ~FLASH_MASK_SEL_MASK) | (Mask & FLASH_MASK_SEL_MASK);
|
FLASH_MASK = (FLASH_MASK & ~FLASH_MASK_SEL_MASK) | ((Mask << FLASH_MASK_SEL_SHIFT) & FLASH_MASK_SEL_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void overlay_FLASH_MaskUnlock(void)
|
void overlay_FLASH_MaskUnlock(void)
|
||||||
@ -115,7 +115,7 @@ uint32_t overlay_FLASH_ReadByAPB(uint32_t Offset)
|
|||||||
|
|
||||||
void overlay_FLASH_SetArea(FLASH_AREA Area)
|
void overlay_FLASH_SetArea(FLASH_AREA Area)
|
||||||
{
|
{
|
||||||
FLASH_CFG = (FLASH_CFG & ~FLASH_CFG_NVR_SEL_MASK) | (Area & FLASH_CFG_NVR_SEL_MASK);
|
FLASH_CFG = (FLASH_CFG & ~FLASH_CFG_NVR_SEL_MASK) | ((Area << FLASH_CFG_NVR_SEL_SHIFT) & FLASH_CFG_NVR_SEL_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void overlay_FLASH_SetReadMode(FLASH_READ_MODE Mode)
|
void overlay_FLASH_SetReadMode(FLASH_READ_MODE Mode)
|
||||||
@ -141,8 +141,7 @@ void overlay_FLASH_WakeFromDeepSleep(void)
|
|||||||
|
|
||||||
void overlay_FLASH_SetMode(FLASH_MODE Mode)
|
void overlay_FLASH_SetMode(FLASH_MODE Mode)
|
||||||
{
|
{
|
||||||
FLASH_CFG = (FLASH_CFG & ~FLASH_CFG_MODE_MASK) | (Mode & FLASH_CFG_MODE_MASK);
|
FLASH_CFG = (FLASH_CFG & ~FLASH_CFG_MODE_MASK) | ((Mode << FLASH_CFG_MODE_SHIFT) & FLASH_CFG_MODE_MASK);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void overlay_FLASH_SetProgramTime(void)
|
void overlay_FLASH_SetProgramTime(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user