After a top-up, batch 28 commit b7fd210 gave Mynewt FCB2 reverse alignment (2 of 3 valid attempts passed) and SPIFFS append error progress (3 of 4) as MEDIUM. Each task comes from the commit Qwen measured, its digest matches, and it is still present at the batch branch head. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
1.9 KiB
C
44 lines
1.9 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include "flash.h"
|
|
int main(int argc,char **argv) {
|
|
if(argc!=3)return 2;
|
|
setvbuf(stdout,NULL,_IONBF,0);
|
|
printf("INIT %d\n",port_start(atoi(argv[1]),atoi(argv[2])));
|
|
spiffs_file handles[64]={0};
|
|
char op[32],name[64];unsigned char buf[8192];
|
|
int i,n,k,w;long off;
|
|
while(scanf("%31s",op)==1) {
|
|
if(!strcmp(op,"OPEN")) {
|
|
if(scanf("%d%d%63s",&i,&k,name)!=3)return 3;
|
|
handles[i]=SPIFFS_open(&port_fs,name,k,0);printf("OPEN %d\n",handles[i]);
|
|
} else if(!strcmp(op,"WRITE")) {
|
|
if(scanf("%d%d%d",&i,&n,&k)!=3 || n<0 || n>8192)return 3;
|
|
for(int j=0;j<n;j++)buf[j]=(unsigned char)(k+j*37);
|
|
printf("WRITE %d\n",(int)SPIFFS_write(&port_fs,handles[i],buf,n));
|
|
} else if(!strcmp(op,"READ")) {
|
|
if(scanf("%d%d",&i,&n)!=2 || n<0 || n>8192)return 3;
|
|
int r=SPIFFS_read(&port_fs,handles[i],buf,n);printf("READ %d ",r);
|
|
if(r>0 && r<=n)for(int j=0;j<r;j++)printf("%02x",buf[j]);puts("");
|
|
} else if(!strcmp(op,"SEEK")) {
|
|
if(scanf("%d%ld%d",&i,&off,&w)!=3)return 3;
|
|
printf("SEEK %d\n",(int)SPIFFS_lseek(&port_fs,handles[i],off,w));
|
|
} else if(!strcmp(op,"TELL")) {
|
|
if(scanf("%d",&i)!=1)return 3;printf("TELL %d\n",(int)SPIFFS_tell(&port_fs,handles[i]));
|
|
} else if(!strcmp(op,"EOF")) {
|
|
if(scanf("%d",&i)!=1)return 3;printf("EOF %d\n",(int)SPIFFS_eof(&port_fs,handles[i]));
|
|
} else if(!strcmp(op,"CLOSE")) {
|
|
if(scanf("%d",&i)!=1)return 3;printf("CLOSE %d\n",(int)SPIFFS_close(&port_fs,handles[i]));
|
|
} else if(!strcmp(op,"FLUSH")) {
|
|
if(scanf("%d",&i)!=1)return 3;printf("FLUSH %d\n",(int)SPIFFS_fflush(&port_fs,handles[i]));
|
|
} else if(!strcmp(op,"FAULT")) {
|
|
if(scanf("%d",&i)!=1)return 3;port_fault_after(i);printf("FAULT %d\n",i);
|
|
} else if(!strcmp(op,"INFO")) {
|
|
u32_t total=0,used=0;int r=SPIFFS_info(&port_fs,&total,&used);
|
|
printf("INFO %d %u %u\n",r,total,used);
|
|
} else return 3;
|
|
}
|
|
return 0;
|
|
}
|