亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? flash.c

?? CC1110點對多點FDMA傳輸方式C源碼
?? C
字號:
/******************************************************************************
*                                                                             *
*        **********                                                           *
*       ************                                                          *
*      ***        ***                                                         *
*     ***    ++    ***                                                        *
*     ***   +  +   ***                      CHIPCON                           *
*     ***   +                                                                 *
*     ***   +  +   ***                                                        *
*     ***    ++    ***                                                        *
*      ***        ***                                                         *
*       ************                                                          *
*        **********                                                           *
*                                                                             *
*******************************************************************************

Filename:     flash.c
Target:       cc2510
Author:       efu
Revised:      20/6-2006
Revision:     1.0

Description:

    This example reads data from the UART and stores it in a flash address
    space. The data is written to the LCD. The next time this example is run,
    the previously stored data is fetched and written to the LCD. Both DMA and
    CPU flash write is used.

    NOTE: The flash supports only a limited number of write/erase cycles,
    therefore, this function should not be used many times, as this may wear
    out the flash page used in this example.

******************************************************************************/
#include <stdio.h>
#include <string.h>
#include "app_ex.h"

// Prototypes
void writeFlashUsingDMA(BYTE* pSrcAddr, INT16 length, WORD flashAddress, BOOL erase);
BOOL flashUnused(BYTE* data, INT16 length);
void initFlash(void);
void flash_main(void);


#define STRING_LENGTH 30
#define PAGE_ADDRESS 0x7000
#define PAGE_NUMBER (PAGE_ADDRESS >> 10)


__no_init const char __code testData[2048] @ PAGE_ADDRESS;


volatile    DMA_DESC dmaChannel;

/******************************************************************************
* @fn  writeFlashUsingDMA
*
* @brief
*      Writes data to flash using DMA. Erases the page in advance if told to.
*
* Parameters:
*
* @param  BYTE* pSrcAddr
*         The start of the data to be written to flash.
*
*         INT16 length
*         The number of bytes to be written to flash.
*
*         WORD flashAddress
*         The address in flash the data is to be written to.
*
*         BOOL erase
*         Indicating whether the flash is to be erased or not.
*
* @return void
*
******************************************************************************/
void writeFlashUsingDMA(BYTE* pSrcAddr, INT16 length, WORD flashAddress, BOOL erase)
{
   BYTE buffer[10];

   INT_GLOBAL_ENABLE(INT_OFF);


   // Setting up the flash address,
   // erasing the page if required.
   SET_WORD(FADDRH, FADDRL, (int)(flashAddress >> 1));
   if(erase == TRUE)
   {
      halFlashErasePage(buffer, PAGE_NUMBER);
   }

   halWait(0xFF);

   // Making sure a multiplum of 4 bytes is transferred.
   while(length & 0x0003){
      length++;
   }


   SET_WORD(dmaChannel.SRCADDRH, dmaChannel.SRCADDRL,   pSrcAddr);   // The start address of the segment
   SET_WORD(dmaChannel.DESTADDRH, dmaChannel.DESTADDRL, &X_FWDATA);  // Input of the AES module
   SET_WORD(dmaChannel.LENH, dmaChannel.LENL, length);               // Setting the length of the transfer (bytes)
   dmaChannel.VLEN      = VLEN_USE_LEN;      // Using the length field
   dmaChannel.PRIORITY  = PRI_LOW;          // High priority
   dmaChannel.M8        = M8_USE_8_BITS;     // Transferring all 8 bits in each byte.
   dmaChannel.IRQMASK   = FALSE;             // The DMA complete interrupt flag is set at completion.
   dmaChannel.DESTINC   = DESTINC_0;         // The destination address is constant
   dmaChannel.SRCINC    = SRCINC_1;          // The address for data fetch is inremented by 1 byte
   dmaChannel.TRIG      = DMATRIG_FLASH;     // Setting the FLASH module to generate the DMA trigger
   dmaChannel.TMODE     = TMODE_SINGLE;      // A single byte is transferred each time.
   dmaChannel.WORDSIZE  = WORDSIZE_BYTE;     // Set to count bytes.

   // Setting up the DMA.
   // Clearing all DMA complete flags and arming the channel.
   DMA_SET_ADDR_DESC0(&dmaChannel);
   DMA_ABORT_CHANNEL(0);
   DMAIRQ &= ~DMA_CHANNEL_0;
   DMA_ARM_CHANNEL(0);

   asm("NOP");

   // Starting to write
   FLASH_CONFIG(WRITE);

   // Waiting for the DMA to finish.
   while(!(DMAIRQ & DMA_CHANNEL_0));
   DMAIRQ &= ~DMA_CHANNEL_0;

   return;
}




