void os_init_idle_task(void) { os_task_init(&g_idle_task, "idle", os_idle_task, NULL, OS_IDLE_PRIO, OS_WAIT_FOREVER, g_idle_task_stack, OS_STACK_ALIGN(OS_IDLE_STACK_SIZE)); }
static void ble_os_test_init_app_task(void) { int rc; rc = os_task_init(&ble_os_test_app_task, "ble_gap_terminate_test_task", ble_os_test_app_task_handler, NULL, BLE_OS_TEST_APP_PRIO, OS_WAIT_FOREVER, ble_os_test_app_stack, OS_STACK_ALIGN(BLE_OS_TEST_APP_STACK_SIZE)); TEST_ASSERT_FATAL(rc == 0); }
#include <stdio.h> #include <string.h> #include "testutil/testutil.h" #include "os/os.h" #include "os/os_cfg.h" #include "os/os_sem.h" #include "os_test_priv.h" #ifdef ARCH_sim #define SEM_TEST_STACK_SIZE 1024 #else #define SEM_TEST_STACK_SIZE 512 #endif struct os_task task1; os_stack_t stack1[OS_STACK_ALIGN(SEM_TEST_STACK_SIZE)]; struct os_task task2; os_stack_t stack2[OS_STACK_ALIGN(SEM_TEST_STACK_SIZE)]; struct os_task task3; os_stack_t stack3[OS_STACK_ALIGN(SEM_TEST_STACK_SIZE)]; struct os_task task4; os_stack_t stack4[OS_STACK_ALIGN(SEM_TEST_STACK_SIZE)]; #define TASK1_PRIO (1) #define TASK2_PRIO (2) #define TASK3_PRIO (3) #define TASK4_PRIO (4)
* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "os/os.h" #include "os/queue.h" #include <assert.h> struct os_task g_idle_task; os_stack_t g_idle_task_stack[OS_STACK_ALIGN(OS_IDLE_STACK_SIZE)]; uint32_t g_os_idle_ctr; /* Default zero. Set by the architecture specific code when os is started. */ int g_os_started; void os_idle_task(void *arg) { /* For now, idle task simply increments a counter to show it is running. */ while (1) { ++g_os_idle_ctr; } }
#include "testutil/testutil.h" #include "nimble/hci_common.h" #include "nimble/ble_hci_trans.h" #include "host/ble_hs_test.h" #include "host/ble_gap.h" #include "ble_hs_test_util.h" #define BLE_OS_TEST_STACK_SIZE 256 #define BLE_OS_TEST_APP_STACK_SIZE 256 #define BLE_OS_TEST_APP_PRIO 9 #define BLE_OS_TEST_TASK_PRIO 10 static struct os_task ble_os_test_task; static struct os_task ble_os_test_app_task; static os_stack_t ble_os_test_stack[OS_STACK_ALIGN(BLE_OS_TEST_STACK_SIZE)]; static os_stack_t ble_os_test_app_stack[OS_STACK_ALIGN(BLE_OS_TEST_APP_STACK_SIZE)]; static uint8_t ble_os_test_peer_addr[6] = { 1, 2, 3, 4, 5, 6 }; static void ble_os_test_app_task_handler(void *arg); static int ble_os_test_gap_event_type; static void ble_os_test_init_app_task(void) { int rc;