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

📄 sdb.c

📁 Linux下对串口进行编程
💻 C
字号:
/* * File         : sdb.c * Date         : 2002-04-20 * Author       : yfy001 * Description  : Serial Debugger  * Copyright (C) 2001, 2002  yfy001 */#include <stdio.h>              // printf#include <fcntl.h>              // open#include <string.h>             // bzero#include <stdlib.h>             // exit#include <sys/times.h>          // times#include <unistd.h>             // read, write, close#include <sys/stat.h>           // lstat#include "types.h"#include "tty.h"#include "args.h"#include "cmd.h"static pkginfo_t pkginfo = {    "sdb",                      // program     "serutils",                 // package     "0.0.6",                    // version     "yfy001",                // author     0                           // reserved };static portinfo_t portinfo = {    0,                          // print prompt after receiving    115200,                     // baudrate: 115200    8,                          // databit: 8    0,                          // debug: off    0,                          // echo: off    1,                          // flow control: hardware    0,                          // tty: /dev/ttyS0    0,                          // parity: none    1,                          // stopbit: 1    0                           // reserved};static args_t args = { &pkginfo, &portinfo };p_args_t p_args = &args;int main(int argc, char *argv[]){    args_parse(argc, argv, 0);    // open comport     atexit(tty_close);    if (tty_open(p_args->p_portinfo)) {        fprintf(stderr,                "Make sure /dev/ttyS%d "                "not in use or you have enough privilege.\n\n",                p_args->p_portinfo->tty);        exit(-1);    }    cmd();    exit(0);}

⌨️ 快捷键说明

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