/* #ifndef __vstrf_defined #define __vstrf_defined char *vstrf(char *format,va_list ap) { int len; char *str,dummy[1]; len = vsnprintf(dummy,0,format,ap); str = ArrayAlloc(len,sizeof(char)); vsprintf(str,format,ap); return str; } #endif */ int WriteF(Stream *st,char *format,...) { va_list ap; char* str; int ret; va_start(ap, format); str = vstrf(format,ap); va_end(ap); ret = WriteArray(st,str); ArrayFree(str); return ret; }
/* ** =================================================================== ** Method : IFsh10_SetWordsParametros (bean IntFLASH) ** ** Description : ** Write word to address in FLASH. ** Parameters : ** NAME - DESCRIPTION ** Addr - Address to FLASH. ** Data - Data to write. ** Returns : ** --- - Error code, possible codes: ** - ERR_OK - OK ** - ERR_NOTAVAIL - Desired program/erase ** operation is not available ** - ERR_VALUE - Read value is not equal to ** written value ** - ERR_SPEED - This device does not work ** in the active speed mode ** - ERR_BUSY - Device is busy ** =================================================================== */ byte IFsh10_GrabarFlash(void * PageAddr, word* Array) { byte err; if ((word)PageAddr & 1) /* Aligned address ? */ return ERR_NOTAVAIL; if (FSTAT_CCIF == 0) /* Is previous command complete ? */ return ERR_BUSY; /* If yes then error */ err=EraseSectorInternal(PageAddr); /* Erase sector */ if(err) return(err); /* Return error code if previous operation finished not correctly */ err = WriteArray(PageAddr,0,PAGE_SIZE,Array); /* Restore sector */ PageAddr=0; /* Se puede volver a mandar a grabar*/ if (err) return err; /* Previous operation was error ? */ return ERR_OK; }
void ManejadorMemBTSafe_setData(void * _self, const struct ManejadorMemBTSafeData * data){ struct ManejadorMemBTSafe * self = _self; word deletePage = 0; if(ManejadorMemBTSafeData_nextPageJmp(_self)){ if( ((word)self->actualAddr) < BT_BAJO_CONSUMO_SAFE_PAGES_START + PAGE_SIZE){ deletePage = BT_BAJO_CONSUMO_SAFE_PAGES_START; self->actualAddr = (void*)(BT_BAJO_CONSUMO_SAFE_PAGES_START + PAGE_SIZE); }else{ deletePage = BT_BAJO_CONSUMO_SAFE_PAGES_START + PAGE_SIZE; self->actualAddr = (void*)BT_BAJO_CONSUMO_SAFE_PAGES_START; } } WriteArray(self->actualAddr,0,sizeof(struct ManejadorMemBTSafeData),data); self->actualAddr += (sizeof(struct ManejadorMemBTSafeData)+1)/2; if(deletePage) EraseSectorInternal((void *)deletePage); }
typename std::enable_if<is_singlevalue_container<T>::value>::type WriteObject(T&& t) { WriteArray(t); }
void WriteObject(T(&p)[N]) { WriteArray(p); }
void WriteObject(std::array<T, N>& t) { WriteArray(t); }
/***************************************************************************** * BYTE WriteMemory(DWORD addr, BYTE *data, WORD length) *****************************************************************************/ BYTE WriteMemory(DWORD addr, BYTE *data, WORD length) { return WriteArray(addr, data, length); }
void PDF::WriteArray(const char * name, const IntArray & array) { WriteName(name); WriteArray(array); fputc('\n', file); }