简体   繁体   English

如何使用汇编语言(Linux)对并行端口进行读写?

[英]how to write/read to parallel port in assembly language(linux)?

how to write/read to parallel port in assembly language(linux)? 如何使用汇编语言(Linux)对并行端口进行读写?

my plan is this 我的计划是这样

connect LEDs to parallel port 将LED连接到并行端口

from the linux machine(ubuntu 10.10), write to parallel port. 从linux机器(ubuntu 10.10)写入并行端口。 so I see lightened LEDs. 所以我看到发光的LED。

the reason why I want to use assembly is, I can understand how things going on. 我想使用汇编语言的原因是,我可以理解事情的进展。

thanks 谢谢

Well, assembly is not necessarily the way to understand what is going on. 好吧,组装不一定是了解正在发生的事情的方式。 I would say it is the contarary. 我会说这是最重要的。 A user process does not see the real memory or ioports, it only sees what the kernel show him. 用户进程看不到实际的内存或ioport,它只能看到内核向他显示的内容。 For example your parallel port is handled by the kernel, so using it involve using system calls. 例如,并行端口由内核处理,因此使用它涉及系统调用。 Using assembly won't get you across the kernel barrier. 使用汇编不会使您越过内核障碍。

I you want to understand what is going on, may be you should ask yourself what you really want to know ? 我想了解正在发生的事情,也许您应该问问自己您真正想知道什么? If you don't know what you are looking for, then I suggest starting with a high level approach, and go down : 如果您不知道要寻找的内容,那么我建议从高级方法入手,然后继续进行下去:

  • write a C program doing what you want. 编写一个您想要做的C程序。
  • examine it, strace it, discover how it does syscall ! 检查它,追踪它,发现它如何进行系统调用!
  • from here you can either do the syscall yourself, or go on the other side of the syscall barrier, in kernel space. 从这里开始,您可以自己执行syscall,或者在内核空间中进入syscall障碍的另一端。 But then it is a new story 但这是一个新故事

If you want to go the other way, ie from bottom to top, understand how a CPU works etc..., I suggest starting with something much simpler, like a PIC board. 如果您想采用另一种方法,即从下到上,了解CPU的工作原理等,我建议从更简单的东西开始,例如PIC板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM