mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
arch/z80/src/ez80/ez80_spi.c: Cosmetic changes from code review.
This commit is contained in:
@@ -111,8 +111,14 @@ static const struct spi_ops_s g_spiops =
|
||||
* array with one 'struct spi_dev_s' instance per bus.
|
||||
*/
|
||||
|
||||
static struct spi_dev_s g_spidev = {&g_spiops};
|
||||
static sem_t g_exclsem = SEM_INITIALIZER(1); /* For mutually exclusive access */
|
||||
static struct spi_dev_s g_spidev =
|
||||
{
|
||||
&g_spiops
|
||||
};
|
||||
|
||||
/* Semaphore supports mutually exclusive access */
|
||||
|
||||
static sem_t g_exclsem = SEM_INITIALIZER(1);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
@@ -183,10 +189,11 @@ static int spi_lock(FAR struct spi_dev_s *dev, bool lock)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency)
|
||||
static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev,
|
||||
uint32_t frequency)
|
||||
{
|
||||
/* We want select divisor to provide the highest frequency (SPIR) that does NOT
|
||||
* exceed the requested frequency.:
|
||||
/* We want select divisor to provide the highest frequency (SPIR) that does
|
||||
* NOT exceed the requested frequency.:
|
||||
*
|
||||
* SPIR <= System Clock Frequency / (2 * BRG)
|
||||
*
|
||||
@@ -297,6 +304,7 @@ static uint8_t spi_waitspif(void)
|
||||
status = inp(EZ80_SPI_SR) & (SPI_SR_SPIF | SPI_SR_WCOL | SPI_SR_MODF);
|
||||
}
|
||||
while (status == 0);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -397,18 +405,19 @@ static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer,
|
||||
* Input Parameters:
|
||||
* dev - Device-specific state data
|
||||
* buffer - A pointer to the buffer in which to recieve data
|
||||
* buflen - the length of data that can be received in the buffer in number
|
||||
* of words. The wordsize is determined by the number of bits-per-word
|
||||
* selected for the SPI interface. If nbits <= 8, the data is
|
||||
* packed into uint8_t's; if nbits >8, the data is packed into
|
||||
* uint16_t's
|
||||
* buflen - The length of data that can be received in the buffer in
|
||||
* number of words. The wordsize is determined by the number of
|
||||
* bits-per-word selected for the SPI interface. If nbits <= 8,
|
||||
* the data is packed into uint8_t's; if nbits >8, the data is
|
||||
* packed into uint16_t's
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t buflen)
|
||||
static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer,
|
||||
size_t buflen)
|
||||
{
|
||||
FAR uint8_t *ptr = (FAR uint8_t *)buffer;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user