Skip to content

Commit 6c77b10

Browse files
authored
Merge from feature nuttx 11.0.0
2 parents 7c3d31b + 6a71977 commit 6c77b10

37 files changed

+203
-184
lines changed

lte/alt1250/alt1250_atcmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static int postproc_internal_atcmd(FAR struct alt1250_s *dev,
7373
FAR struct alt_container_s *reply,
7474
FAR struct usock_s *usock,
7575
FAR int32_t *usock_result,
76-
FAR uint8_t *usock_xid,
76+
FAR uint64_t *usock_xid,
7777
FAR struct usock_ackinfo_s *ackinfo,
7878
unsigned long arg)
7979
{

lte/alt1250/alt1250_daemon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ struct alt1250_s
123123

124124
struct sms_info_s sms_info;
125125
bool is_support_lwm2m;
126-
int lwm2m_apply_xid;
126+
int64_t lwm2m_apply_xid;
127127
};
128128

129129
#endif /* __LTE_ALT1250_ALT1250_DAEMON_H__ */

lte/alt1250/alt1250_devevent.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
static int handle_replypkt(FAR struct alt1250_s *dev,
5555
FAR struct alt_container_s *reply,
56-
FAR int32_t *usock_result, uint8_t *usock_xid,
56+
FAR int32_t *usock_result, uint64_t *usock_xid,
5757
FAR struct usock_ackinfo_s *ackinfo)
5858
{
5959
int ret;
@@ -86,7 +86,7 @@ static int perform_alt1250_reply(FAR struct alt1250_s *dev,
8686
{
8787
int ret = REP_NO_ACK;
8888
int32_t ack_result = OK;
89-
uint8_t ack_xid = 0;
89+
uint64_t ack_xid = 0;
9090
struct usock_ackinfo_s ackinfo;
9191

9292
ret = handle_replypkt(dev, container, &ack_result, &ack_xid, &ackinfo);
@@ -131,7 +131,7 @@ static int handle_intentional_reset(FAR struct alt1250_s *dev)
131131
{
132132
if (dev->lwm2m_apply_xid >= 0)
133133
{
134-
usockif_sendack(dev->usockfd, 0, (uint8_t)dev->lwm2m_apply_xid, false);
134+
usockif_sendack(dev->usockfd, 0, (uint64_t)dev->lwm2m_apply_xid, false);
135135
dev->lwm2m_apply_xid = -1;
136136
}
137137

lte/alt1250/alt1250_postproc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
typedef int (*postproc_hdlr_t)(FAR struct alt1250_s *dev,
3939
FAR struct alt_container_s *reply, FAR struct usock_s *usock,
40-
FAR int32_t *usock_result, uint8_t *usock_xid,
40+
FAR int32_t *usock_result, uint64_t *usock_xid,
4141
FAR struct usock_ackinfo_s *ackinfo, unsigned long arg);
4242

4343
struct postproc_s

lte/alt1250/alt1250_reset_seq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static postproc_hdlr_t ponreset_seq[] =
7373

7474
static int postproc_ponresetseq(FAR struct alt1250_s *dev,
7575
FAR struct alt_container_s *reply, FAR struct usock_s *usock,
76-
FAR int32_t *usock_result, FAR uint8_t *usock_xid,
76+
FAR int32_t *usock_result, FAR uint64_t *usock_xid,
7777
FAR struct usock_ackinfo_s *ackinfo, unsigned long arg)
7878
{
7979
int ret = REP_NO_ACK_WOFREE;

lte/alt1250/alt1250_usockevent.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static const usrsock_reqhandler_t handlers[USRSOCK_REQUEST__MAX] =
6060
****************************************************************************/
6161

6262
int usock_reply(int ufd, int action_code, int32_t result,
63-
uint8_t xid, FAR struct usock_ackinfo_s *ackinfo)
63+
uint64_t xid, FAR struct usock_ackinfo_s *ackinfo)
6464
{
6565
int ret = OK;
6666

@@ -103,7 +103,7 @@ int perform_usockrequest(FAR struct alt1250_s *dev)
103103
{
104104
int ret = OK;
105105
int32_t usock_result;
106-
uint8_t usock_xid;
106+
uint64_t usock_xid;
107107
struct usock_ackinfo_s ackinfo;
108108

109109
if (!IS_USOCKREQ_RECEIVED(dev))

lte/alt1250/alt1250_usockevent.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@
5959
typedef int (*usrsock_reqhandler_t)(FAR struct alt1250_s *dev,
6060
FAR struct usrsock_request_buff_s *req,
6161
FAR int32_t *usock_result,
62-
FAR uint8_t *usock_xid,
62+
FAR uint64_t *usock_xid,
6363
FAR struct usock_ackinfo_s *ackinfo);
6464

6565
/****************************************************************************
6666
* Public Function Prototypes
6767
****************************************************************************/
6868

6969
int usock_reply(int ufd, int action_code, int32_t result,
70-
uint8_t xid, FAR struct usock_ackinfo_s *ackinfo);
70+
uint64_t xid, FAR struct usock_ackinfo_s *ackinfo);
7171

7272
int perform_usockrequest(FAR struct alt1250_s *dev);
7373

lte/alt1250/alt1250_usockif.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static int write_to_usock(int fd, FAR void *buf, size_t sz)
6767
* name: send_dataack
6868
****************************************************************************/
6969

70-
static int send_dataack(int fd, uint8_t ackxid, int32_t ackresult,
70+
static int send_dataack(int fd, uint64_t ackxid, int32_t ackresult,
7171
uint16_t valuelen, uint16_t valuelen_nontrunc,
7272
FAR uint8_t *value_ptr, FAR uint8_t *buf_ptr)
7373
{
@@ -345,7 +345,7 @@ void usockif_discard(int fd, size_t sz)
345345
* name: usockif_sendack
346346
****************************************************************************/
347347

348-
int usockif_sendack(int fd, int32_t usock_result, uint8_t usock_xid,
348+
int usockif_sendack(int fd, int32_t usock_result, uint64_t usock_xid,
349349
bool inprogress)
350350
{
351351
struct usrsock_message_req_ack_s ack;
@@ -363,7 +363,7 @@ int usockif_sendack(int fd, int32_t usock_result, uint8_t usock_xid,
363363
* name: usockif_senddataack
364364
****************************************************************************/
365365

366-
int usockif_senddataack(int fd, int32_t usock_result, uint8_t usock_xid,
366+
int usockif_senddataack(int fd, int32_t usock_result, uint64_t usock_xid,
367367
FAR struct usock_ackinfo_s *ackinfo)
368368
{
369369
return send_dataack(fd, usock_xid, usock_result, ackinfo->valuelen,
@@ -382,7 +382,7 @@ int usockif_sendevent(int fd, int usockid, int event)
382382
msg.head.msgid = USRSOCK_MESSAGE_SOCKET_EVENT;
383383
msg.head.flags = USRSOCK_MESSAGE_FLAG_EVENT;
384384
msg.usockid = usockid;
385-
msg.events = event;
385+
msg.head.events = event;
386386

387387
return write_to_usock(fd, &msg, sizeof(msg));
388388
}

lte/alt1250/alt1250_usockif.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ int usockif_readreqsendbuf(int fd, FAR uint8_t *sendbuf, size_t sz);
117117
int usockif_readreqoption(int fd, FAR uint8_t *option, size_t sz);
118118

119119
void usockif_discard(int fd, size_t sz);
120-
int usockif_sendack(int fd, int32_t usock_result, uint8_t usock_xid,
120+
int usockif_sendack(int fd, int32_t usock_result, uint64_t usock_xid,
121121
bool inprogress);
122-
int usockif_senddataack(int fd, int32_t usock_result, uint8_t usock_xid,
122+
int usockif_senddataack(int fd, int32_t usock_result, uint64_t usock_xid,
123123
FAR struct usock_ackinfo_s *ackinfo);
124124
int usockif_sendevent(int fd, int usockid, int event);
125125

lte/alt1250/callback_handlers/alt1250_evt.c

Lines changed: 74 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
#define EVTTASK_NAME "lteevt_task"
6060
#define LAPIEVT_QNAME "/lapievt"
6161

62+
#define clr_evtcb(info) reg_evtcb(info, 0, NULL)
63+
#define search_free_evtcb() search_evtcb(0)
64+
6265
/****************************************************************************
6366
* Private Function Prototypes
6467
****************************************************************************/
@@ -1692,6 +1695,73 @@ static uint64_t alt1250_evt_search(uint32_t cmdid)
16921695
return evtbitmap;
16931696
}
16941697

1698+
/****************************************************************************
1699+
* Name: reg_evtcb
1700+
****************************************************************************/
1701+
1702+
static int reg_evtcb(struct cbinfo_s *info, uint32_t cmdid, FAR void *cb)
1703+
{
1704+
if (info == NULL)
1705+
{
1706+
return ERROR;
1707+
}
1708+
1709+
info->cmdid = cmdid;
1710+
info->cb = cb;
1711+
1712+
return OK;
1713+
}
1714+
1715+
/****************************************************************************
1716+
* Name: search_evtcb
1717+
****************************************************************************/
1718+
1719+
static struct cbinfo_s *search_evtcb(uint32_t cmdid)
1720+
{
1721+
int i;
1722+
1723+
for (i = 0; i < ARRAY_SZ(g_cbtable); i++)
1724+
{
1725+
if (g_cbtable[i].cmdid == cmdid)
1726+
{
1727+
return &g_cbtable[i];
1728+
}
1729+
}
1730+
1731+
return NULL;
1732+
}
1733+
1734+
/****************************************************************************
1735+
* Name: register_evtcb
1736+
****************************************************************************/
1737+
1738+
static int register_evtcb(uint32_t cmdid, FAR void *cb)
1739+
{
1740+
if (search_evtcb(cmdid) == NULL)
1741+
{
1742+
if (reg_evtcb(search_free_evtcb(), cmdid, cb) == ERROR)
1743+
{
1744+
return -EBUSY;
1745+
}
1746+
1747+
return OK;
1748+
}
1749+
else
1750+
{
1751+
return IS_REPORT_API(cmdid) ? -EALREADY : -EINPROGRESS;
1752+
}
1753+
}
1754+
1755+
/****************************************************************************
1756+
* Name: clear_evtcb
1757+
****************************************************************************/
1758+
1759+
static int clear_evtcb(uint32_t cmdid)
1760+
{
1761+
clr_evtcb(search_evtcb(cmdid));
1762+
return OK;
1763+
}
1764+
16951765
/****************************************************************************
16961766
* Public Functions
16971767
****************************************************************************/
@@ -1723,68 +1793,17 @@ int alt1250_evtdatadestroy(void)
17231793

17241794
int alt1250_regevtcb(uint32_t cmdid, FAR void *cb)
17251795
{
1726-
int ret = OK;
1727-
int i;
1728-
bool is_clear = (cb == NULL);
1729-
int myidx = -1;
1730-
int freeidx = -1;
1796+
int ret;
17311797

17321798
sem_wait(&g_cbtablelock);
17331799

1734-
for (i = 0; i < ARRAY_SZ(g_cbtable); i++)
1735-
{
1736-
if (g_cbtable[i].cmdid == 0)
1737-
{
1738-
freeidx = i;
1739-
}
1740-
1741-
if (g_cbtable[i].cmdid == cmdid)
1742-
{
1743-
myidx = i;
1744-
break;
1745-
}
1746-
}
1747-
1748-
if (!is_clear)
1800+
if (cb == NULL)
17491801
{
1750-
/* Found my ID */
1751-
1752-
if (myidx != -1)
1753-
{
1754-
if (IS_REPORT_API(cmdid))
1755-
{
1756-
ret = -EALREADY;
1757-
}
1758-
else
1759-
{
1760-
ret = -EINPROGRESS;
1761-
}
1762-
}
1763-
1764-
/* No free index at table? */
1765-
1766-
else if (freeidx == -1)
1767-
{
1768-
ret = -EBUSY;
1769-
}
1770-
1771-
/* Not found my ID, but found a free index. */
1772-
1773-
else
1774-
{
1775-
g_cbtable[freeidx].cmdid = cmdid;
1776-
g_cbtable[freeidx].cb = cb;
1777-
}
1802+
ret = clear_evtcb(cmdid);
17781803
}
17791804
else
17801805
{
1781-
/* Found my ID */
1782-
1783-
if (myidx != -1)
1784-
{
1785-
g_cbtable[myidx].cmdid = 0;
1786-
g_cbtable[myidx].cb = NULL;
1787-
}
1806+
ret = register_evtcb(cmdid, cb);
17881807
}
17891808

17901809
sem_post(&g_cbtablelock);

0 commit comments

Comments
 (0)