No, it's still disturbing, but for a different reason now. Thanks for the insight. Jacob --- In motoroladsp@y..., "Leonard N. Elevich" <leonard.n.elevich@m...> wrote: > There is nothing disturbing about it. Most of the SDK APIs are optimized > with preprocessor (macros). Unfortunately, unless you have tools > support, it is very difficult to follow and debug preprocessor code. In > GPIO driver case: > > ioctl(FileDesc, GPIO_TOGGLE, gpioPin(B,0)) > > will be translated into: > > ioctlGPIO_TOGGLE(FD, gpio(B,0)) (see io.h header file) > > which translates to: > > gpioIoctl(FD, GPIO_TOGGLE, gpio(B,0)) (see gpiodrvIO.h) > > which translates to: > > gpioIoctlGPIO_TOGGLE(gpio(B,0)) (see gpiodrv.h) > > which translates to: > > periphBitChagne(...code...) > > which will be translated into a single asm instruction. > From the above sequence you can see that File Descriptor for the GPIO > driver is not needed by the driver's optimized implementation, so it is > dropped in one of the macro translations. In this case all of the useful > information is encoded in the gpioPin() macro, which is propagated > through all macro expansions. > > Leonard > > -----Original Message----- > From: Jacob Christ [mailto:jacob@p...] > Sent: Friday, November 01, 2002 4:26 PM > To: motoroladsp@y... > Subject: [motoroladsp] Scope Problem > > CodeWarrior 5.02 for DSP56800 > > I noticed something quite disturbing today. The following code > compiles and works! > > /////////////////////////////////////////////////////////// > #include "bsp.h" > #include "gpio.h" > > /////////////////////////////////////////////////////////// > void foo(void); > void foo(void) > { > ioctl(I_should_case_an_error_becuase_Im_undefined, GPIO_TOGGLE, > gpioPin(B,0)); > } > > /////////////////////////////////////////////////////////// > int main() > { > int PortB; > > PortB = open(BSP_DEVICE_NAME_GPIO_B, NULL); > > ioctl(PortB, GPIO_SETAS_GPIO, gpioPin(B,0)); > ioctl(PortB, GPIO_SETAS_OUTPUT, gpioPin(B,0)); > > foo(); > > close(PortB); > } > |