This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MMC read write in RTX

Hi,
I am using RTX kernel to read write to MMC the program works fine with normal operation ,but when I use the same code with RTX kernel it does not creat any file infact no information from the MMC is get like File system etc ,is there any new method to use MMC card with MMC any specific routenes for file creation


#include "91x_lib.h"
#include<stdlib.h>
#include <string.h>
#include <stdio.h>
#include "mmc.h"
#include "fat.h"

#ifndef FALSE
#define FALSE 0
#define TRUE 1
#endif

int main(void)
{
        unsigned char SPI_Buffer[512];
        unsigned char data[50]="hello world941\n";
        unsigned int x = 0, y = 0;
        char fname[20];
        unsigned char MMCPRESENCE = 0;
        unsigned char z = FALSE;
//      char *header = (char *)malloc(14);
//      char *infoheader = (char *)malloc(40);
        File_Handler *file_handle;
        file_handle = (File_Handler*)calloc(1,sizeof(File_Handler));
        SCU_Configuration();
        UART_0_GPIO_5_INIT();
        UART0_INIT();
        //SCU_Configuration();                  //Enabling peripheral clock for SSP0 and GPIO2(SSP0 in port 2)
        GPIO_Configuration();           // configuring SSP0 pins in port2
        init_SSP0();
//      createheader(header,116,104);
///     createinfoheader(infoheader,116,104);
        MMCPRESENCE = init_MMC();
        printf("MMCPRESENCE %x \n\r",MMCPRESENCE);
        printf("Logging data to MMC\n\r");
        Read_Disk_Info(SPI_Buffer,file_handle);
        Display_Disk_Info(file_handle);
//      Display_Disk_Info(file_handle);
        printf("opening file\n\r");
        sprintf(fname,"DATA.TXT");
        z=File_Open(fname,SPI_Buffer,file_handle);
        printf("z: %x  \n\r",z);
        //while(1)
        //{
                if(z==TRUE)
                {
                        printf("writing \n\r");
                        Write_File(file_handle,data,strlen(data),SPI_Buffer);
                        printf("written\n\r");
                }
        //}
        File_close(file_handle);
        printf("file closed \n\r");
}


above code works fine without RTX but no file created in RTX kernel

thankd

Parents Reply Children
No data