- 论坛徽章:
- 0
|
刚接触嵌入式linux,在前人已经做好的基础上做继续开发的,
为了调试方便,通常使用printf打印函数,在嵌入式linux中如何进行标准输入输出的定位啊
是基于ARM7(带MMU)开发的,现在只能使用自己做的printf函数打印数据:
- #if 1
- #define DEAL_COMPUTER(fd, data, len) {unsigned int status=0;\
- pthread_mutex_lock(&m_computer);\
- write(fd, data, len);\
- do {\
- ioctl(fd, TIOCSERGETLSR, &status);\
- } while (status!=TIOCSER_TEMT);\
- pthread_mutex_unlock(&m_computer);\
- }
- int printdd(const char *format, ...)
- {
- char buff[255];
- int chars;
- va_list ap;
-
- va_start(ap, format);
- chars = vsprintf(buff, format, ap);
- va_end(ap);
-
- if (chars > 0) {
- DEAL_COMPUTER(serial_fd[3], buff, chars); //将数据打印到串口3,如何定义其为标准输入啊,使用printf即可直接打印
- return 1;
- }
-
- return 0;
- }
- #endif
复制代码 |
|