nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gn...@apache.org
Subject [incubator-nuttx-apps] 01/04: examples: i2schar: nxstyle fixes
Date Tue, 21 Apr 2020 22:42:03 GMT
This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 3cdb81077b24dc56de1880db0ed3382c0bef5e29
Author: Alin Jerpelea <alin.jerpelea@sony.com>
AuthorDate: Tue Apr 21 17:32:44 2020 +0200

    examples: i2schar: nxstyle fixes
    
    nxstyle fixes for i2schar exaples
    
    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
---
 examples/i2schar/i2schar.h             |  2 ++
 examples/i2schar/i2schar_main.c        | 48 +++++++++++++++++++---------------
 examples/i2schar/i2schar_receiver.c    |  9 ++++---
 examples/i2schar/i2schar_transmitter.c |  9 ++++---
 4 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/examples/i2schar/i2schar.h b/examples/i2schar/i2schar.h
index 8f0e6d3..bf84971 100644
--- a/examples/i2schar/i2schar.h
+++ b/examples/i2schar/i2schar.h
@@ -46,7 +46,9 @@
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
+
 /* Configuration ************************************************************/
+
 /* CONFIG_EXAMPLES_I2SCHAR_DEVPATH - The default path to the I2S character
  *   device. Default: /dev/i2schar0
  */
