Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[ARM] Some keil syntax questions

Status
Not open for further replies.

love_electronic

Member level 5
Joined
Nov 16, 2010
Messages
93
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,964
Hi
I wanna ask some basic questions regarding keil uvision syntax.
what are the functions of following statement

Code:
#define GPIOCONF(mode, cnf)	((cnf << 2) | (mode))
Is (cnf<<2) shifting 2 times here?

Code:
#define CONFMASKL(pin) ((u32)~(15 << (pin * 4)))
what this statement tells?
 

Those are normal macro definitions.

The first shift the value of 'cnf' 2 bits to the left making room for ORing in 'mode'. I would suppose that mode is in the range 0-3.

The second makes an inverted 32 bit unsigned integer mask of 4 bits dependent on the 'pin' value, range 0-7. Like pin=0: 0xFFFFFFF0, to pin=7: 0x0FFFFFFF
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top