Developer World
Spresense SDK Library v3.2.0-ebc0364
backuplog.h
1/****************************************************************************
2 * arch/arm/include/cxd56xx/backuplog.h
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership. The
7 * ASF licenses this file to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance with the
9 * License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16 * License for the specific language governing permissions and limitations
17 * under the License.
18 *
19 ****************************************************************************/
20
21#ifndef __ARCH_ARM_INCLUDE_CXD56XX_BACKUPLOG_H
22#define __ARCH_ARM_INCLUDE_CXD56XX_BACKUPLOG_H
23
24/****************************************************************************
25 * Included Files
26 ****************************************************************************/
27
28#include <nuttx/config.h>
29
30#include <sys/types.h>
31#include <stdint.h>
32
33#ifndef __ASSEMBLY__
34#ifdef __cplusplus
35#define EXTERN extern "C"
36extern "C"
37{
38#else
39#define EXTERN extern
40#endif
41
42/****************************************************************************
43 * Public Functions Prototypes
44 ****************************************************************************/
45
46/****************************************************************************
47 * Name: up_backuplog_initialize
48 *
49 * Description:
50 * Initialize the log header where the address and size of each log area
51 * are described. If the log header has been already configured as a wakeup
52 * from sleeping or reboot case, then do nothing and return OK.
53 *
54 * Returned Value:
55 * OK on success; A negated errno value on failure.
56 *
57 ****************************************************************************/
58
59int up_backuplog_initialize(void);
60
61/****************************************************************************
62 * Name: up_backuplog_alloc
63 *
64 * Description:
65 * Allocate the log memory region
66 *
67 * Input Parameters:
68 * name - The log region name
69 * size - The size to allocate
70 *
71 * Returned Value:
72 * The allocated address on success; NULL value on failure.
73 *
74 ****************************************************************************/
75
76void *up_backuplog_alloc(const char *name, size_t size);
77
78/****************************************************************************
79 * Name: up_backuplog_free
80 *
81 * Description:
82 * De-allocate the log memory region
83 *
84 * Input Parameters:
85 * name - The log region name
86 *
87 ****************************************************************************/
88
89void up_backuplog_free(const char *name);
90
91/****************************************************************************
92 * Name: up_backuplog_region
93 *
94 * Description:
95 * Get the address and size of the specified log region name
96 *
97 * Input Parameters:
98 * name - The log region name
99 * addr - The returned address
100 * size - The returned size
101 *
102 * Returned Value:
103 * The index of log entry on success; A negated errno value on failure.
104 *
105 ****************************************************************************/
106
107int up_backuplog_region(const char *name, void **addr, size_t *size);
108
109/****************************************************************************
110 * Name: up_backuplog_entry
111 *
112 * Description:
113 * Get the entry name, address and size
114 *
115 * Input Parameters:
116 * name - The returned entry name
117 * addr - The returned address
118 * size - The returned size
119 *
120 * Returned Value:
121 * OK on success; A negated errno value on failure.
122 *
123 ****************************************************************************/
124
125int up_backuplog_entry(char *name, void **addr, size_t *size);
126
127#undef EXTERN
128#if defined(__cplusplus)
129}
130#endif
131#endif /* __ASSEMBLY__ */
132
133#endif /* __ARCH_ARM_INCLUDE_CXD56XX_BACKUPLOG_H */