summaryrefslogtreecommitdiff
path: root/lib/ultralib/src/flash/flashgetaddr.c
blob: a530947c08354c46ca15c5c13a87792514f52e23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "ultra64.h"
#include "PR/os_internal_flash.h"

u32 __osFlashGetAddr(u32 page_num) {
    u32 devAddr;

    if (__osFlashVersion == OLD_FLASH) {
        // Account for hardware bug in old flash where the address bits are shifted 1-off where they should be
        devAddr = page_num * (FLASH_BLOCK_SIZE >> 1);
    } else {
        devAddr = page_num * FLASH_BLOCK_SIZE;
    }

    return devAddr;
}