Using The 940t


zacaj

void main()
Joined
Apr 3, 2007
Messages
362
Age
29
Location
NY
Website
zacaj.com
I used to program for the iPod through iPodLinux, and the iPod had dual arm7 processors and no MMU. When I wanted to use the 2ND CPU, Id use commands from this file:CODE
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
#define outl(a, b) (*(volatile unsigned int *)(b) = (a))
#define inl(a) (*(volatile unsigned int *)(a))
#define DMA_BUFFER 0x40000040
#define COP_HANDLER 0x4001501C
#define COP_STATUS 0x40015020
#define COP_RUNNING (1 << 0)
#define COP_LINE_REQ (1 << 1)
#define COP_LINE_REQ2 (2 << 1)
int cop_execute(void (*function)())
{
outl((unsigned int)function, COP_HANDLER);
outl(0x0, 0x60007004);
return 1;
}
void cop_lcd_test()
{
while (inl(COP_STATUS) & COP_RUNNING)
{
while ((inl(COP_STATUS) & COP_LINE_REQ)==0);
outl(inl(COP_STATUS) &~ COP_LINE_REQ, COP_STATUS);
}
}
#define CACHE_CTL (*(volatile unsigned long *)(0x6000c000))
#define CACHE_DISABLE 0
void cop_begin()
{
outl(inl(COP_STATUS) &~ COP_LINE_REQ2, COP_STATUS); // clear frameready
cop_execute(cop_lcd_test);
outl(COP_RUNNING, COP_STATUS);

}
void cop_set(void (*function)())
{
}
void cop_end()
{
outl(inl(COP_STATUS) &~ COP_RUNNING, COP_STATUS); // set to 0
outl(inl(COP_STATUS) | COP_LINE_REQ, COP_STATUS);
}


I think Id just pass functions to cop_execute, and to send data to the 2ND CPU, it pass it to outl , then in functions which id passed to cop_execute, id set another variable of the same type as what i passed to outl to inl with the same address. Could this be modified to work with the GP2X?

Also, if I had code which could be written in C written in C++(classes instead of structs,etc, but no polymorphism or anyhting), would I get any noticable speed increase to use the C code compiled in gcc over the C++ code compiled in g++?
 
No, that's not how you access the 940T. There is however code in rlyeh's sdk, the wiki, and various open source programs.
 
Back
Top