?? dev.c
字號:
/*這個文件負責把建立設備樹*/
#include "struct.h"
#include "uart.h"
static d_dev * dev_head;
void add_dev_tree(d_dev *p) /*添加設備到設備樹中*/
{if(p->parent)
{p->brother=p->parent->child;
p->parent->child=p;
}else{
p->brother=dev_head;
dev_head=p;
}
}
static void dev_visit(d_dev * tail) //遞歸算法//
{d_dev *p;
if(tail!=NULL)
{p=tail->parent;
uart_send(tail->name);
while(p)
{
uart_send("--");
uart_send(p->name);
p=p->parent;
}
uart_send("\r\n");
dev_visit(tail->child);
dev_visit(tail->brother);
}
}
void ls_dev_tree(int argc, char ** argv) /*遍歷設備樹*/
{d_dev *tail;
tail=dev_head;
dev_visit(tail);
}
void init_dev_tree()
{dev_head=NULL;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -