12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- /**
- * @file hv_boot_Common.c
- * @brief boot common source code.
- * @details This file provides the following functions: \n
- * (1) Initialization and de-initialization functions \n
- * (2) Start and stop functions \n
- * (3) Feed functions \n
- *
- * @author HiView SoC Software Team
- * @version 1.0.0
- * @date 2022-08-18
- * @copyright Copyright(c),2022-8, Hiview Software. All rights reserved.
- * @par History:
- * <table>
- * <tr><th>Author <th>Date <th>Change Description
- * <tr><td>HiView SoC Software Team <td>2022-08-23 <td>init
- * </table>
- */
- #include "hv_chip_Config.h"
- #include "hv_boot_Common.h"
- char g_cBootString[32] = {0};
- static char* toStrHex(unsigned int uiVal)
- {
- int iIndex = 0;
- unsigned int uiTemp = uiVal;
- g_cBootString[0] = '0';
- g_cBootString[1] = 'x';
- for (iIndex = 0; iIndex < 8; iIndex++)
- {
- uiTemp = (uiVal >> ((7-iIndex) * 4)) & 0xf;
- if (uiTemp < 0xa)
- {
- g_cBootString[2+iIndex] = uiTemp + 0x30;
- } else {
- g_cBootString[2+iIndex] = 'A' + uiTemp - 0xa;
- }
- }
- g_cBootString[10] = '\n';
- g_cBootString[11] = '\0';
- return g_cBootString;
- }
- void Hv_Boot_PrintHex(unsigned int Level, unsigned int uiVal)
- {
- if (Level >= BOOT_DEBUG_CONTR_LEVELL)
- {
- Hv_Chip_DebugUartPuts(toStrHex(uiVal));
- }
- return;
- }
- void Hv_Boot_Print_String(unsigned int Level, const char *pcString)
- {
- if (Level >= BOOT_DEBUG_CONTR_LEVELL)
- {
- Hv_Chip_DebugUartPuts(pcString);
- }
- return;
- }
- void Hv_Boot_Wait_Us(unsigned int Us)
- {
- unsigned int uiCnt = Us * (HV_CHIP_CLK_CPU / 7000000);
- while (uiCnt--)
- {
- asm("nop");
- }
- return;
- }
- void Hv_Boot_Wait_Ms(unsigned int Ms)
- {
- unsigned int uiCnt = Ms * (HV_CHIP_CLK_CPU / 7000);
- while(uiCnt--)
- {
- asm("nop");
- }
- return;
- }
|