pok_ret_t pok_mutex_lock (pok_mutex_id_t id) { pok_lockobj_lockattr_t lockattr; lockattr.operation = LOCKOBJ_OPERATION_LOCK; lockattr.time = 0; lockattr.obj_kind = POK_LOCKOBJ_KIND_MUTEX; return pok_syscall2 (POK_SYSCALL_LOCKOBJ_OPERATION, (uint32_t)id, (uint32_t)&lockattr); }
pok_ret_t pok_sem_wait (pok_sem_id_t id, uint64_t timeout) { pok_lockobj_lockattr_t lockattr; lockattr.operation = LOCKOBJ_OPERATION_LOCK; lockattr.obj_kind = POK_LOCKOBJ_KIND_SEMAPHORE; lockattr.time = timeout; return (pok_syscall2 (POK_SYSCALL_LOCKOBJ_OPERATION, (uint32_t)id, (uint32_t)&lockattr)); }
/* * bsp_start * * This routine does the bulk of the system initialization. */ void bsp_start( void ) { char buff[] = {"RTEMS bsp_start()\n"}; size_t pos; pos = sizeof (buff); /* strlen ("buff[]"); */ pok_syscall2 (POK_SYSCALL_CONSWRITE, (uint32_t)buff, pos); }
pok_ret_t pok_event_wait (pok_event_id_t id, const uint64_t timeout) { pok_lockobj_lockattr_t lockattr; lockattr.operation = LOCKOBJ_OPERATION_WAIT; if (timeout > 0) { pok_time_gettick (&lockattr.time); lockattr.time += timeout; } lockattr.obj_kind = POK_LOCKOBJ_KIND_EVENT; return pok_syscall2 (POK_SYSCALL_LOCKOBJ_OPERATION, (uint32_t)id, (uint32_t)&lockattr); }
void user_hello_part1 () { /* printf( "[PART1] Hello Worlds\n"); */ uint32_t size; uint32_t stack_size; uint32_t base_addr; char buff[] = {"[PART1] Hello Worlds\n"}; int pos = sizeof (buff); pok_syscall2 (POK_SYSCALL_CONSWRITE, (uint32_t)buff, pos); pok_syscall3 (POK_SYSCALL_PARTITION_GET_MEMORY_INFO, (uint32_t)&size, (uint32_t)&base_addr, (uint32_t)&stack_size); printf ("size: 0x%x, base_add: 0x%x, stack_size: 0x%x\n", size, base_addr, stack_size); }
pok_ret_t pok_thread_suspend_other (uint32_t thread_id) { return pok_syscall2 (POK_SYSCALL_THREAD_SUSPEND_OTHER, &thread_id, 0); }
pok_ret_t pok_error_handler_set_ready (const pok_error_status_t* status) { return pok_syscall2 (POK_SYSCALL_ERROR_HANDLER_SET_READY, (uint32_t)status, 0); }
pok_ret_t pok_error_get (pok_error_status_t* status) { return (pok_syscall2 (POK_SYSCALL_ERROR_GET, (uint32_t)status, 0)); }
pok_ret_t pok_thread_create (uint32_t* thread_id, const pok_thread_attr_t* attr) { return pok_syscall2 (POK_SYSCALL_THREAD_CREATE, (uint32_t)thread_id, (uint32_t)attr); }
pok_ret_t pok_thread_resume (uint32_t thread_id) { return pok_syscall2 (POK_SYSCALL_THREAD_RESUME, &thread_id, 0); }
pok_ret_t pok_thread_period () { return pok_syscall2 (POK_SYSCALL_THREAD_PERIOD, (uint32_t)POK_NULL, (uint32_t)POK_NULL); }
pok_ret_t pok_thread_libpok_delayed_start (uint32_t thread_id, uint32_t delay_time) { return pok_syscall2 (POK_SYSCALL_THREAD_DELAYED_START, &thread_id, delay_time); }