⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 csr芯片内置dsp编程demo,可以学习它的dsp编程
💻 C
字号:
/*
  Copyright (C) Cambridge Silicon Radio Ltd. 2005-2006
  Part of BlueLab 3.5.2-release

    An example of accessing flash data from the Kalimba DSP

  Note: A kalimba_r03 chip (date code of 450 or higher) must be used if Kalimba
        is to access flash memory.  If the data code is less than 450 then the
        KalimbaLoad() call from the VM will fail
*/

#include <connection.h>
#include <panic.h>
#include <stdio.h>
#include <pio.h>
#include <print.h>
#include <file.h>
#include <kalimba.h>
#include <kalimba_standard_messages.h>

#define FLASH_TEST_MESSAGE_FROM_KALIMBA     0x1000

static const char kal_app[] = "kalimba_flash_access_example/kalimba_flash_access_example.kap";

static TaskData app_data;

void app_handler(Task task, MessageId id, Message message);

int main(void)
{
   /* load the Kalimba app */
   if (!KalimbaLoad(FileFind(FILE_ROOT,kal_app,sizeof(kal_app)-1)))
   {
      PRINT(("KalimbaLoad failed. Could be due to using a BC3-MM with date code less than 450\n"));
      Panic();
   }

   /* send go message to Kalimba */
   if (!KalimbaSendMessage(KALIMBA_MSG_GO,0,0,0,0))
      /* failed to send message to DSP, abort */
      Panic();

   /* set up a task handler */
   app_data.handler = app_handler;

   /* set up so that task handler called for kalimba messages that have been received */
   MessageKalimbaTask (&app_data) ;
   MessageLongKalimbaTask (&app_data) ;

   /* Start the message scheduler loop */
   MessageLoop();

   return 0;
}


void app_handler(Task task, MessageId id, Message message)
{
   task = task;

   /* Handle incoming message identified by its message ID */
   switch(id)
   {
      case MESSAGE_FROM_KALIMBA:
         if (FLASH_TEST_MESSAGE_FROM_KALIMBA == *((uint16*)message))
         {
           PRINT(("Message from Kalimba: %s\n", (char*)((uint16)message + 2)));
         }
         break;

      default:
         /* unhandles msg */
         Panic();
         break;
    }
   return;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -