> -----Original Message-----
> From: Grr <gebbe...@gmail.com>
> Sent: Sunday, February 21, 2021 3:07 AM
> To: dev@nuttx.apache.org
> Subject: Re: Board-level Ethernet PHY operations in STM32.
> 
> When is using internal OS interfaces from another OS subsystem (or an app) OK 
> and not modularity rape?
> 

psock_/file_ API is public API for kernel space component, not internal to 
socket/file subsystem.
Functions declaration under nuttx/include/ can be used outside the subsystem 
which implement them.
Subsystem internal functions normally declared in the source code folders, e.g.:
https://github.com/apache/incubator-nuttx/blob/master/fs/inode/inode.h
https://github.com/apache/incubator-nuttx/blob/master/net/socket/socket.h

> For example (and following my development line), if a SPI peripheral driver 
> needs to access GPIO data structure in order to control chip
> select, is it more problematic than an app talking directly to a PHY or less?
> 

SPI peripheral driver(e.g. sensor) should call SPI_SELECT to control the chip 
select, it's the responsibility of SPI bus driver(spi_dev_s/spi_ops_s) to do 
the real action:
1.Control the SPI hardware register to change CS signal
2.Or control the GPIO hardware register

> El sáb, 20 feb 2021 a las 12:30, Gregory Nutt (<spudan...@gmail.com>)
> escribió:
> 
> >
> > > I suggested using file_open() and file_ioctl() in a previous email.
> > > That is wrong.  file_ioctl() cannot be used to access
> > > socket_ioctls().  You would have to use psock_ioctl().
> >
> > Because the socket interface goes though the network, there are some
> > hand shakes and interlocks to prevent network activity while accessing
> > the PHY interface.   I think using a custom interface would be
> > problematic.  It would be best to use the internal OS socket
> > interfaces directly.  They prototyped and described in 
> > include/nuttx/net/net.h.
> > For example, instead of using socket() you would use psock_socket(),
> > instead of using bind(), you would use psock_bind(), instead of using
> > ioctl(), you would use psock_ioctl().
> >
> > The APIs are the same as the user space APIs exception that:  (1) the
> > are prefaced with psock_ and (2) the do not use an int socket
> > descriptor. Rather, they use a pointer to the internal socket
> > structure struct socket *
> >
> >
> >
> >

Reply via email to