Skip to content

Commit e029745

Browse files
committed
Add missing definition for esp:partition_mmap/3
Signed-off-by: Paul Guyot <pguyot@kallisys.net>
1 parent e79fc42 commit e029745

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

libs/eavmlib/src/esp.erl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
partition_erase_range/2, partition_erase_range/3,
5151
partition_list/0,
5252
partition_read/3,
53+
partition_mmap/3,
5354
partition_write/3,
5455
rtc_slow_get_binary/0,
5556
rtc_slow_set_binary/1,
@@ -535,6 +536,23 @@ partition_list() ->
535536
partition_read(_Partition_id, _Offset, _Read_size) ->
536537
erlang:nif_error(undefined).
537538

539+
%%-----------------------------------------------------------------------------
540+
%% @param partition_id The id of the partition to read from eg. "main.avm"
541+
%% @param offset Starting offset in bytes where to begin reading
542+
%% @param read_size Number of bytes to read
543+
%% @returns {ok, data} on success, error on failure
544+
%% @doc Read binary data from a specific partition at the given offset,
545+
%% mapping it in RAM. The partition is unmapped when all references
546+
%% are garbage collected.
547+
%%
548+
%% @end
549+
%%-----------------------------------------------------------------------------
550+
-spec partition_mmap(
551+
Partition_id :: binary(), Offset :: non_neg_integer(), Read_size :: non_neg_integer()
552+
) -> {ok, binary()} | error.
553+
partition_mmap(_Partition_id, _Offset, _Read_size) ->
554+
erlang:nif_error(undefined).
555+
538556
%%-----------------------------------------------------------------------------
539557
%% @param partition_id The id of the partition to write to eg. "main.avm"
540558
%% @param offset Starting offset in bytes where to begin writing

0 commit comments

Comments
 (0)