⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pipe.c

📁 串口代理
💻 C
字号:
/* * pipe.c * * serial port <-> TCP/IP piping * * (C)1999 Stefano Busti * */#include <stdlib.h>#include "pipe.h"int pipe_init(pipe_s *pipe, int sock_port){	if (sio_init(&pipe->sio))		return -1;	if (tcp_init(&pipe->sock, sock_port))		return -1;	pipe->mutex = malloc(sizeof(thr_mutex_t));	*(pipe->mutex) = thr_mutex_create();		return 0;}void pipe_cleanup(pipe_s *pipe){	sio_cleanup(&pipe->sio);	tcp_cleanup(&pipe->sock);	thr_mutex_unlock(pipe->mutex);	thr_mutex_destroy(pipe->mutex);	free(pipe->mutex);}void pipe_destroy(void *data){	pipe_s *pipe = (pipe_s *)data;	pipe_cleanup(pipe);	free(pipe);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -