Arkadaşlar merhaba , aşağıda dataflasha yazan bir fonksiyon var , yapmak istediğim fonksiyona değer göndermek.
Çalışan fonksiyon.
void dataflash_yaz(){
__e_iap_status iap_status;
static unsigned char demo_messg[] = "asddmasddddddddmdf";
iap_status = (__e_iap_status) iap_copy_ram_to_flash(&demo_messg, (void *)CONFIG_FLASH_OFFSET, 256);
if (iap_status != CMD_SUCCESS) while(1);
Değer göndermeye çalışıyorum. Pointer olarak denedim olmadı.
dataflash_yaz("11111111")
void dataflash_yaz(unsigned char *demo_messg){
__e_iap_status iap_status;
iap_status = (__e_iap_status) iap_copy_ram_to_flash(&demo_messg, (void *)CONFIG_FLASH_OFFSET, 256);
if (iap_status != CMD_SUCCESS) while(1);
Alıntı yapılan: armsistem - 16 Haziran 2013, 23:54:11
Arkadaşlar merhaba , aşağıda dataflasha yazan bir fonksiyon var , yapmak istediğim fonksiyona değer göndermek.
Çalışan fonksiyon.
void dataflash_yaz(){
__e_iap_status iap_status;
static unsigned char demo_messg[] = "asddmasddddddddmdf";
iap_status = (__e_iap_status) iap_copy_ram_to_flash(&demo_messg, (void *)CONFIG_FLASH_OFFSET, 256);
if (iap_status != CMD_SUCCESS) while(1);
Değer göndermeye çalışıyorum. Pointer olarak denedim olmadı.
dataflash_yaz("11111111")
void dataflash_yaz(unsigned char *demo_messg){
__e_iap_status iap_status;
//EDIT iap_status = (__e_iap_status) iap_copy_ram_to_flash(&demo_messg, (void *)CONFIG_FLASH_OFFSET, 256);
iap_status = (__e_iap_status) iap_copy_ram_to_flash(demo_messg, (void *)CONFIG_FLASH_OFFSET, 256);
if (iap_status != CMD_SUCCESS) while(1);
unsigned char x[]="11111111";
dataflash_yaz(x);
void dataflash_yaz(unsigned char *demo_messg){
__e_iap_status iap_status;
iap_status = (__e_iap_status) iap_copy_ram_to_flash(demo_messg, (void *)CONFIG_FLASH_OFFSET, 256);
if (iap_status != CMD_SUCCESS) while(1);
Bu şekilde deneyebilirseniz çalışması gerekiyor .
Şu şekilde kullanmayı bir dene;
void dataflash_yaz(unsigned char *demo_messg){
__e_iap_status iap_status;
iap_status = (__e_iap_status) iap_copy_ram_to_flash((void *)demo_messg, (void *)CONFIG_FLASH_OFFSET, 256);
if (iap_status != CMD_SUCCESS) while(1);
Olmazsa iap_copy_ram_to_flash fonksiyonunu incelersen;
/**
* Copy RAM contents into flash
*
* @param ram_address RAM address to be copied
* It should be in word boundary
* @param flash_address Flash address where the contents are to be copied
* It should be within 256bytes boundary
* @param count Number of data to be copied (in bytes)
* The options: 256, 512, 1024, 4096
*
* @return CMD_SUCCESS, BUSY, or INVALID_SECTOR
*/
int iap_copy_ram_to_flash(void* ram_address, void* flash_address,
unsigned int count) {
unsigned int command[5];
unsigned int result[4];
command[0] = COPY_RAM_TO_FLASH;
command[1] = (unsigned int) flash_address;
command[2] = (unsigned int) ram_address;
command[3] = count;
command[4] = SystemCoreClock / 1000;
iap_entry(command, result);
return (int) result[0];
}
Alıntı Yap
* @param ram_address RAM address to be copied
* It should be in word boundary
Bu yardımcı olacaktır.
yanıtlar için teşekkür ederim.
Alıntı yapılan: armsistem - 17 Haziran 2013, 10:21:05
yanıtlar için teşekkür ederim.
ByteMaster hocam cevap vermiş. Zaten hata basit,
&demo_messg
demo_messg zaten bir pointer, tekrar ref işaretine gerek yoktu...
Sorumun tam yeri değil ama arkadaşlar dataflash istediğimi yazabiliyorum ama değiştirmek istediğimde sıkıntı oluyor. flw1 yazıyor flw2 yaz dediğimde kilitleniyor.
static unsigned char flw1[]="2222222222222222222222222222222222";
static unsigned char flw2[]="1111111111111111111111111111111111";
if buton1.....
dataflash_yaz(flw1);
else buton2.....
dataflash_yaz(flw2);
void dataflash_yaz(unsigned char *demo_messg){
__e_iap_status iap_status;
U32 SaveInts;
SaveInts = VICIntEnable;
VICIntEnClr = 0xFFFFFFFF;
iap_status = (__e_iap_status) iap_prepare_sector(CONFIG_FLASH_SECTOR,(CONFIG_FLASH_SECTOR + CONFIG_FLASH_SECTOR_SIZE));
if (iap_status != CMD_SUCCESS) while(1);
//*************************************************************************************************************
iap_status = (__e_iap_status) iap_erase_sector(7,7);
if (iap_status != CMD_SUCCESS) while(1);
//***************************************************************************************************************
iap_status = (__e_iap_status) iap_prepare_sector(CONFIG_FLASH_SECTOR, (CONFIG_FLASH_SECTOR + CONFIG_FLASH_SECTOR_SIZE));
if (iap_status != CMD_SUCCESS) while(1);
//***************************************************************************************************************
iap_status = (__e_iap_status) iap_copy_ram_to_flash(demo_messg, (void *)CONFIG_FLASH_OFFSET, 256);
if (iap_status != CMD_SUCCESS) while(1);
//***************************************************************************************************************
VICIntEnable = SaveInts ;
}