r_tick_api.h 5.37 KB
Newer Older
hu's avatar
hu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
/*
****************************************************************************
PROJECT : VLIB
FILE    : $Id: r_tick_api.h 7640 2016-02-12 13:14:23Z florian.zimmermann $
============================================================================ 
DESCRIPTION
Generic TICK driver
============================================================================
                            C O P Y R I G H T
============================================================================
                       Copyright (c) 2013 - 2014
                                  by 
                       Renesas Electronics (Europe) GmbH. 
                           Arcadiastrasse 10
                          D-40472 Duesseldorf
                               Germany
                          All rights reserved.
============================================================================
Purpose: only for testing, not for mass production

DISCLAIMER

LICENSEE has read, understood and accepted the terms and conditions defined in
the license agreement, especially the usage rights. In any case, it is
LICENSEE's responsibility to make sure that any user of the software complies
with the terms and conditions of the signed license agreement.

SAMPLE CODE is not part of the licensed software, as such it must not be used in
mass-production applications. It can only be used for evaluation and
demonstration purposes at customer's premises listed in the signed license
agreement.

****************************************************************************
*/

#ifndef R_TICK_API_H_
#define R_TICK_API_H_

#ifdef __cplusplus
extern "C" {
#endif


/*******************************************************************************
  Title: Generic TICK API
*/

/*******************************************************************************
  Section: Global Types
*/

/*******************************************************************************
  Enum: r_tick_Error_t

  TICK macro driver error code.
  
  If an error occures these enums give information about the
  reason.

  Values:
  R_TICK_ERR_OK           - No error
  R_TICK_ERR_NG           - Unspecified error
*/

typedef enum
{
    R_TICK_ERR_OK         = 0x00u,
    R_TICK_ERR_NG         = 0x01
} r_tick_Error_t;


/*******************************************************************************
  Section: Global API Functions
*/

/*******************************************************************************
  Function: R_TICK_Init

  Driver init function.

  Parameters:
  Unit          - Instance number
 
  Returns:
  see: <r_tick_Error_t>
*/

 r_tick_Error_t R_TICK_Init(uint32_t Unit);


/*******************************************************************************
  Function: R_TICK_DeInit

  Driver deinit function.

  Parameters:
  Unit       - Instance number

  Returns:
  see: <r_tick_Error_t>
*/

 r_tick_Error_t R_TICK_DeInit(uint32_t Unit);



/*******************************************************************************
  Function: R_TICK_GetTimeMS

  Return system tick time in ms

  Parameters:
  Unit       - Instance number

  Returns:
  Tick time in ms
*/

 uint32_t R_TICK_GetTimeMS(uint32_t Unit);


/*******************************************************************************
  Function: R_TICK_GetTimeUS

  Return system tick time in us

  Parameters:
  Unit       - Instance number

  Returns:
  Tick time in ms
*/

 uint32_t R_TICK_GetTimeUS(uint32_t Unit);


/*******************************************************************************
  Function: R_TICK_WaitMS

  Wait for at least 'TickMS' ms and return

  Parameters:
  Unit        - Instance number
  TickMS      - Number of ms to wait

  Returns:
  void
*/

void R_TICK_WaitMS(uint32_t Unit, uint32_t TickMS);


/*******************************************************************************
  Function: R_TICK_WaitUS

  Wait for at least 'TickUS' us and return

  Parameters:
  Unit        - Instance number
  TickUS      - Number of ms to wait

  Returns:
  void
*/

void R_TICK_WaitUS(uint32_t Unit, uint32_t TickUS);


/*******************************************************************************
  Function: R_TICK_SetIsrCallback

  Assign a user callback for the given interrupt of a unit. 
  
  The function will be called after the driver ISR has
  processed the interrupt.

  Parameters:
  Unit          - Instance number
  Isr           - Isr function pointer
  
  Returns:
  void
*/
r_tick_Error_t R_TICK_SetIsrCallback(uint32_t Unit, void (*Isr)(void));
                                 

/*******************************************************************************
  Function: R_TICK_Isr

  Driver interrupt service routine. 
  
  This function shall be called by device interrupt handler 
  (dfxxxx_isr.c) and can be found in tick\src\tick_isr.c. 

  Parameters:
  Unit       - Instance number
  
  Returns:
  void
*/

void R_TICK_Isr(uint32_t Unit);


/*******************************************************************************
  Function: R_TICK_EnableInt

  Enable the TICK interrupt.
  
  Parameters:
  Unit       - Instance number
  
  Returns:
  void
*/

void R_TICK_EnableInt(uint32_t Unit);


/*******************************************************************************
  Function: R_TICK_DisableInt

  Disable the TICK interrupt.
  
  Parameters:
  Unit       - Instance number
  
  Returns:
  void
*/

void R_TICK_DisableInt(uint32_t Unit);


#ifdef __cplusplus
}
#endif

#endif /* R_TICK_API_H_  */