TCP/IP can only send echo

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
Mega Man
Posts: 260
Joined: Sat Jun 18, 2005 3:14 am
Contact:

TCP/IP can only send echo

Post by Mega Man »

I tried to use ps2gdb, but it was not working. I got only a broken echo when I used telnet. I debugged a little bit: The transfer between EE and IOP is not working, only the first non-aligned part of the data are correctly transfered from EE to the IOP.
So I tried to test the network transfer with an easier program. I used ee-echo example. The normal echo function is working, because for receiving and sending the same buffer seems to be used.
When I change the program to send a different string, it is not working anymore and sends still the echo.

I attached the changed code part of echo.c:

Code: Select all

#include <string.h>

int HandleClient&#40; int cs &#41;
&#123;
   int rcvSize,sntSize;
   const char answer&#91;&#93; = "Hello world!!!";
   fd_set rd_set;

   rcvSize = recv&#40; cs, buffer, 100, 0&#41;;
   if &#40; rcvSize <= 0 &#41;
   &#123;
      printf&#40; "PS2ECHO&#58; recv returned %i\n", rcvSize &#41;;
      return -1;
   &#125;
   sntSize = send&#40; cs, answer, strlen&#40;answer&#41;, 0 &#41;;

   return 0;
&#125;
Is this problem only on my ps2 (unmodified v10)?
There is a special syscall used for transfering the aligned part of the data from EE to IOP, which seems not to work (file iop/tcpip/tcpips/src/ps2ips.c: SifRpcGetOtherData()). Did somebody know why this is not working?
radad
Posts: 246
Joined: Wed May 19, 2004 4:54 pm
Location: Melbourne, Australia

Post by radad »

I have also come across the same problem when testing ee-echo. I found the same issue, when I replace your send above with this:

Code: Select all

sntSize = send&#40; cs, answer+3, strlen&#40;answer+3&#41;, 0 &#41;;
It works as it using the misalign section.

On the ee side it is using the function SifWriteBackDCache, can anybody tell me what this does? Also it is using the macro IS_UNCACHED_SEG, where can I find out some information relating to this? Also, like Mega Man said, what does SifRpcGetOtherData do? How much of the memory do the ee and iop share?

Hopefully someone can help here.
Mega Man
Posts: 260
Joined: Sat Jun 18, 2005 3:14 am
Contact:

Post by Mega Man »

The ee has a data cache. Some memory operations are not directly written to the memory. It will be cached. The function SifWriteBackDCache() will write the data from the cache to the memory, because the data are transfered via DMA. DMA cannot access the data cache, it can only access the main memory. So the cache must be flushed.
The ee core doesn't have direct access to memory. All memory is mapped via memory managment unit (MMU). The first area at 0x0000000 is mapped to physical memory address 0x0000000. I think this is cached. The macro IS_UNCACHED_SEG checks whether the address is in the uncached area (seems to be at address 0x20000000). But all these values depends on configuration of the mmu.
The call to SifWriteBackDCache() is always done in the echo example. I think this is correct here.

As I read the code: the transfer will only work if SifRpcGetOtherData() copies data from ee memory to iop memory. But this function doesn't overwrite the given iop memory. The function always returns 0x70000. Did anybody know the meaning of this error code?

The module "fileXio.irx" also use SifRpcGetOtherData(), so it should also fail. But I don't know where the module is used. Did anyone uses "fileXio.irx"?
radad
Posts: 246
Joined: Wed May 19, 2004 4:54 pm
Location: Melbourne, Australia

Post by radad »

As far as I can see SifRpcGetOtherData should never return 0x70000.

I have been trying to work out how all the sif stuff works. In the sifcmd.h file what are the DECLARE_IMPORT numbers supposed to match up with?
radad
Posts: 246
Joined: Wed May 19, 2004 4:54 pm
Location: Melbourne, Australia

Post by radad »

Haven't found my answer as yet. My guess would be that they are in the same order as the functions are packed into the libkernel.a. As the order is quite different this probably isn't it.
Mega Man
Posts: 260
Joined: Sat Jun 18, 2005 3:14 am
Contact:

Post by Mega Man »

radad wrote:Haven't found my answer as yet. My guess would be that they are in the same order as the functions are packed into the libkernel.a. As the order is quite different this probably isn't it.
No, the references are resolved by the PS2-IOP-Kernel. It is some kind of a dynamic linker.
There is a description on ps2dev.org. But I don't saved the link. I couldn't find it in the last days, it is very difficult to find it again. I think we need a index on the website. Then I used google to find it. But here is the link
http://ps2dev.org/kb.x?T=226. I also find a description in the hello example: http://www.bringyou.to/games/PS2IOP.pdf.

The function is exported by a module called "sifman". We need to find a module using the function in a ps2 game. So we can check the number. But the module mustn't be stripped. We need the debug information to use iop-objdump on it. The parameters could be also wrong.
By the way did you also use a v10 console. The parameters could be changed in later versions.
radad
Posts: 246
Joined: Wed May 19, 2004 4:54 pm
Location: Melbourne, Australia

Post by radad »

Ok, I was going on the assumption that the call is made to the SifRpcGetOtherData in ee/kernel/src/sifrpc.c. Are you saying that this function is partof the IOP kernel, something we don't have the source code for?

I think I have a v9 or v10, not sure.
Mega Man
Posts: 260
Joined: Sat Jun 18, 2005 3:14 am
Contact:

Post by Mega Man »

radad wrote:Are you saying that this function is partof the IOP kernel, something we don't have the source code for?.
Yes, we don't have the source code for it (it is a module located in the ps2 rom). But I finally got the problem. When you know it, it is very easy to solve. The function SifRPCGetOtherData() is not exported by module "sifman", it is exported by module "sifcmd". So we just need to move the entry I_sceSifGetOtherData from section "sifman_IMPORTS_start" to "sifcmd_IMPORTS_start" (file: ps2sdk/iop/tcpip/tcpips/src/imports.lst). Someone need to fix this in CVS.
In the module "fileXio.irx" this is correctly done, so this module should work.

Thank you for help, without you I would never have the idea to check the function number.
radad
Posts: 246
Joined: Wed May 19, 2004 4:54 pm
Location: Melbourne, Australia

Post by radad »

Hey good work. It now works for me also.
pixel
Posts: 791
Joined: Fri Jan 30, 2004 11:43 pm

Post by pixel »

Fixed in CVS. Thanks!
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
Post Reply