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 LLC_RESET_DELAY
     60     #define LLC_URSET_DELAY_TIME_OUT        LLC_RESET_DELAY
     61 #else
     62     #define LLC_URSET_DELAY_TIME_OUT        50
     63 #endif /* */
     64 
     65 
     66 
     67 /************************ End of macros *****************************/
     68 
     69 /********************** Callback functions **************************/
     70 
     71 /******************* End of Callback functions **********************/
     72 
     73 /********************* Structures and enums *************************/
     74 
     75 /****************** End of structures and enums *********************/
     76 
     77 /******************** Function declarations *************************/
     78 /**
     79 * \ingroup grp_hal_nfc_llc_helper
     80 *
     81 * \brief LLC timer functions \b Timer Init function
     82 *
     83 * \copydoc page_reg This is to store LLCs main context structure
     84 *
     85 * \param[in, out] psLlcCtxt     Llc main structure information
     86 *
     87 * \retval NFCSTATUS_SUCCESS                 Operation successful.
     88 * \retval NFCSTATUS_INVALID_PARAMETER       At least one parameter of the function is invalid.
     89 *
     90 */
     91 NFCSTATUS
     92 phLlcNfc_TimerInit (
     93     phLlcNfc_Context_t  *psLlcCtxt
     94 );
     95 
     96 /**
     97 * \ingroup grp_hal_nfc_llc_helper
     98 *
     99 * \brief LLC timer functions \b Timer UnInit function
    100 *
    101 * \copydoc page_reg This is to uninitialise all timer related information
    102 *
    103 * \param[in, out] psLlcCtxt     Llc main structure information
    104 *
    105 * \retval NFCSTATUS_SUCCESS                 Operation successful.
    106 * \retval NFCSTATUS_INVALID_PARAMETER       At least one parameter of the function is invalid.
    107 *
    108 */
    109 void
    110 phLlcNfc_TimerUnInit (
    111     phLlcNfc_Context_t  *psLlcCtxt
    112 );
    113 
    114 /**
    115 * \ingroup grp_hal_nfc_llc_helper
    116 *
    117 * \brief LLC timer functions \b Create timer function
    118 *
    119 * \copydoc page_reg creates all the timers in the LLC context
    120 *
    121 *
    122 */
    123 void
    124 phLlcNfc_CreateTimers (void);
    125 
    126 /**
    127 * \ingroup grp_hal_nfc_llc_helper
    128 *
    129 * \brief LLC timer functions \b Start timer function
    130 *
    131 * \copydoc page_reg starts the timer type given by the user
    132 *
    133 * \param[in] TimerType          Timer type to start
    134 * \param[in] ns_value           Value of N(S) for which the timer is started
    135 *
    136 * \retval NFCSTATUS_SUCCESS                 Operation successful.
    137 * \retval NFCSTATUS_INVALID_PARAMETER       At least one parameter of the function is invalid.
    138 * \retval Others                            Errors related to OsalNfc.
    139 *
    140 */
    141 NFCSTATUS
    142 phLlcNfc_StartTimers (
    143     uint8_t             TimerType,
    144     uint8_t             ns_value
    145 );
    146 
    147 /**
    148 * \ingroup grp_hal_nfc_llc_helper
    149 *
    150 * \brief LLC timer functions \b Stop timer function
    151 *
    152 * \copydoc page_reg stop the timer type given by the user
    153 *
    154 * \param[in] TimerType              Timer type to start
    155 * \param[in] no_of_gaurd_to_del     Guard time-out count shall be decreased as and when
    156 *                                   frame is removed
    157 *
    158 *
    159 */
    160 void
    161 phLlcNfc_StopTimers (
    162     uint8_t             TimerType,
    163     uint8_t             no_of_guard_to_del
    164 );
    165 
    166 /**
    167 * \ingroup grp_hal_nfc_llc_helper
    168 *
    169 * \brief LLC timer functions \b Stop timer function
    170 *
    171 * \copydoc page_reg stop the timer type given by the user
    172 *
    173 *
    174 *
    175 *
    176 */
    177 void
    178 phLlcNfc_StopAllTimers (void);
    179 
    180 
    181 /**
    182 * \ingroup grp_hal_nfc_llc_helper
    183 *
    184 * \brief LLC timer functions \b Delete timer function
    185 *
    186 * \copydoc page_reg deletes all the timers in the LLC context
    187 *
    188 * \retval NFCSTATUS_SUCCESS                 Operation successful.
    189 * \retval NFCSTATUS_INVALID_PARAMETER       At least one parameter of the function is invalid.
    190 * \retval Others                            Errors related to OsalNfc.
    191 *
    192 */
    193 void
    194 phLlcNfc_DeleteTimer (void);
    195 
    196 #ifdef LLC_URSET_NO_DELAY
    197 
    198     /* NO definition required */
    199 
    200 #else /* #ifdef LLC_URSET_NO_DELAY */
    201 
    202 void
    203 phLlcNfc_URSET_Delay_Notify (
    204     uint32_t            delay_id,
    205     void                *pContext);
    206 
    207 #endif /* #ifdef LLC_URSET_NO_DELAY */
    208 
    209 /****************** End of Function declarations ********************/
    210 #endif /* PHLLCNFC_TIMER_H */
    211