/* Cesar project {{{ * * Copyright (C) 2008 Spidcom * * <<>> * * }}} */ /** * \file bridgedma-init-test.c * \brief « brief description » * \ingroup « module » * * « long description » */ #include #include #include "common/std.h" #include "common/defs/ethernet.h" #include "lib/test.h" #include "lib/list.h" #include "lib/read_word.h" #include "lib/bitstream.h" #include "hal/phy/inc/bridgedma.h" #include "hal/phy/inc/bridgedma_proto.h" #include "mac/common/pb.h" #include #include #include #define START_OFFSET 128 cyg_thread my_test_thread; cyg_handle_t my_test_thread_handle; u8 my_test_thread_stack [CYGNUM_HAL_STACK_SIZE_TYPICAL]; phy_bridgedma_t *bridgedma_ctx; /* WARNING: callback are not possible to test inside UNIT TEST */ bool _bridgedma_segmentation_cb(void *data, u32 status) { } /* WARNING: callback are not possible to test inside UNIT TEST */ void _bridgedma_deffered_cb(void *data) { } void bridgedma_init_test_case(test_t t) { int user_data; test_case_begin(t, "init"); test_begin(t, "init") { bridgedma_ctx = NULL; bridgedma_ctx = phy_bridgedma_init(&user_data, _bridgedma_segmentation_cb, _bridgedma_deffered_cb); test_fail_unless( (bridgedma_ctx != NULL) && (bridgedma_ctx->job_first == NULL) && (bridgedma_ctx->job_current == NULL) && (bridgedma_ctx->job_last == NULL) && (bridgedma_ctx->user_data == &user_data) && (bridgedma_ctx->bridgedma_cb == _bridgedma_segmentation_cb) && (bridgedma_ctx->deferred_cb == _bridgedma_deffered_cb) && !bridgedma_ctx->status.running && bridgedma_ctx->status.stop ); } test_end; return; } void test_thread_process (cyg_addrword_t data) { test_t *test; test = (test_t *) data; bridgedma_init_test_case (*test); phy_bridgedma_uninit (bridgedma_ctx); test_result (*test); #ifndef __sparc__ HAL_PLATFORM_EXIT (test_nb_failed (*test) == 0 ? 0 : 1); #endif } int main (void) { test_t test; test_init (test, 0, NULL); // Create the thread. cyg_thread_create( 9, &test_thread_process, (cyg_addrword_t) &test, "TEST_THREAD", my_test_thread_stack, CYGNUM_HAL_STACK_SIZE_TYPICAL, &my_test_thread_handle, &my_test_thread); cyg_thread_resume (my_test_thread_handle); return 0; }