/* Locate the writable area on the specified address.  */
void* exFLASH_Locate(u32 page_address, u16 len)
/* Locate the writable area on the specified address.  */
void* exFLASH_Locate(u32 page_address, u16 len)
{
    u16 i;
    u16* ptr = (u16*)page_address;
    for (i = 0; i < (0x0800 / len); i++) {
        if (exFLASH_FindEmpty(ptr, len)) {
            if (i == 0)
                return 0;
            break;
        }
        ptr += len / 2;
    }
    return ptr;
}