Medios Api for .med applications
Back to index

(Generated automatically on Sat Jul 5 00:13:01 CEST 2008)

Function types:

GFX

top
Name
Signature
Description
gfx_openGraphicsvoid gfx_openGraphics(void)
gfx_initGraphicsvoid gfx_initGraphics(void)
gfx_closeGraphicsvoid gfx_closeGraphics(void)
gfx_setPlanevoid gfx_setPlane(int vplane)
gfx_getPlaneint gfx_getPlane(void)
gfx_planeHidevoid gfx_planeHide(int vplane)
gfx_planeShowvoid gfx_planeShow(int vplane)
gfx_planeIsShownint gfx_planeIsShown(int vplane)
gfx_planeSetStatevoid gfx_planeSetState(int vplane,int state)
gfx_planeGetStateint gfx_planeGetState(int vplane)
gfx_planeSetSizevoid gfx_planeSetSize(int vplane,int width,int height,int bitsPerPixel,int mode)
gfx_planeGetSizevoid gfx_planeGetSize(int vplane,int * width,int * height,int * bitsPerPixel)
gfx_planeSetPosvoid gfx_planeSetPos(int vplane,int x,int y)
gfx_planeGetPosvoid gfx_planeGetPos(int vplane,int * x,int * y)
gfx_planeGetBufferOffsetvoid* gfx_planeGetBufferOffset(int vplane)
gfx_planeSetBufferOffsetvoid gfx_planeSetBufferOffset(int vplane, void * offset)
gfx_setRectCursorColorvoid gfx_setRectCursorColor(int color,int ram_palette)
gfx_setRectCursorBordervoid gfx_setRectCursorBorder(int horiz,int verti)
gfx_enableRectCursorvoid gfx_enableRectCursor(int state)
gfx_setRectCursorPosvoid gfx_setRectCursorPos(int x,int y)
gfx_setRectCursorSizevoid gfx_setRectCursorSize(int width,int height)
gfx_setPalletteRGBvoid gfx_setPalletteRGB(int r, int g, int b, int index)
gfx_setEntirePalettevoid gfx_setEntirePalette(int palette[256][3],int size)
osd_getTrspBitint osd_getTrspBit(void)
osd_getBlendFactorBitint osd_getBlendFactorBit(int factor)

Drawing

top
Name
Signature
Description
gfx_clearScreenvoid gfx_clearScreen(unsigned int color)
gfx_drawPixelvoid gfx_drawPixel(unsigned int color,int x, int y)
gfx_readPixelunsigned int gfx_readPixel(int x, int y)
gfx_drawRectvoid gfx_drawRect(unsigned int color, int x, int y, int width, int height)
gfx_fillRectvoid gfx_fillRect(unsigned int color, int x, int y, int width, int height)
gfx_drawLinevoid gfx_drawLine(unsigned int color, int x1, int y1, int x2, int y2)
gfx_putSvoid gfx_putS(unsigned int color, unsigned int bg_color, int x, int y, unsigned char *s)
gfx_putnSvoid gfx_putnS(unsigned int color, unsigned int bg_color, int x, int y, int n, unsigned char *s)
gfx_getStringSizevoid gfx_getStringSize(unsigned char *str, int *w, int *h)
gfx_putCvoid gfx_putC(unsigned int color, unsigned int bg_color, int x, int y, unsigned char s)
gfx_drawSpritevoid gfx_drawSprite(unsigned int * palette, SPRITE * sprite, int x, int y)
gfx_drawBitmapvoid gfx_drawBitmap(BITMAP * bitmap, int x, int y)
gfx_drawResizedBitmapvoid gfx_drawResizedBitmap(BITMAP * bitmap, int x, int y,int width,int height,int mode)
gfx_scrollWindowVertvoid gfx_scrollWindowVert(unsigned int bgColor, int x, int y, int width, int height, int scroll, int UP)
gfx_scrollWindowHorizvoid gfx_scrollWindowHoriz(unsigned int bgColor, int x, int y, int width, int height, int scroll, int RIGHT)
gfx_fontSetvoid gfx_fontSet(int font_nb)
gfx_fontGetint gfx_fontGet(void)
gfx_loadBmp_toPlane_centerMED_RET_T gfx_loadBmp_toPlane_center(char * filename,int plane)
gfx_loadBmp_toPlane_coordMED_RET_T gfx_loadBmp_toPlane_coord(char * filename,int plane,int x,int y)
gfx_loadBmp_toMem_centerMED_RET_T gfx_loadBmp_toMem_center(char * filename,char * dest,int w,int h,int output_mode)
gfx_loadBmp_toMem_coordMED_RET_T gfx_loadBmp_toMem_coord(char * filename,char * dest,int w,int h,int output_mode,int x,int y)

