Index: yc_7816/yc_7816.h
===================================================================
--- /YC3121_SDK/fw/sdk/yc_7816/yc_7816.h	(revision 976)
+++ /YC3121_SDK/fw/sdk/yc_7816/yc_7816.h	(working copy)
@@ -95,16 +95,6 @@
 #define     ISO7816_NOTLRC_ERROR        0x81
 
 
-#define 	BIT7    ((uint8_t)1<<7)
-#define 	BIT6    ((uint8_t)1<<6)
-#define 	BIT5    ((uint8_t)1<<5)
-#define 	BIT4    ((uint8_t)1<<4)
-#define 	BIT3    ((uint8_t)1<<3)
-#define 	BIT2    ((uint8_t)1<<2)
-#define 	BIT1    ((uint8_t)1<<1)
-#define 	BIT0    ((uint8_t)1<<0)
-
-
 //***********
 #define     ISO7816_ACTIVE_CARD         0x00
 #define     ISO7816_WARM_RESET          0x01
Index: yc_7816/yc_7816.c
===================================================================
--- /YC3121_SDK/fw/sdk/yc_7816/yc_7816.c	(revision 976)
+++ /YC3121_SDK/fw/sdk/yc_7816/yc_7816.c	(working copy)
@@ -278,6 +278,10 @@
     while (SCI7816_STAT & 1)
     {
         TempChar = SCI7816_DATA;
+        if(TempChar)
+        {
+            
+        }
 #ifdef DEBUG_7816
         MyPrintf("%02x", TempChar);
         MyPrintf("\n");
@@ -900,7 +904,6 @@
 uint16_t ISO7816_DisposePPS(uint8_t TA1)
 {
     uint16_t f;
-    uint8_t rateL, rateH;
     uint8_t   fi, di;
 
     fi = GET_4_BITS_H(TA1);
@@ -911,9 +914,6 @@
     }
     f = fi_table[fi] / di_table[di];
 
-    rateL = (uint8_t)f;
-    rateH = f >> 8;
-
     if (g_7816Para.bTA2Flag == 0)
     {
         f = 372;
@@ -1050,7 +1050,6 @@
         g_T1.bIFSD = 254;
         return ISO7816_TPDU_T1(pCmd, CmdLen, pResp, pRespLen);
     }
-    return OK;
 }
 
 uint16_t ISO7816_LoopBack(void)
Index: yc_7816/yc_7816_T1.c
===================================================================
--- /YC3121_SDK/fw/sdk/yc_7816/yc_7816_T1.c	(revision 976)
+++ /YC3121_SDK/fw/sdk/yc_7816/yc_7816_T1.c	(working copy)
@@ -230,6 +230,10 @@
     while ((SCI7816_STAT & 1) && (num < 256))
     {
         data = SCI7816_DATA;
+        if(data)
+        {
+            
+        }
         num++;
     }
 }
