code in C

V

vicky

Hello,

As, I am new to the C-language, I was trying to find out this piece of code,
without any comments. Would anyone around here can give me some idea what
this code is doing.


static const associative_array register_names = {

ASSOCIATIVE_ARRAY_END

};

void SwitchOn(pvhVoid adr) {

#ifndef HARDWARE

SwitchSetReg(BASE, 0x0010, 0x0000, 0x0001) ;

#else

vhPrintfMessage("push the button ...\n");

#endif

}

void SwitchSetIntRelease(pvhVoid adr) {

#ifndef HARDWARE

SwitchSetReg(BASE, 0x0010, 0x0000, 0x0000) ;

#else

vhPrintfMessage("Release button ...\n");

#endif

}

Very thankful for any help.

rajan
 
V

Vladimir S. Oka

Hello,

As, I am new to the C-language, I was trying to find out this piece of
code, without any comments. Would anyone around here can give me some
idea what this code is doing.

It is impossible to tell that unless you provide details of all the
various macros, data types, and functions used.

Without that, the only thing that can be said is:
static const associative_array register_names = {

ASSOCIATIVE_ARRAY_END

};

This declares a variable `register_names`, which is of the type
`associative_array`, it is constant, and local to the compilation unit.
void SwitchOn(pvhVoid adr) {

#ifndef HARDWARE

SwitchSetReg(BASE, 0x0010, 0x0000, 0x0001) ;

#else

vhPrintfMessage("push the button ...\n");

#endif

}

This is a function that, depending on whether HARDWARE is defined or
not, calls a function `SwitchSetReg` or `vhPrintfMessage`. The latter
presumably outputs the string somewhere.
void SwitchSetIntRelease(pvhVoid adr) {

#ifndef HARDWARE

SwitchSetReg(BASE, 0x0010, 0x0000, 0x0000) ;

#else

vhPrintfMessage("Release button ...\n");

#endif

}

And same here...
Very thankful for any help.

I doubt this was much help. I'd suggest looking for documentation of the
system this came from.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,176
Messages
2,570,950
Members
47,500
Latest member
ArianneJsb

Latest Threads

Top