@@ -439,12 +439,14 @@ static struct at_socket *alloc_socket_by_device(struct at_device *device, enum a
439439#endif
440440
441441 rt_snprintf (name , RT_NAME_MAX , "%s%d" , "at_skt" , idx );
442- /* create AT socket receive mailbox */
442+ /* create AT socket receive semaphore */
443443 if ((sock -> recv_notice = rt_sem_create (name , 0 , RT_IPC_FLAG_FIFO )) == RT_NULL )
444444 {
445445 LOG_E ("No memory socket receive notic semaphore create." );
446446 goto __err ;
447447 }
448+ /* set AT socket receive semaphore 'max_value' to 1 */
449+ rt_sem_control (sock -> recv_notice , RT_IPC_CMD_SET_VLIMIT , (void * )1 );
448450
449451 rt_snprintf (name , RT_NAME_MAX , "%s%d" , "at_skt" , idx );
450452 /* create AT socket receive ring buffer lock */
@@ -823,7 +825,7 @@ static void at_recv_notice_cb(struct at_socket *sock, at_socket_evt_t event, con
823825 }
824826 rt_mutex_release (sock -> recv_lock );
825827
826- rt_sem_control (sock -> recv_notice , RT_IPC_CMD_RESET , ( void * ) 1 );
828+ rt_sem_release (sock -> recv_notice );
827829
828830 at_do_event_changes (sock , AT_EVENT_RECV , RT_TRUE );
829831}
@@ -842,7 +844,7 @@ static void at_closed_notice_cb(struct at_socket *sock, at_socket_evt_t event, c
842844 at_do_event_changes (sock , AT_EVENT_ERROR , RT_TRUE );
843845
844846 sock -> state = AT_SOCKET_CLOSED ;
845- rt_sem_control (sock -> recv_notice , RT_IPC_CMD_RESET , ( void * ) 1 );
847+ rt_sem_release (sock -> recv_notice );
846848}
847849
848850#ifdef AT_USING_SOCKET_SERVER
0 commit comments