
#include <8052.h>

/* It is highly encouraged to have a look into
   the include file compiler.h
   http://svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/include/mcs51/compiler.h?view=markup
   if you want to share header files between different compilers: */
#include <compiler.h>


/* you did not tell the addresses so
   you have to adapt these to your hardware */
SFR    (APBBR_OPCODE, 0xE6);
SFR16  (APBBR_ADDR,   0xE0);
//SFR16E (APBBR_ADDR,   0xE1E0);
SFR32  (APBBR_RDATA,  0xE2);
//SFR32E (APBBR_RDATA,  0xE5E4E3E2);

#define APBBR_OP_SINGLE_READ (0x0a)


unsigned long APBBR_read_data(unsigned int addr)
{
  bit tmp_EA = EA;

  EA = 0;
  APBBR_ADDR = addr;
  APBBR_OPCODE = APBBR_OP_SINGLE_READ;

  __asm nop __endasm;

  EA = tmp_EA;
  return APBBR_RDATA;
}
