#pragma directive

R

risha

#pragma CODE_SEG NON_BANKED
unsigned char read8bSRAMlinear(unsigned long addr)
{
static unsigned char storedPage;
static unsigned char calcPage;
static unsigned int offset;
static unsigned char data;


calcPage = (unsigned char) (addr / 0x4000); // 0x4000 = page
size
offset = ((addr % 0x4000) + 0x8000);

storedPage = PPAGE;
PPAGE = calcPage;
data = *((unsigned char *)(offset));
PPAGE = storedPage;
return data;
}

void write8bSRAMlinear(unsigned long addr,unsigned char data)
{
static unsigned char storedPage;
static unsigned char calcPage;
static unsigned int offset;

calcPage = (unsigned char) (addr / 0x4000); // 0x4000 = page
size
offset = ((addr % 0x4000) + 0x8000);

storedPage = PPAGE;
PPAGE = calcPage;
*((unsigned char *)(offset)) = data;
PPAGE = storedPage;
}
//------------------------------------------------------------------------------
#pragma CODE_SEG DEFAULT // place to default paged memory
void writemain(void)
{
unsigned long address;
unsigned char data;

//--- NORMAL EXPANDED WIDE ---------------
//PEAR = PEAR_RDWE_MASK | PEAR_LSTRE_MASK; // enable R/W & LSTRB
signal on port E (see S12MEBIV3.pdf)
//MODE |= (MODE_MODA_MASK+MODE_MODB_MASK+MODE_EMK_MASK); //
switch to Expanded Narrow mode emulate port K

//DDRS = 0xFF; // output port
//DDRM = 0xFF; // output port

data = 0;
for(;;)
{
// linear writting to external memory
for(address=0;address<MAX_ADDRESS;address++)
{
write8bSRAMlinear(address, data); // write data to
external RAM
}
// linear reading from external memory
for(address=0;address<MAX_ADDRESS;address++)
{
PTM = read8bSRAMlinear(address); // read data from
external RAM and put them to the port M
}
}

}
//------------------------------------------------------------------------------


can someone explain the working of this #pragma whther it substitutes
or is like a function how does it work?
Using metrowerkscode warrior
Risha
 
J

jacob navia

Pragmas are compiler specific. Read the documentation.
There is *NO* other
way to know what that means.
jacob
 
K

Keith Thompson

jacob navia said:
Pragmas are compiler specific. Read the documentation.
There is *NO* other
way to know what that means.

There are a few language-defined pragmas in C99, but yes, most pragmas
are implementation-defined.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top