1 /** mbed Microcontroller Library
2   ******************************************************************************
3   * @file    sys_api.h
4   * @author
5   * @version V1.0.0
6   * @brief   This file provides following mbed system API:
7   *				-JTAG OFF
8   *				-LOGUART ON/OFF
9   *				-OTA image switch
10   *				-System Reset
11   ******************************************************************************
12   * @attention
13   *
14   * Copyright (c) 2015, Realtek Semiconductor Corp.
15   * All rights reserved.
16   *
17   * This module is a confidential and proprietary property of RealTek and
18   * possession or use of this module requires written permission of RealTek.
19   ******************************************************************************
20   */
21 #ifndef MBED_SYS_API_H
22 #define MBED_SYS_API_H
23 
24 #include "device.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 /** @addtogroup sys SYSTEM
31  *  @ingroup    hal
32  *  @brief      system functions
33  *  @{
34  */
35 
36 ///@name Ameba Common
37 ///@{
38 
39 /**
40   * @brief  Turn off the JTAG function
41   * @retval none
42   */
43 void sys_jtag_off(void);
44 
45 /**
46   * @brief  switch OTA image if the othe OTA image is valid
47   * @retval none
48   * @note for AmebaZ, sys_clear_ota_signature is the same with sys_recover_ota_signature
49   */
50 void sys_clear_ota_signature(void);
51 
52 /**
53   * @brief  switch OTA image if the othe OTA image is valid
54   * @retval none
55   * @note for AmebaZ, sys_clear_ota_signature is the same with sys_recover_ota_signature
56   */
57 void sys_recover_ota_signature(void);
58 
59 /**
60   * @brief  open log uart
61   * @retval none
62   */
63 void sys_log_uart_on(void);
64 
65 /**
66   * @brief  close log uart
67   * @retval none
68   */
69 void sys_log_uart_off(void);
70 
71 /**
72   * @brief  store or load adc calibration parameter
73   * @param  write:  this parameter can be one of the following values:
74   *		@arg 0: load adc calibration parameter offset & gain from flash system data region
75   *		@arg 1: store adc calibration parameter offset & gain to flash system data region
76   * @param  offset: pointer to adc parameter offset
77   * @param  gain: pointer to adc parameter gain
78   * @retval none
79   */
80 void sys_adc_calibration(u8 write, u16 *offset, u16 *gain);
81 
82 /**
83   * @brief  system software reset
84   * @retval none
85   */
86 void sys_reset(void);
87 
88 ///@}
89 
90 #if defined(CONFIG_PLATFORM_8195A) && (CONFIG_PLATFORM_8195A == 1)
91 ///@name Ameba1 Only
92 ///@{
93 /**
94   * @brief check whether is sdram power on
95   * @retval 1: power on
96   *         0: power off
97   */
98 u8   sys_is_sdram_power_on(void);
99 
100 /**
101   * @brief sdram power off
102   * @retval none
103   */
104 void sys_sdram_off(void);
105 ///@}
106 #endif //CONFIG_PLATFORM_8195A
107 
108 #if defined(CONFIG_PLATFORM_8711B) && (CONFIG_PLATFORM_8711B == 1)
109 ///@name AmebaZ Only
110 ///@{
111 /**
112   * @brief vector reset
113   * @retval none
114   */
115 void sys_cpu_reset(void);
116 ///@}
117 #endif //CONFIG_PLATFORM_8711B
118 
119 /*\@}*/
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif
126