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 />

/* FuncInits: for C++, this are the global constructors */<br />

#ifdef __cplusplus<br />

#ifdef __ELF_OBJECT_FILE_FORMAT__<br />

i = _startupData.nofInitBodies - 1;<br />

while ( i >= 0) {<br />

(&_startupData.initBodies->initFunc)[i](); /* call C++ constructors */<br />

i--;<br />

}<br />

#else<br />

if (_startupData.mInits != NULL) {<br />

_PFunc *fktPtr;<br />

fktPtr = _startupData.mInits;<br />

while(*fktPtr != NULL) {<br />

(**fktPtr)(); /* call constructor */<br />

fktPtr++;<br />

}<br />

}<br />

#endif<br />

#endif<br />

/* LibInits: used only for ROM libraries */<br />

}<br />

#pragma NO_EXIT<br />

#ifdef __cplusplus<br />

extern "C"<br />

#endif<br />

void _Startup (void) { /* To set in the linker parameter file: 'VECTOR 0 _Startup' */<br />

/* purpose: 1) initialize the stack<br />

2) initialize run-time, ...<br />

initialize the RAM, copy down init dat etc (Init)<br />

3) call main;<br />

called from: _PRESTART-code generated by the Linker<br />

*/<br />

#ifdef __ELF_OBJECT_FILE_FORMAT__<br />

//asm{<br />

// mov #$40,$25<br />

// }<br />

DisableInterrupts; /* in HIWARE format, this is done in the prestart code */<br />

#endif<br />

for (;;) { /* forever: initialize the program; call the root-procedure */<br />

if (!(_startupData.flags&STARTUP_FLAGS_NOT_INIT_SP)) {<br />

/* initialize the stack pointer */<br />

INIT_SP_FROM_STARTUP_DESC();<br />

}<br />

Init();<br />

(*_startupData.main)();<br />

} /* end loop forever */<br />

}<br />

;<br />

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

DRM007<br />

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

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

Saved successfully!

Ooh no, something went wrong!