mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-07-26 10:38:52 +00:00
55a15958ec
* Add P25 TX external app (UI shell)
- Register p25_tx in external.cmake and external.ld at 0xAE010000
- UI with NAC, SYSID, WACN, RFSSID, SITEID, TG, VCH fields
- 2.4 Msps TX, 155 MHz default, no baseband (m4_app_tag={0,0,0,0})
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add P25 TX baseband processor (M4)
- P25TxConfigure = 102 in message.hpp + P25TxConfigureMessage
- image_tag_p25_tx in spi_image.hpp
- set_p25tx_data() in baseband_api (copies dibits to bb_data, sends msg)
- proc_p25_tx registered in baseband CMakeLists (tag P25T)
- m4_app_tag updated to {'P','2','5','T'}
- TX wired: transmits P25 FSW test pattern (512 dibits) via M4 C4FM proc
- on_tx_progress handler stops TX when frame complete
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* p25_tx: implement correct P25 TSBK encoding from ccemu
- BCH(63,16) via generator matrix (not polynomial division)
- CRC-CCITT bit-by-bit init=0 over 80 bits
- 1/2-rate trellis encoder (4 states)
- DataInterleave per TIA-102
- Status symbol insertion (SS=0x02 every 35 dibits)
- TSBK rotation: IDEN_UP -> NET_STS -> RFSS_STS -> NET_STS
- tsbk_idx_ persists across buffer refills, resets on stop_tx
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* p25_tx: apply clang-format
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* p25_tx: fix HackRF lockup - zero output buffer when idle
When configured=false, execute() returned without writing to the
output buffer. The DMA would re-use stale IQ samples from the
previous cycle, sending garbage to the HackRF and causing it to
lock up mid-transmission.
Fix: explicitly zero the output buffer when the proc is idle.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* p25_tx: address PR review feedback and fix TX restart lockup
- Replace NumberField with SymField::Type::Hex for NAC, SYSID, WACN,
RFSSID, SITEID, TG, VCH (hex values should display as hex)
- Add voice grant TSBK (OpcodeGrpVChGrant 0x00) to rotation cycle;
rotation is now 5-step: IDEN_UP->NET_STS->RFSS_STS->GRP_V_GRANT->NET_STS
- Wire TG and VCH fields into fill_tx_buffer for voice grant encoding
- Reset txprogress_message.done=false on new P25TxConfigure in baseband
- Add #include <cstring> to baseband_api.cpp (needed for memcpy)
- Fix TX restart lockup: remove baseband::shutdown() from stop_tx() so
the M4 stays loaded between sessions; only shut down in destructor.
Previously, the stale ShutdownMessage in the queue would be picked up
by the restarted M4 on second TX, causing it to exit immediately and
leaving the HackRF stuck in TX mode.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* ifndef guard instead of pragma
56 lines
1.9 KiB
C++
56 lines
1.9 KiB
C++
/*
|
|
* Copyright (C) 2024 PortaPack-MAYHEM Contributors
|
|
*
|
|
* This file is part of PortaPack.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef __PROC_P25_TX_H__
|
|
#define __PROC_P25_TX_H__
|
|
|
|
#include "baseband_processor.hpp"
|
|
#include "baseband_thread.hpp"
|
|
#include "message.hpp"
|
|
|
|
// P25 C4FM: 4800 baud, 2.4 Msps = 500 samples per dibit
|
|
#define P25_SAMPLERATE 2400000
|
|
#define P25_SAMPLES_PER_DIBIT 500
|
|
|
|
class P25TxProcessor : public BasebandProcessor {
|
|
public:
|
|
void execute(const buffer_c8_t& buffer) override;
|
|
void on_message(const Message* const msg) override;
|
|
|
|
private:
|
|
bool configured{false};
|
|
uint16_t frame_length{0}; // total dibits in frame
|
|
uint16_t dibit_index{0}; // current dibit being transmitted
|
|
uint32_t sample_count{0}; // samples emitted for current dibit
|
|
|
|
// FM phase accumulator (32-bit wrapping)
|
|
uint32_t phase{0};
|
|
|
|
// Phase step per sample per deviation unit (600 Hz at 2.4 Msps)
|
|
// = round(600 * 2^32 / 2400000) = 1073742
|
|
static constexpr uint32_t base_phase_step{1073742};
|
|
|
|
TXProgressMessage txprogress_message{};
|
|
|
|
/* NB: Threads should be the last members in the class definition. */
|
|
BasebandThread baseband_thread{P25_SAMPLERATE, this, baseband::Direction::Transmit};
|
|
};
|
|
|
|
#endif /* __PROC_P25_TX_H__ */
|