Index: yc_bt.c
===================================================================
--- /YC3121_SDK/fw/sdk/yc_bt.c	(revision 976)
+++ /YC3121_SDK/fw/sdk/yc_bt.c	(working copy)
@@ -1839,18 +1839,11 @@
 
 int BT_ReadBTData(uint8_t* pbuf)
 {
-    uint8_t OpCode;
     int len=0;
     int i=0;
     if(BluetoothBuf.count<3)	return 0;
-    SkipData(1);
-    OpCode=GetData(TRUE);
+    SkipData(2);
     len=GetData(TRUE);
-//  if(OpCode==BLE_DATA)
-//  {
-//      len-=2;//ble handle 处理
-//      SkipData(2);
-//  }
     for(i=0; i<len; i++)
     {
         pbuf[i]=GetData(TRUE);
Index: yc_nfc/yc_emv_contactless_l1.h
===================================================================
--- /YC3121_SDK/fw/sdk/yc_nfc/yc_emv_contactless_l1.h	(revision 976)
+++ /YC3121_SDK/fw/sdk/yc_nfc/yc_emv_contactless_l1.h	(working copy)
@@ -238,15 +238,6 @@
 #define R_BLOCK         2
 #define S_BLOCK         3
 
-#define BIT0            0x01
-#define BIT1            0x02
-#define BIT2            0x04
-#define BIT3            0x08
-#define BIT4            0x10
-#define BIT5            0x20
-#define BIT6            0x40
-#define BIT7            0x80
-
 #define FIFO_LENGTH     64
 #define WATER_LEVEL     32
 
Index: yc_nfc/yc_emv_contactless_l1.c
===================================================================
--- /YC3121_SDK/fw/sdk/yc_nfc/yc_emv_contactless_l1.c	(revision 976)
+++ /YC3121_SDK/fw/sdk/yc_nfc/yc_emv_contactless_l1.c	(working copy)
@@ -919,7 +919,6 @@
   */
 unsigned char YC_EMV_Contactless_L1_WUPA(void)
 {
-    unsigned char i=0;
     unsigned short len = 0;
     unsigned char errno = EMV_ERR_NONE;
     unsigned char WUPA[1]={0};
@@ -942,7 +941,7 @@
 
 #ifdef SDK_DEBUG
         PRINT("ATQA <-: ");
-        for (i = 0; i < len; i++)
+        for (int i = 0; i < len; i++)
         {
             PRINT("%02x ", ATQA[i]);
         }
@@ -964,7 +963,6 @@
   */
 unsigned char YC_EMV_Contactless_L1_REQA(void)
 {
-    unsigned char i=0;
     unsigned short len = 0;
     unsigned char errno = EMV_ERR_NONE;
     unsigned char REQA[1]={0};
@@ -984,7 +982,7 @@
     {
 #ifdef SDK_DEBUG
         PRINT("ATQA <-: ");
-        for (i = 0; i < len; i++)
+        for (int i = 0; i < len; i++)
         {
             PRINT("%02x ", ATQA[i]);
         }
@@ -1203,7 +1201,6 @@
   */
 unsigned char YC_EMV_Contactless_L1_RATS(void)
 {
-    unsigned char i = 0;
     unsigned short len = 0;
     unsigned char SFGI = 0;
     unsigned char TA = 0, TB = 0, TC = 0;
@@ -1220,7 +1217,7 @@
 
 #ifdef SDK_DEBUG
     PRINT("RATS ->: ");
-    for (i = 0; i < 2; i++)
+    for (int i = 0; i < 2; i++)
     {
         PRINT("%02x ", RATS[i]);
     }
@@ -1233,7 +1230,7 @@
     {
 #ifdef SDK_DEBUG
         PRINT("ATS <-: ");
-        for (i = 0; i < len; i++)
+        for (int i = 0; i < len; i++)
         {
             PRINT("%02x ", ATS[i]);
         }
@@ -1348,7 +1345,6 @@
   */
 void YC_EMV_Contactless_L1_HLTA(void)
 {
-    unsigned char i = 0;
     unsigned char HLTA[2] = {0};
 
     HLTA[0] = 0x50;
@@ -1356,7 +1352,7 @@
 
 #ifdef SDK_DEBUG
     PRINT("HLTA ->: ");
-    for (i = 0; i < 2; i++)
+    for (int i = 0; i < 2; i++)
     {
         PRINT("%02x ", HLTA[i]);
     }
@@ -1572,7 +1568,6 @@
   */
 unsigned char YC_EMV_Contactless_L1_ATTRIB(void)
 {
-    unsigned char i = 0;
     unsigned short len = 0;
     unsigned char errno = EMV_ERR_NONE;
     unsigned char ATTRIB[9] = {0};
@@ -1598,7 +1593,7 @@
 
 #ifdef SDK_DEBUG
     PRINT("ATTRIB ->: ");
-    for (i = 0; i < 9; i++)
+    for (int i = 0; i < 9; i++)
     {
         PRINT("%02x ", ATTRIB[i]);
     }
@@ -1613,7 +1608,7 @@
 
 #ifdef SDK_DEBUG
         PRINT("ATTRIB_RES <-: ");
-        for (i = 0; i < len; i++)
+        for (int i = 0; i < len; i++)
         {
             PRINT("%02x ", ATTRIB_RES[i]);
         }
@@ -1641,7 +1636,6 @@
   */
 unsigned char YC_EMV_Contactless_L1_HLTB(void)
 {
-    unsigned char i = 0;
     unsigned short len = 0;
     unsigned char errno = EMV_ERR_NONE;
     unsigned char HLTB[5] = {0};
@@ -1655,7 +1649,7 @@
 
 #ifdef SDK_DEBUG
     PRINT("HLTB ->: ");
-    for (i = 0; i < 5; i++)
+    for (int i = 0; i < 5; i++)
     {
         PRINT("%02x ", HLTB[i]);
     }
@@ -1668,7 +1662,7 @@
 
 #ifdef SDK_DEBUG
     PRINT("HLTB_RES <-: ");
-    for (i = 0; i < len; i++)
+    for (int i = 0; i < len; i++)
     {
         PRINT("%02x ", HLTB_RES[i]);
     }
@@ -1908,7 +1902,7 @@
   * @param  None
   * @retval error code
   */
-static uint8_t EMV_Active(void)
+uint8_t EMV_Active(void)
 {
     uint8_t retr = 0;
     uint8_t errno = EMV_ERR_NONE;
@@ -1978,7 +1972,7 @@
   * @param  None
   * @retval error code
   */
-static uint8_t EMV_PICC_Remove(void)
+uint8_t EMV_PICC_Remove(void)
 {
     if (Poll_Type.Type_A)
     {
@@ -2046,9 +2040,8 @@
 
 
 
-static uint8_t EMV_LoopBack(void)
+uint8_t EMV_LoopBack(void)
 {
-    uint16_t i = 0;
     uint8_t errno = EMV_ERR_NONE;
     uint8_t res[FSD] = {0};
     uint16_t reslen = 0;
@@ -2060,7 +2053,7 @@
 
 #ifdef SDK_DEBUG
     PRINT("C-APDU ->: ");
-    for (i = 0; i < sizeof(APDU_PPSE); i++)
+    for (int i = 0; i < sizeof(APDU_PPSE); i++)
     {
         PRINT("%02x ", APDU_PPSE[i]);
     }
@@ -2077,7 +2070,7 @@
 
 #ifdef SDK_DEBUG
     PRINT("R-APDU <-: ");
-    for (i = 0; i < reslen; i++)
+    for (int i = 0; i < reslen; i++)
     {
         PRINT("%02x ", res[i]);
     }
@@ -2099,7 +2092,7 @@
 
 #ifdef SDK_DEBUG
         PRINT("C-APDU ->: ");
-        for (i = 0; i < reslen - 2; i++)
+        for (int i = 0; i < reslen - 2; i++)
         {
             PRINT("%02x ", res[i]);
         }
@@ -2116,7 +2109,7 @@
 
 #ifdef SDK_DEBUG
         PRINT("R-APDU <-: ");
-        for (i = 0; i < reslen; i++)
+        for (int i = 0; i < reslen; i++)
         {
             PRINT("%02x ", res[i]);
         }
@@ -2124,14 +2117,14 @@
 #endif
     }
 }
-static void EMV_Field_Reset(void)
+void EMV_Field_Reset(void)
 {
     YC_EMV_Contactless_L1_Rf_Switch(OFF);
     Tp();
     YC_EMV_Contactless_L1_Rf_Switch(ON);
 }
 
-static void EMV_Field_Power_Off(void)
+void EMV_Field_Power_Off(void)
 {
     YC_EMV_Contactless_L1_Rf_Switch(OFF);
     Tpoweroff();
@@ -2483,7 +2476,7 @@
 unsigned char  Aset_read_power_xRSSI(void)
 {
 
-    unsigned char tmp = 0, tmp_avgi = 0, tmp_avgq = 0;
+    unsigned char tmp_avgi = 0, tmp_avgq = 0;
     set_dc_win(WIN_SIZE_128);
 
     WRITEREG(REG_TX_PA_GAIN, PA_GAIN_VAL);
@@ -2499,7 +2492,6 @@
     WRITEREG(REG_RSSI_CALC_CTRL, 0x03);
     Nfc_SysTick_Delay_Us(100);
 
-    tmp = READREG(REG_AVG_POW);
     tmp_avgi = READREG(REG_AVG_I);
     tmp_avgq = READREG(REG_AVG_Q);
 
Index: yc_power.c
===================================================================
--- /YC3121_SDK/fw/sdk/yc_power.c	(revision 976)
+++ /YC3121_SDK/fw/sdk/yc_power.c	(working copy)
@@ -25,6 +25,7 @@
 		while(Power_Keyscan());
 		data = lpm_bt_read(LPMBT_CONTROL0);
 		lpm_bt_write(LPMBT_CONTROL0, data & 0xfffbffff);
+        delay_ms(100);
 	}
 
 	return FALSE;
Index: yc_usb/scpu_usb_CDC_Device_Demo/usb_conf.h
===================================================================
--- /YC3121_SDK/fw/sdk/yc_usb/scpu_usb_CDC_Device_Demo/usb_conf.h	(revision 976)
+++ /YC3121_SDK/fw/sdk/yc_usb/scpu_usb_CDC_Device_Demo/usb_conf.h	(working copy)
@@ -236,7 +236,9 @@
 #elif defined (__ICCARM__)     /* IAR Compiler */
     #define __packed    __packed
 #elif defined   ( __GNUC__ )   /* GNU Compiler */
-    //  #define __packed    __attribute__ ((__packed__))
+    #ifndef __packed
+    #define __packed    __attribute__ ((__packed__))
+    #endif
 #elif defined   (__TASKING__)  /* TASKING Compiler */
     #define __packed    __unaligned
 #endif /* __CC_ARM */
Index: yc_usb/scpu_usb_hid_Device_Demo/Usb_dcd_init.c
===================================================================
--- /YC3121_SDK/fw/sdk/yc_usb/scpu_usb_hid_Device_Demo/Usb_dcd_init.c	(revision 976)
+++ /YC3121_SDK/fw/sdk/yc_usb/scpu_usb_hid_Device_Demo/Usb_dcd_init.c	(working copy)
@@ -54,7 +54,7 @@
 uint8_t SetAddress_Flag = 0;
 uint8_t Address_Value = 0;
 uint8_t hid_core_rcv = 0;
-extern volatile uint8_t tx_sendflag;
+volatile uint8_t tx_sendflag[4]={0x01,0x01,0x01,0x01};
 uint32_t USBD_OTG_ISR_Handler(USB_OTG_CORE_HANDLE *pdev)
 {
     USB_OTG_IRQ1_TypeDef gintr_status;
@@ -121,19 +121,21 @@
             /* ep1 send complete*/
             delay_us(10);
             USB_OTG_WRITE_REG8(CORE_USB_FIFO_EMPTY, 0x02);
-            tx_sendflag = 1;
+            tx_sendflag[1] = 1;
         }
         if ((fifo_empty_irq.d8 & 0x04) == 0x04)
         {
             /* ep2 send complete*/
             delay_us(10);
             USB_OTG_WRITE_REG8(CORE_USB_FIFO_EMPTY, 0x04);
+            tx_sendflag[2] = 1;
         }
         if ((fifo_empty_irq.d8 & 0x08) == 0x08)
         {
             /* ep3 send complete*/
             delay_us(10);
             USB_OTG_WRITE_REG8(CORE_USB_FIFO_EMPTY, 0x08);
+            tx_sendflag[3] = 1;
         }
     }
     return retval;
Index: yc_usb/scpu_usb_hid_Device_Demo/usb_conf.h
===================================================================
--- /YC3121_SDK/fw/sdk/yc_usb/scpu_usb_hid_Device_Demo/usb_conf.h	(revision 976)
+++ /YC3121_SDK/fw/sdk/yc_usb/scpu_usb_hid_Device_Demo/usb_conf.h	(working copy)
@@ -234,7 +234,9 @@
 #elif defined (__ICCARM__)     /* IAR Compiler */
     #define __packed    __packed
 #elif defined   ( __GNUC__ )   /* GNU Compiler */
+    #ifndef __packed
     #define __packed    __attribute__ ((__packed__))
+    #endif
 #elif defined   (__TASKING__)  /* TASKING Compiler */
     #define __packed    __unaligned
 #endif /* __CC_ARM */
Index: yc_usb/scpu_usb_msc_Device_Demo/usb_conf.h
===================================================================
--- /YC3121_SDK/fw/sdk/yc_usb/scpu_usb_msc_Device_Demo/usb_conf.h	(revision 976)
+++ /YC3121_SDK/fw/sdk/yc_usb/scpu_usb_msc_Device_Demo/usb_conf.h	(working copy)
@@ -205,7 +205,9 @@
 #elif defined (__ICCARM__)     /* IAR Compiler */
     #define __packed    __packed
 #elif defined   ( __GNUC__ )   /* GNU Compiler */
+    #ifndef __packed
     #define __packed    __attribute__ ((__packed__))
+    #endif
 #elif defined   (__TASKING__)  /* TASKING Compiler */
     #define __packed    __unaligned
 #endif /* __CC_ARM */
Index: yc_usb/scpu_usb_printer_Device_Demo/usb_conf.h
===================================================================
--- /YC3121_SDK/fw/sdk/yc_usb/scpu_usb_printer_Device_Demo/usb_conf.h	(revision 976)
+++ /YC3121_SDK/fw/sdk/yc_usb/scpu_usb_printer_Device_Demo/usb_conf.h	(working copy)
@@ -237,7 +237,9 @@
 #elif defined (__ICCARM__)     /* IAR Compiler */
     #define __packed    __packed
 #elif defined   ( __GNUC__ )   /* GNU Compiler */
-    //  #define __packed    __attribute__ ((__packed__))
+    #ifndef __packed
+    #define __packed    __attribute__ ((__packed__))
+    #endif
 #elif defined   (__TASKING__)  /* TASKING Compiler */
     #define __packed    __unaligned
 #endif /* __CC_ARM */
