Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] SPI Slave Driver - semaphore release in spi_slave_read #14369

Closed
1 task done
FelipeMdeO opened this issue Oct 16, 2024 · 3 comments · Fixed by #14411
Closed
1 task done

[HELP] SPI Slave Driver - semaphore release in spi_slave_read #14369

FelipeMdeO opened this issue Oct 16, 2024 · 3 comments · Fixed by #14411
Assignees

Comments

@FelipeMdeO
Copy link
Contributor

Description

Hello All,

I have other doubt about spi slave driver implementation, it is related spi_slave_driver.c file.

In current implementation we have semaphore reader:

  /* The semphore reader */

  sem_t wait;

It is used in spi_slave.read function, for instance:

 if (priv->rx_length == 0)
        {
          nxmutex_unlock(&priv->lock);
          if (filep->f_oflags & O_NONBLOCK)
            {
              return -EAGAIN;
            }

         ret = nxsem_wait(&priv->wait);
          if (ret < 0)
            {
              return ret;
            }

          ret = nxmutex_lock(&priv->lock);
          if (ret < 0)
            {
              spierr("Failed to get exclusive access: %d\n", ret);
              return ret;
            }
        }
    }

The same semaphore is handle in spi_notify function. But trying search call of this function across the entire project, I cannot find any call of SPIS_DEV_NOTIFY.

@Donny9 , Can you check my reasoning, please?

If so, can you give me an example of how you used the SPIS_DEV_NOTIFY function?

In the lower half I'm working on, I see the SPIS_DEV_SELECT function call inside the spi interrupt, but no reference to notify.

Verification

  • I have verified before submitting the report.
@xiaoxiang781216
Copy link
Contributor

@Donny9 please look at this issue.

@Donny9
Copy link
Contributor

Donny9 commented Oct 19, 2024

@FelipeMdeO please look PR #14411, you can add SPIS_DEV_NOTIFY in interrupt when rx or tx complete

@FelipeMdeO
Copy link
Contributor Author

Thank you @Donny9 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants