Hello,

According to sys_arch.txt

  sys_prot_t sys_arch_protect(void)

  This optional function does a "fast" critical region protection and returns
  the previous protection level. This function is only called during very short
  critical regions. An embedded system which supports ISR-based drivers might
  want to implement this function by disabling interrupts. Task-based systems
  might want to implement this by using a mutex or disabling tasking. This
  function should support recursive calls from the same task or interrupt. In
  other words, sys_arch_protect() could be called while already protected. In
  that case the return value indicates that it is already protected.

I'm using OS21 (STMicro) and I've decided to use a mutex.

Is it correct that, in my case, I can ignore the sys_prot_t
arguments?

My implementation (in sys_arch.c)

typedef int sys_prot_t;
static mutex_t *sys_arch_mutex;

void sys_init(void) { sys_arch_mutex = mutex_create_fifo( ); }

sys_prot_t sys_arch_protect(void)
{
  mutex_lock(sys_arch_mutex);
  return 0;
}

void sys_arch_unprotect(sys_prot_t pval)
{
  mutex_release(sys_arch_mutex);
}

-- 
Regards.

_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to