Quickstart

Informative

The shortest path to a working write: initialize, start an erase, and drive it to completion. Binding rules are in Mem — Requirements; signatures in API Reference.

Bring the driver up

Mem_Init(NULL_PTR);          /* driver becomes initialized; job result MEM_JOB_FINISHED */

Start a job

Each operation is asynchronous — the call only starts the job:

Std_ReturnType r = Mem_Erase(0u /* instanceId */, 0x8000u /* address */, 0x1000u /* length */);
/* r == E_OK: accepted (result now MEM_JOB_PENDING); E_NOT_OK: rejected */

Drive it to completion

Call Mem_PollFunction cyclically and check the result:

for (;;) {
    Mem_PollFunction();
    Mem_JobResultType result = Mem_GetJobResult(0u);
    if (result != MEM_JOB_PENDING) {
        break;   /* MEM_JOB_FINISHED, or a failure/ECC result */
    }
}

That is a complete job. Writing and reading follow the same pattern with Mem_Write / Mem_Read — see Read, write, erase, blank-check. Remember: addresses and lengths must be aligned to the device’s write page / sector; the driver does not align for you.