Electronic Components Datasheet Search
  English  ▼

X  

AN2618 Datasheet(PDF) 18 Page - STMicroelectronics

Part # AN2618
Description  eTPU host interface
PDF  23 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN2618 Datasheet(HTML) 18 Page - STMicroelectronics

Back Button AN2618 Datasheet HTML 14Page - STMicroelectronics AN2618 Datasheet HTML 15Page - STMicroelectronics AN2618 Datasheet HTML 16Page - STMicroelectronics AN2618 Datasheet HTML 17Page - STMicroelectronics AN2618 Datasheet HTML 18Page - STMicroelectronics AN2618 Datasheet HTML 19Page - STMicroelectronics AN2618 Datasheet HTML 20Page - STMicroelectronics AN2618 Datasheet HTML 21Page - STMicroelectronics AN2618 Datasheet HTML 22Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 18 / 23 page
background image
Code example 6.utility.c
AN2618
18/23
Appendix F
Code example 6.utility.c
/********************************************************************************
* FUNCTION: mc_etpu_init
*
* PURPOSE:
This function initialize the eTPU module including
*
*
1. Initialize global registers
*
*
2. Load eTPU code into memory
*
*
3. Copy initial values of global variables to data RAM
*
********************************************************************************/
uint32_t
mc_etpu_init(struct etpu_config_t p_etpu_config, uint32_t *code,uint8_t
codesize, uint32_t *globals)
{
uint32_t *code_end;
uint32_t unused_code_ram;
unused_code_ram = (((ETPU.MCR.B.SCMSIZE - 1 ) * 1024) - (uint32_t)codesize*1024);
if ( unused_code_ram < 0 )
return((uint32_t)ETPU_ERROR_CODESIZE);
/* 1. Initialize global registers */
ETPU.MISCCMPR.R = p_etpu_config.misc;
//write MISC value before it is
enable in MCR
ETPU.MCR.R = p_etpu_config.mcr;
/* Configure Engine 1 */
ETPU.TBCR_1.R = p_etpu_config.tbcr_1;
ETPU.STACR_1.R = p_etpu_config.stacr_1;
ETPU.ECR_1.R = p_etpu_config.ecr_1;
/* Configure Engine 2 */
ETPU.TBCR_2.R = p_etpu_config.tbcr_2;
ETPU.STACR_2.R = p_etpu_config.stacr_2;
ETPU.ECR_2.R = p_etpu_config.ecr_2;
/* load microcode */
/* In order to write the eTPU code ram, both eTPU engine has to be stopped. */
/* Stopping eTPU engine can be achieved by set low power stop bit.
*/
ETPU.ECR_1.B.MDIS = 1;
ETPU.ECR_2.B.MDIS = 1;
/* enable writing to SCM */
ETPU.MCR.B.VIS = 1;
/* 2. Copy microcode */
mc_memcpy32( &CODE_RAM, code, (uint32_t)codesize*1024);
/* disable writing to SCM */
ETPU.MCR.B.VIS = 0;
/* 3. Copy initial global values to parameter RAM. */
mc_memcpy32 ( &DATA_RAM, globals, ETPU_GLOBAL_MEM_SIZE);
/* After writing the eTPU code ram, both eTPU engine has to be re-started.
*/
/* Restart eTPU engine can be achieved by clear low power stop bit.
*/
ETPU.ECR_1.B.MDIS = 0;
ETPU.ECR_2.B.MDIS = 0;
return((uint32_t) 0);
}



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com