diff --git a/examples/i2schar/i2schar_main.c b/examples/i2schar/i2schar_main.c
index d95604e..76963f9 100644
--- a/examples/i2schar/i2schar_main.c
+++ b/examples/i2schar/i2schar_main.c
@@ -102,12 +102,14 @@ static void i2schar_devpath(FAR struct i2schar_state_s *i2schar,
 static void i2schar_help(FAR struct i2schar_state_s *i2schar)
 {
   printf("Usage: i2schar [OPTIONS]\n");
-  printf("\nArguments are \"sticky\".  For example, once the I2C character device is\n");
+  printf("\nArguments are \"sticky\".\n");
+  printf("For example, once the I2C character device is\n");
   printf("specified, that device will be re-used until it is changed.\n");
   printf("\n\"sticky\" OPTIONS include:\n");
   printf("  [-p devpath] selects the I2C character device path.  "
          "Default: %s Current: %s\n",
-         CONFIG_EXAMPLES_I2SCHAR_DEVPATH, g_i2schar.devpath ? g_i2schar.devpath : "NONE");
+         CONFIG_EXAMPLES_I2SCHAR_DEVPATH,
+         g_i2schar.devpath ? g_i2schar.devpath : "NONE");
 #ifdef CONFIG_EXAMPLES_I2SCHAR_TX
   printf("  [-t count] selects the number of audio buffers to send.  "
          "Default: %d Current: %d\n",
@@ -159,7 +161,9 @@ static int arg_decimal(FAR char **arg, FAR long *value)
  * Name: parse_args
  ****************************************************************************/
 
-static void parse_args(FAR struct i2schar_state_s *i2schar, int argc, FAR char **argv)
+static void parse_args(FAR struct i2schar_state_s *i2schar,
+                       int argc,
+                       FAR char **argv)
 {
   FAR char *ptr;
   FAR char *str;
@@ -291,7 +295,7 @@ int main(int argc, FAR char *argv[])
    * the priority of transmitter.  This is important if a loopback test is
    * being performed; it improves the changes that a receiving audio buffer
    * is in place for each transmission.
-    */
+   */
 
   pthread_attr_getschedparam(&attr, &param);
   param.sched_priority++;
@@ -308,11 +312,12 @@ int main(int argc, FAR char *argv[])
   if (ret != OK)
     {
       sched_unlock();
-      printf("i2schar_main: ERROR: failed to Start receiver thread: %d\n", ret);
+      printf("i2schar_main: ERROR: failed to Start receiver thread: %d\n",
+             ret);
       return EXIT_FAILURE;
     }
 
-   pthread_setname_np(receiver, "receiver");
+  pthread_setname_np(receiver, "receiver");
 #endif
 
 #ifdef CONFIG_EXAMPLES_I2SCHAR_TX
@@ -331,7 +336,8 @@ int main(int argc, FAR char *argv[])
   if (ret != OK)
     {
       sched_unlock();
-      printf("i2schar_main: ERROR: failed to Start transmitter thread: %d\n", ret);
+      printf("i2schar_main: ERROR: failed to Start transmitter thread: %d\n",
+             ret);
 #ifdef CONFIG_EXAMPLES_I2SCHAR_RX
       printf("i2schar_main: Waiting for the receiver thread\n");
       pthread_join(receiver, &result);
@@ -339,26 +345,26 @@ int main(int argc, FAR char *argv[])
       return EXIT_FAILURE;
     }
 
-   pthread_setname_np(transmitter, "transmitter");
+  pthread_setname_np(transmitter, "transmitter");
 #endif
 
-   sched_unlock();
+  sched_unlock();
 #ifdef CONFIG_EXAMPLES_I2SCHAR_TX
-   printf("i2schar_main: Waiting for the transmitter thread\n");
-   ret = pthread_join(transmitter, &result);
-   if (ret != OK)
-     {
-       printf("i2schar_main: ERROR: pthread_join failed: %d\n", ret);
-     }
+  printf("i2schar_main: Waiting for the transmitter thread\n");
+  ret = pthread_join(transmitter, &result);
+  if (ret != OK)
+    {
+      printf("i2schar_main: ERROR: pthread_join failed: %d\n", ret);
+    }
 #endif
 
 #ifdef CONFIG_EXAMPLES_I2SCHAR_RX
-   printf("i2schar_main: Waiting for the receiver thread\n");
-   ret = pthread_join(receiver, &result);
-   if (ret != OK)
-     {
-       printf("i2schar_main: ERROR: pthread_join failed: %d\n", ret);
-     }
+  printf("i2schar_main: Waiting for the receiver thread\n");
+  ret = pthread_join(receiver, &result);
+  if (ret != OK)
+    {
+      printf("i2schar_main: ERROR: pthread_join failed: %d\n", ret);
+    }
 #endif
 
   return EXIT_SUCCESS;
diff --git a/examples/i2schar/i2schar_receiver.c b/examples/i2schar/i2schar_receiver.c
index a808e2a..20cf0b8 100644
--- a/examples/i2schar/i2schar_receiver.c
+++ b/examples/i2schar/i2schar_receiver.c
@@ -116,13 +116,14 @@ pthread_addr_t i2schar_receiver(pthread_addr_t arg)
       /* Allocate an audio buffer of the configured size */
 
       desc.numbytes   = CONFIG_EXAMPLES_I2SCHAR_BUFSIZE;
-      desc.u.ppBuffer = &apb;
+      desc.u.pbuffer = &apb;
 
       ret = apb_alloc(&desc);
       if (ret < 0)
         {
-           printf("i2schar_receiver: ERROR: failed to allocate buffer %d: %d\n",
-                   i+1, ret);
+           printf(
+             "i2schar_receiver: ERROR: failed to allocate buffer %d: %d\n",
+                i + 1, ret);
            close(fd);
            pthread_exit(NULL);
         }
@@ -160,7 +161,7 @@ pthread_addr_t i2schar_receiver(pthread_addr_t arg)
             }
           else
             {
-              printf("i2schar_receiver: Received buffer %d\n", i+1);
+              printf("i2schar_receiver: Received buffer %d\n", i + 1);
             }
         }
       while (nread != bufsize);
diff --git a/examples/i2schar/i2schar_transmitter.c b/examples/i2schar/i2schar_transmitter.c
index 31c17f4..470352d 100644
--- a/examples/i2schar/i2schar_transmitter.c
+++ b/examples/i2schar/i2schar_transmitter.c
@@ -119,13 +119,14 @@ pthread_addr_t i2schar_transmitter(pthread_addr_t arg)
       /* Allocate an audio buffer of the configured size */
 
       desc.numbytes   = CONFIG_EXAMPLES_I2SCHAR_BUFSIZE;
-      desc.u.ppBuffer = &apb;
+      desc.u.pbuffer = &apb;
 
       ret = apb_alloc(&desc);
       if (ret < 0)
         {
-           printf("i2schar_transmitter: ERROR: failed to allocate buffer %d: %d\n",
-                   i+1, ret);
+           printf("
+             i2schar_transmitter: ERROR: failed to allocate buffer %d: %d\n",
+             i + 1, ret);
            close(fd);
            pthread_exit(NULL);
         }
@@ -172,7 +173,7 @@ pthread_addr_t i2schar_transmitter(pthread_addr_t arg)
             }
           else
             {
-              printf("i2schar_transmitter: Send buffer %d\n", i+1);
+              printf("i2schar_transmitter: Send buffer %d\n", i + 1);
             }
         }
       while (nwritten != bufsize);


Mime
View raw message