Electronic Components Datasheet Search
  English  ▼

X  

AN2618 Datasheet(PDF) 19 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) 19 Page - STMicroelectronics

Back Button 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 AN2618 Datasheet HTML 23Page - STMicroelectronics  
Zoom Inzoom in Zoom Outzoom out
 19 / 23 page
background image
AN2618
Code example 6.utility.c
19/23
/********************************************************************************
* FUNCTION: mc_etpu_chan_init
*
* PURPOSE:
This function initialize the eTPU channel including
*
*
1. Assign the eTPU function to channel
*
*
2. Configure the channel
*
*
3. Calculate and auto assign function frame
*
********************************************************************************/
uint16_t
mc_etpu_chan_init(uint8_t channel, uint8_t function, uint8_t mode, \
uint8_t
num_param, uint32_t config, uint16_t func_frame)
{
if (func_frame == 0)
{
func_frame = mc_etpu_malloc(num_param);
if (func_frame == 0)
return((uint16_t)ETPU_ERROR_MALLOC);
}
ETPU.CHAN[channel].CR.R = config + (function<<16) + (func_frame>>3);
ETPU.CHAN[channel].SCR.R = mode;
return(func_frame);
}
/********************************************************************************
* FUNCTION: mc_etpu_malloc
*
* PURPOSE:
This function calculates the memory space for a eTPU function based *
*
the number and size of the parameter as well as the static local
*
*
variable for a eTPU function. The function returns the address at
*
*
which the next function frame can be assigned.
*
********************************************************************************/
uint16_t
mc_etpu_malloc(uint16_t num_params)
{
static uint16_t etpu_pram_used = ETPU_PRAM_START_ADDR;
uint16_t next_function_frame = etpu_pram_used;
//each parameter takes 4 bytes, check if there is enough space available
if ((etpu_pram_used + num_params<<2) > ETPU_PRAM_SIZE)
return(0);
else
etpu_pram_used += (num_params<<2);
//Scale the pointer for the function frame
return (next_function_frame);
}



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