21.01.2014 Views

3.22EjemploDRM007 Co..

3.22EjemploDRM007 Co..

3.22EjemploDRM007 Co..

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Source <strong>Co</strong>de<br />

Source <strong>Co</strong>de Files<br />

}<br />

}<br />

PULH<br />

RTS<br />

#endif<br />

extern void _COPY_L(void);<br />

/* DESC: copy very large structures (>= 256 bytes) in 16 bit address space (stack<br />

incl.)<br />

IN: TOS count, TOS(2) @dest, H:X @src<br />

OUT:<br />

WRITTEN: X,H */<br />

#ifdef __ELF_OBJECT_FILE_FORMAT__<br />

#define to<strong>Co</strong>pyDownBegOffs 0<br />

#else<br />

#define to<strong>Co</strong>pyDownBegOffs 2 /* for the hiware format, the to<strong>Co</strong>pyDownBeg field is a<br />

long. Because the HC08 is big endian, we have to use an offset of 2 */<br />

#endif<br />

static void Init(void) {<br />

/* purpose: 1) zero out RAM-areas where data is allocated<br />

2) init run-time data<br />

3) copy initialization data from ROM to RAM<br />

*/<br />

unsigned int i;<br />

int *p;<br />

#if USE_C_IMPL /* C implementation of ZERO OUT and COPY Down */<br />

int j;<br />

char *dst;<br />

_Range *r;<br />

r = _startupData.pZeroOut;<br />

/* zero out */<br />

for (i=0; i != _startupData.nofZeroOuts; i++) {<br />

dst = r->beg;<br />

j = r->size;<br />

do {<br />

*dst = 0; /* zero out */<br />

dst++;<br />

j--;<br />

} while(j != 0);<br />

r++;<br />

}<br />

#else /* faster and smaller asm implementation for ZERO OUT */<br />

asm {<br />

BLDC Motor <strong>Co</strong>ntrol Board for Industrial and Appliance Applications<br />

DRM007<br />

MOTOROLA Source <strong>Co</strong>de 117

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!