This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

is there a simpler way

This works without a problem, except I have to look up the structure of the call every time I add one. Also the readability is not exactly great.

a structure in upper 64 k of "code flash" in a SILabs f122typedef struct
{
U32 MSFC_tag; // 'MSFC' Multi-Size Font Collection // MSFC
U32 MSFC_idno; // random unique font id number (referenced by subfonts if split) // fb06c05c
U8 MSFC_ver; // file version (set to 1) // 01
U8 MSFC_tblcnt; // number of table dir entries following // 03
U8 MSFC_sftcnt; // number of subfonts contained in / belonging to this collection // 01
U8 MSFC_flags; // 0 for standard CBFs (bit0=1 for vertical font) // 01
U16 MSFC_fsiz; // Complete size of the file (max size is 65534 (= 0xfffe) bytes) // 061a
} STR_MSFC;

a function

////////////////////////////////////////////////////////////
//
//
// FUNCTION U32 ReadFlashLong (U8 code * RFSaddr)
//
// read high flash
//

U32 ReadFlashLong (U8 code *RFSaddr)
{
U8 RFCintsav;
U8 RFCdata;
U8 code * RFSadds;
U32 RFScomp;

RFCintsav = SG_IE;
SG_IE = 0;
SG_SFRPAGE = 0;
if (RFSaddr > 0x7fff)
{
SG_PSBANK = 0x30;
}
else
{
SG_PSBANK = 0x20;
RFSaddr += 0x8000 ;
}
RFSadds = RFSaddr;
for (RFCdata = 0 ; RFCdata < 4 ;RFCdata++, RFSadds++)
{
RFScomp <<= 8;
RFScomp |= (U32) *RFSadds;
}
SG_IE = RFCintsav;
return (RFScomp) ;
}


the call

s_msfc = 0 ;
if ( FFS_CfntNo == 2)
{
s_msfc = 0x8000 ;
}
FFSLtemp = ReadFlashLong ((U8 code *) &s_msfc->MSFC_tag);

what would be "natural"
FFSLtemp = ReadFlashLong (s_msfc->MSFC_tag)
gives error;
is there a simpler way to make the call without specifying a pointer to something now specified as a pointer (asx seen in bold above).


I am NOT interested in a suggestion about using "banking" my other routines do not have the time to go through a bank check/switch. I am using a 100Mips '51 and can hardly keep up. Also, the shorts and longs are in the wrong order because the files with these structures are generated on a PC so, even using "banking" would not totally solve the problem.

Erik

0