20 March 2008

Anyone Remember the Total Entertainment Network?

I guess I'm just a huge Internet/gaming nerd, because I get nostalgic about my escapades on the early internet. Back when the only people on it were most likely computer geeks and it was one giant sandbox. So of course I was a member of TEN (Total Entertainment Network). I discovered it as a part of my Duke Nukem 3D package, I believe a TEN beta install was on the CD. Who could forget the cute alien face that told you how slow your connection was?

So I was recently messing around on the WayBack Machine and found myself pointed to the old TEN.net website. In fact, here are all the archived versions. There were two games that I mainly played on TEN: AD&D DARK SUN: Crimson Sands and Duke Nukem 3D. My old AD&D handle was "Kepher" - I didn't know any negative connotations about it at the time, I just made it up. If anyone remembers me out there, hello! The old screenshots on this page should bring back memories. Alas, I don't have any screenshots of my own from TEN days. I would like to know who holds the IP to Crimson Sands today anyway? Probably EA on some old dusty hard drive. If anyone knows please let me know.

I loved the tight knit community that Duke 3D had on TEN. I was one degree away from fame there since my friend in real life was the author of the popular Stealth map series. I think he went as Phazer on TEN. Some names I can remember off the top of my head are Tecnicolor and Pinkymouz (also the author of popular maps called Assault if I recall correctly). I'm embarrased to say that I played with the keyboard exclusively back then. Could you even play it with a mouse?

Check out TEN's cool quotes page, circa 1996. It's too bad Scott Miller's vision didn't pan out: "TEN will finally provide an online home for gamers. TEN's style matches our games perfectly, and we are looking forward to a long, successful partnership." -Scott Miller, President of 3D Realms. Where the heck is Duke Nukem Forever!?

I just thought I would take a step back into those good old days and share it with you.

18 March 2008

OLPC XO-1 Laptop Specs

I received my XO laptop the other day and before I started messing around with it too much I thought I would make an informative post regarding the specs of it. Since the operating system is based on Linux I will show you the commands you use at the Terminal to see some hardware information - these apply to all Linux-based OSes not just the OLPC one.

Once you've found the Terminal in Sugar and opened it you can type:
  • cat /proc/cpuinfo
On my XO-1 that results in the following output:

processor:0
vendor_id:AuthenticAMD
cpu family:5
model:10
model name:Geode(TM) Integrated Processor by AMD PCS
stepping:2
cpu MHz:431.222
cache size:128 KB
fdiv_bug:no
hlt_bug:no
f00f_bug:no
coma_bug:no
fpu:yes
fpu_exception:yes
cpuid level:1
wp:yes
flags:fpu de pse tsc msr cx8 sep pge cmov clflush mmx mmxext 3dnowext 3dnow
bogomips:863.54
clflush size:32

Now to see information about the memory in the system you type:
  • cat /proc/meminfo
The MemTotal for my system is MemTotal: 237852 kB
  • cat /proc/version
Provides an output of: Linux version 2.6.22-20071121.7.olpc.af3dd731d18bc39

  • df or df -h (for human readable format):

FilesystemSizeUsedAvailUse%Mounted on
mtd01.0G322M703M32%/
tmpfs35M035M0%/dev/shm


Those are the default file systems mounted on the XO-1.

16 March 2008

I got my OLPC XO-1 Laptop!

I ordered my OLPC XO-1 the first week of December during their "Give One Get One" period. Hmm, is it XO-1 or X0-1? In case you've been hiding somewhere OLPC stands for One Laptop Per Child and has been formerly known as "the $100 Laptop". After months of waiting it finally came in the mail, in a very small box. They gave me no notification or tracking number, it just arrived as a surprise. It has a return address of BrightStar US, Inc., which seems to be some kind of "technology distributor". Interestingly, it says on the package it was ordered on March 7th, 2008 which is months off. Perhaps it is the date the BrightStar company was ordered to distribute it.

It's really quite simple - all that is included is the laptop, battery, an AC adapter, and instructions telling me to see http://www.laptopgiving.org/start for details on how to use it. So of course I installed the battery, plugged it in, and turned it on. It is about as small as I thought it would be, but heavier as well.
After about 30 minutes of fooling around I have to admit it is very hard to use. It is clearly designed for children! You don't have access to nearly any OS details/capabilities, let alone advanced ones. By the way did I mention the OS is called Sugar and is derived from Fedora Linux? At least there is a Terminal, but by default the PATHs aren't set, so to figure out your OLPC XO-1 MAC address you need to do:
  • /sbin/ifconfig
