summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/layer1
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2010-10-15 21:02:02 +0200
committerSylvain Munaut <tnt@246tNt.com>2010-10-25 20:58:31 +0200
commitf3d1f64e4eababaaf894f3dd1e307d4470dbc8db (patch)
tree9dbb0b05e684c7619487ffd58697b693449075a0 /src/target/firmware/layer1
parente972e1c6b7f0777416e552e2e92c0f10511f67db (diff)
target/fw/layer1: Use common DSP API memcpy instead of repeating code
Also get rid of some early debug print that aren't needed now. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src/target/firmware/layer1')
-rw-r--r--src/target/firmware/layer1/prim_rx_nb.c7
-rw-r--r--src/target/firmware/layer1/prim_tx_nb.c15
2 files changed, 4 insertions, 18 deletions
diff --git a/src/target/firmware/layer1/prim_rx_nb.c b/src/target/firmware/layer1/prim_rx_nb.c
index 6b5ce57f..ef78a996 100644
--- a/src/target/firmware/layer1/prim_rx_nb.c
+++ b/src/target/firmware/layer1/prim_rx_nb.c
@@ -105,7 +105,7 @@ static int l1s_nb_resp(__unused uint8_t p1, uint8_t burst_id, uint16_t p3)
/* 4th burst, get frame data */
if (dsp_api.db_r->d_burst_d == 3) {
- uint8_t i, j;
+ uint8_t i;
uint16_t num_biterr;
uint32_t avg_snr = 0;
int32_t avg_dbm8 = 0;
@@ -147,10 +147,7 @@ static int l1s_nb_resp(__unused uint8_t p1, uint8_t burst_id, uint16_t p3)
pu_update_rx_level(rxnb.dl->rx_level);
/* copy actual data, skipping the information block [0,1,2] */
- for (j = 0,i = 3; i < 15; i++) {
- rxnb.di->data[j++] = dsp_api.ndb->a_cd[i] & 0xFF;
- rxnb.di->data[j++] = (dsp_api.ndb->a_cd[i] >> 8) & 0xFF;
- }
+ dsp_memcpy_from_api(rxnb.di->data, &dsp_api.ndb->a_cd[3], 23, 0);
l1_queue_for_l2(rxnb.msg);
rxnb.msg = NULL; rxnb.dl = NULL; rxnb.di = NULL;
diff --git a/src/target/firmware/layer1/prim_tx_nb.c b/src/target/firmware/layer1/prim_tx_nb.c
index 584996b4..ba4a59c7 100644
--- a/src/target/firmware/layer1/prim_tx_nb.c
+++ b/src/target/firmware/layer1/prim_tx_nb.c
@@ -85,16 +85,12 @@ static int l1s_tx_cmd(uint8_t p1, uint8_t burst_id, uint16_t p3)
uint16_t *info_ptr = dsp_api.ndb->a_cu;
struct msgb *msg;
const uint8_t *data;
- int i;
- uint8_t j;
/* distinguish between DCCH and ACCH */
if (mf_task_flags & MF_F_SACCH) {
- puts("SACCH queue ");
msg = msgb_dequeue(&l1s.tx_queue[L1S_CHAN_SACCH]);
data = msg ? msg->l3h : pu_get_meas_frame();
} else {
- puts("SDCCH queue ");
msg = msgb_dequeue(&l1s.tx_queue[L1S_CHAN_MAIN]);
data = msg ? msg->l3h : pu_get_idle_frame();
}
@@ -104,15 +100,8 @@ static int l1s_tx_cmd(uint8_t p1, uint8_t burst_id, uint16_t p3)
info_ptr[1] = 0; // 2nd word: cleared.
info_ptr[2] = 0; // 3rd word: cleared.
- /* Copy first 22 bytes in the first 11 words after header. */
- for (i=0, j=(3+0); j<(3+11); j++) {
- info_ptr[j] = ((uint16_t)(data[i])) | ((uint16_t)(data[i+1]) << 8);
- printf("%02x %02x ", data[i], data[i+1]);
- i += 2;
- }
- /* Copy last UWORD8 (23rd) in the 12th word after header. */
- info_ptr[14] = data[22];
- printf("%02x\n", data[22]);
+ /* Copy the actual data after the header */
+ dsp_memcpy_to_api(&info_ptr[3], data, 23, 0);
if (msg)
msgb_free(msg);