diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2012-01-26 18:56:16 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2012-01-28 13:13:38 +0100 |
commit | c4701d420479f45c2fdf1526945edd707ed32a55 (patch) | |
tree | 2e5a4efad5f3a94f61deee7ea52e14454f132cd9 /src | |
parent | 9dd1f00e836044d9378350882e54c8c7442b3e60 (diff) |
Added callback function to forward L1CTL packets to rather than SERCOM
This is experimental, maybe there should be a better way to do that.
Diffstat (limited to 'src')
-rw-r--r-- | src/target/firmware/include/layer1/l23_api.h | 2 | ||||
-rw-r--r-- | src/target/firmware/layer1/l23_api.c | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/target/firmware/include/layer1/l23_api.h b/src/target/firmware/include/layer1/l23_api.h index 9b10b62a..4ea71018 100644 --- a/src/target/firmware/include/layer1/l23_api.h +++ b/src/target/firmware/include/layer1/l23_api.h @@ -9,6 +9,8 @@ void l1a_l23api_init(void); void l1_queue_for_l2(struct msgb *msg); struct msgb *l1ctl_msgb_alloc(uint8_t msg_type); struct msgb *l1_create_l2_msg(int msg_type, uint32_t fn, uint16_t snr, uint16_t arfcn); +extern void (*l1a_l23_tx_cb)(struct msgb *msg); +void l1a_l23_rx(uint8_t dlci, struct msgb *msg); void l1ctl_tx_reset(uint8_t msg_type, uint8_t reset_type); diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c index ed43e142..f8152c5c 100644 --- a/src/target/firmware/layer1/l23_api.c +++ b/src/target/firmware/layer1/l23_api.c @@ -49,8 +49,14 @@ #define L3_MSG_HEAD 4 #define L3_MSG_SIZE (sizeof(struct l1ctl_hdr)+sizeof(struct l1ctl_info_dl)+sizeof(struct l1ctl_traffic_ind) + L3_MSG_HEAD) +void (*l1a_l23_tx_cb)(struct msgb *msg) = NULL; + void l1_queue_for_l2(struct msgb *msg) { + if (l1a_l23_tx_cb) { + l1a_l23_tx_cb(msg); + return; + } /* forward via serial for now */ sercomm_sendmsg(SC_DLCI_L1A_L23, msg); } @@ -574,7 +580,7 @@ static void l1ctl_sim_req(struct msgb *msg) } /* callback from SERCOMM when L2 sends a message to L1 */ -static void l1a_l23_rx_cb(uint8_t dlci, struct msgb *msg) +void l1a_l23_rx(uint8_t dlci, struct msgb *msg) { struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data; @@ -653,5 +659,6 @@ exit_nofree: void l1a_l23api_init(void) { - sercomm_register_rx_cb(SC_DLCI_L1A_L23, l1a_l23_rx_cb); + sercomm_register_rx_cb(SC_DLCI_L1A_L23, l1a_l23_rx); } + |