Skip to content

Commit c772d06

Browse files
author
Donatien Garnier
committed
Amend NFCEEPROMDriver API
1 parent 212ac48 commit c772d06

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

features/nfc/doc/nfc_design.md

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ void on_ndef_message_read(nfc_err_t result);
293293
#### NFC EEPROM
294294
295295
The `NFCEEPROM` class derives from `NFCTarget` and shares the same API.
296+
A pointer to a `NFCEEPROMDriver` instance (see below) must be passed in the constructor.
296297
297298
#### NFC Remote Target
298299
@@ -491,33 +492,38 @@ in an object oriented fashion.
491492

492493
### NFC EEPROM API
493494

494-
The one HAL API that will have to be implemented by vendors to make use of the `NFCEEPROM` class are the following virtual methods.
495+
The one HAL API that will have to be implemented by vendors to implement a `NFCEEPROMDriver` driver are the following virtual methods.
495496

496497
From the upper layer's point of view, the EEPROM is a byte array that can be read from/written to. Long operations (reads, writes, erasures) must happen asynchronously. Booleans indicate whether a particular operation was succesful. Encoding is handled by the upper layer.
497498

498499
Address 0 means the start of the NDEF buffer (not necessarily at address 0 in the EEPROM).
499500

500501
When a buffer is passed to the backend, the reference remains valid till the corresponding event is called.
501502

502-
The `backend_set_size()` command is called to change the size of the buffer (within the limits set by `backend_get_max_size()`). Inversely that buffer size can be read by `backend_get_size()`.
503+
The `set_size()` command is called to change the size of the buffer (within the limits set by `get_max_size()`). Inversely that buffer size can be read using `get_size()`.
504+
505+
`start_session()` and `end_session()` are used before a series of memory operations to allow the driver to lock/un-lock the RF interface during these operations to avoid having concurrent access to the memory.
503506

504507
```cpp
505-
void backend_reset()
506-
size_t backend_get_max_size() const
507-
void backend_read_bytes(uint32_t address, size_t count)
508-
void backend_write_bytes(uint32_t address, const uint8_t* bytes, size_t count)
509-
void backend_set_size(size_t count)
510-
void backend_get_size()
511-
void backend_erase_bytes(uint32_t address, size_t size)
508+
void reset()
509+
size_t get_max_size()
510+
void start_session()
511+
void end_session()
512+
void read_bytes(uint32_t address, size_t count)
513+
void write_bytes(uint32_t address, const uint8_t* bytes, size_t count)
514+
void set_size(size_t count)
515+
void get_size()
516+
void erase_bytes(uint32_t address, size_t size)
512517
```
513518
514519
The following events must be called to signal completion of long operations:
515520
```cpp
516-
void on_backend_has_read_bytes(bool success, const uint8_t* bytes)
517-
void on_backend_has_written_bytes(bool success)
518-
void on_backend_has_set_size(bool success)
519-
void on_backend_has_gotten_size(bool success, size_t size)
520-
void on_backend_has_erased_bytes(bool success)
521+
void has_started_session(bool success);
522+
void has_read_bytes(bool success, const uint8_t* bytes);
523+
void has_written_bytes(bool success);
524+
void has_set_size(bool success);
525+
void has_gotten_size(bool success, size_t size);
526+
void has_erased_bytes(bool success);
521527
```
522528

523529
### NCI Driver APIs

0 commit comments

Comments
 (0)