mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-17 21:58:33 +03:00
Attempt to implement working simcard emulator
The BUFLEN is fixed 5 bytes now, which has to be increased. A timeout has to be implemented, which is smaller than max_waittime. If the timeout is triggered, the data received in the buffer so far should be sent to the host computer which is responsible for generating a response. Without the timeout the max_waittime of the phone would expire and it would repeat sending the command, so that we do not have atomary messages anymore.
This commit is contained in:
@@ -53,9 +53,9 @@ ring_buffer buf = { {0}, 0 };
|
||||
|
||||
void buf_push(uint8_t item)
|
||||
{
|
||||
buf.buf[buf.idx % (BUFLEN*2)] = item;
|
||||
buf.buf[buf.idx % (BUFLEN)] = item;
|
||||
PR("----- Push: %x %x\n\r", buf.idx, buf.buf[buf.idx]);
|
||||
buf.idx = (buf.idx+1) % (BUFLEN*2);
|
||||
buf.idx = (buf.idx+1) % (BUFLEN);
|
||||
}
|
||||
|
||||
uint8_t get_buf_start(uint8_t *buf_start)
|
||||
@@ -144,7 +144,7 @@ void USART1_IrqHandler( void )
|
||||
PR("%x\n\r", (USART_PHONE->US_RHR) & 0xFF);
|
||||
} /* else: error occured */
|
||||
|
||||
if ((buf.idx % BUFLEN) == 0) {
|
||||
if ((buf.idx % BUFLEN) == BUFLEN-1) {
|
||||
rcvdChar = 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user