AM263Px MCU+ SDK  10.01.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 
74 #define CHUNK_SIZE (4096U)
75 #define LOCK_NUM0 (0U)
76 #define LOCK_NUM1 (1U)
77 
78 /* ========================================================================== */
79 /* Structure Declarations */
80 /* ========================================================================== */
81 
86 typedef struct
87 {
88  uint8_t chunk[CHUNK_SIZE];
90  uint32_t chunkOffset;
92  uint32_t currWriteOffset;
94  uint32_t prevWriteOffset;
96  uint32_t flashBaseOffset;
98  uint32_t isXip;
100  ELFUP_ELFPH pht[20];
102  ELFUP_Handle elfuph;
104  FLSOPSKD_handle FLSOPSKDhandle;
107 
115 
124 void FOTAAgent_writeStart(FOTAAgent_handle *pHandle,uint32_t baseAddr,uint32_t wrOffset,uint32_t isXip);
125 
136 int32_t FOTAAgent_writeUpdate(FOTAAgent_handle *pHandle,uint8_t *buf,uint32_t size);
137 
145 
146 
147 #ifdef __cplusplus
148 }
149 #endif
150 
151 #endif /* __FOTAAgent__H_ */
152 
FOTAAgent_handle::FLSOPSKDhandle
FLSOPSKD_handle FLSOPSKDhandle
Definition: fota_agent.h:104
spinlock.h
FOTAAgent_handle
FOTA Agent Driver Handle.
Definition: fota_agent.h:87
FOTAAgent_handle::flashBaseOffset
uint32_t flashBaseOffset
Definition: fota_agent.h:96
FOTAAgent_handle::currWriteOffset
uint32_t currWriteOffset
Definition: fota_agent.h:92
FOTAAgent_writeUpdate
int32_t FOTAAgent_writeUpdate(FOTAAgent_handle *pHandle, uint8_t *buf, uint32_t size)
Sends write scheduling request to hardware IP.
FOTAAgent_init
int32_t FOTAAgent_init(FOTAAgent_handle *pHandle)
Initilize the FOTA Agent and the driver.
CHUNK_SIZE
#define CHUNK_SIZE
Size of write chunk
Definition: fota_agent.h:74
FOTAAgent_handle::elfuph
ELFUP_Handle elfuph
Definition: fota_agent.h:102
FOTAAgent_writeEnd
int32_t FOTAAgent_writeEnd(FOTAAgent_handle *pHandle)
End Fota Write operation.
FOTAAgent_writeStart
void FOTAAgent_writeStart(FOTAAgent_handle *pHandle, uint32_t baseAddr, uint32_t wrOffset, uint32_t isXip)
Starts Fota write operation.
FOTAAgent_handle::chunkOffset
uint32_t chunkOffset
Definition: fota_agent.h:90
DebugP.h
FOTAAgent_handle::prevWriteOffset
uint32_t prevWriteOffset
Definition: fota_agent.h:94
FOTAAgent_handle::isXip
uint32_t isXip
Definition: fota_agent.h:98