summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiSwitchRxCtrl.h
blob: 6891b07c52ffac8c975beff48c0c0510d34adeb9 (plain)
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
/******************************************************************************
  \file machwiSwitchRxCtrl.h
  
  \brief Implementation of switching receiver control.

  \author
    Atmel Corporation: http://www.atmel.com \n
    Support email: avr@atmel.com

  Copyright (c) 2008-2011, Atmel Corporation. All rights reserved.
  Licensed under Atmel's Limited License Agreement (BitCloudTM).
  
  \internal
    History:     
      23/08/07 A. Mandychev - Created.
******************************************************************************/

#ifndef _MACHWISWITCHRXCTRL_H
#define _MACHWISWITCHRXCTRL_H

/******************************************************************************
                    Includes section
******************************************************************************/
#include <types.h>
#include <machwiMemAccess.h>
#include <machwiHwdReqMemPool.h>

/******************************************************************************
                    Define(s) section
******************************************************************************/
 
/******************************************************************************
                    Types section
******************************************************************************/

/******************************************************************************
                    Constants section
******************************************************************************/

/******************************************************************************
                    External variables
******************************************************************************/
extern bool __switchIsLocked;

/******************************************************************************
                    Prototypes section
******************************************************************************/
/******************************************************************************
  Switches receiver to TRX OFF if RxOnWhenIdle parameter isn't set.
  Parameters:
    hwdReq - pointer to MACHWD request memory.
    switchingCompleted - callback to indicate the end of switching receiver.
  Returns:
    none.
******************************************************************************/
void machwiSwitchRxAccordToRxOnWhenIdle(MachwiHwdReqDescr_t *hwdReq,
  void (*switchingCompleted)(void));

/******************************************************************************
                    Inline static functions section 
******************************************************************************/
/******************************************************************************
  Resets switching receiver control.
  Parameters:
    none.
  Returns:
    none.
******************************************************************************/
static inline void machwiResetSwitchingRxCtrl(void)
{
  machwiGetMem()->switchIsLocked = false;
}

/******************************************************************************
 Locks switching receiver control.
  Parameters:
    none.
  Returns:
    none.
******************************************************************************/
static inline void machwiLockSwitchingRx(void)
{
  machwiGetMem()->switchIsLocked = true;
}

/******************************************************************************
 Unlocks switching receiver control.
  Parameters:
    none.
  Returns:
    none.
******************************************************************************/
static inline void machwiUnlockSwitchingRx(void)
{
  machwiGetMem()->switchIsLocked = false;
}

/******************************************************************************
 Tests switching receiver control state.
  Parameters:
    none.
  Returns:
    true - switching receiver is locked.
    false - otherwise.
******************************************************************************/
static inline bool machwiIsSwitchingRxLocked(void)
{
  return machwiGetMem()->switchIsLocked;
}

#endif /* _MACHWISWITCHRXCTRL_H */

// eof machwiSwitchRxCtrl.h