5858#define TCPIP_HOSTNAME_MAX_SIZE 255
5959
6060#define TAG "network_driver"
61- #define PORT_REPLY_SIZE (TUPLE_SIZE(2) + REF_SIZE )
61+ #define PORT_REPLY_SIZE (TUPLE_SIZE(2) + TERM_BOXED_PROCESS_REF_SIZE )
6262
6363static const char * const ap_atom = ATOM_STR ("\x2" , "ap" );
6464static const char * const ap_channel_atom = ATOM_STR ("\xA" , "ap_channel" );
@@ -110,7 +110,7 @@ struct ClientData
110110 GlobalContext * global ;
111111 uint32_t port_process_id ;
112112 uint32_t owner_process_id ;
113- uint64_t ref_ticks ;
113+ RefData ref_data ;
114114};
115115
116116static inline term make_atom (GlobalContext * global , AtomString atom_str )
@@ -131,7 +131,7 @@ static term tuple_from_addr(Heap *heap, uint32_t addr)
131131
132132static void send_term (Heap * heap , struct ClientData * data , term t )
133133{
134- term ref = term_from_ref_ticks (data -> ref_ticks , heap );
134+ term ref = term_from_ref_data (data -> ref_data , heap );
135135 term msg = term_alloc_tuple (2 , heap );
136136 term_put_tuple_element (msg , 0 , ref );
137137 term_put_tuple_element (msg , 1 , t );
@@ -659,7 +659,7 @@ static void start_network(Context *ctx, term pid, term ref, term config)
659659 data -> global = ctx -> global ;
660660 data -> port_process_id = ctx -> process_id ;
661661 data -> owner_process_id = term_to_local_process_id (pid );
662- data -> ref_ticks = term_to_ref_ticks (ref );
662+ data -> ref_data = term_to_ref_data (ref );
663663
664664 esp_err_t err ;
665665
@@ -890,7 +890,7 @@ static NativeHandlerResult consume_mailbox(Context *ctx)
890890 return NativeContinue ;
891891 }
892892
893- //TODO: port this code to standard port (and gen_message)
893+ // TODO: port this code to standard port (and gen_message)
894894 term pid = term_get_tuple_element (msg , 0 );
895895 term ref = term_get_tuple_element (msg , 1 );
896896 term cmd = term_get_tuple_element (msg , 2 );
@@ -922,7 +922,7 @@ static NativeHandlerResult consume_mailbox(Context *ctx)
922922 default : {
923923 ESP_LOGE (TAG , "Unrecognized command: %x" , cmd );
924924 // {Ref, {error, badarg}}
925- size_t heap_size = TUPLE_SIZE (2 ) + REF_SIZE + TUPLE_SIZE (2 );
925+ size_t heap_size = TUPLE_SIZE (2 ) + TERM_BOXED_PROCESS_REF_SIZE + TUPLE_SIZE (2 );
926926 if (UNLIKELY (memory_ensure_free (ctx , heap_size ) != MEMORY_GC_OK )) {
927927 ESP_LOGE (TAG , "Unable to allocate heap space for error; no message sent" );
928928 return NativeContinue ;
@@ -932,7 +932,7 @@ static NativeHandlerResult consume_mailbox(Context *ctx)
932932 }
933933 } else {
934934 // {Ref, {error, badarg}}
935- size_t heap_size = TUPLE_SIZE (2 ) + REF_SIZE + TUPLE_SIZE (2 );
935+ size_t heap_size = TUPLE_SIZE (2 ) + TERM_BOXED_PROCESS_REF_SIZE + TUPLE_SIZE (2 );
936936 if (UNLIKELY (memory_ensure_free (ctx , heap_size ) != MEMORY_GC_OK )) {
937937 ESP_LOGE (TAG , "Unable to allocate heap space for error; no message sent" );
938938 return NativeContinue ;
0 commit comments