Meco Man 4 lat temu
rodzic
commit
30ed42bf41

+ 5 - 5
en/dynmem_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -11,7 +11,7 @@
 
 /*
  * Demo: dynamic memory management
- * 
+ *
  * This demo creates a dynamic thread to allocate and free memory.
  * Each time it allocates more memory, and it will end when it can't allocate any memory.
  *
@@ -35,8 +35,8 @@ void thread1_entry(void *parameter)
     {
         /* allocate memory of (1 << i) bytes  */
         ptr = rt_malloc(1 << i);
-        
-        if (ptr != RT_NULL) 
+
+        if (ptr != RT_NULL)
         {
             /* if memory allocated successfully */
             rt_kprintf("get memory :%d byte\n", (1 << i));
@@ -64,7 +64,7 @@ int dynmem_sample(void)
                            THREAD_TIMESLICE);
     /*start thread #1 */
     if (tid != RT_NULL)
-        rt_thread_startup(tid); 
+        rt_thread_startup(tid);
 
     return 0;
 }

+ 3 - 3
en/event_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -40,7 +40,7 @@ static void thread1_recv_event(void *param)
 {
     rt_uint32_t e;
 
-    /* 
+    /*
         first time to receive event(s):
         EITHER Event3 OR Event5 happened can resume thread1
         and then clear conrresponding event(s)' flag
@@ -58,7 +58,7 @@ static void thread1_recv_event(void *param)
     /*
         second time to receive event(s):
         BOTH Event3 AND Event5 happened can resume thread1
-        and then clear conrresponding event(s)' flag 
+        and then clear conrresponding event(s)' flag
     */
     if (rt_event_recv(&event, (EVENT_FLAG3 | EVENT_FLAG5),
                       RT_EVENT_FLAG_AND | RT_EVENT_FLAG_CLEAR,

+ 1 - 1
en/idlehook_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 4 - 4
en/interrupt_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -36,14 +36,14 @@ static void thread_entry(void *parameter)
     rt_uint32_t level;
 
     no = (rt_uint32_t) parameter;
-    
+
     while (1)
     {
         /* disable interrupt */
         level = rt_hw_interrupt_disable();
-        
+
         cnt += no; /* critical sections (or critical region) */
-        
+
         /* enable interrupt */
         rt_hw_interrupt_enable(level);
 

+ 5 - 5
en/mailbox_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -10,16 +10,16 @@
  */
 
 /*
- * Demo: 
+ * Demo:
  *
  * This demo creates two threads and one boxmail (static):
- *    1) thread #1: receive mails 
+ *    1) thread #1: receive mails
  *    2) thread #2: send mails
  *
  * read more:
  *    https://www.rt-thread.io/document/site/thread-comm/thread-comm/#mailbox
  */
- 
+
 #include <rtthread.h>
 
 #define THREAD_PRIORITY      10
@@ -106,7 +106,7 @@ int mailbox_sample(void)
                         "mbt",
                         &mb_pool[0],
                         sizeof(mb_pool) / sizeof(rt_ubase_t), /* size of mails */
-                        RT_IPC_FLAG_FIFO); 
+                        RT_IPC_FLAG_FIFO);
     if (result != RT_EOK)
     {
         rt_kprintf("init mailbox failed.\n");

+ 3 - 3
en/memp_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -8,7 +8,7 @@
  * 2018-08-24     yangjie      the first version
  * 2020-10-17     Meco Man     translate to English comment
  */
- 
+
 /*
  * Demo: memory pool
  *
@@ -19,7 +19,7 @@
  * read more:
  *    https://www.rt-thread.io/document/site/memory/memory/#memory-pool
  */
- 
+
 #include <rtthread.h>
 
 static rt_uint8_t *ptr[50];

+ 4 - 4
en/msgq_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -10,7 +10,7 @@
  */
 
 /*
- * Demo: message queue 
+ * Demo: message queue
  *
  * This demo creates two threads and one message queue:
  *    1) thread #1: receive message(s) from message queue
@@ -52,7 +52,7 @@ static void thread1_entry(void *parameter)
             }
         }
         cnt++;
-        
+
         /* delay for 50ms */
         rt_thread_mdelay(50);
     }
@@ -104,7 +104,7 @@ static void thread2_entry(void *parameter)
         }
         buf++;
         cnt++;
-        
+
         /* delay for 5ms */
         rt_thread_mdelay(5);
     }

+ 4 - 4
en/mutex_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -17,7 +17,7 @@
  * read more:
  *    https://www.rt-thread.io/document/site/thread-sync/thread-sync/#mutex
  */
- 
+
 #include <rtthread.h>
 
 #define THREAD_PRIORITY         8
@@ -36,12 +36,12 @@ static void rt_thread_entry1(void *parameter)
     {
         /* pending the mutex */
         rt_mutex_take(dynamic_mutex, RT_WAITING_FOREVER);
-        
+
         /* protect and deal with public variables */
         number1++;
         rt_thread_mdelay(10);
         number2++;
-        
+
         /* release the mutex */
         rt_mutex_release(dynamic_mutex);
     }

+ 7 - 7
en/priority_inversion.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -11,14 +11,14 @@
 
 /*
  * Demo: prevent priority inversions
- * 
+ *
  * This demo creates 3 threads and 1 mutex to
  * demonstrate how the mutex prevents priority inversions.
  *
  * read more:
  *    https://www.rt-thread.io/document/site/thread-sync/thread-sync/#mutex
  */
