static rtems_task bdbuf_test3_3_thread3(rtems_task_argument arg) { rtems_status_code rc; rtems_bdbuf_buffer *bd = NULL; WAIT_MAIN_SYNC(3); /* * Step 3: * In thread #3 call read(#N3) */ rc = rtems_bdbuf_read(test_dd, TEST_BLK_NUM_N3, &bd); if (rc != RTEMS_SUCCESSFUL) { TEST_FAILED(); } printk("Thread #3 DEBLOCK\n"); CONTINUE_MAIN(3); rc = rtems_bdbuf_release(bd); if (rc != RTEMS_SUCCESSFUL) { TEST_FAILED(); } THREAD_END(); }
static rtems_task bdbuf_test4_1_thread2(rtems_task_argument arg) { rtems_status_code rc; rtems_bdbuf_buffer *bd = NULL; WAIT_MAIN_SYNC(2); /* * Step 2: * In thread #2 call rtems_bdbuf_read(#N). * We will block on this call. */ rc = rtems_bdbuf_read(test_dd, TEST_BLK_NUM_N, &bd); if (rc != RTEMS_SUCCESSFUL) { TEST_FAILED(); } CONTINUE_MAIN(2); /* * Release buffer. */ rc = rtems_bdbuf_release(bd); if (rc != RTEMS_SUCCESSFUL) { TEST_FAILED(); } THREAD_END(); }
static rtems_task bdbuf_test3_1_thread2(rtems_task_argument arg) { rtems_status_code rc; rtems_bdbuf_buffer *bd = NULL; WAIT_MAIN_SYNC(2); /* * Step 4: * In thread #2 call read/get(#M) * [We ask for block number #M - there is no such entry in AVL, * and all the lists are empty (ready, lru, modified), as a result * this thread blocks on * rtems_bdbuf_wait(pool, &pool->waiting, &pool->wait_waiters)] */ rc = rtems_bdbuf_get(test_dev, TEST_BLK_NUM_M, &bd); if (rc != RTEMS_SUCCESSFUL) { TEST_FAILED(); } CONTINUE_MAIN(2); /* * Release buffer. */ rc = rtems_bdbuf_release_modified(bd); if (rc != RTEMS_SUCCESSFUL) { TEST_FAILED(); } THREAD_END(); }
static rtems_task bdbuf_test1_2_thread2(rtems_task_argument arg) { rtems_status_code rc; rtems_bdbuf_buffer *bd = NULL; WAIT_MAIN_SYNC(2); /* * Step 2: * Try to read block #N. Right now thread #1 is waiting * on data transfer operation, so we will block here as well. * * Step 4: * Due to the fact that thread #1 failed to read required block * number, bdbuf library should ask for re-read data again. * But main test task will agin tell device driver to return * RTEMS_IO_ERROR data transfer result. */ rc = rtems_bdbuf_read(test_dd, TEST_BLK_NUM, &bd); if (rc != RTEMS_IO_ERROR || bd != NULL) { TEST_FAILED(); } CONTINUE_MAIN(2); THREAD_END(); }
static rtems_task bdbuf_test3_2_thread2(rtems_task_argument arg) { rtems_status_code rc; rtems_bdbuf_buffer *bd = NULL; WAIT_MAIN_SYNC(2); /* * Step 2: * In thread #2 call get(#N2) */ rc = rtems_bdbuf_get(test_dd, TEST_BLK_NUM_N2, &bd); if (rc != RTEMS_SUCCESSFUL) { TEST_FAILED(); } printk("Thread #2 DEBLOCK\n"); CONTINUE_MAIN(2); rc = rtems_bdbuf_release_modified(bd); if (rc != RTEMS_SUCCESSFUL) { TEST_FAILED(); } THREAD_END(); }
static rtems_task bdbuf_test1_4_thread2(rtems_task_argument arg) { rtems_status_code rc; rtems_bdbuf_buffer *bd = NULL; WAIT_MAIN_SYNC(2); /* * Step 2: * Try to read block #N. Right now thread #1 is waiting * on data transfer operation, so we will block here as well. * * Step 5: * On step 4 thread #1 releases buffer and as the result * our read operation should finish with success. */ rc = rtems_bdbuf_read(test_dd, TEST_BLK_NUM, &bd); if (rc != RTEMS_SUCCESSFUL) { TEST_FAILED(); } CONTINUE_MAIN(2); /* * Step 6: * Release buffer returned on the previous step. */ rc = rtems_bdbuf_release(bd); if (rc != RTEMS_SUCCESSFUL) { TEST_FAILED(); } THREAD_END(); }
static rtems_task bdbuf_test1_3_thread2(rtems_task_argument arg) { rtems_status_code rc; rtems_bdbuf_buffer *bd = NULL; WAIT_MAIN_SYNC(2); /* * Step 2: * Try to read block #N. Right now thread #1 is waiting * on data transfer operation, so we will block here as well. * * Step 4-5: * Due to the fact that thread #1 failed to read required block * number, bdbuf library should ask for re-read data again. * Time time main task will tell driver to report success. */ rc = rtems_bdbuf_read(test_dd, TEST_BLK_NUM, &bd); if (rc != RTEMS_SUCCESSFUL || bd == NULL) { TEST_FAILED(); } CONTINUE_MAIN(2); /* * Step 6: * Release buffer. */ rc = rtems_bdbuf_release(bd); if (rc != RTEMS_SUCCESSFUL) { TEST_FAILED(); } THREAD_END(); }