[Bugfix][T106][task-view-359]The patch for Resolving the issue of AT instruction quantity exceeding the limit
Only Configure :No
Affected branch: master
Affected module: AT
Is it affected on both ZXIC and MTK:only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: I6793db811c4e5e0a6ba2f511875dad8b981d3746
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatreg/atreg.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatreg/atreg.c
index 5210d43..67bb391 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatreg/atreg.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libatreg/atreg.c
@@ -285,20 +285,20 @@
* @note ÎÞ
* @warning ÎÞ
*/
-static void atreg_ser_allocation_proc(void* patreg_ser_instance)
+static int atreg_ser_allocation_proc(void* patreg_ser_instance)
{
int i,j;
pthread_mutex_lock(&atreg_ser_ctx.at_ser_idpool_lock);
- for (i =0; i < ATREG_SER_ID_MAX; i++) {
+ for (i = 0; i < ATREG_SER_ID_MAX; i++) {
for (j = 7; j >= 0; j--) {
- if (0 == atreg_ser_dynamic_idpool[i] & (1 << j)) {
+ if (0 == (int)(atreg_ser_dynamic_idpool[i] & (1 << j))) {
((struct atreg_ser_instance_t *)patreg_ser_instance)->req_msg_id = 8 * (i + 1) - (j + 1);
((struct atreg_ser_instance_t *)patreg_ser_instance)->rsp_msg_id = 8 * (i + 1) - (j + 1) + 1;
atreg_ser_dynamic_idpool[i] = atreg_ser_dynamic_idpool[i] | (1 << j);
atreg_ser_dynamic_idpool[i] = atreg_ser_dynamic_idpool[i] | (1 << (j - 1));
pthread_mutex_unlock(&atreg_ser_ctx.at_ser_idpool_lock);
- return;
+ return 0;
}
}
}
@@ -306,7 +306,7 @@
slog(ATREG_PRINT, SLOG_ERR, "Err: atreg_ser_allocation_proc id pool is FULL\n");
- return;
+ return -1;
}
@@ -317,18 +317,18 @@
* @note ÎÞ
* @warning ÎÞ
*/
-static void atreg_info_allocation_proc(void* patreg_info_instance)
+static int atreg_info_allocation_proc(void* patreg_info_instance)
{
int i,j;
pthread_mutex_lock(&atreg_info_ctx.at_info_idpool_lock);
for (i = 0; i < ATREG_INFO_ID_MAX; i++) {
for (j = 7; j >= 0; j--) {
- if (0 == atreg_info_dynamic_idpool[i] & (1 << j)) {
+ if (0 == (int)(atreg_info_dynamic_idpool[i] & (1 << j))) {
((struct atreg_info_instance_t *)patreg_info_instance)->req_msg_id = 8 * (i + 1) - (j + 1) + 512;
atreg_info_dynamic_idpool[i] = atreg_info_dynamic_idpool[i] | (1 << j);
pthread_mutex_unlock(&atreg_info_ctx.at_info_idpool_lock);
- return;
+ return 0;
}
}
}
@@ -336,7 +336,7 @@
slog(ATREG_PRINT, SLOG_ERR, "Err: atreg_info_allocation_proc id pool is FULL\n");
- return;
+ return -1;
}
@@ -348,20 +348,25 @@
* @note ÎÞ
* @warning ÎÞ
*/
-static void atreg_dynamic_id_allocation(void* patreg_instance, int atreg_type)
+static int atreg_dynamic_id_allocation(void* patreg_instance, int atreg_type)
{
+ int ret = -1;
+
switch (atreg_type) {
case AT_REG_SER:
- atreg_ser_allocation_proc(patreg_instance);
+ ret = atreg_ser_allocation_proc(patreg_instance);
break;
case AT_REG_INFO:
- atreg_info_allocation_proc(patreg_instance);
+ ret = atreg_info_allocation_proc(patreg_instance);
break;
default:
+ slog(ATREG_PRINT, SLOG_ERR, "Err: atreg_dynamic_id_allocation type invalid\n");
break;
}
+
+ return ret;
}
/**
@@ -435,7 +440,11 @@
}
/* ¶¯Ì¬·ÖÅäreq_msg_idÓërsp_msg_id */
- atreg_dynamic_id_allocation((void *)patreg_ser_instance, AT_REG_SER);
+ if (0 != atreg_dynamic_id_allocation((void *)patreg_ser_instance, AT_REG_SER))
+ {
+ slog(ATREG_PRINT, SLOG_ERR, "Err: serv atreg_dynamic_id_allocation fail\n");
+ return -1;
+ }
/* »º´æatʵÀý */
pthread_mutex_lock(&atreg_ser_ctx.at_ser_lock_tmp);
@@ -567,7 +576,11 @@
}
/* ¶¯Ì¬·ÖÅäreq_msg_id */
- atreg_dynamic_id_allocation((void *)patreg_info_instance, AT_REG_INFO);
+ if (0 != atreg_dynamic_id_allocation((void *)patreg_info_instance, AT_REG_INFO))
+ {
+ slog(ATREG_PRINT, SLOG_ERR, "Err: info atreg_dynamic_id_allocation fail\n");
+ return -1;
+ }
/* »º´æatʵÀý */
pthread_mutex_lock(&atreg_info_ctx.at_info_lock_tmp);