📄 serial.h
字号:
// This file is part of MANTIS OS, Operating System// See http://mantis.cs.colorado.edu///// Copyright (C) 2003,2004,2005 University of Colorado, Boulder//// This program is free software; you can redistribute it and/or// modify it under the terms of the mos license (see file LICENSE)/** Project Mantis File: serial.h Authors: Jeff Rose Date: 02-01-04 **//** @file serial.h * @brief Mac layer built on top of serial uart devices. * @author Jeff Rose * @date 02/01/2004 */#ifndef _SERIAL_H_#define _SERIAL_H_#ifndef _BOOT_#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <stdio.h>#include <termios.h>#include <unistd.h>#endif#include "com.h"#if defined(USB_SERIAL)#define DEFAULT_BAUDRATE B115200#else#define DEFAULT_BAUDRATE B57600//#define DEFAULT_BAUDRATE B38400//#define DEFAULT_BAUDRATE B19200#endif#define DEFAULT_SERIAL_DEV "/dev/ttyS0"/* Define the ioctl request flags. */#define BAUD_RATE 0#define PARITY 1/** @brief This will initialize the filedescriptor for the serial device * */void serial_init_fd();/** @brief Setup the serial port and register with the com layer. * * NOTE: -sdev [serial device] can be used to change the serial device. */uint8_t serial_init();/** @brief Send the buffer out over the serial port. * @param buf Buffer to use */uint8_t serial_send(comBuf *buf);/** @brief See full description. * * In linux this function is very important because we don't * have any low power functionality, but you still must set * to listen mode if you want to get packets. */uint8_t serial_mode(uint8_t mode);/** @brief Generic control function for doing things like changing the * properties of the serial connection etc... */uint8_t serial_ioctl(uint8_t request, va_list ap);/** @brief get the current mode of the serial device * */uint8_t serial_get_mode();/** @brief Close the serial device * this command returns control of the serial back to the system. */void serial_close ();void serial_block(); void serial_unblock();#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -