Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - schveiguy

Pages: 1 [2]
utFAT / ensuring a directory exists and is opened
« on: September 16, 2010, 07:55:43 PM »
I'm having trouble ensuring that a directory is present and opened.  Here is the code I have:

Code: [Select]
static int openDirectory()
    int result = UTFAT_SUCCESS;
    if(sdDirectory == NULL)
        sdDirectory = utAllocateDirectory(DISK_D, 0);
    result = utOpenDirectory("/CONF", sdDirectory);
    if(result == UTFAT_FILE_NOT_FOUND)
        // need to create the directory
        result = utMakeDirectory("/CONF", sdDirectory);
        if(result == UTFAT_SUCCESS)
            result = utOpenDirectory("/CONF", sdDirectory);
    return result;
The first time this function is called, the directory D:\CONF is created and opened
Upon the second time calling this, the directory D:\CONF\CONF is created, but D:\CONF is opened.

I tried adding a statement before opening the directory to clear the VALID bit, but what that results in is the directory D:\CONF being created, but D:\ being opened.

I'm unsure how the directory argument to utOpenDirectory is used, I thought it was just a place to put the opened directory, but it appears to play a role in the relation of the directory to open.  Plus, makeDirectory doesn't have any docs, so I'm not sure how it's used there either.

What I want is for this function to work even if someone has removed the directory between calls.


utFAT / Re: Async operations?
« on: September 16, 2010, 03:01:45 PM »
Hi Mark,

I'm not so much concerned about the rate, it can be as slow as it wants to be while writing/reading.

What I'm concerned about is that while my task is writing data, the OS cannot do anything else (aside from process interrupts) while the hardware is sending the data to the card.  Usually in a pre-emptive OS, the processor starts running other tasks on blocking I/O, but as you pointed out, uTasker just does a busy loop, not letting anything else run.

The managed operations seem to be exactly like what I want (immediate return from a write, then async notification when it is complete).  Is this in the latest download?  I noticed you could open a file "managed", is that what you are talking about?  I thought managed meant that the open file itself could survive across calls to the task.

Note that I have very little experience with low-level FAT stuff, so I'm quite ignorant on timings and limits.


utFAT / Async operations?
« on: September 15, 2010, 07:01:39 PM »

Are there any plans to make async operations possible on the utFAT/SD system?  In an application I'm writing, the config and logs will be stored on the SD card, but I'm concerned that the writing of the log/config will consume too many cycles, since the write is synchronous.  I understand the module is preliminary, but so far, it's worked for me!


µTasker general / patch for uStrcmp
« on: September 14, 2010, 01:57:49 PM »
While building a binary search on strings, I found that uStrcmp was inadequate.  It only tests equality, where I need it to test order as well.

Here is a patch if anyone is interested, it should be just as fast as the original, since the test for order doesn't occur until a difference is found.


Pages: 1 [2]