Driver to access a memory mapped device

Hi,
I've got a memory mapped device, but the OS (Solaris 10) doesn't let me access it in user space without a driver. So, I need to write a driver to bind the driver to my device at location 0x7fff00000000. I've followed the Device Driver Tutorial and examples on Sun's website, and came up with the following code. But when I mmap the driver into user space, the device at 0x7fff00000000 is not accessed at all. So, I believe there is a problem in probing and attaching the device. Could you please take a look at my code and tell me what I'm doing wrong? I'm new to device drivers. Thank you.
static int
foo_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
        int instance = ddi_get_instance(dip);
        struct foo_state *fsp;
        switch (cmd) {
        case DDI_ATTACH:
                if (ddi_soft_state_zalloc(foo_state_head, instance)
                    != DDI_SUCCESS) {
                        cmn_err(CE_WARN, "Unable to allocate state for %d",
                            instance);
                        return (DDI_FAILURE);
                if ((fsp = ddi_get_soft_state(foo_state_head, instance))
                    == NULL) {
                        cmn_err(CE_WARN, "Unable to obtain state for %d",
                            instance);
                        ddi_soft_state_free(dip, instance);
                        return (DDI_FAILURE);
                if (ddi_create_minor_node(dip, "foo", S_IFCHR, instance,
                    DDI_PSEUDO, 0) != DDI_SUCCESS) {
                        cmn_err(CE_WARN, "Cannot create minor node for %d",
                            instance);
                        ddi_soft_state_free(dip, instance);
                        ddi_remove_minor_node(dip, NULL);
                        return (DDI_FAILURE);
                fsp->instance = instance;
                fsp->dev = dip;
                ddi_report_dev(dip);
                return (DDI_SUCCESS);
        case DDI_RESUME:
                return (DDI_SUCCESS);
        default:
                return (DDI_FAILURE);
static int
foo_devmap(dev_t dev, devmap_cookie_t handle, offset_t off, size_t len,
    size_t *maplen, uint_t model)
    struct foo_state *fsp;
    int error, rnumber;
    off_t regsize;
    /* Set up data access attribute structure */
    struct ddi_device_acc_attr foo_acc_attr = {
        DDI_DEVICE_ATTR_V0,
        DDI_STRUCTURE_BE_ACC,
        DDI_STRICTORDER_ACC
    fsp = ddi_get_soft_state(foo_state_head, getminor(dev));
    if (fsp == NULL)
        return (-1);
    /* use register set 0 */
    rnumber = 0;
    /* get size of register set */
    if (ddi_dev_regsize(fsp->dev, rnumber, &regsize) != DDI_SUCCESS)
        return (-1);
    /* round up len to a multiple of a page size */
    len = ptob(btopr(len));
    if (off + len > regsize)
        return (-1);
    /* Set up the device mapping */
    error = devmap_devmem_setup(handle, fsp->dev, NULL, rnumber,
       off, len, PROT_ALL, DEVMAP_DEFAULTS, &foo_acc_attr);
    /* acknowledge the entire range */
    *maplen = len;
    return (error);
static int
foo_segmap(dev_t dev, off_t off, struct as *asp, caddr_t *addrp,
     off_t len, unsigned int prot, unsigned int maxprot,
     unsigned int flags, cred_t *credp)
     return (ddi_devmap_segmap(dev, off, asp, addrp,
          len, prot, maxprot, flags, credp));
}

Hi java_user,
There are no EBIU VIs. You will need to use C code for that part of your application.
Mike Lyons
National Instruments
http://www.ni.com/devzone

Similar Messages

  • Icloud drive - direct access from an ios device

    Good morning all :-)  Does anyone know if there is some hidden app that allows direct access to iCloud Drive on either an iPad or iPhone?  I know I can open Numbers, Pages, etc and access my iCloud files that pertain to those specific apps, but is there a way to access iCloud Drive so I can see ALL the folders in my iCloud Drive?  I'm talking similar to the way you open the finder in OS X on the desktop and access the iCloud Drive.
    Apple's website in the iCloud section clearly shows an image of an iOS device with iCloud Drive open, showing all the folders in the drive, however I am reading on third-party websites that there is in fact no such app.  Strange that Apple would show this on their own webpage, but not make it available to the users.
    Thanks!

    As far as I understood there is no such an app like "file manager" for the icloud drive. So its impossible to access your files from your iOS8 device..!!! Amazing ah!!! Therefore you CAN'T read .pdf files!!!. ibook doesnt work for that job. Another surprise in the post-Jobs Apple!!
    Apple sometimes hurts much!!
    <Edited by Host>

  • Use thinkvantage access connections to map a network drive

    Is it possible to use thinkvantage access connections to map a network drive. I have three different basic sites (home, work1, work2) with network drives that I would like to access depending on the site.
    1) I wonder if it is possible to configure thinkvantage access connections to automatically map the network resources through a connection profile?
    2) I wonder if it is possible to configure thinkvantage access connections to automatically map the network resources through a connection profile that is based on vpn connection?
    thanks in advance
    sincerely, anders

    Hi,
    directly it's not possible for Access Connection to reconfigure your network drives.
    However, there is one really cool part of Access Connection, that might be realy suitable for your situation. This part is the script/application, that can be executed when a profile gets applied.
    So for your situation I can imagine, that you create a .bat file, that contains something like this:
    net use * /DELETE /YES
    net use Z: \\computer name\share name
    The first part will delete all maped drives. The second part will establish connection that you want to use. Of course you can multiply the last part, so that you can configure multiple connections.
    Please let me know, if this helps.
    Cheers

  • WIN 7 : Not able to access(CreateFile failed) winusb device if inbox driver is loaded

    Hello ALL,
    CreateFile API is failed with ERROR_FILE_NOT_FOUND, when winusb comes with composite device.
    Description:
    i have two Custom winusb devices which supports MS-OS descriptor with the Microsoft DeviceInterfaceGUID ({b35924d6-3e16-4a9e-9782-5524a4b79bac}).
    Two custom devices are,
    1. USB Composite Device - (Winusb  + CDC interface) - CreateFile API got Failed.
    2. Winusb Device - CreateFile API got Passed.
    So when i insert the composite device into machine, driver loaded automatically from online. But the CreateFile API got failed.
    I gottah chance to analyze using WINOBJ tool.
    https://technet.microsoft.com/en-us/sysinternals/bb896657
    I could see that, when the inbox driver is loaded to the composite device,
    Symbolic Link was not shown in
    WINOBJ tool. Thats why CreateFile API was failed.
    When the inbox driver is loaded to the Non Composite device, Symbolic Link showed in WINOBJ tool. Link was created automatically.
    To fix this problem,
    I created test signed winusb driver with specific HARDWARE id's, then i loaded that driver for the device, it started working.
    Some More findings:
    1. If i connect my device under Intel EHCI/xHCI controller with microsoft controller driver, above problem did not occur.
    2. Problem only comes when the device is connected under Intel xHCI controller with intel controller driver.
    3. Same problem in other link - http://www.osronline.com/showthread.cfm?link=233799
    Could you please anyone help what could be the reason for symbolic link was not created if the winusb device comes with composite device?
    Because i cannot go with test signed drivers.
    Prasannna

    > Problem only comes when the device is connected under Intel xHCI controller with intel controller driver.
    Complain to Intel?

  • AXI memory mapped to PCI Express BAR0 size in Root Complex

    I am using AXI memory mapped to PCI express (2.5) IP as a Root complex in my design.
    I have selected the maximum BAR0 Size as 2 GB under PCIE:BARS and AXI-PCIe BAR translation as 0x00000000.
    I want to access a memory in the host side of the Root complex using an endpoint.
    When I tried to access the address more than 0x7FFF_FFFF from the endpoint in my testbench, the transaction is getting lost in the PCIe section of the IP. I don't see any AXI transaction in the output of the AXI.
    Any transaction from the endpoint to address less than 0x80000000 goes through.
    Is this a limitation in the IP?
    What is the solution if we want to access 4GB of memory from the endpoint thorugh the Root complex?

    Hi Suresh,
    This is a known issue with the core.  This is targeted for fix in the next Vivado release, where you will either have the option of selecting a 4G BAR for the RP, or masking out the RP BAR altogether, which will allow the full 4G memory space to accept requests from the downstream devices.  

  • How can I access an unsupported usb device that's seen by system profiler

    is there a way to access an unsupported usb device? my parents bought my daughter a cheap and easy to use digital camera and I am looking for a way to access the photos. the camera's manual mentions that there is no mac driver and there are no plans to develop one. I plug it in anyways in the event the system / Iphoto recognizes this, But I get nothing on the desktop as in a generic disk image icon. I open system profiler and My G4 knows the camera is plugged in. If this interface between the two is recognized how can I access the camera?
    does a driver have to be written to allow access? I saw a usb dev kit on version tracker but I have no clue as to how to write a driver. I could get a flash card reader but I was hoping that there may be some back door or an app somewhere to allow me to get the photos off the camera.
    thanks!!!

    Hi, Israel.
    You wrote: " I plug it in anyways in the event the system / Iphoto recognizes this"See if Image Capture recognizes the camera. Launch Image Capture, which is in the Macintosh HD > Applications folder.
    Otherwise, you're probably going to have to go the route of using a card reader. While the connection may be USB, they may be using some non-standard implementation that requires a driver.
    Writing drivers is not something you'd want to even attempt since you didn't create the hardware!
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X

  • Mass Storage Driver Severe Crash - USB Mass Storage device useless

    I am running the latest, updated version of OSX Leopard; Hardware Growler; and Parallels Desktop. Today, as I was doing a very resource-intensive task on Windows XP - via parallels - I plugged in my Samsung M610 to try to access the memory card. I then closed Windows XP, and noticed that my cpu was still registering at 100% output. Opening Activity Monitor and looking at the processes there, I saw that Mass Storage was taking 100.00 units of CPU output, and was not responding, I immediately clicked end process. Much to my dismay however, Activity Monitor then proceeded to lock up, so I forced it to quit, which caused finder to lock up in turn. Throughout this time, my cpu was still working overtime, so I decided to power the computer off. Upon rebooting and much "whew"-ing I tried to plug my Cell Phone in again; as usual Hardware Growler notified me of the connection and it's details, however, confusingly finder had no knowledge of any mass storage connection. After multiple connects and reconnects, testing all USB ports on my MBP (and being annoyed by the system telling me to properly find and eject hardware before removing it, which I suppose I should take as a good sign) my memory card remained invisible to finder. Hardware growler continues to perfectly recognize the device connection.
    The most odd thing about this particular problem, is that other USB devices are recognized... at least one other Mass storage device is, but I have only one other device to test at the moment.... Any help would be greatly appreciated.

    Check the following link and find the part of the text "Common resolutions for Code 10 error".
    http://support.microsoft.com/kb/943104/en-us

  • Sat P105-S2036 WinVista SD memory card device not shown in WIndows Explorer

    The label on the botton of the laptop says the Model Number is PSPAOU-1W2036. I have had it for about 2 years. It has a single slot SD memory card only reader in the front. During this time till 2 days ago, it ran factory installed Windows XP MCE just fine. This SD reader shows up in Device Manager as well as in My Computer Windows Explorer window as a drive with letter D since I renamed the DVD drive to letter R. During the last two days, I successfully upgraded the operating system to Windows Vista Ultimate. Everything works fine except that the SD memory card reader no longer shows in neither Device Manager, nor Windows Explorer. But the Device Manager does show a working SDA Standard Compliant SD Host Controller, and a nonworking Mass Storage Controller (missing driver) under Other devices (See Attachment 1). What needs to be done to make the SD memory card reader a working device in Windows Vista? Thank to answers in advance.
    Solved!
    Go to Solution.
    Attachments:
    01 Device Manager shows SD Controller but no SD reader device.txt ‏2 KB

    Thanks to Moderator Trina for moving my inquiry to Moved: /t5/General-Technology/Sat-P105-S2036-WinVista-SD-memory-card-device-not-shown-in/m-p/34845#U34845
    There I searched for SD and found co-member kaidssss' 2009 February 27's post "SD memory Cards Slots" which was resolved by Super Contributor Jerry_Lippey in less than 3 hours with this CSD.Toshiba.com driverweb page
    TI Card Reader Driver for Windows Vista/XP at
    http://www.csd.toshiba.com/cgi-bin/tais/support/jsp/download.jsp?soid=1713025
    THANKS.

  • How to Access Table Space Map in Oracle 10g OEM

    How and from where to Access Table Space Map in Oracle 10g OEM ??
    Thanks

    Hi,
    first of all, the online help system of grid control is outstanding. Just click on Help in the upper right corner and enter "Tablespace Extent Map" in the search form.
    Result:
    Show Tablespace Contents Page
    Each Oracle database is divided into one or more logical units called tablespaces. You can use Oracle Enterprise Manager to manage these tablespaces and create or modify the parameters for the tablespaces. Use the Tablespace property sheet to set general and storage information for the specified tablespace.
    Use the Show Tablespace Contents page to display the list of tablespace segments that comprise the existing tablespace. You can display Tablespace Extents by choosing Show Tablespace Extent Map at the bottom of the page. An extent is a logical unit of database storage space allocation made up of a number of contiguous data blocks. One or more extents in turn make up a segment. When the existing space in a segment is completely used, Oracle allocates a new extent for the segment.
    You can view segment extents by clicking on the link in the Extents column to display the Extents in Segments page.
    You can display the Show Tablespace Contents page by choosing Show Tablespace Contents from the command drop down list on the Tablespace property page, the Tablespace View page, or the Tablespace search results page.
    Note: Developers could only display the tablespace map to a maximum hard coded number of 30,000 extents. Tablespaces are often larger than that. If a tablespace is larger than 30,000 extents, the portion over that is displayed as Unmapped. To avoid exceeding the memory capacity of the tablespace map and to display the map without unmapped extents, use a search criteria displaying results of less than 30K extents.
    For an overview of tablespaces, see the "Overview of Tablespaces " chapter of the Oracle Database Concepts Guide.
    For more information about managing tablespaces, see the " Managing Tablespaces" chapter of the Oracle Database Administrators Guide.
    For more information about managing datafiles, see the " Managing Datafiles and Tempfiles" chapter of the Oracle Database Administrator's Guide.

  • Optical drive being accessed during sleep

    I close the lid, put it to sleep and my optical drive keeps being accessed. Its erratic; 1,2 or 3 times a minute - sometimes it doesn't start for 35 minutes, sometimes it stops after a while. No outside devices attached. Its annoying to say the least.
    Anyone else have this problem? I talked to technical at applecare several times and they had no record of anyone else having this issue.

    I've made some progress. I figured that was happening (and shouldn't be happening) was that something was momentarily waking the computer which does a optical disk access when it wakes.
    I disabled wifi and that didn’t do it and then I disabled Bluetooth – I use a Logitech Bluetooth mouse – and that stopped the problem.
    Further details if anyone is interested: when I close the computer case and put my mouse on top of the macbook there is no problem. No optical drive accesses. When I put the mouse on my wooden desktop the problem starts. I turned the mouse upside down (case closed – sleep state) and after a while a little red led started blinking in a small window. When I put my finger over the window the optical drive was accessed. The mouse is sending something to the computer and it wakes. It shouldn’t wake but it does.
    macbook pro Mac OS X (10.4.7)

  • HT201272 I'm having trouble downloading a previously purchase song to my iCloud so I can access it from another device.  The iCloud download button is not there.  Help?

    I'm having trouble downloading a previously purchase song to my iCloud so I can access it from another device.  The iCloud download button is not there.  Help?

    I agree. I don't rely on iCloud as a backup, that is what I have my portable hard drive for. Its 500 GB so I can hold my entire iTunes library several times over on it. I have all my movies on my hard drive, but somehow "The Mist" got deleted off of my hard drive, so I figured "Well, the option to redownload an already purchased movie is available through iCloud, I'll just do that!"
    And permissions and download availability have nothing to do with it, the movie's still there, it still allows me to redownload it. The only problem is when I click download, I get that message.
    And nobody else uses my computer, but I do have multiple accounts authorized on it. Even still though, I am attepmpting to download it through the account I purchased it under. :/

  • ZCM 11.2.3 USB IMAG. - attempt to access beyond end of devic

    Hi There,
    this may have been covered before but i have searched and had little headway into the issue.
    I am getting the following errors shown (thousands) on the "Alt-F4" screen whilst imaging.
    [xxx.xxxxxx] sda1: rw=65, want=xxxxxxxxx, limit=xxxxxxxx
    [xxx.xxxxxx] attempt to access beyond end of device
    I have checked that the tntfs.ko has loaded.
    I am using USB imaging with ENGL 8.0 and 11.2.3.
    The drive is a USB 3 1TB with 10gb fat32 partition for boot and Remaining EXT4 partition for images.
    The images will apply on some machines but fail half way through on others....
    is it something to do with partitioning etc?
    any ideas?

    Doubt much could be solved on the Forums.
    Two things I would recommend.....
    #1 - Test all of the USB Ports to see if they all operate the same.
    #2 - Look for Any BIOS upgrade.
    If Neither helped, an SR may help.
    On 3/3/2014 4:46 PM, pfurches wrote:
    >
    > Same issue here. Brand new Dell Latitude E6540 with solid state drives.
    > Images at half the speed of a new OptiPlex 9020. Alt-F4 shows these
    > messages constantly while imaging. We are using the latest 11.2.4 MU1
    > January 2014 imaging update.
    >
    > Any luck on this or should I get an SR started?
    >
    >
    > craig_wilson;2307530 Wrote:
    >> Try the Updated Drivers.
    >> As I mentioned, there are USB Driver Issue Fixes in the Later Updates.
    >> Especially with newer model computers.
    >>
    >> Since the issue is imaging from a USB Drive but not PXE, that may help
    >> resovle the issue.
    >>
    >> Look for the 11.2.3 Version of the January Imaging Updates and try
    >> those.
    >>
    >> On 2/20/2014 7:16 PM, camkerr81 wrote:
    >>>
    >>> Thanks Craig and Shaun.
    >>>
    >>> I have tried the suggested EXT3 with no luck. Ive also tried different
    >>> usb devices to see if it was the drive.
    >>>
    >>> For testing sake i tried my USB imaging drive on a older HP laptop and
    >>> it worked fine without any of the "attempt to access beyond.." errors.
    >>>
    >>> Ive tried switching to IDE in the bios over AHCI and also setting the
    >>> SATA speed to 3GB instead of 6GB but still the same issue.
    >>>
    >>> Are there any known issues with SSD drives and imaging?
    >>>
    >>> We are running 11.2.3 MU1 so i cant see why it would be the imaging
    >>> engine as the devices are all last years models are it works perfectly
    >>> fine PXE imaging using the exact same images.
    >>>
    >>> Im tempted to use ImageX instead for the USB imaging as this has been
    >>> painful for something so simple.
    >>>
    >>> Also a note that USB imaging seems to be around 6 minutes slower than
    >>> PXE imaging which doesn't make sense to me.
    >>>
    >>> A 14GB image is taking 22 minutes via usb and around 16 for PXE .
    >>>
    >>>
    >>> craig_wilson;2307036 Wrote:
    >>>> If the issues are with newer model devices, you may also want to try
    >>>> making sure you are using the latest Imaging Update Drivers.
    >>>>
    >>>> Could even be something such as needing better support for a
    >> particular
    >>>> devices USB Ports.
    >>>>
    >>>> On 2/19/2014 4:49 AM, Shaun Pond wrote:
    >>>>> Shaun,
    >>>>>
    >>>>> well "unsupported" is not quite correct, but I still think it's
    >> worth
    >>>> a
    >>>>> try with EXT3
    >>>>>
    >>>>
    >>>>
    >>>> --
    >>>> Craig Wilson - MCNE, MCSE, CCNA
    >>>> Novell Technical Support Engineer
    >>>>
    >>>> Novell does not officially monitor these forums.
    >>>>
    >>>> Suggestions/Opinions/Statements made by me are solely my own.
    >>>> These thoughts may not be shared by either Novell or any rational
    >> human.
    >>>
    >>>
    >>
    >>
    >> --
    >> Craig Wilson - MCNE, MCSE, CCNA
    >> Novell Technical Support Engineer
    >>
    >> Novell does not officially monitor these forums.
    >>
    >> Suggestions/Opinions/Statements made by me are solely my own.
    >> These thoughts may not be shared by either Novell or any rational human.
    >
    >
    Craig Wilson - MCNE, MCSE, CCNA
    Novell Technical Support Engineer
    Novell does not officially monitor these forums.
    Suggestions/Opinions/Statements made by me are solely my own.
    These thoughts may not be shared by either Novell or any rational human.

  • Memory mapping large files

    Hi folks.
    I am developing an application that has very large input files. During execution, the files will be processed twice: once, sequentially to get the position of each piece of data in the file, and then directly by seeking to a specific position to retrieve a specific piece of information.
    My rational for doing this is to avoid loading the entire content of the file into memory via some data structure. However, all of the seeking/reading seems to be quite a performance hit.
    Is there a way to memory map a file and then be able to read only a portion of the data based on its byteposition? I've searched around for sample code, but I can only find examples of sequential access.
    Any help will be appreciated extremely!!
    Thanks

    That's pretty simple. Thanks
    Follow-up questions:
    The code I have now reads:
    FileChannel fc = seqDBRAF.getChannel();
    ByteBuffer roBuf = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
    CharBuffer cb = Charset.forName("ISO-8859-15").newDecoder().decode(roBuf);
    The decode line takes a long time to execute not the "map" line. Why is this?
    If/when I use the position method to "seek" to the right place, should I do this to the ByteBuffer and then decode? Or decode first and then just read from the position in the Charbuffer?
    Thanks

  • To retrive information already stored in memory of device

    HI
    Can we wite an j2me application to retrive
    information already stored in memory of device
    such as name,phone nos ,...etc
    regards
    Rameshwari

    Hi
    I have to access the information stored in
    mobile device(nokia3100) such as address book or any other info stored in memory
    but PIM api is not supported by the device
    is there any means so that i can access the inforamtion stored on the device
    reply as soon as possible

  • Error code 1450 - memory mapped file

    Hello,
    in my application I am using memory mapped files. I have three of it, the maximum size of the biggest one is 5MB. I store 64 Waveforms from a DAQ card in it. 
    The application runs fine, but sometimes comes an error, when I try to access the MMF. The error code is 1450, "insufficient system resources"
    Is a size of 5MB too big? Should I rather create one MMF for each waveform?

    Hi mitulatbati,
    which development tools are you actually using?
    Which platform, libraries and so on...?
    Can you post example code?
    Marco Brauner NIG 

Maybe you are looking for

  • What is icloud setup for Multiple users, multiple devices in family?

    What would be the recommended setup for iCloud to allow family members with multiple devices and multiple iTune accounts to share purchases, sync there own mail account, contacts, and reminders with multiple devices, and be able to sync calenders wit

  • Jogl for Windows

    Hello, I have a Jogl question...it appears that javagaming forums are down, so I thought that I'd try my luck here. I came across this text in the following wikipedia article: http://en.wikipedia.org/wiki/Comparison_of_Direct3D_and_OpenGL "Microsoft'

  • User defined F4 help on a table control field

    hi            i m calling table maintenance view on click of a button on module pool screen . i have 1 column internal table which has the contents of help to be displayed on 1 of the fields in table control . how to code and where? i m using   CALL

  • MM_validateForm errors in Firefox

    Hi, I have a website that uses the MM_validateForm script from Dreamweaver. It would seem that it is working fine to validate all the fields, except for the email input field. In IE it ignore it completely (you can submit the form without filling in

  • How do you Turn off Private Browsing in FireFox?

    Somehow Private Browsing was turned on our Firefox browser. How can we turn this off so that we CAN see past history?