void ifx_atm_init_chip(void)
{
    init_pmu();

    reset_ppe();

    init_pdma();

    init_mailbox();

    init_atm_tc();

    clear_share_buffer();
}
示例#2
0
int main(int argc, char *argv[]){
	int i = 0, ret, fd, cpu_index = 14;
	char c;
	
	if(argc <= 1){
		printf("You should input some of socket file path\n");
		return 0;
	}
	for(i = 1; i < argc; i++)
		printf("socket file is %s\n", argv[i]);
	/**
	* init all of epoll and open per socket file
	*/
	if(init_pdma() < 0){
		printf("PDMA failed in main\n");
		return 0;
	}

	host_connect_chardev(argc, argv);
	epollfd = epoll_create(FDSIZE);
	for(i = 0; i < argc - 1; i++){
		add_event(epollfd, host_pdma_control.socket_fds[i], EPOLLIN);
	}
	// for(i = 0; i < argc - 1; i++){
	// 	pollfd[i].fd = host_pdma_control.socket_fds[i];
	// 	pollfd[i].events = POLLIN;
	// }
	if(get_pdma_info(host_pdma.pdma_fd)){
		printf("Cannot get pdma_info\n");
		return 0;
	}

	pthread_spin_init(&native_queue_lock, PTHREAD_PROCESS_SHARED);
	pthread_spin_init(&readyread_queue_lock, PTHREAD_PROCESS_SHARED);
	/**
	* init queue
	*/
	init_queue();

	pthread_create(&(host_pdma_control.native_request_thread), NULL,
			get_request_thread, &cpu_index);
	cpu_index += 1;
	pthread_create(&(host_pdma.send_request2pdma_thread), NULL,
			deal_request_thread, &(cpu_index));
	cpu_index += 1;
	pthread_create(&(host_pdma.ready_thread), NULL,
			ready_response_thread, &(cpu_index));

	while(1){
		printf("Host has start. If you want to stop it, you can input \'c\' \n");
		printf("input>");
		c = getchar();
		getchar();
		if(c == 's')
			break;
		else
			break;
	}
	host_exit(argc-1);
	exit(0);
}