And find the HWaddr for your mesh connection type. If I recall correctly it shares it with eth0 as well. It looks like the laptop does have some neat capabilities that I will need to try out in the future, and for now it should serve well as a distraction during long classes and/or work. Look for more posts on this in the future. Here are a couple more photos I took:


You can find more photos elsewhere, like here.

14 March 2008

Desktop Wallpaper Sites

If you are tired of seeing pretty desktop backgrounds that other people have and want one of your own I've compiled a list of places to grab from. Of course, you could also search google images to return large images only. I've done my best to pre sort them by ratings.

http://socwall.com/browse/index.php?wpSortby=4
http://www.ewallpapers.eu/top-wallpaper
http://interfacelift.com/wallpaper/index.php?sort=ratings
http://www.vladstudio.com/wallpapers/?order=viewed

Of course I have to include a Linux-flavored one:

http://www.gnome-look.org/

Hopefully you can find a good wallpaper the size of your desktop resolution.

13 March 2008

Mozilla Firefox 3 Beta 4

In case you didn't already know, Firefox is a web browser that can be used to browse the Internet instead of Microsoft's Internet Explorer. I have been using the current version, which is Firefox 2 up until today, when I discovered Firefox 3 Beta. I downloaded and installed the Mozilla Firefox Beta 4 version on windows XP and here is what it looks like on the first load:


Of course the improvements are security, speed, etc. One tangible new feature is the new bookmark tagging ability. When you bookmark a page you can also add a "tag" to it to make organizing and searching for it later easier. Here is an example where I bookmark the Ubuntu Hardy Heron release schedule.


There is also the new location bar features. You can type in a page title, tag, or address in the location bar and it will search through your history and bookmarks and display a list of results. I grabbed a quick screenshot of it here:


You can read the actual Release Notes here. There are known issues. And of course, it is currently for testing purposes only.

Update: 13 Mar 4:30PM EST I performed an Acid3 test on the default install and here are the results: 67/100.

I think Firefox 2 scores at about 52/100.

11 March 2008

Exxon Serious About Lithium-Ion Car Battery

According to this article by the Wall Street Journal, Exxon is pretty serious about developing a new battery to work in electric and electric-gas hybrid cars. Lithium-ion batteries are notorious for getting too hot and catching on fire, but that hasn't stopped Exxon from employing "14 Ph.D.s in Japan, New Jersey and Texas" to improve the technology. In addition to that, according to the article, Exxon is also building a $300 million manufacturing facility in South Korea.

A quick examination of the lithium-ion wikipedia page makes me wonder if this is such a great thing after all. It seems as though there are several serious disadvantages and only a couple advantages. Who cares if the self-discharge rate is low if the battery charge capacity shrinks over time? Hopefully the 14 PhDs can fix some of that since I'd like to afford a hybrid some day.

According to the article Exxon won't make the actual batteries, but this isn't a huge leap for Exxon. Its scientists have already developed a "separator" film that is already an important part of lithium-ion batteries. That film is made of plastic, but guess what plastic is made out of?

08 March 2008

Installing Ultima Online in Xubuntu 6.06 (Part 2)

If you recall from the previous posting, I was unable to get UO to install in Xubuntu 6.06 because of some errors with wine. I knew I had an older version of wine, but since according to the applications database others had gotten it to work on the old version I went ahead with it. As I suspected the older version was the problem. Regarding the wine part of the UO installation process, read this post to learn how to install the latest stable wine for 6.06 (as of this post it was 0.9.53) - skip the 'upgrade' part if you want to keep Xubuntu 6.06 in this case.

If you have wine installed already and your UO installer file is saved within your .wine directory, you may want to move it to your home directory before you uninstall wine. I'm not sure if it would delete it or not, but I moved it just to be safe.

In case the post moves I will reiterate it below. Open a terminal and type:
  • sudo apt-get remove wine
  • sudo vi /etc/apt/sources.list
Assuming you are using 6.06, add the following to the bottom of the sources.list file and save it:
Now type:
  • sudo apt-get update
  • sudo apt-get install wine
Now that a newer wine is installed we can move onto installing UO for real. Move to the directory that contains the installer file and in a terminal window type:
  • wine UOML_setup.exe
For me including sudo had ownership issues, so leave it out this time. Now follow the on screen instructions and UO should install successfully. This time, the output of the terminal during install gave the same type of 'fixme' outputs, but it worked this time, so /shrug. Once it is installed you can move to the directory you installed it to and type
  • wine UO.exe
That will run the patcher and then the client to play the game.

04 March 2008

Installing Ultima Online in Ubuntu Linux

I wanted to put my Xubuntu 6.06 box to some use so I decided to pick up a very old game and install Ultima Online on it. Since UO isn't native to Linux I'm going to need wine or something similar in order to install and play it.

So the first thing we need to do is install wine if you don't have it installed already. On Ubuntu OSes you type: 'sudo apt-get install wine'. After it installs you may want to type 'winecfg' in a terminal and become familiar with the options. The version you get will depend on what version of Ubuntu you are running, since I am running an older one the version of wine I installed is 0.9.9, the current version available as of today is 0.9.56 The wine application database for Ultima Online Mondain's Legacy has test results claiming that this should work on 0.9.9, so we shall see.

Next you need to download the free UO installer from somewhere, I got mine from download.com. Save it to the hidden .wine/drive_c folder in your home directory. Once it is finished downloading, we can run the installer using wine by typing 'sudo wine UOML_setup.exe' from the directory that contains the file. From here it loads the splash screen and shows a loading bar, once the bar reaches 100% on my system the install freezes. Sorry i cannot continue with the install any further.

Here is the output from my terminal, it freezes after the last line:

doojsdad@doojsdad-desktop:~/.wine/drive_c/Program Files$ sudo wine UOML_setup.exe
fixme:ole:ITypeInfo_fnRelease destroy child objects
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7993e5f4,0x7993e5f8), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7993e5f0,0x7993e5f4), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9cedc,0x7fb9cee0), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9cd9c,0x7fb9cda0), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9ce60,0x7fb9ce64), stub!
fixme:win:SetWindowTextA setting text "TITLE_CAPTIONBAR" of other process window (nil) should not use SendMessage
fixme:win:SetWindowTextA setting text "Ultima Online: Mondain's Legacy - Install Shield Wizard" of other process window (nil) should not use SendMessage
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9cd38,0x7fb9cd3c), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9cbf8,0x7fb9cbfc), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9ccbc,0x7fb9ccc0), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9d638,0x7fb9d63c), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9d4f8,0x7fb9d4fc), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9d5bc,0x7fb9d5c0), stub!
fixme:win:SetWindowTextA setting text "TITLE_CAPTIONBAR" of other process window (nil) should not use SendMessage
fixme:win:SetWindowTextA setting text "Ultima Online: Mondain's Legacy - Install Shield Wizard" of other process window (nil) should not use SendMessage
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9d494,0x7fb9d498), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9d354,0x7fb9d358), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9d418,0x7fb9d41c), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9d980,0x7fb9d984), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9d840,0x7fb9d844), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9d904,0x7fb9d908), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9d808,0x7fb9d80c), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9d6c8,0x7fb9d6cc), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9d78c,0x7fb9d790), stub!
fixme:win:SetWindowTextA setting text "TITLE_CAPTIONBAR" of other process window (nil) should not use SendMessage
fixme:win:SetWindowTextA setting text "Ultima Online: Mondain's Legacy - Install Shield Wizard" of other process window (nil) should not use SendMessage
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9d664,0x7fb9d668), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9d524,0x7fb9d528), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9d5e8,0x7fb9d5ec), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb91398,0x7fb9139c), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb91258,0x7fb9125c), stub!
fixme:ole:RpcChannelBuffer_GetDestCtx (0x7fb9131c,0x7fb91320), stub!
fixme:x11drv:X11DRV_SetWindowRgn not supported on other thread window 0x2002a

Upon further inspection of the applications database on wine, it looks like others have reported similar test results on different wine versions, but they were rated as 'Garbage' and hidden away. Figures. I am still looking for a solution to this, I will update when I find one.

02 March 2008

Installing Xubuntu 6.06

Today I decided to bring an old PC back to life by installing Xubuntu 6.06 LTS on it. I chose Xubuntu 6.06 because this computer is pretty crappy and I wanted the oldest stable release possible. The PC is a Compaq P4 1.8GHz with a measly 256MB RAM. You can open a Terminal from the shortcut in the Applications menu and type 'cat /proc/cpuinfo' and 'cat /proc/meminfo' to see detailed information.
If you have very little RAM or an old processor, you might want to consider installing Xubuntu instead of regular Ubuntu.

Once you have decided you want to install Xubuntu you need to download the latest .iso and burn a LiveCD. You can find a download here, note the minimum system requirements as well (Yes, even Xubuntu has its limits). The LiveCD means it can be booted from and used for simple functions without actually installing anything, but we want to install it so let's continue.

The first thing you want to make sure you do before proceeding is setting your computer to boot from CD-ROM. When your computer first boots up hit the 'Del' key, the F10, or whatever key your BIOS wants in order to enter it's setup. Find the 'Boot Order' option and set the CD-ROM to occur before your hard drives. Before you save and exit insert the Xubuntu LiveCD. After the computer reboots it should start to boot from the CD and you should see a list of instructions after a while. Here you can check the CD for defects if you want, perform a memory test on your system memory, or install Xubuntu. If you aren't sure which install option to pick choose the default 'Start or Install Xubuntu'.

Start or Install Xubuntu

Xubuntu will start and you will see a desktop with two icons: 'Examples' or 'Install'. Since we want to install Xubuntu go ahead and double click the Install icon and follow the on-screen instructions. You will need to choose your language, time zone, user name and password (don't forget what you chose!). Eventually you will have three choices: partition only free space for Xubuntu, erase all data and auto partition, or choose your own partitioning. Since I am only using Xubuntu on this system I chose the 'erase all' option. After about a half hour the install will be done and it will ask you to reboot.

Post-Install

That was easy. You should now be staring at the login screen. After you login the first thing you need to do is Update the software so you are running the lastest, most secure, version. You can go to Applications->System->Update Manager using the GUI or open a Terminal and type 'sudo apt-get update'. Run a 'Check' for the latest updates and there should be over a hundred. The download and install of these should take about 12 minutes.

You may want to change the 'repositories' that Xubuntu checks when it performs an update/install. You can do this, as well as set the updater to automatically check for updates (which is off by default) by going to Applications->System->Software Properties. By default the only repositories chosen to update/install from are the 'Official' ones, but you can also check the boxes for the 'Community' supported ones. A lot of useful packages are only made available via the community repositories so I like to check those, some people might consider it risky so do so at your own risk (not only for security but for integration/compatibility with the rest of Xubuntu).
The next thing you should do is get acquianted with the Synaptic Package Manager. This is where you can add or remove software, to put it simply.

Each package has a description that helps you choose which one to install, and once you do, the manager takes care of all other dependencies for you.

One last thing you can check out is the adding extra items to the top bar of Xfce. Right click on it and choose 'Add New Item' to see what is available. I like to add the weather indicator.

That's it for now, I hope this proves useful for someone besides me.

28 February 2008

Convolution and Decimation in the C Language

If you are working with DSP systems, or learning about them, you are going to want to know how to use filters to shape and select the signals you work with. For example, you might know that in order to only pass low frequency signals, you create an ideal low-pass filter (which is a square wave), and multiply that by the corresponding frequency spectrum of the input signal. Simple enough, but how does this actually translate to embedded systems?

You are most likely going to be doing convolution. You probably already know about the relationship between convolution in the time-domain, and multiplication in the frequency-domain. And if you are like me, the concept of convolution is much more abstract than multiplying, so the task of convolving two signals on a DSP seems daunting at first. It turns out it's not that bad, let's take a look at a quick example with two square waves. You can easily replace the two square waves with real life signals. Click the image to see the following code:


Let's look at the top-half of the code. The arrays signal_x, and filter_h correspond to the signal to be filtered and the filter respectively. And the array result_y will hold the result of the convolution. Note that the size of the results array will need to be large enough to hold the combination of the sizes of signal_x and filter_h.

Next the signal_x values are generated on the fly to be a large square wave, obviously this is specific to this example and signal_x will be different in the real world. Then the convolution is performed using the appropriate arrays. The 'for' loop will increment from 0 to the size of the input array minus the size of the filter array. This is because if you let it proceed further, the fetched value for signal_x within the accumulation loop will be trash. As you can see, the so-called accumulation 'for' loop simply multiplies signal_x and filter_h from the current location through to the end of the filter taps. After the accumulation the result is stored in result_y. Remember that normally you would 'flip' one of the signals before convolving them, but since the filter is symmetrical you can ignore that step. Figures of signal_x, filter_h, and the resulting convolution are shown below (using GNU Octave):



Note the 4th figure talks about decimation. The last half of the example code demonstrates another useful technique in DSP and that is reducing the sampling rate of some signal by using decimation. The most important thing to remember about decimation is that you need to filter it before hand to avoid aliasing. As you may have guessed, this code is really more related to decimation than convolution if you replace filter_h with some anti-aliasing filter. The code is identical except for two important points; one is that now you are incrementing the index by the decimation factor. It's that simple. But, you need to leave the accumulation loop incrementing by 1 though so you are filtering using useful information. The second important point isn't shown but it is that your results array, here result_y, can be reduced in size when you allocate it beforehand. It's a waste to filter a signal and store it in some array A with size X and then decimate it in another loop and save it in another array B with size X/2? Obviously this code is a great space saver, and can be done because by definition decimation is throwing away output data.

That's it! I hope this has helped you understand implementing convolution and decimation a little better.

26 February 2008

Whole System Timing

Sometimes when developing on DSPs we need to keep precise timing records between inputs and outputs. For example, the time between an incoming sinusoid, work performed on it, and output sinusoid might be expected to be 5ms in a requirement. But care should be taken to be clear on what the requirements mean by time between "input" and "output". It could be referring to the actual DSP or it could be referring to the entire system. Each component has a delay attributed to it. For example just because the signal is output from the DSP doesn't mean it won't go through filters, upconverters, digital to analog converters, splitters, amplifiers, etc. These could be in the form of FPGAs from Xilinx, other DSPs, or separate "black boxes". You need to ensure that the timing development reflects the entire system. Otherwise the system may be completely non-functional.

Cache Coherency and DMA Transfers

When performing DMA transfers on modern computers (or DSPs in my case), it is important to remember some important points in order to be successful. I will review the points I know are important to Texas Instruments DSP development. I'm sure they are applicable to other hardware as well.

One of the most important points is the following: DMA transfers do not automatically handle cache coherency. The first time I attempted to use DMA transfers in development I was moving data directly from one external memory to another external memory (this is also a bad idea, which I'll go over later). Upon completion when the destination data was read, it was corrupt, why? Because when you request a DMA transfer from a cacheable memory location in external memory, the L2 controller pulls the data directly from that external memory location. This is a problem if you've been writing to that location previously, because the most recent data will only be held in L2 cache and only old data will reside in external memory. You need to issue a cache writeback or "flush" before you issue a DMA request that reads from a cacheable memory location. Likewise, if you are writing to external memory you need to invalidate cache lines, otherwise old data will be retrieved from the cache.

To make things more efficient, you need to consider the size of your cache lines and how they relate to your data in external memory. This is important because cache operations are entire line operations, not partial lines. Don't forget about internal DMA requests here (requests issued in the background by the L2 memory controller). On a cache miss of an external memory location, an entire L2 line's worth of data is fetched via an internal DMA request. So you want to "align" your data to the cache lines so each cache operation is as quick as possible, ie it only performs one DMA transfer and not two. On TI DSPs this is done with #pragma DATA_ALIGN(buffer, section).

One more thing, like was noted before, moving data from one external memory to another using DMA is extremely inefficient. Remember that the memory bus speed is very slow compared to the DSP/CPU clock. So that means that not only are you extremely slowed by one bus (read), but two (write), because the data must pass through the L2 memory controller. If at all possible use internal RAM. On TI DSPs, the leftover L2 after cache configuration becomes IRAM (aka ISRAM). To use IRAM on the DSP you would create a new section in the linker file that points to IRAM, and then in your code you would make a buffer reside in that section by #pragma DATA_SECTION(buffer, section).