Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

8255

i am using RedHat 7.3, i want to control device using PPI 8255 and C.
if i use "outb" i get error message "segmentation fault" when run it.
do i have to use assembler? How to?????

Comments

  • XSGauthierXSGauthier Posts: 13Member
    : i am using RedHat 7.3, i want to control device using PPI 8255 and C.
    : if i use "outb" i get error message "segmentation fault" when run it.
    : do i have to use assembler? How to?????
    :
    You can`t use oi port access because linux runs in protected mode and the cpu won`t let you use the privileged instruction out. You have to write a kernel module that drives your 8255 and exports an interface in /dev like /dev/my8255. since your driver runs in kernel space you have access to the io ports. you also have to copy data from kernel to user space using kernel_to_user or sth like that. Check linux driver modules in the linux source code for code examples.

    a warning by the way: device drivers can crash the entire system since kernel space is unprotected from spurious writes, if your driver program crashes and write everywhere in memory or whatever incorrect behavior the kernel process will crash with a kernel panic. so save everything and sync your drives before testing to minimize data loss.

    useful commands:

    sync
    lsmod
    insmod
    rmmod

Sign In or Register to comment.