Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfc0808b

Browse files
committed
Add Gemalto Cinterion mbed-os patches
1 parentfd3f936 commitfc0808b

7 files changed

+516
-0
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
From ae470a5d61a27ec11fea588fa53a1f4f1ddac1cb Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Tue, 7 Nov 2023 10:38:21 +0100
4+
Subject: [PATCH 215/221] Gemalto Cinterion Cellular: Disable urcs while
5+
reading
6+
7+
---
8+
.../GEMALTO_CINTERION_CellularStack.cpp | 23 +++++++++++--------
9+
1 file changed, 14 insertions(+), 9 deletions(-)
10+
11+
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
12+
index 33a73bf9a3..fc2e8985d7 100644
13+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
14+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp
15+
@@ -524,6 +524,9 @@ sisw_retry:
16+
return (_at.get_last_error() == NSAPI_ERROR_OK) ? accept_len : NSAPI_ERROR_DEVICE_ERROR;
17+
}
18+
19+
+#define DISABLE_URCs _at.at_cmd_discard("^SCFG", "=", "%s%s","Tcp/WithURCs","off")
20+
+#define RESTORE_URCs_AND_RETURN(ret) do { _at.at_cmd_discard("^SCFG", "=", "%s%s","Tcp/WithURCs","on"); return ret; } while(0)
21+
+
22+
nsapi_size_or_error_t GEMALTO_CINTERION_CellularStack::socket_recvfrom_impl(CellularSocket *socket, SocketAddress *address,
23+
void *buffer, nsapi_size_t size)
24+
{
25+
@@ -531,13 +534,15 @@ nsapi_size_or_error_t GEMALTO_CINTERION_CellularStack::socket_recvfrom_impl(Cell
26+
// open on the modem, assert here to catch a programming error
27+
MBED_ASSERT(socket->id != -1);
28+
29+
+ DISABLE_URCs;
30+
+
31+
// we must use this flag, otherwise ^SISR URC can come while we are reading response and there is
32+
// no way to detect if that is really an URC or response
33+
if (!socket->pending_bytes) {
34+
_at.process_oob(); // check for ^SISR URC
35+
if (!socket->pending_bytes) {
36+
tr_debug("Socket %d recv would block", socket->id);
37+
- return NSAPI_ERROR_WOULD_BLOCK;
38+
+ RESTORE_URCs_AND_RETURN(NSAPI_ERROR_WOULD_BLOCK);
39+
}
40+
}
41+
42+
@@ -552,7 +557,7 @@ sisr_retry:
43+
_at.resp_start("^SISR:");
44+
if (!_at.info_resp()) {
45+
tr_error("Socket %d not responding", socket->id);
46+
- return NSAPI_ERROR_DEVICE_ERROR;
47+
+ RESTORE_URCs_AND_RETURN(NSAPI_ERROR_DEVICE_ERROR);
48+
}
49+
50+
int socket_id = _at.read_int();
51+
@@ -564,24 +569,24 @@ sisr_retry:
52+
goto sisr_retry;
53+
}
54+
tr_error("Socket recvfrom id %d != %d", socket_id, socket->id);
55+
- return NSAPI_ERROR_DEVICE_ERROR;
56+
+ RESTORE_URCs_AND_RETURN(NSAPI_ERROR_DEVICE_ERROR);
57+
}
58+
59+
nsapi_size_or_error_t len = _at.read_int();
60+
if (len == 0) {
61+
tr_warn("Socket %d no data", socket->id);
62+
_at.resp_stop();
63+
- return NSAPI_ERROR_WOULD_BLOCK;
64+
+ RESTORE_URCs_AND_RETURN(NSAPI_ERROR_WOULD_BLOCK);
65+
}
66+
if (len == -1) {
67+
if (GEMALTO_CINTERION::get_module() == GEMALTO_CINTERION::ModuleTX62 && _at.get_last_read_error() == -2) {
68+
_at.process_oob();
69+
tr_error("Socket %d recvfrom finished!", socket->id);
70+
socket->pending_bytes = 0;
71+
- return NSAPI_ERROR_OK;
72+
+ RESTORE_URCs_AND_RETURN(NSAPI_ERROR_OK);
73+
}
74+
tr_error("Socket %d recvfrom failed!", socket->id);
75+
- return NSAPI_ERROR_DEVICE_ERROR;
76+
+ RESTORE_URCs_AND_RETURN(NSAPI_ERROR_DEVICE_ERROR);
77+
}
78+
if (len >= (nsapi_size_or_error_t)size) {
79+
len = (nsapi_size_or_error_t)size;
80+
@@ -606,7 +611,7 @@ sisr_retry:
81+
int len = _at.read_bytes(at_buf + ip_len, 1);
82+
if (len <= 0) {
83+
tr_error("Socket %d recvfrom addr (len %d)", socket->id, ip_len);
84+
- return NSAPI_ERROR_DEVICE_ERROR;
85+
+ RESTORE_URCs_AND_RETURN(NSAPI_ERROR_DEVICE_ERROR);
86+
}
87+
ip_len += len;
88+
} while (ip_len < ip_address_len && at_buf[ip_len - 2] != '\r' && at_buf[ip_len - 1] != '\n');
89+
@@ -629,7 +634,7 @@ sisr_retry:
90+
int ip_len = _at.read_string(ip_address, sizeof(ip_address));
91+
if (ip_len <= 0) {
92+
tr_error("Socket %d recvfrom addr (len %d)", socket->id, ip_len);
93+
- return NSAPI_ERROR_DEVICE_ERROR;
94+
+ RESTORE_URCs_AND_RETURN(NSAPI_ERROR_DEVICE_ERROR);
95+
}
96+
}
97+
98+
@@ -671,7 +676,7 @@ sisr_retry:
99+
100+
_at.resp_stop();
101+
102+
- return (_at.get_last_error() == NSAPI_ERROR_OK) ? (recv_len ? recv_len : NSAPI_ERROR_WOULD_BLOCK) : NSAPI_ERROR_DEVICE_ERROR;
103+
+ RESTORE_URCs_AND_RETURN((_at.get_last_error() == NSAPI_ERROR_OK) ? (recv_len ? recv_len : NSAPI_ERROR_WOULD_BLOCK) : NSAPI_ERROR_DEVICE_ERROR);
104+
}
105+
106+
// setup internet connection profile for sockets
107+
--
108+
2.42.0
109+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
From 8dd642cb19e16ae9169fa52f26f4b1a6abc489d8 Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Tue, 7 Nov 2023 14:10:31 +0100
4+
Subject: [PATCH 216/221] AT_CellularContext: Fix ^SCFG commands to configure
5+
bands and URCs
6+
7+
---
8+
.../source/framework/AT/AT_CellularContext.cpp | 15 +++++----------
9+
1 file changed, 5 insertions(+), 10 deletions(-)
10+
11+
diff --git a/connectivity/cellular/source/framework/AT/AT_CellularContext.cpp b/connectivity/cellular/source/framework/AT/AT_CellularContext.cpp
12+
index 087846e9b5..e876e384c9 100644
13+
--- a/connectivity/cellular/source/framework/AT/AT_CellularContext.cpp
14+
+++ b/connectivity/cellular/source/framework/AT/AT_CellularContext.cpp
15+
@@ -452,26 +452,21 @@ void AT_CellularContext::enable_access_technology()
16+
{
17+
case CATM1:
18+
_at.at_cmd_discard("^SXRAT", "=","%d", _rat);
19+
- _at.cmd_start_stop("^SCFG", "=","%s%s", "Radio/Band/CatM",buffer);
20+
- _at.resp_start("^SCFG");
21+
- _at.cmd_start_stop("^SCFG", "=","%s%d%d", "Radio/Band/CatNB",0,0);
22+
- _at.resp_start("^SCFG");
23+
+ _at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatM",buffer);
24+
+ _at.at_cmd_discard("^SCFG", "=","%s%d%d", "Radio/Band/CatNB",0,0);
25+
break;
26+
27+
case CATNB:
28+
_at.at_cmd_discard("^SXRAT", "=","%d", _rat);
29+
- _at.cmd_start_stop("^SCFG", "=","%s%s", "Radio/Band/CatNB",buffer);
30+
- _at.resp_start("^SCFG");
31+
- _at.cmd_start_stop("^SCFG", "=","%s%d%d", "Radio/Band/CatM",0,0);
32+
- _at.resp_start("^SCFG");
33+
+ _at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatNB",buffer);
34+
+ _at.at_cmd_discard("^SCFG", "=","%s%d%d", "Radio/Band/CatM",0,0);
35+
break;
36+
37+
default:
38+
break;
39+
}
40+
41+
- _at.cmd_start_stop("^SCFG", "=", "%s%s", "Tcp/withURCs", "on");
42+
- _at.resp_start("^SCFG");
43+
+ _at.at_cmd_discard("^SCFG", "=", "%s%s", "Tcp/withURCs", "on");
44+
free(buffer);
45+
46+
}
47+
--
48+
2.42.0
49+
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
From 822f1b2b855afd1f332dc3c8e490c1f7b08923b5 Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Fri, 10 Nov 2023 10:30:12 +0100
4+
Subject: [PATCH 217/221] AT_CellularContext: move enable_access_technology()
5+
at commands into GEMALTO_CINTERION_CellularContext
6+
7+
---
8+
.../framework/AT/AT_CellularContext.h | 4 +--
9+
.../framework/AT/AT_CellularContext.cpp | 25 +----------------
10+
.../GEMALTO_CINTERION_CellularContext.cpp | 28 +++++++++++++++++++
11+
.../GEMALTO_CINTERION_CellularContext.h | 1 +
12+
4 files changed, 32 insertions(+), 26 deletions(-)
13+
14+
diff --git a/connectivity/cellular/include/cellular/framework/AT/AT_CellularContext.h b/connectivity/cellular/include/cellular/framework/AT/AT_CellularContext.h
15+
index eb3bf5afdd..2f68f1f97b 100644
16+
--- a/connectivity/cellular/include/cellular/framework/AT/AT_CellularContext.h
17+
+++ b/connectivity/cellular/include/cellular/framework/AT/AT_CellularContext.h
18+
@@ -135,8 +135,6 @@ private:
19+
20+
PinName _dcd_pin;
21+
bool _active_high;
22+
- RadioAccessTechnologyType _rat;
23+
- FrequencyBand _band;
24+
25+
protected:
26+
char _found_apn[MAX_APN_LENGTH];
27+
@@ -144,6 +142,8 @@ protected:
28+
bool _cp_req;
29+
bool _is_connected;
30+
ATHandler &_at;
31+
+ RadioAccessTechnologyType _rat;
32+
+ FrequencyBand _band;
33+
};
34+
35+
} // namespace mbed
36+
diff --git a/connectivity/cellular/source/framework/AT/AT_CellularContext.cpp b/connectivity/cellular/source/framework/AT/AT_CellularContext.cpp
37+
index e876e384c9..c05fc386e0 100644
38+
--- a/connectivity/cellular/source/framework/AT/AT_CellularContext.cpp
39+
+++ b/connectivity/cellular/source/framework/AT/AT_CellularContext.cpp
40+
@@ -445,30 +445,7 @@ bool AT_CellularContext::set_new_context(int cid)
41+
42+
void AT_CellularContext::enable_access_technology()
43+
{
44+
- char *buffer = new char [8];
45+
- memset(buffer, 0, 8);
46+
- sprintf(buffer,"%08X", _band);
47+
- switch (_rat)
48+
- {
49+
- case CATM1:
50+
- _at.at_cmd_discard("^SXRAT", "=","%d", _rat);
51+
- _at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatM",buffer);
52+
- _at.at_cmd_discard("^SCFG", "=","%s%d%d", "Radio/Band/CatNB",0,0);
53+
- break;
54+
-
55+
- case CATNB:
56+
- _at.at_cmd_discard("^SXRAT", "=","%d", _rat);
57+
- _at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatNB",buffer);
58+
- _at.at_cmd_discard("^SCFG", "=","%s%d%d", "Radio/Band/CatM",0,0);
59+
- break;
60+
-
61+
- default:
62+
- break;
63+
- }
64+
-
65+
- _at.at_cmd_discard("^SCFG", "=", "%s%s", "Tcp/withURCs", "on");
66+
- free(buffer);
67+
-
68+
+ enable_access_technology();
69+
}
70+
71+
nsapi_error_t AT_CellularContext::do_activate_context()
72+
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp
73+
index 7ee2c8e53c..bc2b1d514c 100644
74+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp
75+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp
76+
@@ -148,4 +148,32 @@ NetworkStack *GEMALTO_CINTERION_CellularContext::get_stack()
77+
}
78+
#endif // NSAPI_PPP_AVAILABLE
79+
80+
+void GEMALTO_CINTERION_CellularContext::enable_access_technology()
81+
+{
82+
+ char *buffer = new char [8];
83+
+ memset(buffer, 0, 8);
84+
+ sprintf(buffer,"%08X", _band);
85+
+ switch (_rat)
86+
+ {
87+
+ case CATM1:
88+
+ _at.at_cmd_discard("^SXRAT", "=","%d", _rat);
89+
+ _at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatM",buffer);
90+
+ _at.at_cmd_discard("^SCFG", "=","%s%d%d", "Radio/Band/CatNB",0,0);
91+
+ break;
92+
+
93+
+ case CATNB:
94+
+ _at.at_cmd_discard("^SXRAT", "=","%d", _rat);
95+
+ _at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatNB",buffer);
96+
+ _at.at_cmd_discard("^SCFG", "=","%s%d%d", "Radio/Band/CatM",0,0);
97+
+ break;
98+
+
99+
+ default:
100+
+ break;
101+
+ }
102+
+
103+
+ _at.at_cmd_discard("^SCFG", "=", "%s%s", "Tcp/withURCs", "on");
104+
+ free(buffer);
105+
+
106+
+}
107+
+
108+
} /* namespace mbed */
109+
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.h b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.h
110+
index 0645b2b87c..cd9aef0222 100644
111+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.h
112+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.h
113+
@@ -34,6 +34,7 @@ protected:
114+
virtual NetworkStack *get_stack();
115+
#endif // NSAPI_PPP_AVAILABLE
116+
virtual nsapi_error_t do_user_authentication();
117+
+ virtual void enable_access_technology();
118+
};
119+
120+
} /* namespace mbed */
121+
--
122+
2.42.0
123+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From 915ad28bd3e9d369128691e8558c4626bc65fb82 Mon Sep 17 00:00:00 2001
2+
From: pennam <m.pennasilico@arduino.cc>
3+
Date: Fri, 10 Nov 2023 10:30:54 +0100
4+
Subject: [PATCH 218/221] GEMALTO_CINTERION_CellularContext: do not disable all
5+
bands
6+
7+
* Switching rat AT command fails and should not be necessary to disable bands since we do not use a fallback rat
8+
---
9+
.../GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp | 2 --
10+
1 file changed, 2 deletions(-)
11+
12+
diff --git a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp
13+
index bc2b1d514c..bf7522621b 100644
14+
--- a/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp
15+
+++ b/connectivity/drivers/cellular/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularContext.cpp
16+
@@ -158,13 +158,11 @@ void GEMALTO_CINTERION_CellularContext::enable_access_technology()
17+
case CATM1:
18+
_at.at_cmd_discard("^SXRAT", "=","%d", _rat);
19+
_at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatM",buffer);
20+
- _at.at_cmd_discard("^SCFG", "=","%s%d%d", "Radio/Band/CatNB",0,0);
21+
break;
22+
23+
case CATNB:
24+
_at.at_cmd_discard("^SXRAT", "=","%d", _rat);
25+
_at.at_cmd_discard("^SCFG", "=","%s%s", "Radio/Band/CatNB",buffer);
26+
- _at.at_cmd_discard("^SCFG", "=","%s%d%d", "Radio/Band/CatM",0,0);
27+
break;
28+
29+
default:
30+
--
31+
2.42.0
32+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp