Exemplo n.º 1
1
// Application Main program
__NO_RETURN void app_main (void *argument) {
  (void)argument;

  DAP_Setup();                          // DAP Setup 

  USBD_Initialize(0U);                  // USB Device Initialization
  USBD_Connect(0U);                     // USB Device Connect

  while (!USBD_Configured(0U));         // Wait for USB Device to configure

  LED_CONNECTED_OUT(1U);                // Turn on  Debugger Connected LED
  LED_RUNNING_OUT(1U);                  // Turn on  Target Running LED
  Delayms(500U);                        // Wait for 500ms
  LED_RUNNING_OUT(0U);                  // Turn off Target Running LED
  LED_CONNECTED_OUT(0U);                // Turn off Debugger Connected LED

  // Create DAP Thread
  DAP_ThreadId = osThreadNew(DAP_Thread, NULL, &DAP_ThreadAttr);

  // Create SWO Thread
  SWO_ThreadId = osThreadNew(SWO_Thread, NULL, &SWO_ThreadAttr);

  osDelay(osWaitForever);
  for (;;) {};
}
Exemplo n.º 2
0
int main (void) {

  Status = osKernelInitialize();

  ThreadA_Id = osThreadNew(ThreadA, NULL, &ThreadAttr);
  ThreadB_Id = osThreadNew(ThreadB, NULL, &ThreadAttr);
  ThreadC_Id = osThreadNew(ThreadC, NULL, NULL);
  ThreadD_Id = osThreadNew(ThreadD, NULL, &ThreadAttr);

  Status = osKernelStart();

  for (;;);
}
Exemplo n.º 3
0
osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument) {

  if (thread_def == NULL) {
    return NULL;
  }
  return osThreadNew((osThreadFunc_t)thread_def->pthread, argument, &thread_def->attr);
}
Exemplo n.º 4
0
void ns_event_loop_thread_create(void)
{
    event_mutex_id = osMutexNew(&event_mutex_attr);
    MBED_ASSERT(event_mutex_id != NULL);

    event_thread_id = osThreadNew(event_loop_thread, NULL, &event_thread_attr);
    MBED_ASSERT(event_thread_id != NULL);
}
Exemplo n.º 5
0
int main (void) {

  SystemCoreClockUpdate();
  osKernelInitialize();                 // Initialize CMSIS-RTOS
  osThreadNew(app_main, NULL, NULL);    // Create application main thread
  if (osKernelGetState() == osKernelReady) {
    osKernelStart();                    // Start thread execution
  }

  for (;;) {};
}
Exemplo n.º 6
0
int Init_Semaphore (void)
{
 
  sid_Thread_Semaphore = osSemaphoreNew(2, 2, NULL);
  if (!sid_Thread_Semaphore) {
    ; // Semaphore object not created, handle failure
  }
 
  tid_Thread_Semaphore = osThreadNew (Thread_Semaphore, NULL, NULL);
  if (!tid_Thread_Semaphore) {
    return(-1);
  }
 
  return(0);
}
Exemplo n.º 7
0
void test_partition_init(spm_partition_t *partition)
{
    if (NULL == partition) {
        SPM_PANIC("partition is NULL!\n");
    }

    partition->mutex = osMutexNew(&test_partition_mutex_attr);
    if (NULL == partition->mutex) {
        SPM_PANIC("Failed to create mutex for secure partition test_partition!\n");
    }

    for (uint32_t i = 0; i < TEST_PARTITION_ROT_SRV_COUNT; ++i) {
        test_partition_rot_services[i].partition = partition;
    }
    partition->rot_services = test_partition_rot_services;

    partition->thread_id = osThreadNew(test_partition_main, NULL, &test_partition_thread_attr);
    if (NULL == partition->thread_id) {
        SPM_PANIC("Failed to create start main thread of partition test_partition!\n");
    }
}
Exemplo n.º 8
0
void platform_init(spm_partition_t *partition)
{
    if (NULL == partition) {
        SPM_PANIC("partition is NULL!\n");
    }

    partition->mutex = osMutexNew(&platform_mutex_attr);
    if (NULL == partition->mutex) {
        SPM_PANIC("Failed to create mutex for secure partition platform!\n");
    }

    for (uint32_t i = 0; i < PLATFORM_ROT_SRV_COUNT; ++i) {
        platform_rot_services[i].partition = partition;
    }
    partition->rot_services = platform_rot_services;

    partition->thread_id = osThreadNew(platform_partition_entry, NULL, &platform_thread_attr);
    if (NULL == partition->thread_id) {
        SPM_PANIC("Failed to create start main thread of partition platform!\n");
    }
}
void server_tests_part2_init(spm_partition_t *partition)
{
    if (NULL == partition) {
        SPM_PANIC("partition is NULL!\n");
    }

    partition->mutex = osMutexNew(&server_tests_part2_mutex_attr);
    if (NULL == partition->mutex) {
        SPM_PANIC("Failed to create mutex for secure partition server_tests_part2!\n");
    }

    for (uint32_t i = 0; i < SERVER_TESTS_PART2_ROT_SRV_COUNT; ++i) {
        server_tests_part2_rot_services[i].partition = partition;
    }
    partition->rot_services = server_tests_part2_rot_services;

    partition->thread_id = osThreadNew(server_part2_main, NULL, &server_tests_part2_thread_attr);
    if (NULL == partition->thread_id) {
        SPM_PANIC("Failed to create start main thread of partition server_tests_part2!\n");
    }
}
Exemplo n.º 10
0
void crypto_acl_test_init(spm_partition_t *partition)
{
    if (NULL == partition) {
        SPM_PANIC("partition is NULL!\n");
    }

    partition->mutex = osMutexNew(&crypto_acl_test_mutex_attr);
    if (NULL == partition->mutex) {
        SPM_PANIC("Failed to create mutex for secure partition crypto_acl_test!\n");
    }

    for (uint32_t i = 0; i < CRYPTO_ACL_TEST_ROT_SRV_COUNT; ++i) {
        crypto_acl_test_rot_services[i].partition = partition;
    }
    partition->rot_services = crypto_acl_test_rot_services;

    partition->thread_id = osThreadNew(test_partition_main, NULL, &crypto_acl_test_thread_attr);
    if (NULL == partition->thread_id) {
        SPM_PANIC("Failed to create start main thread of partition crypto_acl_test!\n");
    }
}