puzzles about code in fx2regs.h

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

#ifdef ALLOCATE_EXTERN
#define EXTERN
#define _AT_ _at_
#else
#define EXTERN extern
#define _AT_ ;/ ## /
#endif

   

   

EXTERN xdata volatile BYTE GPIF_WAVE_DATA    _AT_ 0xE400;
EXTERN xdata volatile BYTE RES_WAVEDATA_END  _AT_ 0xE480;

   

// General Configuration

   

EXTERN xdata volatile BYTE CPUCS             _AT_ 0xE600;  // Control & Status
EXTERN xdata volatile BYTE IFCONFIG          _AT_ 0xE601;  // Interface Configuration
EXTERN xdata volatile BYTE PINFLAGSAB        _AT_ 0xE602;  // FIFO FLAGA and FLAGB Assignments
EXTERN xdata volatile BYTE PINFLAGSCD        _AT_ 0xE603;  // FIFO FLAGC and FLAGD Assignments
EXTERN xdata volatile BYTE FIFORESET         _AT_ 0xE604;  // Restore FIFOS to default state

   

 

   

​I do not get it about "#define _AT_ ;/ ## /".If the file is first used or included,the ALLOCATE_EXTERN is not defined,the program will jump to "#define EXTERN extern".However ,"#define _AT_ ;/ ## /" will not make _AT_ function as the _at_ in keil.Somebody could explain this for me? Thank you so much.

0 Likes
1 Reply
Anonymous
Not applicable

Hi,

   

 

   

This is explained in the comments made in the same file.

   

Please see below.

   

 

   

// Without "#define ALLOCATE_EXTERN", you just get the external reference:
// extern xdata volatile BYTE OUT7BUF[64]   ;//   0x7B40;
// This uses the concatenation operator "##" to insert a comment "//"
// to cut off the end of the line, "_at_   0x7B40;", which is not wanted.

0 Likes