Deleted the old Sensinode 'read mac from flash' routine.

Since the introduction of a purpose-written routine, the old
generic one (which was written in asm) was never being used.
There was a configuration directive which allowed us to switch
between the two. All references to this configuration directive
have also been removed.
This commit is contained in:
George Oikonomou 2012-04-01 19:54:41 +01:00
parent 5d8f63a61b
commit d958ee3125
4 changed files with 0 additions and 103 deletions

View File

@ -57,79 +57,3 @@ bus_init (void)
clock_init(); clock_init();
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/**
* Read a block of code memory.
* The code must be placed in the lowest bank of flash.
*
* \param address address to read from flash
* \param buffer buffer to store data
* \param size number of bytes to read
*/
#if !SHORTCUTS_CONF_FLASH_READ
void
flash_read(uint8_t *buf, uint32_t address, uint8_t size)
{
buf; /*dptr0*/
address; /*stack-6*/
size; /*stack-7*/
buf;
DISABLE_INTERRUPTS();
__asm
mov dpl, r2
mov dph, r3
mov a, r0
push acc
mov a, r2
push acc
mov a, _MEMCTR
push acc
mov a, _bp
add a, #0xf9 ;stack - 7 = size
mov r0,a
mov a, @r0 ;r2 = size
mov r2, a ;r2 = size
inc r0
mov a, @r0
mov _DPL1, a ;DPTR1 = address & 0x7FFF | 0x8000
inc r0
mov a, @r0
orl a, #0x80
mov _DPH1, a
inc r0 ;MEMCTR = ((address >> 15 & 3) << 4) | 0x01 (bank select)
mov a, @r0
dec r0
rrc a
mov a, @r0
rrc a
rr a
rr a
anl a, #0x30
orl a, #1
mov _MEMCTR,a
lp1:
mov _DPS, #1 ;active DPTR = 1
clr a
movc a, @a+dptr ;read flash (DPTR1)
inc dptr
mov _DPS, #0 ;active DPTR = 0
movx @dptr,a ;write to DPTR0
inc dptr
djnz r2,lp1 ;while (--size)
pop acc
mov _MEMCTR, a ;restore bank
pop acc
mov r2,a
pop acc
mov r0,a
__endasm;
ENABLE_INTERRUPTS();
DPL1 = *buf++;
}
#endif
/*---------------------------------------------------------------------------*/

View File

@ -49,9 +49,6 @@
#define inline #define inline
void bus_init(void); void bus_init(void);
#if !SHORTCUTS_CONF_FLASH_READ
void flash_read(uint8_t *buf, uint32_t address, uint8_t size);
#endif
void clock_ISR( void ) __interrupt (ST_VECTOR); void clock_ISR( void ) __interrupt (ST_VECTOR);
#endif /* __BUS_H__ */ #endif /* __BUS_H__ */

View File

@ -95,12 +95,6 @@
*/ */
#define SHORTCUTS_CONF_NETSTACK 1 #define SHORTCUTS_CONF_NETSTACK 1
/*
* Directly read mac from flash with a __code pointer, instead of using the
* generic flash_read() routine. This reduces HOME code size
*/
#define SHORTCUTS_CONF_FLASH_READ 1
/* /*
* Sensors * Sensors
* It is harmless to #define XYZ 1 * It is harmless to #define XYZ 1

View File

@ -99,12 +99,7 @@ set_rime_addr(void)
uint8_t *addr_long = NULL; uint8_t *addr_long = NULL;
uint16_t addr_short = 0; uint16_t addr_short = 0;
char i; char i;
#if SHORTCUTS_CONF_FLASH_READ
__code unsigned char * macp; __code unsigned char * macp;
#else
static uint8_t ft_buffer[8];
#endif
PUTSTRING("Rime is 0x"); PUTSTRING("Rime is 0x");
PUTHEX(sizeof(rimeaddr_t)); PUTHEX(sizeof(rimeaddr_t));
@ -112,7 +107,6 @@ set_rime_addr(void)
if(node_id == 0) { if(node_id == 0) {
PUTSTRING("Reading MAC from flash\n"); PUTSTRING("Reading MAC from flash\n");
#if SHORTCUTS_CONF_FLASH_READ
/* /*
* The MAC is always stored in 0x1FFF8 of our flash. This maps to address * The MAC is always stored in 0x1FFF8 of our flash. This maps to address
* 0xFFF8 of our CODE segment, when BANK3 is selected. * 0xFFF8 of our CODE segment, when BANK3 is selected.
@ -138,18 +132,6 @@ set_rime_addr(void)
/* Remap 0x8000 0xFFFF to BANK1 */ /* Remap 0x8000 0xFFFF to BANK1 */
FMAP = 1; FMAP = 1;
ENABLE_INTERRUPTS(); ENABLE_INTERRUPTS();
#else
/*
* Or use the more generic flash_read() routine which can read from any
* address of our flash
*/
flash_read(ft_buffer, 0x1FFF8, 8);
/* Flip the byte order and store MSB first */
for(i = (RIMEADDR_SIZE - 1); i >= 0; --i) {
rimeaddr_node_addr.u8[RIMEADDR_SIZE - 1 - i] = ft_buffer[i];
}
#endif
} else { } else {
PUTSTRING("Setting manual address from node_id\n"); PUTSTRING("Setting manual address from node_id\n");