[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5739 - gnuradio/branches/features/ofdm/sync/gnuradio-
From: |
trondeau |
Subject: |
[Commit-gnuradio] r5739 - gnuradio/branches/features/ofdm/sync/gnuradio-core/src/lib/general |
Date: |
Fri, 8 Jun 2007 13:28:16 -0600 (MDT) |
Author: trondeau
Date: 2007-06-08 13:28:16 -0600 (Fri, 08 Jun 2007)
New Revision: 5739
Modified:
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.h
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.i
Log:
Passing a string argument to framer to determin modulation (this is a temporary
step to be replaced by an object to do demapping and slicing for a given
modulation type). Also fixed headers and copyright.
Modified:
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc
===================================================================
---
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc
2007-06-08 19:15:37 UTC (rev 5738)
+++
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc
2007-06-08 19:28:16 UTC (rev 5739)
@@ -133,21 +133,33 @@
}
gr_ofdm_frame_sink_sptr
-gr_make_ofdm_frame_sink(gr_msg_queue_sptr target_queue, unsigned int
occupied_carriers)
+gr_make_ofdm_frame_sink(gr_msg_queue_sptr target_queue, unsigned int
occupied_carriers,
+ const std::string &mod)
{
- return gr_ofdm_frame_sink_sptr(new gr_ofdm_frame_sink(target_queue,
occupied_carriers));
+ return gr_ofdm_frame_sink_sptr(new gr_ofdm_frame_sink(target_queue,
occupied_carriers, mod));
}
-gr_ofdm_frame_sink::gr_ofdm_frame_sink(gr_msg_queue_sptr target_queue,
unsigned int occupied_carriers)
+gr_ofdm_frame_sink::gr_ofdm_frame_sink(gr_msg_queue_sptr target_queue,
unsigned int occupied_carriers,
+ const std::string &mod)
: gr_sync_block ("ofdm_frame_sink",
gr_make_io_signature2 (2, 2,
sizeof(gr_complex)*occupied_carriers, sizeof(char)),
gr_make_io_signature (0, 0, 0)),
d_target_queue(target_queue), d_occupied_carriers(occupied_carriers),
d_byte_offset(0), d_partial_byte(0)
{
- d_bytes_out = new unsigned char[(int)ceil(d_occupied_carriers/8.0)];
+ d_bytes_out = new unsigned char[(int)ceil(d_occupied_carriers/4.0)];
+ if(mod == "qpsk") {
+ d_demapper = &gr_ofdm_frame_sink::qpsk_demapper;
+ }
+ else if(mod == "bpsk") {
+ d_demapper = &gr_ofdm_frame_sink::bpsk_demapper;
+ }
+ else {
+ throw std::invalid_argument("Modulation type must be BPSK or QPSK.");
+ }
+
enter_search();
}
@@ -170,7 +182,7 @@
fprintf(stderr,">>> Entering state machine\n");
//bytes = bpsk_demapper(&in[0], d_bytes_out);
- bytes = qpsk_demapper(&in[0], d_bytes_out);
+ bytes = (this->*d_demapper)(&in[0], d_bytes_out);
switch(d_state) {
Modified:
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.h
===================================================================
---
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.h
2007-06-08 19:15:37 UTC (rev 5738)
+++
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.h
2007-06-08 19:28:16 UTC (rev 5739)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2006 Free Software Foundation, Inc.
+ * Copyright 2007 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -30,30 +30,22 @@
typedef boost::shared_ptr<gr_ofdm_frame_sink> gr_ofdm_frame_sink_sptr;
gr_ofdm_frame_sink_sptr
-gr_make_ofdm_frame_sink (gr_msg_queue_sptr target_queue, unsigned int
occupied_tones);
+gr_make_ofdm_frame_sink (gr_msg_queue_sptr target_queue, unsigned int
occupied_tones,
+ const std::string &mod);
/*!
- * \brief Given a stream of bits and access_code flags, assemble packets.
- * \ingroup sink
- *
- * input: stream of bytes from gr_correlate_access_code_bb
- * output: none. Pushes assembled packet into target queue
- *
- * The framer expects a fixed length header of 2 16-bit shorts
- * containing the payload length, followed by the payload. If the
- * 2 16-bit shorts are not identical, this packet is ignored. Better
- * algs are welcome.
- *
- * The input data consists of bytes that have two bits used.
- * Bit 0, the LSB, contains the data bit.
- * Bit 1 if set, indicates that the corresponding bit is the
- * the first bit of the packet. That is, this bit is the first
- * one after the access code.
+ * \brief Takes an OFDM symbol in, demaps it into bits of 0's and 1's, packs
+ * them into packets, and sends to to a message queue sink.
+
+ * NOTE: The mod input parameter simply chooses a pre-defined demapper/slicer.
Eventually,
+ * we want to be able to pass in a reference to an object to do the demapping
and slicing
+ * for a given modulation type.
*/
class gr_ofdm_frame_sink : public gr_sync_block
{
friend gr_ofdm_frame_sink_sptr
- gr_make_ofdm_frame_sink (gr_msg_queue_sptr target_queue, unsigned int
occupied_tones);
+ gr_make_ofdm_frame_sink (gr_msg_queue_sptr target_queue, unsigned int
occupied_tones,
+ const std::string &mod);
private:
enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER};
@@ -78,7 +70,8 @@
int d_packetlen_cnt; // how many so far
protected:
- gr_ofdm_frame_sink(gr_msg_queue_sptr target_queue, unsigned int
occupied_tones);
+ gr_ofdm_frame_sink(gr_msg_queue_sptr target_queue, unsigned int
occupied_tones,
+ const std::string &mod);
void enter_search();
void enter_have_sync();
@@ -96,8 +89,11 @@
unsigned char qpsk_slicer(gr_complex x);
unsigned int qpsk_demapper(const gr_complex *in,
- unsigned char *out);
+ unsigned char *out);
+ // pointer to mod-specific demapper
+ unsigned int (gr_ofdm_frame_sink::*d_demapper)(const gr_complex *in,
unsigned char *out);
+
public:
~gr_ofdm_frame_sink();
Modified:
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.i
===================================================================
---
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.i
2007-06-08 19:15:37 UTC (rev 5738)
+++
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.i
2007-06-08 19:28:16 UTC (rev 5739)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006 Free Software Foundation, Inc.
+ * Copyright 2007 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,12 +23,14 @@
GR_SWIG_BLOCK_MAGIC(gr,ofdm_frame_sink);
gr_ofdm_frame_sink_sptr
-gr_make_ofdm_frame_sink(gr_msg_queue_sptr target_queue, unsigned int
occupied_tones);
+gr_make_ofdm_frame_sink(gr_msg_queue_sptr target_queue, unsigned int
occupied_tones,
+ const std::string &mod);
class gr_ofdm_frame_sink : public gr_sync_block
{
protected:
- gr_ofdm_frame_sink(gr_msg_queue_sptr target_queue, unsigned int
occupied_tones);
+ gr_ofdm_frame_sink(gr_msg_queue_sptr target_queue, unsigned int
occupied_tones,
+ const std::string &mod);
public:
~gr_ofdm_frame_sink();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5739 - gnuradio/branches/features/ofdm/sync/gnuradio-core/src/lib/general,
trondeau <=