- 
+
 #include <rtthread.h>
 
 /* thread(s) handler */
@@ -38,7 +38,7 @@ static void thread1_entry(void *parameter)
     rt_thread_mdelay(100);
 
     /* at this point, thread #3 holds the mutex and thread #2 is pending on holding the mutex */
-    
+
     /* check the priority level of thread #2 and thread #3 */
     if (tid2->current_priority != tid3->current_priority)
     {
@@ -66,10 +66,10 @@ static void thread2_entry(void *parameter)
     /* let the lower priority thread run first */
     rt_thread_mdelay(50);
 
-    /* 
+    /*
      * pending the mutex
-     * At this time, kernel raises the priority of thread #3 to same priority 
-     * as thread #2 
+     * At this time, kernel raises the priority of thread #3 to same priority
+     * as thread #2
      */
     result = rt_mutex_take(mutex, RT_WAITING_FOREVER);
 

+ 3 - 3
en/producer_consumer.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -19,7 +19,7 @@
  * read more:
  *    https://www.rt-thread.io/document/site/thread-sync/thread-sync/#semaphores
  */
- 
+
 #include <rtthread.h>
 
 #define THREAD_PRIORITY       6
@@ -113,7 +113,7 @@ int producer_consumer(void)
     if (producer_tid != RT_NULL)
         rt_thread_startup(producer_tid);
 
-    
+
     consumer_tid = rt_thread_create("consumer",
                                     consumer_thread_entry, RT_NULL,
                                     THREAD_STACK_SIZE,

+ 2 - 2
en/scheduler_hook.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -15,7 +15,7 @@
  * This demo sets a scheduler hook function and prints context-switching information.
  *
  * read more:
- *    https://www.rt-thread.io/document/site/thread/thread/#set-the-scheduler-hook 
+ *    https://www.rt-thread.io/document/site/thread/thread/#set-the-scheduler-hook
  */
 
 #include <rtthread.h>

+ 2 - 2
en/semaphore_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -18,7 +18,7 @@
  * read more:
  *    https://www.rt-thread.io/document/site/thread-sync/thread-sync/#semaphores
  */
- 
+
 #include <rtthread.h>
 
 #define THREAD_PRIORITY         25

+ 6 - 6
en/signal_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -12,16 +12,16 @@
 /*
  * Demo: signal
  *
- * This demo creates one thread. When the signal is installed, the signal 
- * processing mode is set to custom processing. The processing function of 
- * the signal is defined to be thread1_signal_handler(). After the thread is 
- * running and the signal is installed, a signal is sent to this thread. 
+ * This demo creates one thread. When the signal is installed, the signal
+ * processing mode is set to custom processing. The processing function of
+ * the signal is defined to be thread1_signal_handler(). After the thread is
+ * running and the signal is installed, a signal is sent to this thread.
  * This thread will receive the signal and print the message.
  *
  * read more:
  *    https://www.rt-thread.io/document/site/thread-comm/thread-comm/#signal
  */
- 
+
 #include <rtthread.h>
 
 #define THREAD_PRIORITY         25

+ 4 - 4
en/thread_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -9,17 +9,17 @@
  * 2020-10-17     Meco Man     translate to English comment
  */
 
-/* 
+/*
  * Demo: thread(s)
  *
- * This demo creates two threads: 
+ * This demo creates two threads:
  *    1) create thread #1 dynamically, and delete automatically when the thread #1 finished;
  *    2) create thread #2 statically, and print counting numbers continuously.
  *
  * read more:
  *    https://www.rt-thread.io/document/site/thread/thread/
  */
- 
+
 #include <rtthread.h>
 
 #define THREAD_PRIORITY         25

+ 1 - 1
en/timer_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 3 - 3
en/timeslice_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -11,7 +11,7 @@
 
 /*
  * Demo: Time-Slicing (or Round-Robin Scheduling)
- * 
+ *
  * This demo creates two threads to show how Time-Slicing works.
  *
  * read more:
@@ -48,7 +48,7 @@ static void thread_entry(void *parameter)
 int timeslice_sample(void)
 {
     rt_thread_t tid = RT_NULL; /* thread handle */
-    
+
     /* create thread #1 */
     tid = rt_thread_create("thread1",
                            thread_entry, (void *)1,

+ 1 - 1
zh/dynmem_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 1 - 1
zh/event_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 1 - 1
zh/idlehook_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 1 - 1
zh/interrupt_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 1 - 1
zh/mailbox_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 2 - 2
zh/mailbox_urgent_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -71,7 +71,7 @@ static void thread2_entry(void *parameter)
     while (count < 10)
     {
         count ++;
-        
+
         /* 分别发送正常邮件和紧急邮件到邮箱中 */
         /* 关调度器是为了同时给线程1两封邮件,观察线程1如何处理紧急邮件和正常邮件 */
         rt_enter_critical();

+ 1 - 1
zh/memp_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 1 - 1
zh/msgq_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 1 - 1
zh/mutex_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 1 - 1
zh/priority_inversion.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 1 - 1
zh/producer_consumer.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 1 - 1
zh/scheduler_hook.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 1 - 1
zh/semaphore_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 1 - 1
zh/signal_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 1 - 1
zh/thread_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 1 - 1
zh/timer_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *

+ 1 - 1
zh/timeslice_sample.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *