Jump to content

Stonebone

Members+
  • Posts

    10
  • Joined

  • Last visited

Everything posted by Stonebone

  1. Ok well, maybe you should keep the source in a public repository instead. I assume you use something like cvs anyway since it's so convinient even if you are the only programmer. That way you don't need to spend time on doing many intermediate releases. Sourceforge started supporting subversion recently...
  2. While transfering big files with tftpds i noticed that it seemed to fail systematically. After studying the traffic in ethereal I came to the conclusion that dswifi calculates the checksum for the udp package incorrectly in some rare cases. I read here on the forum that it fails on odd-sized packages but this was an even sized package so it is not the same bug. After spending several hours tracking down this bug, my friend Gustav Munkby and I found the cause of this bug. In a few places in the checksum calculation code similar to this appears: checksum += checksum>>16; checksum &= 0xFFFF; This code is meant to take of the carries from the ones'-complement additions. The correct way of doing this is like this: while(checksum >> 16) checksum = (checksum & 0xFFFF) + (checksum >> 16); As an example, if checksum = 0x1FFFF the former code give an incorrect result (0), but the later code will give the correct result (1). I have updated my hacked version to fix this in at least some places: http://www.itstud.chalmers.se/~larssten/wifi_lib.tar.bz2
  3. I've released tftpds 1.0. See my new page: http://www.itstud.chalmers.se/~larssten/nds/
  4. The ARM9 cpu is running at 33.514 MHz. The divisor is set to 256 gives us (33.514*10^6 / 256)^-1 ≈ 7.6*10^-6 s per tick. Then we have 13106 * 7.6*10^-6 ≈ 0.100 s. This is how I understand that the timers work anyway, I might be wrong.
  5. That's great to hear. I can't wait!
  6. Ah yes I should have said, I added this before the main method as well: extern void sgIP_ARP_Timer100ms(); extern void Wifi_Update();
  7. By using a standard protocol I don't need to write a pc client. This is how I do on the pc side: curl -T tftpds.ds.gba tftp://192.168.0.189
  8. Download the new code here: http://www.itstud.chalmers.se/~larssten/wifi_lib.tar.bz2 It has some changes to make it compile with the latest devkitpro on linux, but search for "stonebone" to find the important changes. Basically it's just calling IPC_SendSync(0) when a packet is ready to be sent or recieved. Here's what you need to do to use the hacked version. Before you would do something like this in ARM9: TIMER3_CR = 0; irqSet(IRQ_TIMER3, Wifi_Timer_50ms); irqEnable(IRQ_TIMER3); TIMER3_DATA = (u16)-13106; TIMER3_CR = TIMER_IRQ_REQ | TIMER_DIV_256; 1. Replace "Wifi_Timer_50ms" with "sgIP_ARP_Timer100ms". Since Wifi_Timer_50ms() used to call that function we still need to have that timer. Perhaps it could be solved in some other way but it worked for me. 2. Then add the following code: irqSet(IRQ_IPC_SYNC, Wifi_Update); irqEnable(IRQ_IPC_SYNC); REG_IPC_SYNC = IPC_SYNC_IRQ_ENABLE; This makes dswifi check for new packages every time the IPC interrupt occurs. 3. You also need to add the above code block to ARM7 as well somewhere early in main(). 4. I think you also need to call Wifi_Update() after printing "ARM7 Init Confirmed." (on ARM9) because it does some more stuff than checking for packages. It can't hurt to have it anyway. Hope that was all. Yes I looked at your code but it was very hard to understand so I thought it would be easier to write something from scratch. My goal was to write a similar program as yours but which writes to my Flash Advance Pro 256M cart. It doesn't have all the complicated menus of wifi_lib_test which makes it quicker to use. At the moment it has hardcoded wifi settings but I plan to read them from firmware instead which should work fine. Ofcourse if you don't have Mario Kart DS it would be complicated to change the settings but I don't know how useful this program will be for others anyway.
  9. I had hoped that sgstair would respond to this thread... Anyway, I've implemented some simple IPC interrupts in the lib, only a few lines of code changed, and the speed increased from about 5 kb/s to about 30 kb/s. That six times faster... If anyone wants the changes I can post them here.
  10. I've implemented a simple TFTP-server that I'm going to use for a project later. TFTP works by sending one DATA packet, wait for ACK, send next DATA, and so on. This means only one packet is in the queue at any time and therefore the protocol is very sensitive to latency. I've only gotten about 5 kb/s transfer rates. I've discovered that the bottleneck is the communication between the ARM7 and the ARM9 processors. The ARM9 polls for new packages every 50 ms, when the Wifi_Timer_50ms() function is called. That means new packages are recieved 10 times every second. Since TFTP sends 512 bytes in every package you only get a transfer rate of 10 * 512 ~ 5 kb/s. This leads me to two questions: 1. Why is it using polled communications between the processors when the IPC interrupts could be used? 2. Why is the IP stack implemented on the ARM9 processor and not ARM7? It would be much more efficient if I could implement the TFTP-server in ARM7... The socket functions could be made available on both processors using IPC for ease of use. And another question: 3. In wifi_lib_test TIMER3_DATA is set to -13106. Doesn't that give an interrupt every 100 ms instead of 50 ms? PS. using wifi_lib 0.2b
×
×
  • Create New...