AnsweredAssumed Answered

FSMC Memory Issue

Question asked by asl.sean on Apr 2, 2013
Latest reply on Apr 2, 2013 by Jack Peacock
Hi , 

I am testing out the following file , GLCD_16bitIF_STM32F2xx.c from KEIL 
#define LCD_BASE   (0x60000000UL | 0x00000000UL)
 
#define LCD_REG16  (*((volatile unsigned short *)( LCD_BASE )))
#define LCD_DAT16  (*((volatile unsigned short *)(LCD_BASE+2)))
 
#define BG_COLOR  0                     /* Background color                   */
#define TXT_COLOR 1                     /* Text color                         */
 
  
/*---------------------------- Global variables ------------------------------*/
 
/******************************************************************************/
static volatile unsigned short Color[2] = {White, Black};
static unsigned char Himax;
 
/************************ Local auxiliary functions ***************************/
 
/*******************************************************************************
* Delay in while loop cycles                                                   *
*   Parameter:    cnt:    number of while cycles to delay                      *
*   Return:                                                                    *
*******************************************************************************/
 
static void delay (int cnt) {
  cnt <<= DELAY_2N;
  while (cnt--);
}
 
 
/*******************************************************************************
* Write a command the LCD controller                                           *
*   Parameter:    cmd:    command to be written                                *
*   Return:                                                                    *
*******************************************************************************/
 
static __inline void wr_cmd (unsigned char cmd) {
 
  LCD_REG16 = cmd;
}
 
 
/*******************************************************************************
* Write data to the LCD controller                                             *
*   Parameter:    dat:    data to be written                                   *
*   Return:                                                                    *
*******************************************************************************/
 
static __inline void wr_dat (unsigned short dat) {
 
  LCD_DAT16 = dat;
}

However , i do not understand why the memory allocation is as such 

#define LCD_BASE   (0x60000000UL | 0x00000000UL)

#define LCD_REG16  (*((volatile unsigned short *)( LCD_BASE )))
#define LCD_DAT16  (*((volatile unsigned short *)(LCD_BASE+2)))

I understand that  (0x60000000UL | 0x00000000UL) is the bank selection , however why is
LCD_REG16 & LCD_DAT16 at byte 0 and 2 position respectively.

Thanks.

Outcomes