本文整理汇总了C++中CYG_TEST_FAIL_FINISH函数的典型用法代码示例。如果您正苦于以下问题:C++ CYG_TEST_FAIL_FINISH函数的具体用法?C++ CYG_TEST_FAIL_FINISH怎么用?C++ CYG_TEST_FAIL_FINISH使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CYG_TEST_FAIL_FINISH函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: can0_thread
//===========================================================================
// READER THREAD
//===========================================================================
void can0_thread(cyg_addrword_t data)
{
cyg_uint32 len;
cyg_uint32 blocking;
cyg_can_event rx_event;
Cyg_ErrNo res;
blocking = 0;
len = sizeof(blocking);
if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_READ_BLOCKING ,&blocking, &len))
{
CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
}
len = sizeof(rx_event);
res = cyg_io_read(hDrvFlexCAN, &rx_event, &len);
if (-EAGAIN == res)
{
CYG_TEST_PASS_FINISH("can_test1 test OK");
}
else if (-EINTR == res)
{
CYG_TEST_PASS_FINISH("can_test1 test OK");
}
else
{
CYG_TEST_FAIL_FINISH("Error reading from /dev/can0");
}
}
开发者ID:axonim,项目名称:ecos-ax-som-bf609,代码行数:33,代码来源:can_nonblock.c
示例2: test_channel
static void
test_channel(const char *dev, cyg_io_handle_t channel)
{
Cyg_ErrNo res;
cyg_uint32 cfg_data;
cyg_uint32 len;
cyg_adc_sample_t sample;
int count;
diag_printf("\nTesting ADC channel '%s'\n", dev);
// Disable channel
res = cyg_io_set_config(channel, CYG_IO_SET_CONFIG_ADC_DISABLE, 0, 0);
if (res != ENOERR)
CYG_TEST_FAIL_FINISH("Failed to disable ADC channel");
// Make channel non-blocking
cfg_data = 0;
len = sizeof(cfg_data);
res = cyg_io_set_config(channel, CYG_IO_SET_CONFIG_READ_BLOCKING,
&cfg_data, &len);
if (res != ENOERR)
CYG_TEST_FAIL_FINISH("Failed to make ADC channel non-blocking");
// Set channel sampling rate
cfg_data = TEST_RATE;
len = sizeof(cfg_data);
res = cyg_io_set_config(channel, CYG_IO_SET_CONFIG_ADC_RATE,
&cfg_data, &len);
if (res != ENOERR)
CYG_TEST_FAIL_FINISH("Failed to set ADC channel sampling rate");
// Flush channel
do {
len = sizeof(sample);
res = cyg_io_read(channel, &sample, &len);
} while (res == ENOERR);
// Enable channel
res = cyg_io_set_config(channel, CYG_IO_SET_CONFIG_ADC_ENABLE, 0, 0);
if (res != ENOERR)
CYG_TEST_FAIL_FINISH("Failed to enable ADC channel");
// Read from channel
count = 0;
while (count < TEST_SAMPLES) {
len = sizeof(sample);
res = cyg_io_read(channel, &sample, &len);
if (res == ENOERR) {
diag_printf("%d\n", sample);
count++;
}
}
// Disable channel
res = cyg_io_set_config(channel, CYG_IO_SET_CONFIG_ADC_DISABLE, 0, 0);
if (res != ENOERR)
CYG_TEST_FAIL_FINISH("Failed to disable ADC channel");
}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:59,代码来源:adc1.c
示例3: cyg_start
externC void
cyg_start( void )
{
ezxml_t f1, team, driver;
const char * teamname;
int i;
CYG_TEST_INIT();
f1 = ezxml_parse_str(document, sizeof(document));
for (team = ezxml_child(f1, "team"); team; team = team->next) {
teamname = ezxml_attr(team, "name");
for (i=0,driver = ezxml_child(team, "driver");
driver;
driver = driver->next,i++) {
if (strcmp(results[i].driver, ezxml_child(driver, "name")->txt) ||
strcmp(results[i].team, teamname) ||
strcmp(results[i].points, ezxml_child(driver, "points")->txt))
CYG_TEST_FAIL("Parser failed first test");
}
}
if (strcmp(ezxml_get(f1, "team", 0, "driver", 1, "name", -1)->txt,
"David Coultard"))
CYG_TEST_FAIL_FINISH("Parser failed second test");
else
CYG_TEST_PASS_FINISH("Parser passed");
ezxml_free(f1);
}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:31,代码来源:ezxml.c
示例4: main
int main(int argc, char **argv)
{
pthread_t thread;
pthread_attr_t attr;
void *retval;
CYG_TEST_INIT();
// Create test thread
pthread_attr_init( &attr );
pthread_attr_setstackaddr( &attr, (void *)&thread_stack[sizeof(thread_stack)] );
pthread_attr_setstacksize( &attr, sizeof(thread_stack) );
pthread_create( &thread,
&attr,
pthread_entry1,
(void *)0x12345678);
// Now join with it
pthread_join( thread, &retval );
// check retval
if( (long)retval == 0x12345679 )
CYG_TEST_PASS_FINISH( "pthread1" );
else
CYG_TEST_FAIL_FINISH( "pthread1" );
}
开发者ID:lijinlei,项目名称:Kernel_BOOX60,代码行数:29,代码来源:pthread1.c
示例5: cyg_start
void
cyg_start(void)
{
CYG_TEST_INIT();
//
// open flexcan device driver
//
if (ENOERR != cyg_io_lookup("/dev/can0", &hDrvFlexCAN))
{
CYG_TEST_FAIL_FINISH("Error opening /dev/can0");
}
//
// create the two threads which access the CAN device driver
// a reader thread with a higher priority and a writer thread
// with a lower priority
//
cyg_thread_create(4, can0_thread,
(cyg_addrword_t) 0,
"can0_thread",
(void *) can0_thread_data.stack,
1024 * sizeof(long),
&can0_thread_data.hdl,
&can0_thread_data.obj);
cyg_thread_resume(can0_thread_data.hdl);
cyg_scheduler_start();
}
开发者ID:KarenHung,项目名称:ecosgit,代码行数:31,代码来源:flexcan_wake.c
示例6: cyg_start
void
cyg_start(void)
{
CYG_TEST_INIT();
//
// open CAN device driver
//
if (ENOERR != cyg_io_lookup("/dev/can0", &hCAN0))
{
CYG_TEST_FAIL_FINISH("Error opening /dev/can0");
}
//
// create the thread that accesses the CAN device driver
//
cyg_thread_create(4, can0_thread,
(cyg_addrword_t) 0,
"can0_thread",
(void *) can0_thread_data.stack,
1024 * sizeof(long),
&can0_thread_data.hdl,
&can0_thread_data.obj);
cyg_thread_resume(can0_thread_data.hdl);
cyg_scheduler_start();
}
开发者ID:DavionKnight,项目名称:GT873M_4F,代码行数:28,代码来源:can_extended_cfg.c
示例7: entry1
static void entry1( cyg_addrword_t data )
{
cyg_count32 val;
cyg_semaphore_peek(&s1, &val);
CHECK( 2 == val);
cyg_semaphore_wait(&s1);
cyg_semaphore_peek(&s1, &val);
CHECK( 1 == val);
cyg_semaphore_wait(&s1);
CHECK( 0 == q++ );
cyg_semaphore_peek(&s0, &val);
CHECK( 0 == val);
cyg_semaphore_post(&s0);
cyg_semaphore_wait(&s1);
CHECK( 2 == q++ );
cyg_semaphore_post(&s0);
cyg_semaphore_wait(&s1);
CHECK( 5 == q++ );
cyg_semaphore_peek(&s0, &val);
CHECK( 2 == val);
CHECK( cyg_semaphore_trywait(&s0) );
cyg_semaphore_peek(&s0, &val);
CHECK( 1 == val);
CHECK( cyg_semaphore_trywait(&s0) );
cyg_semaphore_peek(&s0, &val);
CHECK( 0 == val);
cyg_semaphore_post(&s2);
cyg_semaphore_wait(&s0);
CYG_TEST_FAIL_FINISH("Not reached");
}
开发者ID:lijinlei,项目名称:Kernel_BOOX60,代码行数:31,代码来源:ksem1.c
示例8: server
void server(void)
{
int s_source;
struct sockaddr_in local,c_addr;
int c_len;
int len;
char *hello_string=" Hello eCos network \n";
diag_printf("UDP SERVER:");
diag_printf(hello_string);
s_source = socket(AF_INET, SOCK_DGRAM, 0);
if (s_source < 0) {
pexit("stream socket");
}
memset(&local, 0, sizeof(local));
local.sin_family = AF_INET;
local.sin_len = sizeof(local);
local.sin_port = ntohs(SOURCE_PORT);
local.sin_addr.s_addr = htonl(INADDR_ANY); //accepts everyone...
if(bind(s_source, (struct sockaddr *) &local, sizeof(local)) < 0) {
pexit("bind /source/ error");
}
c_len = sizeof(c_addr);
if ((len = recvfrom(s_source, data_buf, sizeof(data_buf),0,
(struct sockaddr *)&c_addr,&c_len)) < 0 ) {
CYG_TEST_FAIL_FINISH("I/O error");
}
diag_printf("SERVER : message arrived from %s\n",inet_ntoa(c_addr.sin_addr));
diag_printf("SERVER : Message : %s\n",data_buf);
close(s_source);
}
开发者ID:LucidOne,项目名称:Rovio,代码行数:33,代码来源:udp_lo_test.c
示例9: kmutex1_main
void kmutex1_main( void )
{
CYG_TEST_INIT();
cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "kmutex1-0",
(void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
cyg_thread_resume(thread[0]);
cyg_thread_create(4, entry1 , (cyg_addrword_t)1, "kmutex1-1",
(void *)stack[1], STACKSIZE, &thread[1], &thread_obj[1]);
cyg_thread_resume(thread[1]);
cyg_thread_create(4, entry2 , (cyg_addrword_t)2, "kmutex1-2",
(void *)stack[2], STACKSIZE, &thread[2], &thread_obj[2]);
cyg_thread_resume(thread[2]);
cyg_mutex_init( &m0 );
cyg_mutex_init( &m1 );
cyg_cond_init( &cvar0, &m0 );
cyg_cond_init( &cvar1, &m0 );
cyg_cond_init( &cvar2, &m1 );
cyg_scheduler_start();
CYG_TEST_FAIL_FINISH("Not reached");
}
开发者ID:lijinlei,项目名称:Kernel_BOOX60,代码行数:27,代码来源:kmutex1.c
示例10: client
void client(void)
{
int s_source;
struct sockaddr_in local;
int len;
diag_printf("client:started\n");
s_source = socket(AF_INET, SOCK_STREAM, 0);
if (s_source < 0) {
pexit("stream socket");
}
memset(&local, 0, sizeof(local));
local.sin_family = AF_INET;
local.sin_len = sizeof(local);
local.sin_port = htons(SOURCE_PORT);
local.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
if (connect(s_source, (struct sockaddr *)&local, sizeof(local)) < 0) {
pexit("Can't connect to target");
}
if ((len = write(s_source,data_buf_write,40)) < 0){
CYG_TEST_FAIL_FINISH( "Error writing buffer");
}
}
开发者ID:Joel397,项目名称:Ongoing_work_files,代码行数:26,代码来源:tcp_lo_test.c
示例11: can_tx_thread
//===========================================================================
// Thread 1
//===========================================================================
void can_tx_thread(cyg_addrword_t data)
{
cyg_uint32 len;
cyg_can_message tx_msg;
cyg_uint32 msg_cnt = 0;
cyg_uint8 i;
CYG_CAN_MSG_SET_PARAM(tx_msg, 0, CYGNUM_CAN_ID_STD, 0, CYGNUM_CAN_FRAME_DATA);
//
// Prepare CAN message with a known CAN state
//
for (i = 0; i < 8; ++i)
{
tx_msg.data.bytes[i] = i;
}
while (msg_cnt < 0xF0)
{
tx_msg.id = msg_cnt;
len = sizeof(tx_msg);
if (ENOERR != cyg_io_write(hCAN_Tbl[0], &tx_msg, &len))
{
CYG_TEST_FAIL_FINISH("Error writing to channel 0");
}
tx_msg.id = msg_cnt;
len = sizeof(tx_msg);
if (ENOERR != cyg_io_write(hLoopCAN_Tbl[0], &tx_msg, &len))
{
CYG_TEST_FAIL_FINISH("Error writing to channel 1");
}
//
// Increment data in each single data byte
//
for (i = 0; i < 8; ++i)
{
tx_msg.data.bytes[i] += 1;
}
msg_cnt++;
tx_msg.dlc = (tx_msg.dlc + 1) % 9;
} // while (msg_cnt < 0x100)
}
开发者ID:DavionKnight,项目名称:GT873M_4F,代码行数:50,代码来源:can_rx_tx.c
示例12: finish
static void finish( cyg_ucount8 t )
{
cyg_mutex_lock( &m1 ); {
m1d |= 1<<t;
if( 0x7 == m1d )
CYG_TEST_PASS_FINISH("Kernel C API Mutex 1 OK");
cyg_cond_wait( &cvar2 );
} /* cyg_mutex_unlock( &m1 ); */
CYG_TEST_FAIL_FINISH("Not reached");
}
开发者ID:lijinlei,项目名称:Kernel_BOOX60,代码行数:10,代码来源:kmutex1.c
示例13: server
void server(void)
{
int s_source, e_source;
struct sockaddr_in e_source_addr, local;
int one = 1;
fd_set in_fds;
int len;
char *hello_string=" Hello eCos network \n";
diag_printf("TCP SERVER:");
diag_printf(hello_string);
s_source = socket(AF_INET, SOCK_STREAM, 0);
if (s_source < 0) {
pexit("stream socket");
}
if (setsockopt(s_source, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) {
pexit("setsockopt /source/ SO_REUSEADDR");
}
if (setsockopt(s_source, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) {
pexit("setsockopt /source/ SO_REUSEPORT");
}
memset(&local, 0, sizeof(local));
local.sin_family = AF_INET;
local.sin_len = sizeof(local);
local.sin_port = ntohs(SOURCE_PORT);
local.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
if(bind(s_source, (struct sockaddr *) &local, sizeof(local)) < 0) {
pexit("bind /source/ error");
}
listen(s_source, SOMAXCONN);
e_source = 0;
while (true) {
FD_ZERO(&in_fds);
FD_SET(s_source, &in_fds);
len = sizeof(e_source_addr);
if ((e_source = accept(s_source,(struct sockaddr *)&e_source_addr,&len))<0) {
pexit("accept /source/");
}
diag_printf("TCP SERVER connection from %s: %d\n",
inet_ntoa(e_source_addr.sin_addr),ntohs(e_source_addr.sin_port));
if (e_source != 0) {
break;
}
} /* while (true) */
if ((len = read(e_source, data_buf, MAX_BUF)) < 0 ) {
CYG_TEST_FAIL_FINISH( "I/O error" );
}
diag_printf("SERVER : %s\n",data_buf);
}
开发者ID:Joel397,项目名称:Ongoing_work_files,代码行数:54,代码来源:tcp_lo_test.c
示例14: cyg_start
void
cyg_start(void)
{
cyg_uint32 len;
cyg_can_info_t can_cfg;
CYG_TEST_INIT();
//
// open flexcan device driver
//
if (ENOERR != cyg_io_lookup("/dev/can0", &hDrvFlexCAN))
{
CYG_TEST_FAIL_FINISH("Error opening /dev/can0");
}
//
// setup CAN baudrate 250 KBaud
//
can_cfg.baud = CYGNUM_CAN_KBAUD_250;
len = sizeof(can_cfg);
if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_INFO ,&can_cfg, &len))
{
CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
}
//
// create the main thread
//
cyg_thread_create(4, can0_thread,
(cyg_addrword_t) 0,
"can0_thread",
(void *) can0_thread_data.stack,
1024 * sizeof(long),
&can0_thread_data.hdl,
&can0_thread_data.obj);
cyg_thread_resume(can0_thread_data.hdl);
cyg_scheduler_start();
}
开发者ID:axonim,项目名称:ecos-ax-som-bf609,代码行数:41,代码来源:can_nonblock.c
示例15: zlib2_main
void zlib2_main( void )
{
CYG_TEST_INIT();
cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "zlib1",
(void *)stack[0], STACKSIZE,&thread[0], &thread_obj[0]);
cyg_thread_resume(thread[0]);
cyg_scheduler_start();
CYG_TEST_FAIL_FINISH("Not reached");
}
开发者ID:roccozhang,项目名称:mleafboot,代码行数:12,代码来源:zlib2.c
示例16: entry0
static void entry0( cyg_addrword_t data )
{
int i;
unsigned long len;
int err;
int buf_size = sizeof(gzip_test_ref)+512;
unsigned char* unpacked = malloc(buf_size);
if (NULL == unpacked)
CYG_TEST_NA("Not enough memory for buffers");
CYG_TEST_INFO("Decompressing");
len = buf_size;
err = uncompress(unpacked, &len, gzip_test, sizeof(gzip_test));
switch (err) {
case Z_OK:
break;
case Z_MEM_ERROR:
CYG_TEST_NA("Not enough memory for decompression");
break;
case Z_BUF_ERROR:
CYG_TEST_FAIL_FINISH("Decompressed data larger than original");
break;
case Z_DATA_ERROR:
CYG_TEST_FAIL_FINISH("Decompression failed");
break;
default:
CYG_TEST_FAIL_FINISH("Unknown decompression error");
break;
}
for (i = 0; i < sizeof(gzip_test_ref)-1; i++) {
if (gzip_test_ref[i] != unpacked[i])
CYG_TEST_FAIL_FINISH("Verify failed");
}
CYG_TEST_PASS_FINISH("zlib2 OK");
}
开发者ID:roccozhang,项目名称:mleafboot,代码行数:39,代码来源:zlib2.c
示例17: clock_loop
// Clock measurement is done in a separate function so that alignment
// constraints are deterministic - some processors may perform better
// in loops that are better aligned, so by making it always the same
// function, this is prevented.
// FIXME: how do we guarantee the compiler won't inline this on -O3?
static unsigned long
clock_loop( const int timeout, clock_t prevclock, clock_t *newclock )
{
clock_t c=0;
long i;
for (i=0; i<timeout; i++) {
c = clock();
if ( c != prevclock )
break; // Hit the next clock pulse
}
if (i==timeout)
CYG_TEST_FAIL_FINISH("No change in clock state!");
// it should not overflow in the lifetime of this test
if (c < prevclock)
CYG_TEST_FAIL_FINISH("Clock decremented!");
*newclock = c;
return i;
} // clock_loop()
开发者ID:LucidOne,项目名称:Rovio,代码行数:28,代码来源:clock.c
示例18: cyg_start
//===========================================================================
// Entry point
//===========================================================================
void cyg_start(void)
{
CYG_TEST_INIT();
//
// open CAN device driver channel 1
//
if (ENOERR != cyg_io_lookup(CYGPKG_DEVS_CAN_LPC2XXX_CAN0_NAME, &hCAN_Tbl[0]))
{
CYG_TEST_FAIL_FINISH("Error opening CAN channel 0");
}
//
// open CAN device driver channel 2
//
if (ENOERR != cyg_io_lookup(CYGPKG_DEVS_CAN_LPC2XXX_CAN1_NAME, &hCAN_Tbl[1]))
{
CYG_TEST_FAIL_FINISH("Error opening CAN channel 1");
}
//
// create the main thread
//
cyg_thread_create(5, can0_thread,
(cyg_addrword_t) 0,
"can_tx_thread",
(void *) can0_thread_data.stack,
1024 * sizeof(long),
&can0_thread_data.hdl,
&can0_thread_data.obj);
cyg_thread_resume(can0_thread_data.hdl);
cyg_scheduler_start();
}
开发者ID:axonim,项目名称:ecos-ax-som-bf609,代码行数:39,代码来源:can_busload.c
示例19: kthread1_main
void kthread1_main( void )
{
CYG_TEST_INIT();
cyg_thread_create(4, entry0, (cyg_addrword_t)222, "kthread1-0",
(void *)stack[0], STACKSIZE, &pt0, &thread[0] );
cyg_thread_create(4, entry1, (cyg_addrword_t)333, "kthread1-1",
(void *)stack[1], STACKSIZE, &pt1, &thread[1] );
cyg_thread_resume(pt0);
cyg_thread_resume(pt1);
cyg_scheduler_start();
CYG_TEST_FAIL_FINISH("Not reached");
}
开发者ID:EPiCS,项目名称:reconos_v2,代码行数:16,代码来源:kthread1.c
示例20: nc_slave_main
void
nc_slave_main(void)
{
int i;
CYG_TEST_INIT();
// Create the idle thread environment
cyg_semaphore_init(&idle_thread_sem, 0);
cyg_thread_create(IDLE_THREAD_PRIORITY, // Priority
net_idle, // entry
0, // entry parameter
"Network idle", // Name
&idle_thread_stack[0], // Stack
STACK_SIZE, // Size
&idle_thread_handle, // Handle
&idle_thread_data // Thread data structure
);
cyg_thread_resume(idle_thread_handle); // Start it
// Create the load threads and their environment(s)
for (i = 0; i < NUM_LOAD_THREADS; i++) {
cyg_semaphore_init(&load_thread_sem[i], 0);
cyg_thread_create(LOAD_THREAD_PRIORITY, // Priority
net_load, // entry
i, // entry parameter
"Background load", // Name
&load_thread_stack[i][0], // Stack
STACK_SIZE, // Size
&load_thread_handle[i], // Handle
&load_thread_data[i] // Thread data structure
);
cyg_thread_resume(load_thread_handle[i]); // Start it
}
// Create a main thread, so we can run the scheduler and have time 'pass'
cyg_thread_create(10, // Priority - just a number
tmain, // entry
0, // entry parameter
"socket echo test", // Name
&stack[0], // Stack
STACK_SIZE, // Size
&thread_handle, // Handle
&thread_data // Thread data structure
);
cyg_thread_resume(thread_handle); // Start it
cyg_scheduler_start();
CYG_TEST_FAIL_FINISH("Not reached");
}
开发者ID:houzhenggang,项目名称:mt7688_mips_ecos,代码行数:46,代码来源:nc_test_slave.c
注:本文中的CYG_TEST_FAIL_FINISH函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论