Dingoo entry.a header file?


Reesy

Certified Guru
Joined
Nov 26, 2006
Messages
301
Age
45
Location
Hampshire, UK
Website
reesy.gp32x.de
Entry.a from the Dingoo SDK contains the following functions. Does anyone know if there is a complete header file for Entry.a? I've found the odd definition in some of the Dingoo SDK examples but nothing complete.

dl_main
run_console
GBA_card_write_rom
write_gba_card
vxMem_Info
GBA_Get_Rom
GBA_hardware_init
getext
AppMain
abort
printf
sprintf
fprintf
strncasecmp
malloc
realloc
free
fread
fwrite
fseek
LcdGetDisMode
vxGoHome
StartSwTimer
free_irq
fsys_RefreshCache
strlen
_lcd_set_frame
_lcd_get_frame
lcd_get_cframe
ap_lcd_set_frame
lcd_flip
__icache_invalidate_all
__dcache_writeback_all
TaskMediaFunStop
OSCPUSaveSR
OSCPURestoreSR
serial_getc
serial_putc
_kbd_get_status
get_game_vol
_kbd_get_key
fsys_fopen
fsys_fread
fsys_fclose
fsys_fseek
fsys_ftell
fsys_remove
fsys_rename
fsys_ferror
fsys_feof
fsys_fwrite
fsys_findfirst
fsys_findnext
fsys_findclose
fsys_flush_cache
USB_Connect
udc_attached
USB_No_Connect
waveout_open
waveout_close
waveout_close_at_once
waveout_set_volume
HP_Mute_sw
waveout_can_write
waveout_write
pcm_can_write
pcm_ioctl
OSTimeGet
OSTimeDly
OSSemPend
OSSemPost
OSSemCreate
OSTaskCreate
OSSemDel
OSTaskDel
GetTickCount
_sys_judge_event
fsys_fopenW
__to_unicode_le
__to_locale_ansi
get_current_language
get_dl_handle
dl_res_open
dl_res_get_size
dl_res_get_data
dl_res_close
pmp_au

Thanks
Reesy
 
This is what I got so far for entry.a:
Code:
         dl_main
         run_console
         GBA_card_write_rom
         write_gba_card
         vxMem_Info
         GBA_Get_Rom
         GBA_hardware_init
         getext
         AppMain
void     abort()
int      printf(const char*, ...)
int      sprintf(char*, const char*, ...)
int      fprintf(FILE*, const char*, ...)
         strncasecmp
void*    malloc(size_t)
void*    realloc(void*, size_t)
void     free(void*)
size_t   fread(void*, size_t, size_t, FILE*)
size_t   fwrite(const void*, size_t, size_t, FILE*)
int      fseek(FILE*, long int, int)
         LcdGetDisMode
         vxGoHome
         StartSwTimer
void     free_irq(unsigned int irq)
         fsys_RefreshCache
         strlen
void     _lcd_set_frame()
void*    _lcd_get_frame()
void*    lcd_get_cframe()
         ap_lcd_set_frame
         lcd_flip
void     __icache_invalidate_all()
void     __dcache_writeback_all()
         TaskMediaFunStop
OS_CPU_SR OSCPUSaveSR()
void      OSCPURestoreSR(OS_CPU_SR cpu_sr)
int      serial_getc()
void     serial_putc(const char c)
void     _kbd_get_status(KEY_STATUS*)
         get_game_vol
unsigned int _kbd_get_key()
FILE*    fsys_fopen(const char*, const char*)
int      fsys_fread(void*, size_t, size_t, FILE*)
int      fsys_fclose(FILE*)
int      fsys_fseek(FILE*, long int, int)
long int fsys_ftell(FILE*)
         fsys_remove
         fsys_rename
int      fsys_ferror(FILE*)
int      fsys_feof(FILE*)
int      fsys_fwrite(const void*, size_t, size_t, FILE*)
         fsys_findfirst
         fsys_findnext
         fsys_findclose
         fsys_flush_cache
         USB_Connect
         udc_attached
         USB_No_Connect
