<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Semaphore implementation for the Radio</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10707/semaphore-implementation-for-the-radio</link><description>Dear Nordic developers, 
 In my project there is a possibility that CPU and RADIO EasyDMA peripheral can access to the same memory RAM locations in parallel. I read from the manual that RADIO EasyDMA unit is accessing to a RAM location between READY</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 09 Dec 2015 15:48:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10707/semaphore-implementation-for-the-radio" /><item><title>RE: Semaphore implementation for the Radio</title><link>https://devzone.nordicsemi.com/thread/39982?ContentTypeID=1</link><pubDate>Wed, 09 Dec 2015 15:48:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79c76bc6-8ea1-4841-811f-ea5fb48996e5</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;your welcome :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Semaphore implementation for the Radio</title><link>https://devzone.nordicsemi.com/thread/39981?ContentTypeID=1</link><pubDate>Wed, 09 Dec 2015 15:44:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b380c4d4-4b4c-4aaf-ae83-6c1a280acbcb</guid><dc:creator>haruthakop</dc:creator><description>&lt;p&gt;Hi Aryan&lt;/p&gt;
&lt;p&gt;Thanks a lot for your help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Semaphore implementation for the Radio</title><link>https://devzone.nordicsemi.com/thread/39980?ContentTypeID=1</link><pubDate>Tue, 08 Dec 2015 12:09:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc53d5ad-2382-4df3-bf36-3f0b2175c44e</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I think you can implement your own MUTual EXclusion semaphore and change the micro lib library where RADIO transaction is enabled to fetch this mutex first.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t mutex_acquire(uint8_t * p_mutex)
{
  bool success;
  int irq_was_masked;
  
  /* Disable Interrupts if not */
  irq_was_masked = __disable_irq(); 

  success = (*p_mutex != MUTEX_TAKEN);
  *p_mutex = MUTEX_TAKEN;
  
  /* Enable Interrupts if disabled by this function */
  if (!irq_was_masked)
  {
    __enable_irq();
  }
  
  if (success)
  {
    return UESB_SUCCESS;
  }
  else
  {
    return UESB_MUTEX_ALREADY_TAKEN_ERROR;
  }  
}

uint32_t mutex_release(uint8_t * p_mutex)
{
  int irq_was_masked;

  /* Disable Interrupts if not */
  irq_was_masked = __disable_irq(); 

  *p_mutex = MUTEX_FREE;

  /* Enable Interrupts if disabled by this function */
  if (!irq_was_masked)
  {
    __enable_irq();
  }
  
  return UESB_SUCCESS;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Keep in mind the possibility of a deadlock as mentioned &lt;a href="https://devzone.nordicsemi.com/question/45841/sd_mutex-implementation-question/9"&gt;here&lt;/a&gt; which you need to handle.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Semaphore implementation for the Radio</title><link>https://devzone.nordicsemi.com/thread/39979?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2015 15:47:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:308cd9ab-f8c0-4c0b-a93e-e2720680dc22</guid><dc:creator>haruthakop</dc:creator><description>&lt;p&gt;Thanks for your answer.&lt;/p&gt;
&lt;p&gt;Do you have any recommendation how can it be implemented in micro-esb library?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Semaphore implementation for the Radio</title><link>https://devzone.nordicsemi.com/thread/39978?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2015 15:39:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ae4335a-4965-4d5e-b153-6a3836686710</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Sorry, there is no such mechanism for RADIO&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>