card_emu_tests: Cosmetic changes (re-order code; more comments)

Change-Id: I36aefc824187ee99d83a451d869b137c13334d91
diff --git a/firmware/test/card_emu_tests.c b/firmware/test/card_emu_tests.c
index fe1739b..a5ba62e 100644
--- a/firmware/test/card_emu_tests.c
+++ b/firmware/test/card_emu_tests.c
@@ -13,7 +13,9 @@
 #define PHONE_INT	2
 #define PHONE_DATAOUT	3
 
-/* stub functions required by card_emu.c */
+/***********************************************************************
+ * stub functions required by card_emu.c
+ ***********************************************************************/
 
 void card_emu_uart_wait_tx_idle(uint8_t uart_chan)
 {
@@ -30,6 +32,7 @@
 static uint8_t tx_debug_buf[1024];
 static unsigned int tx_debug_buf_idx;
 
+/* the card emulator wants to send some data to the host [reader] */
 int card_emu_uart_tx(uint8_t uart_chan, uint8_t byte)
 {
 	printf("UART_TX(%02x)\n", byte);
@@ -37,13 +40,6 @@
 	return 1;
 }
 
-static void reader_check_and_clear(const uint8_t *data, unsigned int len)
-{
-	assert(len == tx_debug_buf_idx);
-	assert(!memcmp(tx_debug_buf, data, len));
-	tx_debug_buf_idx = 0;
-}
-
 void card_emu_uart_enable(uint8_t uart_chan, uint8_t rxtx)
 {
 	char *rts;
@@ -95,7 +91,21 @@
 	printf("tc_etu_disable(tc_chan=%u)\n", chan_nr);
 }
 
-const uint8_t atr[] = { 0x3b, 0x02, 0x14, 0x50 };
+
+
+/***********************************************************************
+ * test helper functions
+ ***********************************************************************/
+
+
+static void reader_check_and_clear(const uint8_t *data, unsigned int len)
+{
+	assert(len == tx_debug_buf_idx);
+	assert(!memcmp(tx_debug_buf, data, len));
+	tx_debug_buf_idx = 0;
+}
+
+static const uint8_t atr[] = { 0x3b, 0x02, 0x14, 0x50 };
 
 static int verify_atr(struct card_handle *ch)
 {
@@ -130,6 +140,7 @@
 	verify_atr(ch);
 }
 
+/* emulate the host/reader sending some bytes to the [emulated] card */
 static void reader_send_bytes(struct card_handle *ch, const uint8_t *bytes, unsigned int len)
 {
 	unsigned int i;