[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit

Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/boot/common/src/loader/cpu/m0/cpu.c b/boot/common/src/loader/cpu/m0/cpu.c
new file mode 100644
index 0000000..084bdb6
--- /dev/null
+++ b/boot/common/src/loader/cpu/m0/cpu.c
@@ -0,0 +1,62 @@
+/*
+ * (C) Copyright 2016 ZXIC Inc.
+ *
+ */
+
+#include <common.h>
+#include "../../drivers/config.h"
+
+
+// ϵͳʱÖÓ
+typedef struct
+{
+	u32		ctrl;					// ϵͳʱÖÓ¿ØÖÆ
+	u32		reload;					// ÖØÔØÖµ
+	u32		count;					// µ±Ç°Öµ
+	u32		calibration;			// У׼ֵ
+
+} t_tick;
+
+
+volatile t_tick	 g_tick; 
+
+
+// ʱÖÓ³õʼ»¯
+void timer_init(void)
+{
+	volatile t_tick	*tick 	= (t_tick*)(&g_tick);
+	tick->ctrl				= 0;
+	tick->count		        = 0;
+	tick->reload			= (u32)-1;
+	tick->ctrl				= 0x05;
+}
+
+// ×¢Òâ×î´ó¼ÆÊ± 24λ
+void usdelay(u32 us)
+{
+	int t0, t1, t2, t3;
+
+	volatile t_tick	*tick 	= (t_tick*)(&g_tick);
+
+	t0  	= tick->count;
+	t1		= us * (SYS_CPU_FREQ / 1000000);
+
+	if(t1 <= t0)
+	{
+		t2	= t0 - t1;
+		while((t3 = tick->count) > t2)
+		{
+			if(t3 > 0xFFFF00) break;
+		}
+	}
+	else
+	{
+		t2	= 0x00FFFFFF + t0 - t1;
+		while(1)
+		{
+			t1 = tick->count;
+			if((t1 >= t0) && (t1 <= t2)) break;
+		}
+	}
+}
+