Technical discussions related to Analog Devices DSPs (including Blackfin, TigerSHARC, SHARC and ADSP-21xx DSPs).
Hi! I have succussfully executed the I2C protocol code downloaded from the Analog devices....but the code is too much big and they have used SCCB interface... . I have downloaded I2C code from blackfin.org forum......... I didn't understand some function definitions in that.....like.. //#define INL inline // Large Code Size/Little Stack usage #define INL // Small Code Size/Larger Stack usage "void INL Init(void)" but the prototype is:"void Init(void);" "void INL Start(void)" but the prototype is:"void start(void);" "void INL stop(void)" but the prototype is:"void stop(void)" I didn't clearly understood what is this "INL" and why they have used.... and also in this they have used the delay very less.... if u want means iam attaching that code...... help me to come out of this problem
See below m...@yahoo.co.in wrote: > Hi! > > I have succussfully executed the I2C protocol code downloaded from the Analog devices....but the code is too much big and they have used SCCB interface... . > I have downloaded I2C code from blackfin.org forum......... > I didn't understand some function definitions in that.....like.. > > //#define INL inline // Large Code Size/Little Stack usage > #define INL // Small Code Size/Larger Stack usage > > "void INL Init(void)" but the prototype is:"void Init(void);" > "void INL Start(void)" but the prototype is:"void start(void);" > "void INL stop(void)" but the prototype is:"void stop(void)" > > I didn't clearly understood what is this "INL" and why they have used.... > and also in this they have used the delay very less.... > > if u want means iam attaching that code...... > > help me to come out of this problem Hi, inline is a compiler directive that ask the compiler to put function code inside the calling function instead of doing a function call. Pro: remove the cost of function call (pushing/pulling on/from things on stack, pipeline break), use less stack Con: code is larger since function code is duplicated into each calling function (note that if function is very small, like get/set method in C++, then amount of code used for calling can be larger than function body, in that case using inline has only advantages) Regards
On Tue, 18 Sep 2007 m...@yahoo.co.in wrote: > Hi! > > I have succussfully executed the I2C protocol code downloaded from the Analog devices....but the code is too much big and they have used SCCB interface... . > I have downloaded I2C code from blackfin.org forum......... > I didn't understand some function definitions in that.....like.. > > //#define INL inline // Large Code Size/Little Stack usage > #define INL // Small Code Size/Larger Stack usage > > "void INL Init(void)" but the prototype is:"void Init(void);" > "void INL Start(void)" but the prototype is:"void start(void);" > "void INL stop(void)" but the prototype is:"void stop(void)" > > I didn't clearly understood what is this "INL" and why they have used.... > and also in this they have used the delay very less.... > > if u want means iam attaching that code...... > > help me to come out of this problem I've not run into this compiler option before, but the idea is clear - an inline subroutine will compile the code for a subroutine in the middle of your program, a regular subroutine will put a "call" instruction in the middle of your program. The prototype should not matter, if it is inline, no calls are made and the linker does no work, if it's regular the prototype is correct and the linker can find the entry point correctly. Seems like a pretty slick compiler. Hats off to blackfin.org for getting it to work. Patience, persistence, truth, Dr. mike