芯片解密,芯片破解,IC解密,单片机解密,MCU解密,STM解密

飞芯科技提供芯片解密,芯片破解,IC解密,单片机解密,MCU解密,STM解密逆向服务

IC解密NV32F100引脚图与功能及GPIO驱动程序

  1. IC解密#include "common.h"
  2. IC解密#include "systick.h"
  3. //#include "stdint.h"
  4. uint32_t cnt_start_value;
  5. uint32_t cnt_end_value;
  6. uint32_t overhead;
  7. SysTick_CallbackType SysTick_Callback[1] = {NULL};
  8. static volatile uint32_t mTicks = 0;
  9. #if 0
  10.   __IO uint32_t CTRL;                    /*!< Offset: 0x000 (R/W)  SysTick Control and Status Register */
  11.   __IO uint32_t LOAD;                    /*!< Offset: 0x004 (R/W)  SysTick Reload Value Register       */
  12.   __IO uint32_t VAL;                     /*!< Offset: 0x008 (R/W)  SysTick Current Value Register      */
  13.   __I  uint32_t CALIB;                   /*!< Offset: 0x00C (R/ )  SysTick Calibration Register        */
  14. #endif
  15. void systick_init(void)
  16. {

  17.           SysTick->VAL = 0x0;        /* clear current ETMer value */
  18.     SysTick->LOAD = 0x00FFFFFF;
  19.     SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk;   
  20. }
  21. void SysTick_SetCallBack(SysTick_CallbackType pSysTick_CallBack)
  22. {
  23.     SysTick_Callback[0] = pSysTick_CallBack;
  24.       
  25. }
  26. void delay_us(uint32_t us)  
  27. {
  28.   SysTick->CTRL =0;
  29.   SysTick->LOAD  =  ((BUS_CLK_HZ/1000000)/16)*us;        
  30.   SysTick->VAL   = 0;        
  31.         NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
  32.   SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_TICKINT_Msk;
  33.   SysTick_SetCallBack(SysTick_CallBack);
  34.   while(!mTicks);
  35.   mTicks = 0;
  36.   SysTick->CTRL =0;   //1ض¨ê±Æ÷1ØÖD¶Ï
  37. }

  38. void delay_ms(uint32_t mstime)
  39. {   
  40.         delay_us(mstime*1000);
  41. }
  42. /****************************************************************************//*!
  43. *
  44. * @brief SystickÖD¶Ï·tÎñ×óoˉêy
  45. *
  46. *****************************************************************************/
  47. void SysTick_CallBack(void)        
  48. {
  49.              mTicks++;
  50. }
  51. void systick_disable(void)
  52. {
  53.     SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
  54. }
  55. void cal_systick_read_overhead(void)
  56. {
  57.           uint32_t cnt_start_value;
  58.     uint32_t cnt_end_value;
  59.       
  60.           cnt_start_value = SysTick->VAL;

  61.     cnt_end_value = SysTick->VAL;
  62.       
  63.         overhead = cnt_start_value - cnt_end_value;
  64.       
  65. #ifdef DEBUG_PRINT
  66.         printf("systick start value: 0x%x\n\r", (unsigned int)cnt_start_value);
  67.         printf("systick end value: 0x%x\n\r", (unsigned int) cnt_end_value);
  68.         printf("systick current value read overhead: 0x%x\n\r", (unsigned int)overhead);
  69. #endif

  70. }


  71. void SysTick_Isr(void)
  72. {
  73.     if( SysTick_Callback[0] )
  74.     {
  75.         SysTick_Callback[0]();
  76.     }
  77. }



联系方式

地址:石家庄市新华区民族路77号华强广场D座2009
电话:0311-88816616/87087811
手机:13315190088
传真:0311-67901001
联系人:张工
网址:www.taihedz.cn
邮箱:feixindz@163.com
微信:xinpianjiemi
QQ:527263666/568069805

在线客服
热线电话

企业微信