diff --git a/cc_write b/cc_write index 8336a80..e5fcc5b 100755 Binary files a/cc_write and b/cc_write differ diff --git a/cc_write.c b/cc_write.c index 4df3289..440bd5e 100644 --- a/cc_write.c +++ b/cc_write.c @@ -111,6 +111,7 @@ int writePage(int page) uint32_t offset = ((page&0xf)<<11) + Pages[page].minoffset; uint32_t len = Pages[page].maxoffset-Pages[page].minoffset+1; + if(len&0xf) len= (len&0x7f0)+16; // configure DMA-0 pour DEBUG --> RAM uint8_t dma_desc0[8]; dma_desc0[0] = 0x62;// src[15:8] @@ -279,12 +280,12 @@ int main(int argc,char **argv) int page= (sla+addr)>>11; if (page>maxpage) maxpage=page; uint16_t start=(sla+addr)&0x7ff; - if(start+len> 2048) - { + if(start+len> 2048) // some datas are for next page + { //copy end of datas to next page if (page+1>maxpage) maxpage=page+1; memcpy(&Pages[page+1].datas[0] - ,data,(start+len-2048)); - if(0 < Pages[page].minoffset) Pages[page].minoffset=0; + ,data+2048-start,(start+len-2048)); + if(0 < Pages[page+1].minoffset) Pages[page+1].minoffset=0; if( (start+len-2048-1) > Pages[page].maxoffset) Pages[page].maxoffset=start+len-2048-1; len=2048-start; }