Пример #1
0
int main(int argc, char * argv[]) {

  unsigned int i = 0;
  char b[32];
  int ret = 0;

  fifo_t fifo;
  fifo_init(&fifo);

  for(i = 0; i < 2600; i++) {
   if(!fifo_put(&fifo, i + 'a')) {
     printf("buffer full at %d\n", i);
     break;
   }
  }

  unsigned int out = -1;
  unsigned int in  = out + 10;
  printf("%u - %u = %u\n", in, out, in - out);

  

  ret = fifo_out(&fifo, b, 7);
  b[ret] = 0;

  printf("%d - %s\n", ret, b);
}
Пример #2
0
void test_thread(void * pParam) 
{	
	RAW_S32 ret;
	RAW_S32 received_bytes;
	
	int aa = 0x55;
	int bb = 0x56;
	
	vc_port_printf("passing argument is %x\n", *(RAW_U32 *)pParam);
	
	raw_page_init(test_page_mem, test_page_mem + 1024*1024);
	raw_malloc_init();
	
	fifo_init(&fifo, fifo_space, 16);
	fifo_in(&fifo, &aa, 4);
	fifo_in(&fifo, &bb, 4);

	fifo_out(&fifo, &fifo_data, 4);
	fifo_out(&fifo, &fifo_data, 4);
	fifo_in(&fifo, &bb, 4);
	fifo_in(&fifo, &bb, 4);
	fifo_in(&fifo, &bb, 4);
	fifo_out(&fifo, &fifo_data, 4);
	received_bytes = fifo_out_all(&fifo, fifo_received_data);
	fifo_data = 0;
	
	fifo_out(&fifo, &fifo_data, 4);

	rsh_register_command(&test_rsh_command, &pxNewListItem1);
	rsh_register_command(&test_rsh_command2, &pxNewListItem2);
	rsh_register_command(&three_parameters_case, &pxNewListItem3);

	rsh_register_command(&test_rsh_command3, &pxNewListItem4);
	rsh_register_command(&test_rsh_command4, &pxNewListItem5);

	do {

		ret = rsh_process_command("help", out_put_shell, 1024);
		vc_port_printf("%s\n", out_put_shell);
		
	} while (ret == 0);

	do {
		ret = rsh_process_command("tes222222", out_put_shell, 1024);
	} while (ret == 0);


	do {
		ret = rsh_process_command("bb1", out_put_shell, 1024);
		vc_port_printf("%s\n", out_put_shell);
	} while (ret == 0);
	

	do {
		ret = rsh_process_command("aa", out_put_shell, 1024);
		vc_port_printf("%s\n", out_put_shell);
	} while (ret == 0);

	do {
		ret = rsh_process_command("aaa", out_put_shell, 1024);
	} while (ret == 0);

	
	do {
		ret = rsh_process_command("echo_3_parameters 1 2 3", out_put_shell, 1024);
		vc_port_printf("%s\n", out_put_shell);
	} while (ret == 0);

	raw_open("/I2C3/", 0);
	
	pthread_create(&thread2, 0, test_thread2, 0);
	pthread_create(&thread3, 0, test_thread3, 0);
	pthread_create(&thread4, 0, test_thread4, 0);
	pthread_create(&thread5, 0, test_thread5, 0);
	pthread_create(&thread6, 0, test_thread6, 0);
	
	raw_task_delete(raw_task_identify());
	
}