/******************************************************************************
* @fn  flashUnused
*
* @brief
*      Checks whether the given flash area is uninitialized (0xFF).
*
* Parameters:
*
* @param  BYTE* data
*         The start of the data to be investigated.
*
*         INT16 length
*         The number of bytes to be insvestigated.
*
* @return BOOL
*         Indicating if flash was unused (TRUE) or not (FALSE).
*
******************************************************************************/
BOOL flashUnused(BYTE* data, INT16 length)
{
   while((data[--length] == 0xFF) && (length));

   if(length == 0)return TRUE;
   else return FALSE;
}


/******************************************************************************
* @fn  initFlash
*
* @brief
*      Initializes components for use with the Flash application example.
*
* Parameters:
*
* @param  void
*
* @return void
*
******************************************************************************/
void initFlash(void)
{
   initLcd();

   INIT_BUTTON();
   INIT_GLED();
   INIT_YLED();

}


/******************************************************************************
* @fn  flash_main
*
* @brief
*      Main function.
*
* Parameters:
*
* @param  void
*
* @return void
*
******************************************************************************/
#ifdef COMPLETE_APPLICATION
void flash_main(void){
#else
void main(void){
#endif
   BYTE buffer[30];
   char inputBuffer[STRING_LENGTH];
   INT8 pointer = 0;
   BOOL stop = FALSE;
   BOOL write = FALSE;
   char c;
   char *menuText[] = {(char*)" CPU write?", (char*)" DMA write?"};
   BYTE command;
   BOOL unUsed;

   initFlash();

   // Clearing buffers
   memset(buffer,0,sizeof(buffer));
   memset(inputBuffer,0,sizeof(inputBuffer));

   // Setting up UART
   UART_SETUP(0,57600,HIGH_STOP);
   UTX0IF = 1;  // Set UART 0 TX interrupt flag

   while(getJoystickDirection() != CENTRED);

   //Displaying the stored flash message.
   lcdUpdateLine(LINE1,(char*)"Last written:");
   if((unUsed = flashUnused((BYTE*)testData, STRING_LENGTH)))
   {
      lcdUpdateLine(LINE2,(char*)"Unused");
   }
   else
   {
      scrollText((char*) testData, STRING_LENGTH);
   }

   while(getJoystickDirection() != CENTRED);
   while(getJoystickDirection() == CENTRED);
   while(getJoystickDirection() != CENTRED);


   // User decides whether to use CPU or DMA to write flash or to abort.
   command = lcdMenu(menuText,2);
   if(command == ABORT_MENU)
   {
      return;
   }


   // Uart communication
   lcdUpdate((char*)"Enter UART", (char*)"data");
   printf((char*)"\n\nFlash Programming\n");


   printf((char*)"Press a key\n\n");
   uartGetkey (); // wait for a key to be pressed or the application to be ended
   if (stopApplication() ) return;
   else
   {
      inputBuffer[0] = U0DBUF;
      halWait(5);
      USART0_FLUSH();
      inputBuffer[1] = U0DBUF;
   }

   // Printing the previously written data
   printf((char*)"\nLast written:\n");
   if(unUsed)
   {
      printf((char*)"Unused\n");
   }
   else
   {
      printf((char*)"%s\n",&testData);
   }

   //Aquiring new data:
   printf((char*)"\n\nType data to be written.\nWill be printed to the LCD next time.");
   printf((char*)"\n(ENTER: store in flash, ESC: abort)\n\n");
   memset(inputBuffer,0,STRING_LENGTH);

   while(!stop)
   {
      c = getkey();
      U0DBUF = c;

      switch (c){
      case ENTER:
         inputBuffer[pointer] = 0;
         printf((char*)"\n\nTo write: %s\nENTER if OK.\n",inputBuffer);
         if(getkey() == ENTER)
         {
            // Write data to flash;
            stop = TRUE;
            write = TRUE;
         }
         else
         {
            // Reaquire data.
            printf((char*)"\nEnter text:\n");
            pointer = 0;
         }
         break;
      case BACK_SPACE:
         // Erasing the last typed data.
         if (pointer > 0)
         {
            pointer--;
            inputBuffer[pointer] = ' ';
         }
         break;
      case ESC:
         // Abort Flash write.
         stop = TRUE;
         write = FALSE;
         break;
      default:
         // Add typed data to buffer.
         if (pointer < STRING_LENGTH-1)
         {
            inputBuffer[pointer] = c;
            pointer++;
         }
         break;
      }
   }

  INT_GLOBAL_ENABLE(INT_OFF);

   // Updating the flash if asked to.
   if(write == TRUE)
   {
      if(command == 0)
      {
         halFlashWritePage((BYTE*) &inputBuffer, buffer, PAGE_NUMBER);
      }
      else
      {
         writeFlashUsingDMA((BYTE*) &inputBuffer, STRING_LENGTH, PAGE_ADDRESS, TRUE);
      }
      printf((char*)"\nUpdated:");
      printf((char*)" %s\n",(char __code*) (PAGE_NUMBER << 10));
      lcdUpdateLine(LINE1,(char*)"Updated");
   }
   else
   {
      printf((char*)"\nNot updated\n");
      lcdUpdateLine(LINE1,(char*)"Not updated");
   }
   lcdUpdateLine(LINE2,(char*)"LEFT to continue");


   // Done
   haltApplicationWithLED();

   return;
}


/******************************************************************************
* @fn  flash_init
*
* @brief
*      Initializes the Flash application example.
*
* Parameters:
*
* @param  APPLICATION *a
*         Main application
*
* @return void
*
******************************************************************************/
#ifdef COMPLETE_APPLICATION
void flash_init(APPLICATION *a)
{
   a->menuText = (char*)"Flash Writing";
   a->description = (char*)"57600 8-N-1";
   a->main_func = flash_main;
}
#endif

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品视频1区2区| 在线观看成人免费视频| 一区二区三区不卡在线观看| 欧美电影免费观看高清完整版 | 蜜桃一区二区三区四区| 久久婷婷国产综合精品青草 | 欧美日韩夫妻久久| 不卡的电影网站| 国产一区二区三区四区在线观看| 夜夜嗨av一区二区三区四季av| 久久久久国产一区二区三区四区 | 丝袜美腿一区二区三区| 日韩一区中文字幕| 久久精品亚洲麻豆av一区二区| 8x福利精品第一导航| 在线免费亚洲电影| 成人h动漫精品一区二| 黄色精品一二区| 开心九九激情九九欧美日韩精美视频电影 | 欧美激情一区在线观看| 欧美大白屁股肥臀xxxxxx| 欧美日韩免费在线视频| 91理论电影在线观看| voyeur盗摄精品| 波多野结衣在线aⅴ中文字幕不卡 波多野结衣在线一区 | 久久精品视频在线免费观看| 日韩欧美的一区二区| 91精选在线观看| 制服丝袜亚洲色图| 欧美日韩亚洲综合在线| 欧美性做爰猛烈叫床潮| 欧美性色黄大片| 欧美性色aⅴ视频一区日韩精品| 一本一道综合狠狠老| 91蝌蚪国产九色| 色先锋aa成人| 91久久久免费一区二区| 欧美无乱码久久久免费午夜一区| 一本色道久久综合狠狠躁的推荐 | 免费观看成人av| 日本欧洲一区二区| 美女网站色91| 精品一二三四在线| 国产高清在线精品| 成人av网站免费| 色婷婷久久一区二区三区麻豆| 91首页免费视频| 欧美日韩国产影片| 日韩亚洲欧美在线| 欧美精品一区二区三区久久久 | 欧美综合视频在线观看| 欧美伦理电影网| 欧美大片一区二区三区| 国产人伦精品一区二区| 亚洲日本一区二区三区| 亚洲一区二区在线播放相泽| 日本成人中文字幕| 国产一区在线不卡| thepron国产精品| 欧美午夜精品理论片a级按摩| 在线综合视频播放| 久久久久久久久久美女| 亚洲免费大片在线观看| 日韩国产欧美在线视频| 国产专区综合网| 91捆绑美女网站| 日韩美一区二区三区| 中文字幕av资源一区| 亚洲最新在线观看| 九一九一国产精品| 99天天综合性| 欧美一二三区在线| 国产精品欧美一级免费| 亚洲成人自拍网| 国产不卡免费视频| 欧美日韩国产片| 国产欧美精品一区| 亚洲国产人成综合网站| 国产精品资源在线| 欧美日韩一区二区欧美激情| 久久久久久久久久久99999| 亚洲午夜一二三区视频| 国产91丝袜在线观看| 欧美日韩亚洲国产综合| 久久精品在这里| 亚洲国产精品久久久男人的天堂| 国产一区二区视频在线| 欧美在线观看视频在线| 国产欧美精品区一区二区三区| 亚洲国产精品久久人人爱| 床上的激情91.| 日韩视频免费观看高清完整版在线观看| 日本一区二区在线不卡| 日本一道高清亚洲日美韩| 色综合久久久网| 久久精品一区二区三区不卡| 日韩成人av影视| 色哟哟亚洲精品| 国产日韩av一区二区| 日本aⅴ亚洲精品中文乱码| 色综合咪咪久久| 国产午夜精品理论片a级大结局 | 亚洲视频香蕉人妖| 国产精品一区免费在线观看| 欧美日本一区二区三区| 亚洲激情欧美激情| 成人av在线一区二区三区| 精品国产乱码久久久久久免费 | 不卡的av在线| 久久久久一区二区三区四区| 日韩成人dvd| 欧美日韩综合在线| 亚洲欧美aⅴ...| 成人a免费在线看| 日本一区二区高清| 国产精品一区二区三区四区| 日韩精品一区二区三区中文不卡| 亚洲电影一区二区| 色av成人天堂桃色av| 亚洲私人影院在线观看| 成人高清免费观看| 欧美极品少妇xxxxⅹ高跟鞋 | 午夜不卡av在线| 欧美自拍偷拍一区| 亚洲免费观看高清完整版在线观看 | 亚洲另类春色国产| 99视频一区二区| 国产精品欧美经典| www.日韩精品| 中文字幕一区二区在线观看| 成人av网站在线观看| 国产精品福利一区| www.日韩大片| 亚洲欧美aⅴ...| 欧美性欧美巨大黑白大战| 夜夜精品浪潮av一区二区三区| 日本韩国欧美三级| 亚洲福利一区二区| 91麻豆精品国产91久久久久久久久| 五月婷婷综合激情| 日韩一区二区视频| 国内精品久久久久影院一蜜桃| ww久久中文字幕| 成人中文字幕在线| 中文字幕永久在线不卡| 91福利资源站| 天堂成人国产精品一区| 精品国产乱码久久久久久牛牛 | 亚洲欧美二区三区| 欧美亚洲禁片免费| 免费观看在线色综合| 精品国产第一区二区三区观看体验| 激情欧美一区二区| 国产精品私人影院| 色妹子一区二区| 日韩精品91亚洲二区在线观看| 欧美精品一区二区三区久久久| 国产成人自拍在线| 亚洲免费在线看| 精品视频在线视频| 久久国产精品第一页| 中文av一区二区| 欧美三级日韩三级| 韩国女主播一区| 亚洲精品ww久久久久久p站| 欧美老年两性高潮| 国产一区二区三区在线观看精品| 亚洲天堂免费看| 日韩色视频在线观看| av亚洲精华国产精华精华| 午夜a成v人精品| 久久精品夜色噜噜亚洲aⅴ| 欧美在线观看视频一区二区 | 国产毛片精品视频| 亚洲欧美色一区| 日韩午夜激情视频| 99久久精品国产一区二区三区 | 在线免费亚洲电影| 国产一区二区成人久久免费影院| 亚洲欧洲日产国产综合网| 欧美一区二区三区人| 成人免费高清在线观看| 日本不卡在线视频| 亚洲美女少妇撒尿| 国产调教视频一区| 欧美日韩精品系列| 99久久精品99国产精品| 青青国产91久久久久久| 一区二区三区在线观看欧美| 欧美精品一区二区久久婷婷| 欧美日韩一区二区电影| www.成人网.com| 国产乱理伦片在线观看夜一区 | 在线这里只有精品| 国产成人激情av| 久久9热精品视频| 亚洲图片自拍偷拍| 亚洲欧洲韩国日本视频| 久久久无码精品亚洲日韩按摩| 欧美人妖巨大在线|