summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/phy.h
blob: 24c87d814c7c83ab16e86e4172fbe35fa3f8fc08 (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
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
/**************************************************************************//**
  \file phy.h
  
  \brief Types and constants declaration for IEEE std 802.15.4-2006
    PHY implementation.
    
  \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:     
     18/05/07 ALuzhetsky - Created.
******************************************************************************/

#ifndef _PHY_H
#define _PHY_H

/******************************************************************************
                    Includes section
******************************************************************************/
#include <inttypes.h>

/******************************************************************************
                    Define(s) section
******************************************************************************/
#define DBM_11 11
#define DBM_10 10
#define DBM_9 9
#define DBM_8 8
#define DBM_7 7
#define DBM_6 6
#define DBM_5 5
#define DBM_4 4
#define DBM_3 3
#define DBM_2 2
#define DBM_1 1
#define DBM_0 0
#define DBM_MIN_1 (-1)
#define DBM_MIN_2 (-2)
#define DBM_MIN_3 (-3)
#define DBM_MIN_4 (-4)
#define DBM_MIN_5 (-5)
#define DBM_MIN_6 (-6)
#define DBM_MIN_7 (-7)
#define DBM_MIN_8 (-8)
#define DBM_MIN_9 (-9)
#define DBM_MIN_10 (-10)
#define DBM_MIN_11 (-11)
#define DBM_MIN_12 (-12)
#define DBM_MIN_13 (-13)
#define DBM_MIN_14 (-14)
#define DBM_MIN_15 (-15)
#define DBM_MIN_16 (-16)
#define DBM_MIN_17 (-17)
#define DBM_MIN_18 (-18)
#define DBM_MIN_19 (-19)
#define DBM_MIN_20 (-20)
#define DBM_MIN_21 (-21)
#define DBM_MIN_22 (-22)
#define DBM_MIN_23 (-23)
#define DBM_MIN_24 (-24)
#define DBM_MIN_25 (-25)
#define DBM_MIN_26 (-26)
#define DBM_MIN_27 (-27)

#define PHY_CHANNEL_0   0
#define PHY_CHANNEL_1   1
#define PHY_CHANNEL_2   2
#define PHY_CHANNEL_3   3
#define PHY_CHANNEL_4   4
#define PHY_CHANNEL_5   5
#define PHY_CHANNEL_6   6
#define PHY_CHANNEL_7   7
#define PHY_CHANNEL_8   8
#define PHY_CHANNEL_9   9
#define PHY_CHANNEL_10  10
#define PHY_CHANNEL_11  11
#define PHY_CHANNEL_12  12
#define PHY_CHANNEL_13  13
#define PHY_CHANNEL_14  14
#define PHY_CHANNEL_15  15
#define PHY_CHANNEL_16  16
#define PHY_CHANNEL_17  17
#define PHY_CHANNEL_18  18
#define PHY_CHANNEL_19  19
#define PHY_CHANNEL_20  20
#define PHY_CHANNEL_21  21
#define PHY_CHANNEL_22  22
#define PHY_CHANNEL_23  23
#define PHY_CHANNEL_24  24
#define PHY_CHANNEL_25  25
#define PHY_CHANNEL_26  26

#define PHY_SYMBOL_DURATION_PAGE_0_CHANNELS_0     50 ///< Symbol duration for channel 0 and BPSK modulation.
#define PHY_SYMBOL_DURATION_PAGE_0_CHANNELS_1_10  25 ///< Symbol duration for channels [1 - 10] and BPSK modulation.
#define PHY_SYMBOL_DURATION_PAGE_0_CHANNELS_11_26 16 ///< Symbol duration for channels [11 - 26] and OQPSK modulation.
#define PHY_SYMBOL_DURATION_PAGE_1_CHANNELS_0     80 ///< Symbol duration for channel 0 and ASK modulation.
#define PHY_SYMBOL_DURATION_PAGE_1_CHANNELS_1_10  20 ///< Symbol duration for channels [1 - 10] and ASK modulation.
#define PHY_SYMBOL_DURATION_PAGE_2_CHANNELS_0     40 ///< Symbol duration for channel 0 and OQPSK modulation.
#define PHY_SYMBOL_DURATION_PAGE_2_CHANNELS_1_10  16 ///< Symbol duration for channels [1 - 10] and OQPSK modulation.
//Chinese frequencies.
#define PHY_SYMBOL_DURATION_PAGE_5_CHANNELS_0_3   16 ///< Symbol duration for channels [0 - 3] OQPSK modulation.
//#define PHY_SYMBOL_DURATION_PAGE_5_CHANNELS_4_7   16 ///< Symbol duration for channels [4 - 7] MPSK modulation. Not supported.

#define PHY_SYMBOL_DURATION_PAGE_20_CHANNELS_0_25 50 ///< Symbol duration for channels [0 - 25] and BPSK modulation.
#define PHY_SYMBOL_DURATION_PAGE_22_CHANNELS_0_25 40 ///< Symbol duration for channels [0 - 25] and OQPSK modulation.

// PHY PIB attribute read only parameters.
#define PHY_SYMBOLS_PER_OCTET_PAGE_0_CHANNELS_0     8
#define PHY_SYMBOLS_PER_OCTET_PAGE_0_CHANNELS_0_10  8
#define PHY_SYMBOLS_PER_OCTET_PAGE_0_CHANNELS_11_26 2
//#define PHY_SYMBOLS_PER_OCTET_PAGE_1_CHANNELS_0    (2/5)
//#define PHY_SYMBOLS_PER_OCTET_PAGE_1_CHANNELS_1_10 (6/3.75)
#define PHY_SYMBOLS_PER_OCTET_PAGE_2_CHANNELS_0     2
#define PHY_SYMBOLS_PER_OCTET_PAGE_2_CHANNELS_0_10  2
//Chinese frequencies.
#define PHY_SYMBOLS_PER_OCTET_PAGE_5_CHANNELS_0_3   2
//#define PHY_SYMBOLS_PER_OCTET_PAGE_5_CHANNELS_4_7  2 // Not supported.

#define PHY_SYMBOLS_PER_OCTET_PAGE_20_CHANNELS_0_25 8
#define PHY_SYMBOLS_PER_OCTET_PAGE_22_CHANNELS_0_25 2

// Size of frame fields
#define PHY_FRAME_LENGTH_FIELD_SIZE 1
#define PHY_FCS_FIELD_SIZE          2
#define PHY_SFD_FIELD_SIZE          1
#define PHY_PREAMBLE_FIELD_SIZE     4
#define PHY_LQI_FIELD_SIZE          1
#define PHY_RSSI_FIELD_SIZE         1

/******************************************************************************
                    Types section
******************************************************************************/
//! CCA mode types. IEEE 802.15.4-2006 6.9.9 Clear channel assessment (CCA).
typedef enum
{
  PHY_CCA_MODE_N = 0,
  PHY_CCA_MODE_1 = 1,
  PHY_CCA_MODE_2 = 2,
  PHY_CCA_MODE_3 = 3
} PHY_CcaMode_t;

//! Energy level type.
typedef uint8_t PHY_EnergyLevel_t;

//! Evailible channel pages.
enum
{
  CHANNEL_PAGE_0 = 0,
  CHANNEL_PAGE_1 = 1,
  CHANNEL_PAGE_2 = 2,
  CHANNEL_PAGE_5 = 5,
  CHANNEL_PAGE_20 = 20,
  CHANNEL_PAGE_22 = 22,
};

#endif /* _PHY_H */

// eof phy.h