Accessing hardware registers in Linux userspace

后端 未结 1 501
感情败类
感情败类 2021-01-15 13:44

I wpuld like to write to hardware registers on OMAP3530 in Linux userspace. Please, find below code. Mmap returns error:

Memory map failed. error -1

mmap: Pe

1条回答
  •  情话喂你
    2021-01-15 14:34

    The documentation for mmap() says (emphasis mine):

    The mmap() function shall fail if:

    EACCES

    The fildes argument is not open for read, regardless of the protection specified, or fildes is not open for write and PROT_WRITE was specified for a MAP_SHARED type mapping.

    Since you specify PROT_WRITE, the file should be open for write. Your code only opens it for read.

    0 讨论(0)
提交回复
热议问题