Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
IoT
Open IoT SDK
examples
total-solutions
Commits
73d53d94
Verified
Commit
73d53d94
authored
May 20, 2022
by
Vincent Coubard
Browse files
Convert mqtt agent to CMSIS RTOS
Signed-off-by:
Vincent Coubard
<
vincent.coubard@arm.com
>
parent
39c5e25c
Changes
4
Hide whitespace changes
Inline
Side-by-side
bsp/aws_configs/iot_mqtt_agent_config.h
View file @
73d53d94
/*
* Amazon FreeRTOS V1.4.8
* Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
...
...
@@ -31,7 +32,7 @@
#ifndef _AWS_MQTT_AGENT_CONFIG_H_
#define _AWS_MQTT_AGENT_CONFIG_H_
#include
"
FreeRTOS
.h"
#include
"
cmsis_os2
.h"
/**
* @brief Controls whether or not to report usage metrics to the
...
...
bsp/aws_libraries/abstractions/mqtt_agent/freertos_agent_message.c
View file @
73d53d94
/*
* FreeRTOS V202104.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
...
...
@@ -33,10 +34,6 @@
#include
<string.h>
#include
<stdio.h>
/* Kernel includes. */
#include
"FreeRTOS.h"
#include
"semphr.h"
/* Header include. */
#include
"freertos_agent_message.h"
#include
"core_mqtt_agent_message_interface.h"
...
...
@@ -47,14 +44,14 @@ bool Agent_MessageSend( MQTTAgentMessageContext_t * pMsgCtx,
MQTTAgentCommand_t
*
const
*
pCommandToSend
,
uint32_t
blockTimeMs
)
{
BaseType
_t
queueStatus
=
pdFAIL
;
osStatus
_t
queueStatus
=
osError
;
if
(
(
pMsgCtx
!=
NULL
)
&&
(
pCommandToSend
!=
NULL
)
)
{
queueStatus
=
xQueueSendToBack
(
pMsgCtx
->
queue
,
pCommandToSend
,
pdMS_TO_TICKS
(
blockTimeMs
)
);
queueStatus
=
osMessageQueuePut
(
pMsgCtx
->
queue
,
pCommandToSend
,
0U
,
pdMS_TO_TICKS
(
blockTimeMs
)
);
}
return
(
queueStatus
==
pdPASS
)
?
true
:
false
;
return
(
queueStatus
==
osOK
)
?
true
:
false
;
}
/*-----------------------------------------------------------*/
...
...
@@ -63,12 +60,12 @@ bool Agent_MessageReceive( MQTTAgentMessageContext_t * pMsgCtx,
MQTTAgentCommand_t
**
pReceivedCommand
,
uint32_t
blockTimeMs
)
{
BaseType
_t
queueStatus
=
pdFAIL
;
osStatus
_t
queueStatus
=
osError
;
if
(
(
pMsgCtx
!=
NULL
)
&&
(
pReceivedCommand
!=
NULL
)
)
{
queueStatus
=
xQueueReceive
(
pMsgCtx
->
queue
,
pReceivedCommand
,
pdMS_TO_TICKS
(
blockTimeMs
)
);
queueStatus
=
osMessageQueueGet
(
pMsgCtx
->
queue
,
pReceivedCommand
,
NULL
,
pdMS_TO_TICKS
(
blockTimeMs
)
);
}
return
(
queueStatus
==
pdPASS
)
?
true
:
false
;
return
(
queueStatus
==
osOK
)
?
true
:
false
;
}
bsp/aws_libraries/abstractions/mqtt_agent/freertos_command_pool.c
View file @
73d53d94
/*
* FreeRTOS V202104.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
...
...
@@ -33,9 +34,8 @@
#include
<string.h>
#include
<stdio.h>
/* Kernel includes. */
#include
"FreeRTOS.h"
#include
"semphr.h"
/* CMSIS includes. */
#include
"cmsis_os2.h"
/* Header include. */
#include
"freertos_command_pool.h"
...
...
@@ -55,9 +55,8 @@ static MQTTAgentCommand_t commandStructurePool[ MQTT_COMMAND_CONTEXTS_POOL_SIZE
/**
* @brief The message context used to guard the pool of MQTTAgentCommand_t structures.
* For FreeRTOS, this is implemented with a queue. Structures may be
* obtained by receiving a pointer from the queue, and returned by
* sending the pointer back into it.
* This is implemented with a queue. Structures may be obtained by receiving a
* pointer from the queue, and returned by sending the pointer back into it.
*/
static
MQTTAgentMessageContext_t
commandStructMessageCtx
;
...
...
@@ -72,17 +71,14 @@ void Agent_InitializePool( void )
{
size_t
i
;
MQTTAgentCommand_t
*
pCommand
;
static
uint8_t
staticQueueStorageArea
[
MQTT_COMMAND_CONTEXTS_POOL_SIZE
*
sizeof
(
MQTTAgentCommand_t
*
)
];
static
StaticQueue_t
staticQueueStructure
;
bool
commandAdded
=
false
;
if
(
initStatus
==
QUEUE_NOT_INITIALIZED
)
{
memset
(
(
void
*
)
commandStructurePool
,
0x00
,
sizeof
(
commandStructurePool
)
);
commandStructMessageCtx
.
queue
=
xQueueCreateStatic
(
MQTT_COMMAND_CONTEXTS_POOL_SIZE
,
commandStructMessageCtx
.
queue
=
osMessageQueueNew
(
MQTT_COMMAND_CONTEXTS_POOL_SIZE
,
sizeof
(
MQTTAgentCommand_t
*
),
staticQueueStorageArea
,
&
staticQueueStructure
);
NULL
);
configASSERT
(
commandStructMessageCtx
.
queue
);
/* Populate the queue. */
...
...
bsp/aws_libraries/abstractions/mqtt_agent/include/freertos_agent_message.h
View file @
73d53d94
/*
* FreeRTOS V202104.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
...
...
@@ -35,9 +36,9 @@
#include
<stdint.h>
#include
<stdbool.h>
/*
FreeRTO
S includes. */
#include
"
FreeRTOS
.h"
#include
"
queue
.h"
/*
CMSI
S includes. */
#include
"
cmsis_os2
.h"
#include
"
RTOS_config
.h"
/* Include MQTT agent messaging interface. */
#include
"core_mqtt_agent_message_interface.h"
...
...
@@ -48,7 +49,7 @@
*/
struct
MQTTAgentMessageContext
{
QueueHandle
_t
queue
;
osMessageQueueId
_t
queue
;
};
/*-----------------------------------------------------------*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment