Home | History | Annotate | Download | only in src
      1 /*
      2  * Copyright (C) 2010 NXP Semiconductors
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 /*!
     18 * \file  phLlcNfc_Timer.h
     19 * \brief To create, start, stop and destroy timer.
     20 *
     21 * Project: NFC-FRI-1.1
     22 *
     23 * $Date: Thu Jun 10 17:26:41 2010 $
     24 * $Author: ing02260 $
     25 * $Revision: 1.14 $
     26 * $Aliases: NFC_FRI1.1_WK1023_R35_1 $
     27 *
     28 */
     29 
     30 #ifndef PHLLCNFC_TIMER_H
     31 #define PHLLCNFC_TIMER_H
     32 
     33 /**
     34 *  \name LLC NFC state machine handling
     35 *
     36 * File: \ref phLlcNfc_StateMachine.h
     37 *
     38 */
     39 /*@{*/
     40 #define PH_LLCNFC_TIMER_FILEREVISION "$Revision: 1.14 $" /**< \ingroup grp_hal_nfc_llc_helper */
     41 #define PH_LLCNFC_TIMER_FILEALIASES  "$Aliases: NFC_FRI1.1_WK1023_R35_1 $"     /**< \ingroup grp_hal_nfc_llc_helper */
     42 /*@}*/
     43 /*************************** Includes *******************************/
     44 
     45 /*********************** End of includes ****************************/
     46 
     47 /***************************** Macros *******************************/
     48 #define PH_LLCNFC_CONNECTIONTIMER           (0x00)      /**< Timer for connection time out */
     49 #define PH_LLCNFC_GUARDTIMER                (0x01)      /**< Timer for guard time out */
     50 #define PH_LLCNFC_ACKTIMER                  (0x02)      /**< Timer for ack time out  */
     51 #define PH_LLCNFC_MAX_RETRY_COUNT           (0x03)      /**< Retries */
     52 /** Resolution value for the timer */
     53 #define PH_LLCNFC_RESOLUTION                TIMER_RESOLUTION
     54 /**< 0x05 Timer for connection time out value */
     55 #define PH_LLCNFC_CONNECTION_TO_VALUE       LINK_CONNECTION_TIMEOUT
     56 /**< 0x05 Timer for guard time out value */
     57 #define PH_LLCNFC_GUARD_TO_VALUE            LINK_GUARD_TIMEOUT
     58 
     59 #ifdef PIGGY_BACK
     60 
     61 #define PH_LLCNFC_ACK_TO_VALUE              LINK_ACK_TIMEOUT
     62 
     63 #endif /* #ifdef PIGGY_BACK */
     64 
     65 #ifdef LLC_RESET_DELAY
     66     #define LLC_URSET_DELAY_TIME_OUT        LLC_RESET_DELAY
     67 #else
     68     #define LLC_URSET_DELAY_TIME_OUT        50
     69 #endif /* */
     70 
     71 
     72 
     73 /************************ End of macros *****************************/
     74 
     75 /********************** Callback functions **************************/
     76 
     77 /******************* End of Callback functions **********************/
     78 
     79 /********************* Structures and enums *************************/
     80 
     81 /****************** End of structures and enums *********************/
     82 
     83 /******************** Function declarations *************************/
     84 /**
     85 * \ingroup grp_hal_nfc_llc_helper
     86 *
     87 * \brief LLC timer functions \b Timer Init function
     88 *
     89 * \copydoc page_reg This is to store LLCs main context structure
     90 *
     91 * \param[in, out] psLlcCtxt     Llc main structure information
     92 *
     93 * \retval NFCSTATUS_SUCCESS                 Operation successful.
     94 * \retval NFCSTATUS_INVALID_PARAMETER       At least one parameter of the function is invalid.
     95 *
     96 */
     97 NFCSTATUS
     98 phLlcNfc_TimerInit (
     99     phLlcNfc_Context_t  *psLlcCtxt
    100 );
    101 
    102 /**
    103 * \ingroup grp_hal_nfc_llc_helper
    104 *
    105 * \brief LLC timer functions \b Timer UnInit function
    106 *
    107 * \copydoc page_reg This is to uninitialise all timer related information
    108 *
    109 * \param[in, out] psLlcCtxt     Llc main structure information
    110 *
    111 * \retval NFCSTATUS_SUCCESS                 Operation successful.
    112 * \retval NFCSTATUS_INVALID_PARAMETER       At least one parameter of the function is invalid.
    113 *
    114 */
    115 void
    116 phLlcNfc_TimerUnInit (
    117     phLlcNfc_Context_t  *psLlcCtxt
    118 );
    119 
    120 /**
    121 * \ingroup grp_hal_nfc_llc_helper
    122 *
    123 * \brief LLC timer functions \b Create timer function
    124 *
    125 * \copydoc page_reg creates all the timers in the LLC context
    126 *
    127 *
    128 */
    129 void
    130 phLlcNfc_CreateTimers (void);
    131 
    132 /**
    133 * \ingroup grp_hal_nfc_llc_helper
    134 *
    135 * \brief LLC timer functions \b Start timer function
    136 *
    137 * \copydoc page_reg starts the timer type given by the user
    138 *
    139 * \param[in] TimerType          Timer type to start
    140 * \param[in] ns_value           Value of N(S) for which the timer is started
    141 *
    142 * \retval NFCSTATUS_SUCCESS                 Operation successful.
    143 * \retval NFCSTATUS_INVALID_PARAMETER       At least one parameter of the function is invalid.
    144 * \retval Others                            Errors related to OsalNfc.
    145 *
    146 */
    147 NFCSTATUS
    148 phLlcNfc_StartTimers (
    149     uint8_t             TimerType,
    150     uint8_t             ns_value
    151 );
    152 
    153 /**
    154 * \ingroup grp_hal_nfc_llc_helper
    155 *
    156 * \brief LLC timer functions \b Stop timer function
    157 *
    158 * \copydoc page_reg stop the timer type given by the user
    159 *
    160 * \param[in] TimerType              Timer type to start
    161 * \param[in] no_of_gaurd_to_del     Guard time-out count shall be decreased as and when
    162 *                                   frame is removed
    163 *
    164 *
    165 */
    166 void
    167 phLlcNfc_StopTimers (
    168     uint8_t             TimerType,
    169     uint8_t             no_of_guard_to_del
    170 );
    171 
    172 /**
    173 * \ingroup grp_hal_nfc_llc_helper
    174 *
    175 * \brief LLC timer functions \b Stop timer function
    176 *
    177 * \copydoc page_reg stop the timer type given by the user
    178 *
    179 *
    180 *
    181 *
    182 */
    183 void
    184 phLlcNfc_StopAllTimers (void);
    185 
    186 
    187 /**
    188 * \ingroup grp_hal_nfc_llc_helper
    189 *
    190 * \brief LLC timer functions \b Delete timer function
    191 *
    192 * \copydoc page_reg deletes all the timers in the LLC context
    193 *
    194 * \retval NFCSTATUS_SUCCESS                 Operation successful.
    195 * \retval NFCSTATUS_INVALID_PARAMETER       At least one parameter of the function is invalid.
    196 * \retval Others                            Errors related to OsalNfc.
    197 *
    198 */
    199 void
    200 phLlcNfc_DeleteTimer (void);
    201 
    202 #ifdef LLC_URSET_NO_DELAY
    203 
    204     /* NO definition required */
    205 
    206 #else /* #ifdef LLC_URSET_NO_DELAY */
    207 
    208 void
    209 phLlcNfc_URSET_Delay_Notify (
    210 
    211     uint32_t            delay_id);
    212 
    213 
    214 
    215 #endif /* #ifdef LLC_URSET_NO_DELAY */
    216 
    217 /****************** End of Function declarations ********************/
    218 #endif /* PHLLCNFC_TIMER_H */
    219