GUI

top
Name
Signature
Description
widget_createWIDGET widget_create(void)
checkbox_createCHECKBOX checkbox_create(void)
trackbar_createTRACKBAR trackbar_create(void)
chooser_createCHOOSER chooser_create(void)
button_createBUTTON button_create(void)
menu_createMENU menu_create(void)
menuItem_createMENU_ITEM menuItem_create(void)
textMenu_createTEXTMENU textMenu_create(void)
textMenuItem_createTEXTMENU_ITEM textMenuItem_create(void)
widgetMenu_createWIDGETMENU widgetMenu_create(void)
widgetMenuItem_createWIDGETMENU_ITEM widgetMenuItem_create(void)
widgetMenuCheckbox_createWIDGETMENU_CHECKBOX widgetMenuCheckbox_create(void)
widgetMenuTrackbar_createWIDGETMENU_TRACKBAR widgetMenuTrackbar_create(void)
widgetMenuChooser_createWIDGETMENU_CHOOSER widgetMenuChooser_create(void)
iconMenu_createICONMENU iconMenu_create(void)
iconMenuItem_createICONMENU_ITEM iconMenuItem_create(void)
widgetList_createWIDGETLIST widgetList_create(void)
label_createLABEL label_create(void)
browser_simpleBrowseint browser_simpleBrowse(char * path,char * res)
icon_loadICON icon_load(char * filename)
icon_addICON icon_add(char * name,unsigned char * data,int w,int h)
icon_getICON icon_get(char * name)
msgBox_showint msgBox_show(unsigned char* caption, unsigned char* msg, int type, int icon,int evt_hanlder)
msgBox_infovoid msgBox_info(unsigned char* msg)
virtKbdvoid virtKbd(int evt_hanlder, char * str)Virtual Keyboard, str will be changed by the string inputed, evt_handler should be an active event pipe get from evt_getHandler

Events

top
Name
Signature
Description
evt_getHandlerint evt_getHandler(unsigned int mask)get a new event handler from kernel, returns an error if all handlers are busy
evt_freeHandlerMED_RET_T evt_freeHandler(int num_evt_pipe)release an event handler
evt_getStatusint evt_getStatus(int num_evt_pipe)reads next event and returns the event number (returns NO_EVENT if there is no event)
evt_getFullStatusMED_RET_T evt_getFullStatus(int num_evt_pipe, struct evt_t * evt)same as aove, but full evt info will be send
evt_getStatusBlockingint evt_getStatusBlocking(int num_evt_pipe)same as evt_getStatus but thread is blocked until an event occurs

Buttons

top
Name
Signature
Description
getBtnNameconst char * getBtnName(int btn)returns button name
btn_readStateint btn_readState(void)direct access to button state, use it with BTMASK_* from include/buttons.h

File system

top
Name
Signature
Description
openint open(const char* pathname, int flags)
closeint close(int fdesc)
fsyncint fsync(int fdesc)
readint read(int fdesc, void *buf, int count)
lseekint lseek(int fdesc, int offset, int whence)
writeint write(int fdesc, const void *buf, int count)
truncateint truncate(int fdesc, int length)
filesizeint filesize(int fdesc)
ftellint ftell(int fdesc)
opendirDIR* opendir(const char* name)
closedirint closedir(DIR* dir)
readdirstruct dirent* readdir(DIR* dir)
mkdirint mkdir(const char *name, int mode)
fs_pwdMED_RET_T fs_pwd(char * name)
fs_cdMED_RET_T fs_cd(char * name)

Dynamic Memory

top
Name
Signature
Description
mallocvoid* malloc(long size)Memory allocation,only SDRAM is currently available, not IRAM. NULL is returned if there isn't enough space
reallocvoid* realloc(void *buffer, long newsize)buffer reallocation, used to change the size of an existing buffer. For size increase, the implementation is not optimum as buffer is moved to a place with enough room
freevoid free(void *buf)free an allocated buffer (standard version)
kfreevoid kfree(void *buf)free an allocated buffer (kernel version, use it only if you know what you are doing)
callocvoid* calloc(unsigned int nmemb,unsigned int size)allocate a buffer of nmemb element of size size

String

