AM261x MCU+ SDK: fota_agent.h Source File

| AM261x MCU+ SDK 26.00.00 |

fota_agent.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2024 Texas Instruments Incorporated
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the
14 * distribution.
15 *
16 * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
49 #ifndef __FOTAAgent__H_
50 #define __FOTAAgent__H_
51
52 #ifdef __cplusplus
53 extern "C"
54 {
55 #endif
56
57 /* ========================================================================== */
58 /* Include Files */
59 /* ========================================================================== */
60
61 #include <stdio.h>
62 #include <kernel/dpl/DebugP.h>
63 #include <stdlib.h>
64 #include <string.h>
65 #include <drivers/flsopskd.h>
66 #include <middleware/tiELFuParser/tielfup32.h>
67 #include <drivers/spinlock.h>
68
69 /* ========================================================================== */
70 /* Macros & Typedefs */
71 /* ========================================================================== */
72
73 #define FOTAAGENT_WRITEOFFSET_DNC (0U)
74
75 /* ========================================================================== */
76 /* Structure Declarations */
77 /* ========================================================================== */
78
82 typedef struct
83 {
84 size_t programHeaderCnt;
85 ELFUP_ELFPH *pProgramHeader;
86 uint8_t * pProcessingBuffer;
87 FLSOPSKD_Params flsopsParams;
88 }FOTAAgent_Params;
89
90 typedef struct
91 {
92 char doFlashSegments;
93 uint32_t BufferManager_lastAddress;
94 uint32_t pProcessingBuffer_len;
95 uint32_t filePointer;
96 uint32_t flashWritePointer;
97 uint32_t wrOffset;
98 FLSOPSKD_Handle flopsHandle;
99 ELFUP_Handle elfupHandle;
100 FOTAAgent_Params params;
101 } FOTAAgent_Handle;
102
110 int32_t FOTAAgent_Params_init(FOTAAgent_Params *params);
111
122 int32_t FOTAAgent_init(FOTAAgent_Handle *pHandle, FOTAAgent_Params *params);
123
144 int32_t FOTAAgent_writeStart(FOTAAgent_Handle *pHandle, uint32_t wrOffset, char doFlashSegments);
145
161 int32_t FOTAAgent_writeUpdate(FOTAAgent_Handle *pHandle, uint8_t *buf, uint32_t size);
162
173 int32_t FOTAAgent_writeEnd(FOTAAgent_Handle *pHandle);
174
183 int32_t FOTAAgent_getFLSOPSKDHandle(FOTAAgent_Handle *pHandle, FLSOPSKD_Handle* flsopskdHandle);
184
185
186 #ifdef __cplusplus
187 }
188 #endif
189
190 #endif /* __FOTAAgent__H_ */
191
FOTAAgent_Handle::filePointer
uint32_t filePointer
Definition: fota_agent.h:95
FOTAAgent_Handle::pProcessingBuffer_len
uint32_t pProcessingBuffer_len
Definition: fota_agent.h:94
FLSOPSKD_Handle
Definition: flsopskd.h:81
spinlock.h
FOTAAgent_Handle::elfupHandle
ELFUP_Handle elfupHandle
Definition: fota_agent.h:99
FOTAAgent_Params_init
int32_t FOTAAgent_Params_init(FOTAAgent_Params *params)
Initilize params with default values.
FOTAAgent_writeEnd
int32_t FOTAAgent_writeEnd(FOTAAgent_Handle *pHandle)
Logically end writes and end the state machine.
FOTAAgent_Params::pProgramHeader
ELFUP_ELFPH * pProgramHeader
Definition: fota_agent.h:85
FOTAAgent_init
int32_t FOTAAgent_init(FOTAAgent_Handle *pHandle, FOTAAgent_Params *params)
Initilize FOTA Agent API.
FOTAAgent_Handle::doFlashSegments
char doFlashSegments
Definition: fota_agent.h:92
FOTAAgent_writeUpdate
int32_t FOTAAgent_writeUpdate(FOTAAgent_Handle *pHandle, uint8_t *buf, uint32_t size)
Update internal machine with new data.
FOTAAgent_Params::flsopsParams
FLSOPSKD_Params flsopsParams
Definition: fota_agent.h:87
FOTAAgent_Params
FOTA Agent Driver Handle.
Definition: fota_agent.h:83
FLSOPSKD_Params
Definition: flsopskd.h:72
FOTAAgent_Params::pProcessingBuffer
uint8_t * pProcessingBuffer
Definition: fota_agent.h:86
FOTAAgent_writeStart
int32_t FOTAAgent_writeStart(FOTAAgent_Handle *pHandle, uint32_t wrOffset, char doFlashSegments)
Logically start writes and initilize state internal machine.
FOTAAgent_Handle
Definition: fota_agent.h:91
FOTAAgent_Handle::flashWritePointer
uint32_t flashWritePointer
Definition: fota_agent.h:96
FOTAAgent_Params::programHeaderCnt
size_t programHeaderCnt
Definition: fota_agent.h:84
FOTAAgent_getFLSOPSKDHandle
int32_t FOTAAgent_getFLSOPSKDHandle(FOTAAgent_Handle *pHandle, FLSOPSKD_Handle *flsopskdHandle)
Retrive FLSOPSKD handle.
DebugP.h
FOTAAgent_Handle::params
FOTAAgent_Params params
Definition: fota_agent.h:100
FOTAAgent_Handle::wrOffset
uint32_t wrOffset
Definition: fota_agent.h:97
FOTAAgent_Handle::flopsHandle
FLSOPSKD_Handle flopsHandle
Definition: fota_agent.h:98
FOTAAgent_Handle::BufferManager_lastAddress
uint32_t BufferManager_lastAddress
Definition: fota_agent.h:93