01.06.2013 Views

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

int iniPutString(char *sectionName, char *itemName, char *text)<br />

{<br />

union REGS inregs;<br />

union REGS outregs;<br />

struct SREGS sregs;<br />

inregs.h.ah = 0x23;<br />

inregs.x.bx = FP_SEG(sectionName);<br />

inregs.x.si = FP_OFF(sectionName);<br />

sregs.es = FP_SEG(itemName);<br />

inregs.x.di = FP_OFF(itemName);<br />

sregs.ds = FP_SEG(text);<br />

inregs.x.dx = FP_OFF(text);<br />

int86x(0xA0,&inregs,&outregs,&sregs);<br />

return outregs.x.ax;<br />

}<br />

//Call of this function:<br />

iniPutString("MY_SECTION", "MY_ITEM", "VALUE_TEXT");<br />

//and produces the following chip.ini entry<br />

[MY_SECTION]<br />

MY_ITEM=VALUE_TEXT<br />

<br />

Developer Notes<br />

Keep in mind that this function writes to the chip.ini file. This generates flash write cycles and these cycles are limited.<br />

Top of list<br />

Index page<br />

Interrupt 0xA0 service 0x24: Find an entry in chip.ini<br />

Parameters<br />

AH<br />

CX<br />

BX:SI<br />

ES:DI<br />

Finds an entry in chip.ini configuration file.<br />

Must be 0x24.<br />

Maximum length of target string (without '\0').<br />

Pointer to section string<br />

Pointer to item name<br />

DS:DX<br />

Pointer to target<br />

Return Value<br />

Comments<br />

AX= 0 : Entry not found<br />

AX= -1: Could not open chip.ini<br />

else Success: pointer at DS:DX contains the found string AX contains length of the found string<br />

Important: API functions 0x23 and 0x24 are not reentrant.<br />

Don't use in different tasks or in combination with <strong>@CHIP</strong>-<strong>RTOS</strong> commands,<br />

which are writing to chip.ini, e.g. DHCP. Avoid race conditions with<br />

any other API call, which writes or read also to/from chip.ini<br />

e.g. 0xA0 0x02 Set IP address<br />

Page 91 / 400

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!