2 * (C) 2010 by Andreas Eversberg <jolly@eversberg.eu>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 /* 4.3.1.1 List of states for PLMN slection process (automatic mode) */
24 #define GSM_A1_TRYING_RPLMN 1
25 #define GSM_A2_ON_PLMN 2
26 #define GSM_A3_TRYING_PLMN 3
27 #define GSM_A4_WAIT_FOR_PLMN 4
28 #define GSM_A5_HPLMN 5
29 #define GSM_A6_NO_SIM 6
31 /* 4.3.1.2 List of states for PLMN slection process (manual mode) */
33 #define GSM_M1_TRYING_RPLMN 1
34 #define GSM_M2_ON_PLMN 2
35 #define GSM_M3_NOT_ON_PLMN 3
36 #define GSM_M4_TRYING_PLMN 4
37 #define GSM_M5_NO_SIM 5
39 /* 4.3.2 List of states for cell selection process */
41 #define GSM_C1_NORMAL_CELL_SEL 1
42 #define GSM_C2_STORED_CELL_SEL 2
43 #define GSM_C3_CAMPED_NORMALLY 3
44 #define GSM_C4_NORMAL_CELL_RSEL 4
45 #define GSM_C5_CHOOSE_CELL 5
46 #define GSM_C6_ANY_CELL_SEL 6
47 #define GSM_C7_CAMPED_ANY_CELL 7
48 #define GSM_C8_ANY_CELL_RSEL 8
49 #define GSM_C9_CHOOSE_ANY_CELL 9
50 #define GSM_Cx_CONNECTED_MODE_1 10
51 #define GSM_Cx_CONNECTED_MODE_2 11
53 /* 4.3.4 List of states for location registration process */
55 #define GSM_L1_UPDATED 1
56 #define GSM_L2_IDLE_NO_SIM 2
57 #define GSM_L3_ROAMING_NOT_ALL 3
58 #define GSM_L4_NOT_UPDATED 4
59 #define GSM_Lx_LR_PENDING 5
61 /* GSM 03.22 events */
62 #define GSM322_EVENT_SWITCH_ON 1
63 #define GSM322_EVENT_SWITCH_OFF 2
64 #define GSM322_EVENT_SIM_INSERT 3
65 #define GSM322_EVENT_SIM_REMOVE 4
66 #define GSM322_EVENT_REG_FAILUE 5
67 #define GSM322_EVENT_REG_SUCC 6
68 #define GSM322_EVENT_NEW_PLMN 7
69 #define GSM322_EVENT_ON_PLMN 8
70 #define GSM322_EVENT_LU_REJECT 9
71 #define GSM322_EVENT_HPLMN_SEAR 10
72 #define GSM322_EVENT_HPLMN_FOUN 11
73 #define GSM322_EVENT_HPLMN_NOTF 12
74 #define GSM322_EVENT_USER_RESEL 13
75 #define GSM322_EVENT_LOSS_RADIO 14
76 #define GSM322_EVENT_PLMN_AVAIL 15
77 #define GSM322_EVENT_INVAL_SIM 16
78 #define GSM322_EVENT_CHOSE_PLMN 17
79 #define GSM322_EVENT_SEL_MANUAL 18
80 #define GSM322_EVENT_SEL_AUTO 19
81 #define GSM322_EVENT_CELL_FOUND 20
82 #define GSM322_EVENT_NO_CELL_F 21
83 #define GSM322_EVENT_LEAVE_IDLE 22
84 #define GSM322_EVENT_RET_IDLE 23
85 #define GSM322_EVENT_CELL_RESEL 24
86 #define GSM322_EVENT_ 25
87 #define GSM322_EVENT_ 26
88 #define GSM322_EVENT_ 27
89 #define GSM322_EVENT_ 28
96 /* node for each PLMN */
97 struct gsm322_plmn_list {
98 struct llist_head entry;
103 /* node for each forbidden LA */
104 struct gsm322_la_list {
105 struct llist_head entry;
111 /* node for each BA-List */
112 struct gsm322_ba_list {
113 struct llist_head entry;
116 /* Band allocation for 1024 frequencies.
117 * First bit of first index is frequency 0.
122 /* PLMN search process */
125 struct llist_head nplmn_list; /* new list of PLMN */
126 struct llist_head splmn_list; /* sorted list of PLMN */
127 int plmn_curr; /* current selected PLMN */
128 uint16_t mcc; /* current mcc */
129 uint16_t mnc; /* current mnc */
130 struct llist_head la_list; /* forbidden LAs */
131 struct llist_head ba_list; /* BCCH Allocation per PLMN */
134 /* Cell selection process */
135 struct gsm322_cellsel {
137 uint16_t mcc; /* current mcc */
138 uint16_t mnc; /* current mnc */
141 /* GSM 03.22 message */
146 uint8_t reject; /* location update reject */
149 #define GSM322_ALLOC_SIZE sizeof(struct gsm322_msg)
150 #define GSM322_ALLOC_HEADROOM 0