diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2011-07-17 12:44:35 +0200 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2011-11-13 20:25:19 +0100 |
commit | de4f00d9316006333a4a9454d000463c5480b3d5 (patch) | |
tree | 658abc7e78bc57216caeca05b1264b5a732e04e7 /src/target/firmware/layer1 | |
parent | 9311c0025f70df98e4b47940e1398b8de5518668 (diff) |
target/fw/sim: SIM Layer 1 driver
Originally written by dexter and then Andreas did a lot of cleanup
work to bring it into shape for inclusion in master
Written-by: Philipp Maier <zero-kelvin@gmx.de>
Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src/target/firmware/layer1')
-rw-r--r-- | src/target/firmware/layer1/l23_api.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c index 11f07cd7..ed43e142 100644 --- a/src/target/firmware/layer1/l23_api.c +++ b/src/target/firmware/layer1/l23_api.c @@ -41,6 +41,7 @@ #include <abb/twl3025.h> #include <rf/trf6151.h> +#include <calypso/sim.h> #include <l1ctl_proto.h> @@ -552,6 +553,26 @@ static void l1ctl_rx_traffic_req(struct msgb *msg) l1a_txq_msgb_enq(&l1s.tx_queue[L1S_CHAN_TRAFFIC], msg); } +void sim_apdu(uint16_t len, uint8_t *data); + +static void l1ctl_sim_req(struct msgb *msg) +{ + uint16_t len = msg->len - sizeof(struct l1ctl_hdr); + uint8_t *data = msg->data + sizeof(struct l1ctl_hdr); + +#if 1 /* for debugging only */ + { + int i; + printf("SIM Request (%u): ", len); + for (i = 0; i < len; i++) + printf("%02x ", data[i]); + puts("\n"); + } +#endif + + sim_apdu(len, data); +} + /* callback from SERCOMM when L2 sends a message to L1 */ static void l1a_l23_rx_cb(uint8_t dlci, struct msgb *msg) { @@ -619,6 +640,9 @@ static void l1a_l23_rx_cb(uint8_t dlci, struct msgb *msg) l1ctl_rx_traffic_req(msg); /* we have to keep the msgb, not free it! */ goto exit_nofree; + case L1CTL_SIM_REQ: + l1ctl_sim_req(msg); + break; } exit_msgbfree: |