[Allstar Digital] USRP

Mike Zingman mike.zingman at gmail.com
Fri Oct 30 13:11:53 EDT 2015


Just to get things started.  The USRP channel driver is a very useful tool
for getting PCM audio in/our of allstar in a pure digital format.  We used
this to transfer decoded AMBE from DMR to Allstar with this snipit of code:

    *#define USRP_PCM_SAMPLES **160*

*    #define USRP_VOICE_FRAME_SIZE (USRP_PCM_SAMPLES*sizeof(short))  //
0.02 * 8k*

*    #define USRP_ENDPOINT   "192.168.1.180"*

*    #define USRP_PORT       32001*



*    enum { USRP_TYPE_VOICE=0, USRP_TYPE_DTMF, USRP_TYPE_TEXT };*



*    // udp data header*

*    struct _chan_usrp_bufhdr {*

*        char eye[4]; // verification string*

*        uint32_t seq; // sequence counter*

*        uint32_t memory; // memory ID or zero (default)*

*        uint32_t keyup; // tracks PTT state*

*        uint32_t talkgroup; // trunk TG id*

*        uint32_t type; // see above enum*

*        uint32_t mpxid; // for future use*

*        uint32_t reserved; // for future use*

*        short audio[USRP_PCM_SAMPLES];*

*    };*

*    static DV3000_UDP *udp2 = NULL;*

*    static int seq = 0;*



*    void sendAudioToUSRP( void *buffer, int bytes )*

*    {*

*        struct _chan_usrp_bufhdr    packet;*

*        unsigned char *recvBuffer = (unsigned char *)&packet;*

*        int packetSize = sizeof( struct _chan_usrp_bufhdr );*


*        memset(recvBuffer, 0, packetSize);*



*        if (udp2 == NULL)*

*        {*

*            char address[] = USRP_ENDPOINT;*

*            udp2 = new DV3000_UDP();*

*            udp2->openSocket(address, USRP_PORT);*

*            if (packetSize != ((USRP_PCM_SAMPLES * sizeof(short)) + (8 *
sizeof(uint32_t))))*

*                printf("Alignment error");*

*        }*


*        memcpy(packet.eye, "USRP", 4);*

*        packet.keyup = 1;*

*        packet.seq = htonl(seq++);*

*        packet.type = USRP_TYPE_VOICE;*


*        memcpy(packet.audio, buffer, bytes);*

*        udp2->writeSocket(recvBuffer,  packetSize);*

*    }*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.allstarlink.org/pipermail/allstar-digital/attachments/20151030/4fd065ca/attachment.html>


More information about the Allstar-Digital mailing list