void*    _waveout_open(void *)
int      _waveout_close(void *)
void     _waveout_close_at_once(unsigned int)
         waveout_set_volume
         HP_Mute_sw
         waveout_can_write
         waveout_write
int      pcm_can_write()
int      pcm_ioctl(unsigned int cmd, unsigned long arg)
uint32_t  OSTimeGet()
void      OSTimeDly(uint16_t ticks)
void      OSSemPend(OS_EVENT* event, uint16_t timeout, uint8_t* error)
uint8_t   OSSemPost(OS_EVENT* event)
OS_EVENT* OSSemCreate(uint16_t cnt)
uint8_t   OSTaskCreate(void (*task)(), void* data, uint16_t stack_size, uint8_t priority)
OS_EVENT* OSSemDel(OS_EVENT *event, uint8_t option, uint8_t* error)
uint8_t   OSTaskDel(uint8_t priority)
unsigned long int GetTickCount()
int      _sys_judge_event()
         fsys_fopenW
         __to_unicode_le
char*    __to_locale_ansi(wchar_t*)
         get_current_language
         get_dl_handle
         dl_res_open
         dl_res_get_size
         dl_res_get_data
         dl_res_close
         pmp_au

If anyone has any questions regarding the ones I've defined then ask, some interesting information about things I discovered:

For GetTickCount() the tick resolution seems to be 960KHz (960000).

Once the framebuffer has been written to (at address _lcd_get_frame), you need to call _lcd_set_frame and a dcache invalidate to update the screen.

You don't need to allocate space for the framebuffer, that is done inside the operating system at some point.

The button masks are:
Code:
#define CONTROL_BUTTON_A      0x80000000
#define CONTROL_BUTTON_B      0x00200000
#define CONTROL_BUTTON_X      0x00010000
#define CONTROL_BUTTON_Y      0x00000040
#define CONTROL_BUTTON_START  0x00000800
#define CONTROL_BUTTON_SELECT 0x00000400

#define CONTROL_TRIGGER_LEFT  0x00000100
#define CONTROL_TRIGGER_RIGHT 0x20000000

#define CONTROL_DPAD_UP       0x00100000
#define CONTROL_DPAD_DOWN     0x08000000
#define CONTROL_DPAD_LEFT     0x10000000
#define CONTROL_DPAD_RIGHT    0x00040000
The code in the loader seems to be just plain wrong.

Also the whole of interface.c, and keyboard.h are completely redundant.

EDIT: The list has been modified for ones that I haven't fully determined, and some new ones.
IMPORTANT NOTE: strlen is not the same as strlen in the c standard library, using it as such will cause your programs to crash.
 
Is it easy enough to set the A320 to 256 pallete mode? I'm interested in porting over some GP32 goodies and make a sort of blog of the process.
 
Ok, I worked out some new information regarding the display system, my last sample did not use double buffering but I worked out how it works.

_lcd_get_frame() returns the address of the display buffer.
_lcd_set_frame() updates the lcd with the contents of the display buffer.
g_pGameDecodeBuf contains the address of the draw buffer.

To draw to the display correctly you have to:
- Draw to the draw buffer.
- Copy the draw buffer into the display buffer.
- Writeback the dcache.
- Call _lcd_set_frame to update the display.

I have a new sample of this working correctly, located here: http://flatmush.juliusparishy.com/a320/DoubleBuffer.zip

Edit: Craigx, google _lcd_get_frame and look at the translated spanish forums, they have a macro that you can use to put the display into 8-bit mode.
 
here is another one which i find out using the sources found on igenic's ftp:

/* PCM ioctl command */
#define PCM_SET_SAMPLE_RATE 0
#define PCM_SET_CHANNEL 1
#define PCM_SET_FORMAT 2
#define PCM_SET_VOL 3
#define PCM_GET_VOL 4

/* Audio Sample Format */
#define AFMT_U8 8
#define AFMT_S16_LE 16

int pcm_ioctl(unsigned int cmd, unsigned long arg)
- 1st argument is one of the 1st defines
- 2nd argument depends on your command:
-- PCM_SET_VOL (value between 0 & 100)
-- PCM_SET_FORMAT (value of audio sample format)

