?? main.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 + -