mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
Merge remote-tracking branch 'origin/master' into irqlock
This commit is contained in:
@@ -1907,16 +1907,35 @@ static int mcan_del_extfilter(FAR struct sam_mcan_s *priv, int ndx)
|
|||||||
|
|
||||||
DEBUGASSERT(priv != NULL && priv->config != NULL);
|
DEBUGASSERT(priv != NULL && priv->config != NULL);
|
||||||
config = priv->config;
|
config = priv->config;
|
||||||
DEBUGASSERT(ndx < config->nextfilters);
|
|
||||||
|
/* Check user Parameters */
|
||||||
|
|
||||||
|
DEBUGASSERT(ndx >= 0 || ndx < config->nextfilters);
|
||||||
|
|
||||||
|
if (ndx < 0 || ndx >= config->nextfilters)
|
||||||
|
{
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get exclusive excess to the MCAN hardware */
|
/* Get exclusive excess to the MCAN hardware */
|
||||||
|
|
||||||
mcan_dev_lock(priv);
|
mcan_dev_lock(priv);
|
||||||
|
|
||||||
/* Release the filter */
|
|
||||||
|
|
||||||
word = ndx >> 5;
|
word = ndx >> 5;
|
||||||
bit = ndx & 0x1f;
|
bit = ndx & 0x1f;
|
||||||
|
|
||||||
|
/* Check if this filter is really assigned */
|
||||||
|
|
||||||
|
if ((priv->extfilters[word] & (1 << bit)) == 0)
|
||||||
|
{
|
||||||
|
/* No, error out */
|
||||||
|
|
||||||
|
mcan_dev_unlock(priv);
|
||||||
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release the filter */
|
||||||
|
|
||||||
priv->extfilters[word] &= ~(1 << bit);
|
priv->extfilters[word] &= ~(1 << bit);
|
||||||
|
|
||||||
DEBUGASSERT(priv->nextalloc > 0);
|
DEBUGASSERT(priv->nextalloc > 0);
|
||||||
@@ -2137,16 +2156,35 @@ static int mcan_del_stdfilter(FAR struct sam_mcan_s *priv, int ndx)
|
|||||||
|
|
||||||
DEBUGASSERT(priv != NULL && priv->config != NULL);
|
DEBUGASSERT(priv != NULL && priv->config != NULL);
|
||||||
config = priv->config;
|
config = priv->config;
|
||||||
DEBUGASSERT(ndx < config->nstdfilters);
|
|
||||||
|
/* Check Userspace Parameters */
|
||||||
|
|
||||||
|
DEBUGASSERT(ndx >= 0 || ndx < config->nstdfilters);
|
||||||
|
|
||||||
|
if (ndx < 0 || ndx >= config->nstdfilters)
|
||||||
|
{
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get exclusive excess to the MCAN hardware */
|
/* Get exclusive excess to the MCAN hardware */
|
||||||
|
|
||||||
mcan_dev_lock(priv);
|
mcan_dev_lock(priv);
|
||||||
|
|
||||||
/* Release the filter */
|
|
||||||
|
|
||||||
word = ndx >> 5;
|
word = ndx >> 5;
|
||||||
bit = ndx & 0x1f;
|
bit = ndx & 0x1f;
|
||||||
|
|
||||||
|
/* Check if this filter is really assigned */
|
||||||
|
|
||||||
|
if ((priv->stdfilters[word] & (1 << bit)) == 0)
|
||||||
|
{
|
||||||
|
/* No, error out */
|
||||||
|
|
||||||
|
mcan_dev_unlock(priv);
|
||||||
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release the filter */
|
||||||
|
|
||||||
priv->stdfilters[word] &= ~(1 << bit);
|
priv->stdfilters[word] &= ~(1 << bit);
|
||||||
|
|
||||||
DEBUGASSERT(priv->nstdalloc > 0);
|
DEBUGASSERT(priv->nstdalloc > 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user