top
Name
Signature
Description
strlwrvoid strlwr(char *s)
qsortvoid qsort(void* __base, size_t __nmemb, size_t __size, int(*_compar)(const void*, const void*))
atoiint atoi(const char *str)
strdupchar * strdup(const char * s)
strcasecmpint strcasecmp(const char *s1, const char *s2)
strncasecmpint strncasecmp(const char *s1, const char *s2, size_t n)
strpbrkchar * strpbrk(const char *,const char *)
strtokchar * strtok(char *,const char *)
strtok_rchar * strtok_r(char *ptr, const char *sep, char **end)
strsepchar * strsep(char **,const char *)
strspnsize_t strspn(const char *,const char *)
strcpychar * strcpy(char *,const char *)
strncpychar * strncpy(char *,const char *, size_t)
strcatchar * strcat(char *, const char *)
strncatchar * strncat(char *, const char *, size_t)
strcmpint strcmp(const char *,const char *)
strncmpint strncmp(const char *,const char *,size_t)
strnicmpint strnicmp(const char *, const char *, size_t)
strchrchar * strchr(const char *,int)
strrchrchar * strrchr(const char *,int)
strstrchar * strstr(const char *,const char *)
strlensize_t strlen(const char *)
strnlensize_t strnlen(const char *,size_t)
memsetvoid * memset(void *,int,size_t)
memcpyvoid * memcpy(void *,const void *,size_t)
memmovevoid * memmove(void *,const void *,size_t)
memscanvoid * memscan(void *,int,size_t)
memcmpint memcmp(const void *,const void *,size_t)
memchrvoid * memchr(const void *,int,size_t)
vsnprintfint vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
snprintfint snprintf(char * buf, size_t size, const char *fmt, ...)
vsprintfint vsprintf(char *buf, const char *fmt, va_list args)
sprintfint sprintf(char * buf, const char *fmt, ...)
vsscanfint vsscanf(const char * buf, const char * fmt, va_list args)
sscanfint sscanf(const char * buf, const char * fmt, ...)
atofdouble atof(char * str)
strtoddouble strtod(char * str, char ** ptr)

Sound

top
Name
Signature
Description
speaker_enablevoid speaker_enable(int enable)Changes the state of internal speaker
speaker_stateint speaker_state(void)Returns internal speaker state
speaker_availableint speaker_available(void)Returns true if device supports an internal speaker
codec_mustSeekbool codec_mustSeek(int * time)
codec_setElapsedvoid codec_setElapsed(int elapsed)
codec_seekDonevoid codec_seekDone(void)
codec_mustContinuebool codec_mustContinue(void)
output_writevoid output_write(void * buffer, int size)
output_outputParamsChangedvoid output_outputParamsChanged(void)
buffer_seekint buffer_seek(int offset,int whence)
buffer_readint buffer_read(void * buf,int count)
buffer_getActiveItemPLAYLIST_ITEM * buffer_getActiveItem(void)
mas_chgModeMED_RET_T mas_chgMode(int mode)MAS specific: change decoder mode
mas_mp3LaunchDecodevoid mas_mp3LaunchDecode(void)MAS specific: launch MP3 decode
mas_setMp3Buffervoid mas_setMp3Buffer(struct mas_sound_buffer * b1,struct mas_sound_buffer * b2)MAS specific: init buffers
mas_mp3DecodeStateint mas_mp3DecodeState(void)MAS specific: returns decoder state
mas_mp3StopDecodevoid mas_mp3StopDecode(void)MAS specific: stop decoder
mas_i2sChgSRatevoid mas_i2sChgSRate(int)MAS specific: change the sample rate for I2S PCM decoder
mas_clearMp3Buffervoid mas_clearMp3Buffer(void)MAS specific: clear buffer config

Cfg file

