实习笔记(防丢)

来源:互联网 发布:北京雾霾 知乎 编辑:程序博客网 时间:2024/05/17 21:55
1、Args.c 文件中optarg  变量意思?


2、
ncurses库,控制台界面的显示库,
我们使用printw来替换printf输出内容,scanw替换scanf接受输入, addch替换putc或者putchar,getch替换getc或者getchar.他们用法一样,仅仅名字不同,类似的,addstr可以用来向窗体 写入一个字符串,getstr用来从窗体中读入一个字符串.所有这些函数都是以一个"w"字母开头,后面再跟上函数的?字, 如果需要操作另外一个窗体内容,第一个参数必须是该窗体的WINDOWS结构指针,举个例子,printw(...)和wprintw(stdscr,...) 是相同的,就如同refresh()和wrefresh(stdscr)一样


3、
makefile的用法
    makefile中的自动变量
    $<  表示规则的第一个条件
    $?   表示规则中所有比目标新的条件
    $^   表示规则中的所有条件
    $@    表示当前规则中的目标


  常用的make命令行选项
      -n  打印命令而不真的执行命令   检查makefile是否写得正确,因为makefile不是顺序执行的
     -c  切换到另外一个目录下执行那个目录下的makefile


4、
测试代码的编译顺序(makefile执行make命令的顺序)
testctrl.o
common.o
args.o
log.o
strparser.o
disktest.o
ethtest.o
dispalywindow.o
lcdtest.o
key.o
ri.o
audiotest.o
pthreadl.o
buzzer.o


生成的目标文件:armboardtest




5、typedef int (*MenuFunction)(void * arg);   什么意思?


6、测试代码中各个英文单词含义  std.h头文件中
#define TESTITEM_TITLE_MODEL   "模式选择"
#define TESTITEM_TITLE_AUTO    "自动测试"
#define TESTITEM_TITLE_MANUAL  "手动测试"
#define TESTITEM_TITLE_RESETDISK  "清除日志"
#define TESTITEM_TITLE_PRINT   "打印报告"


#define TESTITEM_TITLE_RTC "时钟测试"
#define TESTITEM_TITLE_ETH "网卡测试" 
#define TESTITEM_TITLE_KEY "键盘测试"




#define TESTITEM_TITLE_USB "U 盘测试"
#define TESTITEM_TITLE_LCD "背光测试" 
#define TESTITEM_TITLE_ALARM "报警测试" 
#define TESTITEM_TITLE_RI "红外测试" 
#define TESTITEM_TITLE_BUZZER "蜂鸣测试" 
#define TESTITEM_TITLE_VIO "视频测试"
#define TESTITEM_TITLE_AUDIO "音频测试" 


#define TESTITEM_VIO_VI   "输入测试"
#define TESTITEM_VIO_VO   "输出测试"
#define TESTITEM_VIO_TEST "自动测试"


#define TESTITEM_VIO_SI   "对讲输入"
#define TESTITEM_VIO_AI   "音频输入"
#define TESTITEM_VIO_AO   "音频输出" 


7、代码中涉及到信号,及进程间的通信相关等




8、C 项目中的extern "C" {}   
     解决地点:http://www.fengfly.com/plus/view-183718-1.html
  
9、linux中setenv函数
用来改变或增加环境变量的内容
    通过setenv函数设置的环境变量只在本进程,而且是本次执行中有效。如果在某一次运行程序时执行了setenv函数,
    进程终止后再次运行该程序,上次的设置是无效的,上次设置的环境变量是不能读到的。  
      
10、assert (i  <  MAX_FILE_SIZE); 
     C里面的宏  如果为真则没任何作用,如果值为假,那么它先向标准错误流stderr打印一条出错信息,
           然后通过调用abort来终止程序运行。
11、atoi 函数,将字符串转换成整型数


12、挂载优盘
     直接调用system函数。system函数会启动一个进程,启动shell,然后shell接受命令(system函数中的参数)
     这样就能直接利用linux内核  方便的挂载优盘 
     讲解http://blog.csdn.net/yankai0219/article/details/6730121
     
13、linux网络套接字编程
    Socket          


14、extern  和  enum用法,typedef enum的用法


15、MsgBox()函数   弹出一个对话框,同时还可以返回用户在此对话框的选择


16、看门狗的作用?
          不是用来复位的吗?


17、这个结构体是干嘛的?
struct _win_st
{
NCURSES_SIZE_T _cury, _curx; /* current cursor position */


/* window location and size */
NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */
NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */


short   _flags;/* window state flags */


/* attribute tracking */
attr_t  _attrs;/* current attribute for non-space character */
chtype  _bkgd;/* current background char/attribute pair */


/* option values set by user */
bool _notimeout;/* no time out on function-key entry? */
bool _clear;/* consider all data in the window invalid? */
bool _leaveok;/* OK to not reset cursor on exit? */
bool _scroll;/* OK to scroll this window? */
bool _idlok;/* OK to use insert/delete line? */
bool _idcok;/* OK to use insert/delete char? */
bool _immed;/* window in immed mode? (not yet used) */
bool _sync;/* window in sync mode? */
bool _use_keypad;/* process function keys into KEY_ symbols? */
int _delay;/* 0 = nodelay, <0 = blocking, >0 = delay */


struct ldat *_line;/* the actual line data */


/* global screen state */
NCURSES_SIZE_T _regtop;/* top line of scrolling region */
NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */


/* these are used only if this is a sub-window */
int _parx;/* x coordinate of this window in parent */
int _pary;/* y coordinate of this window in parent */
WINDOW *_parent; /* pointer to parent if a sub-window */


/* these are used only if this is a pad */
struct pdat
{
   NCURSES_SIZE_T _pad_y,      _pad_x;
   NCURSES_SIZE_T _pad_top,    _pad_left;
   NCURSES_SIZE_T _pad_bottom, _pad_right;
} _pad;


NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */


#ifdef _XOPEN_SOURCE_EXTENDED
cchar_t  _bkgrnd;/* current background char/attribute pair */
#endif
};


18、ioctl()函数详解  
ioctl是设备驱动程序中对设备的I/O通道进行管理的函数。
        讲解地址    http://blog.csdn.net/gemmem/article/details/7268533
        
19、多线程、多进程编程
            编写设备驱动程序   搭建内核树