Tool/software: Code Composer Studio
Hi;
I am working on read/write a file with using of SL_Filesystem API. The sl_start(0,0,0) function returns -2004 when I increase read size to 4000 from 3000 bytes.
I want to get file size then read file in one cycle with using of that size.Is it possible to do this without worrying about a limit on reading size? So Is there a limit about read size from a file.
I want to share code which I used;
void mainThread(void *pvParameters) { int32_t status = 0; pthread_attr_t pAttrs_spawn; struct sched_param priParam; SPI_init(); Display_init(); display = Display_open(Display_Type_UART, NULL); if (display == NULL) { /* Failed to open display driver */ while(1); } pthread_attr_init(&pAttrs_spawn); priParam.sched_priority = SPAWN_TASK_PRIORITY; status = pthread_attr_setschedparam(&pAttrs_spawn, &priParam); status |= pthread_attr_setstacksize(&pAttrs_spawn, TASK_STACK_SIZE); status = pthread_create(&spawn_thread, &pAttrs_spawn, sl_Task, NULL); if(status) { printError("Task create failed", status); } mode = sl_Start(0, 0, 0); if (mode < 0) { Display_printf(display, 0, 0,"\n\r[line:%d, error code:%d] %s\n\r", __LINE__, mode, DEVICE_ERROR); } char* DeviceFileName = "test.txt"; _i32 RetVal; unsigned long MaxSize = 4000; unsigned long Offset = 0; unsigned char InputBuffer[4000]; long DeviceFileHandle = sl_FsOpen((unsigned char *)DeviceFileName,SL_FS_READ,NULL); RetVal = sl_FsRead( DeviceFileHandle, Offset, (unsigned char *)InputBuffer, MaxSize); RetVal = sl_FsClose(DeviceFileHandle, NULL, NULL , 0); }