top
Name
Signature
Description
cfg_clearvoid cfg_clear(CFG_DATA * data)deallocates data (you must call this when you're finished with data)
cfg_newFileCFG_DATA * cfg_newFile(void)allocates data for a new file
cfg_readFileCFG_DATA * cfg_readFile(char * filename)allocates and reads data from an existing file, returns NULL if the file can't be red
cfg_writeFilebool cfg_writeFile(CFG_DATA * data, char * filename)writes data to a file, returns true upon success
cfg_rewindItemsvoid cfg_rewindItems(CFG_DATA * data)used to enumerate all items, returns to the first one
cfg_nextItembool cfg_nextItem(CFG_DATA * data, char * * name,char * * value)used to enumerate all items, reads the next item and returns its name and value
cfg_itemExistsbool cfg_itemExists(CFG_DATA * data, char * name)returns true if the item exists
cfg_readStringchar * cfg_readString(CFG_DATA * data, char * name)reads a string item
cfg_readIntint cfg_readInt(CFG_DATA * data, char * name)reads an integer item
cfg_readBoolbool cfg_readBool(CFG_DATA * data, char * name)reads a boolean item
cfg_writeStringvoid cfg_writeString(CFG_DATA * data, char * name,char * value)writes a string item
cfg_writeIntvoid cfg_writeInt(CFG_DATA * data, char * name,int value)writes an integer item
cfg_writeBoolvoid cfg_writeBool(CFG_DATA * data, char * name,bool value)writes a boolean item
cfg_addDummyLinevoid cfg_addDummyLine(CFG_DATA * data, char * text)adds a dummy line (usually a comment)
cfg_deleteItembool cfg_deleteItem(CFG_DATA * data, char * name)deletes an item, returns true if the item was found and deleted
cfg_printItemsvoid cfg_printItems(CFG_DATA * data)outputs a list of all items in the console, usefull for debug

csv file

top
Name
Signature
Description
csv_newFileMED_RET_T csv_newFile(char * filename)
csv_endMED_RET_T csv_end(void)
csv_line2ArrayMED_RET_T csv_line2Array(int nbItem,char ** item_array,char sepChar)
csv_readLineMED_RET_T csv_readLine(void * data,char * formatStr,char sepChar)

Time

top
Name
Signature
Description
tmr_getTickunsigned int tmr_getTick(void)returns current tick timer value (1tick=10ms / 100Hz)
tmr_getMicroTickunsigned int tmr_getMicroTick(void)1000 times more precise than tmr_getTick (1microtick=10µs / 100Khz)
time_getMED_RET_T time_get(struct med_tm * valTime)reads current date/time from clock, struct med_tm is defined in sys_def/time.h
time_setMED_RET_T time_set(struct med_tm * newTime)changes date/time of clock, struct med_tm is defined in
udelayvoid udelay(unsigned long usecs)waits for usecs
mdelayvoid mdelay(unsigned long msecs)waits for msecs

Energy Saving

top
Name
Signature
Description
set_timer_statusvoid set_timer_status(int timer_type,int power_mode,int status)enable/disable timer according to power mode
set_timer_delayvoid set_timer_delay(int timer_type,int power_mode,int delay)set timer delay according to power mode
get_timer_statusint get_timer_status(int timer_type,int power_mode)reads timer status according to power mode
get_timer_delayint get_timer_delay(int timer_type,int power_mode)reads timer delay according to power mode
halt_disableTimervoid halt_disableTimer(int disable)pause the Halt timer and keeps it curent setting (usefull for sound player, usb, ...)
DC_isConnectedint DC_isConnected(void)DC connector status
batLevelint batLevel(void)measures current bat level

Arch Info

top
Name
Signature
Description
getArchint getArch(void)gets arch type, include sys_def/arch.h to get available arch
getArchNamechar * getArchName(void)gets the name of the running device
getResolutionvoid getResolution(int * width,int * height)returns resolution for this arch

USb /_FW

top
Name
Signature
Description
usb_isConnectedint usb_isConnected(void)checks if usb cable is connected
FW_isConnectedint FW_isConnected(void)checks if FireWire cable is connected

Debug

top
Name
Signature
Description
printfvoid printf(char *fmt, ...)Prints text on UART and on device screen if mediOS was build with debug on screen
print_datavoid print_data(char * data,int length)Outputs a buffer to UART and debug screen
do_bkptvoid do_bkpt(void)Adds a breakpoint in code for aoMulator (needs specific build option)
getErrnoMED_RET_T getErrno(void)returns last error number

Irq

top
Name
Signature
Description
irq_changeHandlervoid irq_changeHandler(int irq_num,void(*fct)(int irq,struct pt_regs * regs))Change Handler for a given IRQ
irq_enablevoid irq_enable(int irq)enable IRQ
irq_disablevoid irq_disable(int irq)disable IRQ

Thread

top
Name
Signature
Description
yieldunsigned long yield(void)yield current thread

Misc

top
Name
Signature
Description
lang_getStrchar* lang_getStr(int id)Returns a string in current lang from an id, for a list of idea look in lang file from trunk/tools/lang
lcd_setBrightnessvoid lcd_setBrightness(int br)changes brightness (not an Hardware option)
lcd_getBrightnessint lcd_getBrightness(void)reads current brightness (not an Hardware option)
halt_devicevoid halt_device(void)launches halt procedure
reload_firmwarevoid reload_firmware(void)according to arch this reloads archos firmware or reset the device
srandvoid srand(unsigned int seed)Init random generator
randint rand(void)get a random number

Uart

top
Name
Signature
Description
uart_inint uart_in(unsigned char * data,int uartNum)if data is available in uart uartNum buffer, reads next char from uart (in data) and returns 1, returns 0 otherwise (for uartNum you shall use one of the define from trunk/include/sys_def/uart.h)
uart_outvoid uart_out(unsigned char data,int uartNum)send char data on uart uartNum
uart_outStringvoid uart_outString(unsigned char * data,int uartNum)send a full string (NULL terminated) on uart uartNum
uart_changeSpeedvoid uart_changeSpeed(int speed,int uart_num)change the speed of uart uartNum

Back to index