|
| 1 | +/**************************************************************************** |
| 2 | + * arch/xtensa/src/esp32s2/esp32s2_systemreset.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_XTENSA_SRC_ESP32S3_ESP32S3_SYSTEMRESET_H |
| 22 | +#define __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_SYSTEMRESET_H |
| 23 | + |
| 24 | +/**************************************************************************** |
| 25 | + * Included Files |
| 26 | + ****************************************************************************/ |
| 27 | + |
| 28 | +#ifndef __ASSEMBLY__ |
| 29 | + |
| 30 | +#include <stdint.h> |
| 31 | + |
| 32 | +#undef EXTERN |
| 33 | +#if defined(__cplusplus) |
| 34 | +#define EXTERN extern "C" |
| 35 | +extern "C" |
| 36 | +{ |
| 37 | +#else |
| 38 | +#define EXTERN extern |
| 39 | +#endif |
| 40 | + |
| 41 | +/**************************************************************************** |
| 42 | + * Public Types |
| 43 | + ****************************************************************************/ |
| 44 | + |
| 45 | +/* Shutdown handler type */ |
| 46 | + |
| 47 | +typedef void (*shutdown_handler_t)(void); |
| 48 | + |
| 49 | +/**************************************************************************** |
| 50 | + * Public Function Prototypes |
| 51 | + ****************************************************************************/ |
| 52 | + |
| 53 | +/**************************************************************************** |
| 54 | + * Name: esp32s2_register_shutdown_handler |
| 55 | + * |
| 56 | + * Description: |
| 57 | + * This function allows you to register a handler that gets invoked before |
| 58 | + * the application is restarted. |
| 59 | + * |
| 60 | + * Input Parameters: |
| 61 | + * handler - Function to execute on restart |
| 62 | + * |
| 63 | + * Returned Value: |
| 64 | + * OK on success (positive non-zero values are cmd-specific) |
| 65 | + * Negated errno returned on failure. |
| 66 | + * |
| 67 | + ****************************************************************************/ |
| 68 | + |
| 69 | +int esp32s2_register_shutdown_handler(shutdown_handler_t handler); |
| 70 | + |
| 71 | +/**************************************************************************** |
| 72 | + * Name: esp32s2_unregister_shutdown_handler |
| 73 | + * |
| 74 | + * Description: |
| 75 | + * This function allows you to unregister a handler which was previously |
| 76 | + * registered using up_register_shutdown_handler function. |
| 77 | + * |
| 78 | + * Input Parameters: |
| 79 | + * handler - Function to execute on restart |
| 80 | + * |
| 81 | + * Returned Value: |
| 82 | + * OK on success (positive non-zero values are cmd-specific) |
| 83 | + * Negated errno returned on failure. |
| 84 | + * |
| 85 | + ****************************************************************************/ |
| 86 | + |
| 87 | +int esp32s2_unregister_shutdown_handler(shutdown_handler_t handler); |
| 88 | + |
| 89 | +/**************************************************************************** |
| 90 | + * Name: up_shutdown_handler |
| 91 | + * |
| 92 | + * Description: |
| 93 | + * Process all registered shutdown callback functions. |
| 94 | + * |
| 95 | + ****************************************************************************/ |
| 96 | + |
| 97 | +void up_shutdown_handler(void); |
| 98 | + |
| 99 | +#ifdef __cplusplus |
| 100 | +} |
| 101 | +#endif |
| 102 | +#undef EXTERN |
| 103 | + |
| 104 | +#endif /* __ASSEMBLY__ */ |
| 105 | +#endif /* __ARCH_XTENSA_SRC_ESP32S2_ESP32S2_SYSTEMRESET_H */ |
0 commit comments