}\r
\r
\r
+/* this must be called after mmu hack, the allocated regions must not get cached */\r
+void sharedmem_init(void)\r
+{\r
+ if (shared_mem != NULL) return;\r
+\r
+ shared_mem = (unsigned char *) mmap(0, 0x210000, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0x2000000);\r
+ if(shared_mem == MAP_FAILED)\r
+ {\r
+ printf("mmap(shared_data) failed with %i\n", errno);\r
+ exit(1);\r
+ }\r
+ shared_data = (_940_data_t *) (shared_mem+0x100000);\r
+ /* this area must not get buffered on either side */\r
+ shared_ctl = (_940_ctl_t *) (shared_mem+0x200000);\r
+ mp3_mem = (unsigned char *) mmap(0, MP3_SIZE_MAX, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0x3000000);\r
+ if (mp3_mem == MAP_FAILED)\r
+ {\r
+ printf("mmap(mp3_mem) failed with %i\n", errno);\r
+ exit(1);\r
+ }\r
+ crashed_940 = 1;\r
+}\r
+\r
+\r
extern char **g_argv;\r
\r
/* none of the functions in this file should be called before this one */\r
gp2x_memregl[0x4508>>2] = ~(1<<26); // unmask DUALCPU ints in the undocumented 940's interrupt controller\r
\r
\r
-\r
- if (shared_mem == NULL)\r
- {\r
- shared_mem = (unsigned char *) mmap(0, 0x210000, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0x2000000);\r
- if(shared_mem == MAP_FAILED)\r
- {\r
- printf("mmap(shared_data) failed with %i\n", errno);\r
- exit(1);\r
- }\r
- shared_data = (_940_data_t *) (shared_mem+0x100000);\r
- /* this area must not get buffered on either side */\r
- shared_ctl = (_940_ctl_t *) (shared_mem+0x200000);\r
- mp3_mem = (unsigned char *) mmap(0, MP3_SIZE_MAX, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0x3000000);\r
- if (mp3_mem == MAP_FAILED)\r
- {\r
- printf("mmap(mp3_mem) failed with %i\n", errno);\r
- exit(1);\r
- }\r
- crashed_940 = 1;\r
- }\r
-\r
if (crashed_940)\r
{\r
unsigned char ucData[1024];\r