#include <types.h>
Go to the source code of this file.
Defines | |
#define | TRANSAC_STATE_CLEAN 0x00 |
#define | TRANSAC_STATE_DATA 0xA5 |
Transaction buffer contains data. More... | |
Functions | |
bool | ta_setdata (iu8 *data, iu8 len, iu16 dst) |
Begins a transaction and sets the data. More... | |
bool | ta_commit (void) |
Commits the data in the transaction buffer. More... | |
bool | ta_rollback (void) |
Do a rollback and discard the data in the transaction buffer. More... |
2) Card is removed while writing the status byte: This is most likely no problem. If the state is anything other than TRANSAC_STATE_DATA, it is regarded as clean, which it is. The only problem is, when it accidently is TRANSAC_STATE_DATA, which is IMO very unlikely, because the erased state is totally different. But on the other side, if the card tearing occured shortly after the state update, the state really is TRANSAC_STATE_DATA.
3) Card is removed while doing a commit and writing the data therein: This is no problem, because after the next reset the commit is tried again.
4) Card is removed after a commit, while reseting the status byte: This is no problem, because most likely the new state is interpreted as TRANSAC_STATE_CLEAN, which it is, and if the new state is really TRANSAC_STATE_DATA, it is just a second time written.
5) Card is removed while writing status byte in a rollback: This might be a problem, because the rollback might file, when the unlikely event occures, that the state is TRANSAC_STATE_DATA. But this can also happen, if the card is removed before the rollback, because the state is there already TRANSAC_STATE_DATA.
|
Transaction buffer is clean. (Also all other values not being 0xA5 are interpreted as clean. |
|
Transaction buffer contains data.
|
|
Commits the data in the transaction buffer. Data is written to the destination specified in ta_setdata(). The state is then set to clean. This function must be called after each reset to commit pending transactions.
|
|
Do a rollback and discard the data in the transaction buffer. The state is set to clean.
|
|
Begins a transaction and sets the data. data/len bytes are written to the transaction buffer. The destination address is also stored there. Then the state is set to TRANSAC_STATE_DATA.
|