Read, write, erase, blank-check
Informative
How to run the core memory jobs and read their results. Binding rules: CHI-MEM-MUST-04… CHI-MEM-MUST-10 in Mem — Requirements; signatures in API Reference.
Start a job
Each service starts one asynchronous job on a memory instance:
Mem_Write(0u, address, srcPtr, length); /* program `length` bytes (page-aligned) */
Mem_Read(0u, address, dstPtr, length); /* read `length` bytes into dstPtr */
Mem_Erase(0u, address, length); /* erase (sector-aligned) */
Mem_VerifyBlank(0u, address, length); /* check the area is blank */
All return E_OK (accepted) or E_NOT_OK (rejected — e.g. a job is already pending, or a
development error). Keep any srcPtr / dstPtr buffer valid until the job finishes.
Wait for the result
The job runs inside Mem_PollFunction; poll until the result leaves MEM_JOB_PENDING:
Mem_JobResultType result;
do {
Mem_PollFunction();
result = Mem_GetJobResult(0u);
} while (result == MEM_JOB_PENDING);
Interpret the result:
Result |
Meaning |
|---|---|
|
Success. |
|
The operation failed. |
|
|
|
A correctable / uncorrectable ECC error was detected (see Errors). |
Note
Mem_GetJobResult returns the most recent job’s result for the instance — read it before
starting the next job, or copy it. The driver does not verify a write or erase by reading it
back (CHI-MEM-MUST-15).