lkml.org 
[lkml]   [2003]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Subjectmmap to Access PCI space?
    Date
    Hi All,
    I need to access a couple of SATA chips from a user-mode
    program (yep, running as root). I know for a fact that my
    chip resides at address 0xfc300000 (/proc/iomem and /proc/ide/siimage
    tells me this). Can I do a mmap like the following to access the registers
    on ths chip?

    fdDevMem = open( "/dev/mem", O_RDWR );
    ptr =
    mmap
    (
    NULL,
    4096,
    PROT_READ | PROT_WRITE,
    MAP_SHARED,
    fdDevMem,
    0xfc300000
    );

    When I try this, I get a valid pointer back, but it doesn't seem to
    be mapped to my si3112 chip register bank.

    I've also used code like the following:
    ptr =
    mmap
    (
    0xfc300000,
    4096,
    PROT_READ | PROT_WRITE,
    MAP_SHARED | MAP_ANONYMOUS,
    -1,
    0
    );

    Same story.
    If I use MAP_FIXED and/or MAP_PRIVATE, the mmap call fails.

    What am I doing wrong here?
    Thanks,
    Randy Hyde

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:58    [W:3.703 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site