This i found in interface.c that came with the booblebop example :
But i'm unable to put it to good use :(

extern void *_waveout_open(void *);
extern int _waveout_close(void *);
extern void _waveout_close_at_once(unsigned int);

Hey we are looking at the wrong file for the audio part !!!
we need to be looking at, and using the following lib : libaudio.a which is located in c:\cygwin\mipseltools\lib !! The function are defined there and more public function are availible there ! We only need to figure out what the paremeters are they take. I have used the ida decompiler to get the asm files (mips instructions) but i can not figure out how to deduct the paremeters it takes based on the asm file.

waveout_open
waveout_write
waveout_close
waveout_reset
waveout_ioctl
waveout_can_write
waveout_set_volume
waveout_get_volume
wavein_open
wavein_read
wavein_close
wavein_can_read
wavein_reset
wavein_ioctl
jz_audio_reset
i2s_codec_close
jz_audio_open
pcm_read
pcm_write
codec_delay_us
codec_set_linein_volume
init_jz_i2s
pcm_ioctl
pcm_can_write
pcm_can_read
jz_clocks
codec_replay_main
 
I have now come to a point where I'm stuck due to my lack of knowledge of MIPS and GCC.
The source for all the functions can be found in the library files that come with the mips toolchain, so that's become pretty easy, however the functions linked in entry.a are only a very small (and limiting) subset of the actual functions the operating system provides.
I know the definitions of a lot of the other functions, but I don't know how to modify symbol.o (which is within entry.a) to link to the extra new functions.
I seem to always get linker errors when I try to include the libccenv (which contains a lot of nice functions) because it clashes with entry.a (can't compile without that) and because some of the functions in it depend on libraries that I don't have (aren't in the toolchain).

Anyone got any ideas?
 
flatmush said:
functions linked in entry.a are only a very small (and limiting) subset of the actual functions the operating system provides.
I know the definitions of a lot of the other functions, but I don't know how to modify symbol.o (which is within entry.a) to link to the extra new functions.
My fear is that it is not possible. As I understand it, uCOS can be linked into the main executable and I fear that is the way it is used here. So IMO there is no separate full featured uCOS present which is loading the blue menu executable. There is one main executable (China Chip Portable Media Player CCPMP.bin?) with parts of uCOS compiled in statically. And then only some of functions of main executable are exported to external executables/shared libraries (emulators, 3d games) and those are in the entry.a

If I am right then maybe some additional uCOS code can be found inside the main executable and somehow added to entry.a but I fear other unneeded code is either optimized out or inlined so it is not callable.

I hope I am wrong, though.
 
JoyRider helped me to get the libraries that come with the s2dsdk toolchain to work so that we don't need to do that anymore, unfortunately half of the libraries are broken or not fully compatible with the dingoo for some reason, so it'll be a bit of work to figure it all out when I have some time.
 
Hey guys, thank you for your work and source to code without the sdk on dingoo !
I have been trying this today and it works great ! (the official sdk is just a mess ...)
anyway, I tried to understand how to use the waveout_ functions to make some sound get out of the dingoo and after some hours of disassembly of the official sdk example app and trying to understand mips assembly, I finally got a result.
here you go:
Code:
typedef	struct
{
	unsigned int	frequency;
	unsigned short	bits;
	unsigned char	channels;
	unsigned char	volume;
}		TWaveOpen;

TWaveOpen	mywaveinfo;

extern	int	waveout_write(int dummy, char *buffer, int count);
extern	int	waveout_can_write();

extern	void	*waveout_open(TWaveOpen *woinfo);
extern	int		waveout_close(void *);


// put some raw pcm wave data here
unsigned char mySound_16kHz_16bits_mono_LE[] = {...};


	mywaveinfo.frequency = 16000;
	mywaveinfo.bits = 16;
	mywaveinfo.channels = 1;
	mywaveinfo.volume = 100;

	waveout_open(&mywaveinfo);

	waveout_write(0, mySound_16kHz_16bits_mono_LE, sizeof(mySound_16kHz_16bits_mono_LE));
 
Back
Top