AR2 Transmit
Edit this on GitLab
AR2 Transmit Sample Application (SSK 1.x)
Overview
The AR2_Transmit sample application demonstrates how to transmit ARINC 429 messages using the NAI SSK 1.x API on AR2 modules. Use this sample as a practical reference for configuring an ARINC transmit channel and sending data in either immediate (FIFO) or triggered transmission mode.
The AR2 module provides a larger transmit FIFO (1024 words) compared to the AR1 module (255 words), and includes hardware FIFO status monitoring with configurable almost-empty and almost-full thresholds. These features make the AR2 well-suited for high-throughput ARINC data streaming.
Supported modules: AR2. Consult naibrd_ar.h for the complete list of AR2 module ID definitions.
Related samples:
-
AR_Transmit — the AR1 variant of this sample, which uses a 255-word FIFO and does not support triggered mode with FIFO status polling
-
AR2_Receive — the AR2 receive companion; run it alongside this sample to verify transmit/receive operation on the same module
Prerequisites:
-
An NAI board with an AR2 module installed
-
SSK 1.x built for your target platform (Windows, Linux, or VxWorks)
-
A physical or loopback connection on the ARINC channel under test
How to run:
Launch the AR2_Transmit executable from your SSK build output directory. On VxWorks, the entry point is AR2_Transmit() rather than main().
Board Connection and Module Selection
The application begins by calling naiapp_RunBoardMenu() to establish a connection to your NAI board. This presents an interactive menu where you specify the connection type (PCI, Ethernet, etc.), IP address (if applicable), and board type. After a successful connection, you select a card index and module number.
|
Note
|
This startup sequence is common to all NAI sample applications. The board connection and module selection code shown here is not specific to ARINC. |
Configuration file: The default configuration file for this sample is default_AR2Xmit.txt. This file does not ship with the SSK. It is created when you save your connection settings from the board menu. On the first run, the board menu always appears. On subsequent runs, if a saved configuration file exists, the menu can be skipped and the saved settings are loaded automatically.
static const int8_t *CONFIG_FILE = (int8_t *)"default_AR2Xmit.txt";
if (naiapp_RunBoardMenu(CONFIG_FILE) == TRUE)
{
/* Query the user for the card index */
stop = naiapp_query_CardIndex(naiapp_GetBoardCnt(), 0, &cardIndex);
if (stop != TRUE)
{
check_status(naibrd_GetModuleCount(cardIndex, &moduleCnt));
/* Query the user for the module number */
stop = naiapp_query_ModuleNumber(moduleCnt, 1, &module);
if (stop != TRUE)
{
moduleID = naibrd_GetModuleID(cardIndex, module);
if ((moduleID != 0))
{
Run_AR2_Transmit();
}
}
}
}
In your own application, you will call the same naibrd connection and identification functions but can skip the interactive menu entirely — just supply your card index, module number, and channel directly.
|
Important
|
Common Connection Errors
|
Program Structure
Entry Point
The entry point is main() on Windows and Linux, or AR2_Transmit() on VxWorks:
#if defined (__VXWORKS__)
int32_t AR2_Transmit(void)
#else
int32_t main(void)
#endif
After board connection and module selection, the program calls Run_AR2_Transmit(), which handles channel configuration and the transmit mode menu loop.
Application Parameters
The sample packs the card index, module number, and channel number into a naiapp_AppParameters_t struct that is passed to each command handler. In your own code, you will track these same three values:
-
cardIndex— identifies which board (zero-based) -
module— identifies which module slot (one-based) -
channel— identifies which ARINC channel on the module (one-based)
Channel Initialization
Before entering either transmit mode, Run_AR2_Transmit() performs a standard channel initialization sequence. To prepare an AR2 channel for transmission in your own application, follow the same steps.
/* Reset the channel */
check_status(naibrd_AR_ChannelReset(cardIndex, module, archan));
/* Disable Tx/Rx */
check_status(naibrd_AR_SetTxEnable(cardIndex, module, archan, AR_DISABLE));
check_status(naibrd_AR_SetRxEnable(cardIndex, module, archan, AR_DISABLE));
/* Set for Bounded Tx FIFO */
check_status(naibrd_AR_SetTxFifoBounded(cardIndex, module, archan, AR_ENABLE));
/* Set the Tx FIFO Almost Full Threshold to 800 and Almost Empty Threshold to 200 */
check_status(naibrd_AR_SetTxFifoThresholds(cardIndex, module, archan, 200, 800));
/* Set gap time */
naibrd_AR_SetTxIntervalRate(cardIndex, module, archan, 6);
Step-by-step:
-
naibrd_AR_ChannelReset()— resets the channel to a known state, clearing any pending data in the FIFO and resetting all channel configuration registers. -
naibrd_AR_SetTxEnable()/naibrd_AR_SetRxEnable()— explicitly disables both transmit and receive before reconfiguring. Always disable before changing mode settings. -
naibrd_AR_SetTxFifoBounded()— enables bounded FIFO mode. When bounded mode is enabled, the transmitter stops when the FIFO is empty rather than wrapping around and retransmitting old data. For most applications you want bounded mode enabled. -
naibrd_AR_SetTxFifoThresholds()— sets the almost-empty threshold to 200 words and the almost-full threshold to 800 words. These thresholds control when theAR2_TX_FIFO_ALM_EMPTYandAR2_TX_FIFO_ALM_FULLstatus flags assert. The triggered mode uses the almost-empty threshold to know when it is safe to load more data. Consult your module’s manual for the valid threshold range. -
naibrd_AR_SetTxIntervalRate()— sets the inter-message gap time. A value of 6 provides a 6-bit-time gap between consecutive ARINC words. Consult your module’s manual for valid gap time values and their effect on throughput.
Utility function: GetARCfg() (from nai_ar_utils.c) prompts the user for card index, module number, and channel number using the defaults DEF_AR_CARD_INDEX (0), DEF_AR_MODULE (1), and DEF_AR_XMIT_CHANNEL (1). In your own code, supply these values directly.
|
Important
|
Common Errors
|
Immediate (FIFO) Transmission Mode
Immediate mode transmits ARINC words as soon as they are written to the FIFO. To send data immediately on an AR2 channel, set the send mode to AR_TX_SENDMODE_IMMED, enable the transmitter, and write data with naibrd_AR_TransmitBuffer().
Configuring Immediate Mode
/* Set Immediate FIFO Transmission mode */
check_status(naibrd_AR_SetTxSendMode(cardIndex, module, channel, AR_TX_SENDMODE_IMMED));
/* Enable transmitter */
check_status(naibrd_AR_SetTxEnable(cardIndex, module, channel, AR_ENABLE));
-
naibrd_AR_SetTxSendMode()— passAR_TX_SENDMODE_IMMEDto select immediate transmission. Data written to the FIFO is sent on the wire without waiting for a trigger signal. -
naibrd_AR_SetTxEnable()— passAR_ENABLEto activate the transmitter. No data is sent until the transmitter is enabled.
Sending Data
The sample sends a user-specified number of words, breaking the request into blocks of up to 1024 words (the AR2 FIFO depth):
/* Break up the FIFO updates to blocks of AR_FIFO_Size (1024) */
blockCnt = nNumWordsToSend / AR_FIFO_Size;
if (blockCnt * AR_FIFO_Size < nNumWordsToSend)
blockCnt++;
dataCnt = 0;
for (i = 0; i < blockCnt; i++)
{
dataIndex = 0;
do
{
SendData[dataIndex++] = (uint32_t)increment++; /* incremental data */
dataCnt++;
} while ((dataIndex < AR_FIFO_Size) && (dataCnt < nNumWordsToSend));
check_status(naibrd_AR_TransmitBuffer(cardIndex, module, channel, dataIndex, SendData, &nNumWordsSent));
naibrd_Wait(1000000); /* Delay to allow FIFO to drain before refilling */
}
Key points for your own code:
-
naibrd_AR_TransmitBuffer()writes up todataIndexwords fromSendDatainto the transmit FIFO. ThenNumWordsSentoutput tells you how many words were actually accepted. Always check this value. -
FIFO depth is 1024 words on AR2 modules. If you need to send more than 1024 words, break the data into blocks and wait for the FIFO to drain between blocks.
-
naibrd_Wait(1000000)provides a 1-second delay (in microseconds) to let the FIFO empty before the next block. In a production application, poll the FIFO status instead of using a fixed delay (see the triggered mode section for an example of FIFO status polling).
Disabling the Transmitter
When you are finished transmitting, disable the transmitter:
check_status(naibrd_AR_SetTxEnable(cardIndex, module, channel, AR_DISABLE));
|
Important
|
Common Errors
|
Triggered Transmission Mode
Triggered mode loads data into the FIFO first, then starts transmission only when you issue an explicit trigger signal. This gives you precise control over when data goes on the wire. The AR2 module also provides FIFO status flags that let you stream more than 1024 words by refilling the FIFO as it drains.
Configuring Triggered Mode
/* Set Triggered FIFO Transmission mode */
check_status(naibrd_AR_SetTxSendMode(cardIndex, module, channel, AR_TX_SENDMODE_TRGF));
/* Enable transmitter */
check_status(naibrd_AR_SetTxEnable(cardIndex, module, channel, AR_ENABLE));
-
AR_TX_SENDMODE_TRGF— triggered FIFO mode. Data loaded into the FIFO is held until you callnaibrd_AR_SetTxSendTrigger().
Loading and Triggering
To transmit data in triggered mode, first load the FIFO, then fire the trigger:
/* Load initial data (up to 1024 words) */
check_status(naibrd_AR_TransmitBuffer(cardIndex, module, channel, nNumWordsToSend, SendData, &nNumWordsSent));
nai_msDelay(1000);
/* Fire the trigger to begin transmission */
check_status(naibrd_AR_SetTxSendTrigger(cardIndex, module, channel));
-
naibrd_AR_TransmitBuffer()— loads the data into the transmit FIFO without sending it (in triggered mode, data is held until the trigger). -
nai_msDelay(1000)— a short delay (in milliseconds) after loading to ensure the FIFO is stable before triggering. In your own code, you may adjust this based on your timing requirements. -
naibrd_AR_SetTxSendTrigger()— fires the trigger signal, causing the module to begin transmitting the loaded FIFO data on the ARINC bus.
Streaming Large Transfers with FIFO Status Polling
When the total word count exceeds 1024, the sample uses FIFO status polling to refill the buffer while transmission is in progress. This is a key advantage of the AR2 module:
while (nNumWordsToSend > 0)
{
/* Wait for Tx Buffer to go below Almost Empty Threshold */
do
{
check_status(naibrd_AR_GetTxFifoStatus(cardIndex, module, channel, NAI_AR_STATUS_REALTIME, &fifostatus));
} while ((fifostatus & AR2_TX_FIFO_ALM_EMPTY) == 0);
/* Load the next batch of words */
check_status(naibrd_AR_TransmitBuffer(cardIndex, module, channel, wordsThisBatch, SendData, &nNumWordsSent));
nNumWordsToSend -= nNumWordsSent;
dataCnt += nNumWordsSent;
}
/* Wait for FIFO to fully empty */
do
{
check_status(naibrd_AR_GetTxFifoStatus(cardIndex, module, channel, NAI_AR_STATUS_REALTIME, &fifostatus));
} while ((fifostatus & AR2_TX_FIFO_EMPTY) == 0);
How the streaming loop works:
-
Poll
naibrd_AR_GetTxFifoStatus()withNAI_AR_STATUS_REALTIMEto read the current FIFO status. TheAR2_TX_FIFO_ALM_EMPTYflag asserts when the FIFO level drops below the almost-empty threshold you set during initialization (200 words in this sample). -
Refill the FIFO by calling
naibrd_AR_TransmitBuffer()with the next batch (up to 800 words in the sample, leaving headroom below the 1024-word capacity). -
Repeat until all data has been loaded.
-
Wait for
AR2_TX_FIFO_EMPTYto confirm all data has been transmitted before proceeding.
FIFO status flags used:
-
AR2_TX_FIFO_ALM_EMPTY— asserts when the FIFO level is at or below the almost-empty threshold -
AR2_TX_FIFO_EMPTY— asserts when the FIFO is completely empty (all data transmitted)
The almost-empty threshold (200) and refill batch size (800) are chosen so that the FIFO never overflows (200 remaining + 800 new = 1000, within the 1024-word capacity) and never underflows if data is available to send.
Disabling the Transmitter
As with immediate mode, disable the transmitter when finished:
check_status(naibrd_AR_SetTxEnable(cardIndex, module, channel, AR_DISABLE));
|
Important
|
Common Errors
|
Troubleshooting Reference
The following table summarizes errors and symptoms you may encounter when working with the AR2 transmit API. Consult your AR2 module’s manual for hardware-specific diagnostics.
| Error / Symptom | Possible Causes | Suggested Resolution |
|---|---|---|
No board found |
Board not powered, PCI not seated, Ethernet cable disconnected |
Verify physical connections and power; check IP configuration for Ethernet |
Connection timeout |
Wrong IP address, firewall blocking port |
Confirm IP address matches board configuration; check firewall rules |
|
Module does not support the requested feature; AR1 module used instead of AR2 |
Verify module type with |
Module not present (moduleID == 0) |
No module in the selected slot |
Verify module slot number and board population |
Data not appearing on ARINC bus |
Transmitter not enabled; channel not reset; triggered mode without trigger call |
Ensure |
|
FIFO full; too much data written at once |
Break data into blocks of up to 1024 words; poll FIFO status or add delay between blocks |
FIFO overflow |
Refilling FIFO faster than it drains |
Reduce batch size; poll |
FIFO underflow (transmission stops early) |
Not refilling fast enough during streaming |
Lower the almost-empty threshold; increase polling frequency; reduce inter-message gap time |
|
Thresholds not configured; transmitter not enabled |
Call |
|
Transmitter in unbounded mode (retransmitting old data) |
Enable bounded FIFO mode with |
Full Source
Full Source — AR2_Transmit.c (SSK 1.x)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/* Common Sample Program include files */
#include "include/naiapp_boardaccess_menu.h"
#include "include/naiapp_boardaccess_query.h"
#include "include/naiapp_boardaccess_access.h"
#include "include/naiapp_boardaccess_display.h"
#include "include/naiapp_boardaccess_utils.h"
#include "nai_ar_utils.h"
/* naibrd include files */
#include "nai.h"
#include "naibrd.h"
#include "functions/naibrd_ar.h"
static const int8_t *CONFIG_FILE = (int8_t *)"default_AR2Xmit.txt";
/* Function prototypes */
void Run_AR2_Transmit(void);
static nai_status_t AR2_TxImmediate(int32_t paramCount, int32_t* p_params);
static nai_status_t AR2_TxTriggered(int32_t paramCount, int32_t* p_params);
/****** Command Table *******/
enum arfuncgen_commands
{
AR_FUNCGEN_CMD_TX_IMMEDIATE,
AR_FUNCGEN_CMD_TX_TRIGGERED,
AR_FUNCGEN_CMD_COUNT
};
/****** Command Tables *******/
static naiapp_cmdtbl_params_t AR_FuncGenMenuCmds[] =
{
{"FIFO ", "AR Transmit Immediate Mode ", AR_FUNCGEN_CMD_TX_IMMEDIATE, AR2_TxImmediate},
{"TRIG ", "AR Transmit Triggered Mode ", AR_FUNCGEN_CMD_TX_TRIGGERED, AR2_TxTriggered}
};
#define DEF_AR_CARD_INDEX 0
#define DEF_AR_MODULE 1
#define DEF_AR_XMIT_CHANNEL 1
#define DEF_AR_XMIT_DATA_COUNT 1
/***** Global Variables *****/
static int32_t AR_FIFO_Size = 1024;
/**************************************************************************************************************/
/**
<summary>
The purpose of the AR_Transmit is to illustrate the methods to call in the naibrd library to configure
the ARINC channel to transmit ARINC messages in FIFO or scheduled mode.
The following system configuration routines from the nai_sys_cfg.c file are called to assist with the configuration
setup for this program prior to calling the naibrd 1553 routines.
- ClearDeviceCfg
- QuerySystemCfg
- DisplayDeviceCfg
- GetBoardSNModCfg
- SaveDeviceCfg
Note, the AR_Transmit application can run in conjunction with the AR_Receive, AR_ReceiveInterruptEther or
AR_ReceiveInterruptBus applications to illustrate ARINC transmit and receive operations together with the NAI ARINC module.
</summary>
*/
/**************************************************************************************************************/
#if defined (__VXWORKS__)
int32_t AR2_Transmit(void)
#else
int32_t main(void)
#endif
{
bool_t stop = FALSE;
int32_t cardIndex;
int32_t moduleCnt;
int32_t module;
uint32_t moduleID = 0;
int8_t inputBuffer[80];
int32_t inputResponseCnt;
if (naiapp_RunBoardMenu(CONFIG_FILE) == TRUE)
{
while (stop != TRUE)
{
/* Query the user for the card index */
stop = naiapp_query_CardIndex(naiapp_GetBoardCnt(), 0, &cardIndex);
if (stop != TRUE)
{
check_status(naibrd_GetModuleCount(cardIndex, &moduleCnt));
/* Query the user for the module number */
stop = naiapp_query_ModuleNumber(moduleCnt, 1, &module);
if (stop != TRUE)
{
moduleID = naibrd_GetModuleID(cardIndex, module);
if ((moduleID != 0))
{
Run_AR2_Transmit();
}
}
}
printf("\nType Q to quit or Enter key to restart application:\n");
stop = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
}
}
printf("\nType the Enter key to exit the program: ");
naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
naiapp_access_CloseAllOpenCards();
return 0;
}
static nai_status_t AR2_TxImmediate(int32_t paramCount, int32_t* p_params)
{
bool_t bQuit = FALSE;
int32_t nNumWordsToSend = 1;
int32_t nNumWordsSent;
int32_t i, j;
int32_t blockCnt, dataCnt, dataIndex;
int32_t increment = 0x55555555;
uint32_t SendData[1024];
p_naiapp_AppParameters_t p_ar_params = (p_naiapp_AppParameters_t)p_params;
int32_t cardIndex = p_ar_params->cardIndex;
int32_t module = p_ar_params->module;
int32_t channel = p_ar_params->channel;
#if defined (WIN32)
UNREFERENCED_PARAMETER(paramCount);
#endif
/* Set Immediate FIFO Transmission mode */
check_status(naibrd_AR_SetTxSendMode(cardIndex, module, channel, AR_TX_SENDMODE_IMMED));
/* Enable transmitter */
check_status(naibrd_AR_SetTxEnable(cardIndex, module, channel, AR_ENABLE));
while (!bQuit)
{
/* Query for the number of data words to send */
bQuit = GetARTransmitDataCount(DEF_AR_XMIT_DATA_COUNT, &nNumWordsToSend);
if (!bQuit)
{
/* Break up the FIFO updates to blocks of AR_FIFOSize */
blockCnt = nNumWordsToSend / AR_FIFO_Size;
if (blockCnt * AR_FIFO_Size < nNumWordsToSend)
blockCnt++;
dataCnt = 0;
for (i = 0; i < blockCnt; i++)
{
dataIndex = 0;
do
{
SendData[dataIndex++] = (uint32_t)increment++; /* incremental data */
dataCnt++;
} while ((dataIndex < AR_FIFO_Size) && (dataCnt < nNumWordsToSend));
printf("\nSending %d words ...\n", dataIndex);
for (j = 0; j < dataIndex; j++)
printf("Sent 0x%08X\n", SendData[j]);
check_status(naibrd_AR_TransmitBuffer(cardIndex, module, channel, dataIndex, SendData, &nNumWordsSent)); /* send data */
printf(" %d words sent. Total words sent = %d\n", nNumWordsSent, dataCnt);
naibrd_Wait(1000000); /* Delay is necessary to allow the FIFO buffer to empty before filling it up with more data */
}
}
}
/* Disable transmitter */
check_status(naibrd_AR_SetTxEnable(cardIndex, module, channel, AR_DISABLE));
return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}
static nai_status_t AR2_TxTriggered(int32_t paramCount, int32_t* p_params)
{
bool_t bQuit = FALSE;
int32_t nNumWordsToSend = 1;
int32_t nNumWordsSent;
int32_t i;
int32_t dataCnt;
int32_t increment = 0x55555555;
uint32_t SendData[1024];
nai_ar_status_t fifostatus;
p_naiapp_AppParameters_t p_ar_params = (p_naiapp_AppParameters_t)p_params;
int32_t cardIndex = p_ar_params->cardIndex;
int32_t module = p_ar_params->module;
int32_t channel = p_ar_params->channel;
#if defined (WIN32)
UNREFERENCED_PARAMETER(paramCount);
#endif
/* Set Immediate FIFO Transmission mode */
check_status(naibrd_AR_SetTxSendMode(cardIndex, module, channel, AR_TX_SENDMODE_TRGF));
/* Enable transmitter */
check_status(naibrd_AR_SetTxEnable(cardIndex, module, channel, AR_ENABLE));
while (!bQuit)
{
/* Query for the number of data words to send */
bQuit = GetARTransmitDataCount(DEF_AR_XMIT_DATA_COUNT, &nNumWordsToSend);
if (!bQuit)
{
dataCnt = 0;
/* Load Tx Buffer with nNumWordsToSend number of words or 1024 if nNumWordsToSend is greater than 1024 */
if (nNumWordsToSend <= 1024)
{
for (i = 0; i < nNumWordsToSend; i++)
{
SendData[i] = (uint32_t)increment++; /* incremental data */
}
printf("\nLoading %d words ...\n", nNumWordsToSend);
check_status(naibrd_AR_TransmitBuffer(cardIndex, module, channel, nNumWordsToSend, SendData, &nNumWordsSent)); /* load data */
nNumWordsToSend = 0;
dataCnt += nNumWordsSent;
}
else
{
for (i = 0; i < 1024; i++)
{
SendData[i] = (uint32_t)increment++; /* incremental data */
}
printf("\nLoading %d words ...\n", 1024);
check_status(naibrd_AR_TransmitBuffer(cardIndex, module, channel, 1024, SendData, &nNumWordsSent)); /* load data */
nNumWordsToSend -= 1024;
dataCnt += nNumWordsSent;
}
nai_msDelay(1000);
/* Trigger Tx */
printf("\nSent Trigger Signal\n");
check_status(naibrd_AR_SetTxSendTrigger(cardIndex, module, channel));
while (nNumWordsToSend > 0) /* If there are more words to send */
{
/* Wait for Tx Buffer to go below Almost Empty Threshold */
do
{
check_status(naibrd_AR_GetTxFifoStatus(cardIndex, module, channel, NAI_AR_STATUS_REALTIME, &fifostatus));
} while ((fifostatus & AR2_TX_FIFO_ALM_EMPTY) == 0);
if (nNumWordsToSend > 800)
{
/* Load 800 more words */
for (i = 0; i < 800; i++)
{
SendData[i] = (uint32_t)increment++; /* incremental data */
}
printf("\nLoading %d more words ...\n", 800);
check_status(naibrd_AR_TransmitBuffer(cardIndex, module, channel, 800, SendData, &nNumWordsSent)); /* load data */
nNumWordsToSend -= 800;
dataCnt += nNumWordsSent;
}
else
{
/* Load nNumWordsToSend more words */
for (i = 0; i < nNumWordsToSend; i++)
{
SendData[i] = (uint32_t)increment++; /* incremental data */
}
printf("\nLoading %d more words ...\n", nNumWordsToSend);
check_status(naibrd_AR_TransmitBuffer(cardIndex, module, channel, nNumWordsToSend, SendData, &nNumWordsSent)); /* load data */
nNumWordsToSend = 0;
dataCnt += nNumWordsSent;
}
}
/* Wait for Tx Buffer to go to Empty */
do
{
check_status(naibrd_AR_GetTxFifoStatus(cardIndex, module, channel, NAI_AR_STATUS_REALTIME, &fifostatus));
} while ((fifostatus & AR2_TX_FIFO_EMPTY) == 0);
printf("Total words sent = %d\n", dataCnt);
}
}
/* Disable transmitter */
check_status(naibrd_AR_SetTxEnable(cardIndex, module, channel, AR_DISABLE));
return (bQuit) ? NAI_ERROR_UNKNOWN : NAI_SUCCESS;
}
/**************************************************************************************************************/
/**
<summary>
Run_AR2_Transmit queries the user for the card, module and channel to configure as the ARINC transmitter
as well as the data rate (high (100KHz) or low (12.5KHz)) and the type of message transmission (FIFO or scheduled).
Methods in the naibrd library are invoked to configure the ARINC channel.
Once the ARINC channel is configured and running, the user can:
1) In FIFO mode, enter the number of words to transmit. Note, the data sent is an incremental value.
2) In Scheduled mode, transmit an async ARINC data word.
</summary>
*/
/**************************************************************************************************************/
void Run_AR2_Transmit(void)
{
int32_t cardIndex, module, archan;
bool_t bQuit = FALSE;
bool_t bContinue, bCmdFound;
int32_t cmd;
int8_t inputBuffer[80];
int32_t inputResponseCnt;
naiapp_AppParameters_t ar_params;
p_naiapp_AppParameters_t ar_receive_params = &ar_params;
bQuit = GetARCfg(DEF_AR_CARD_INDEX, DEF_AR_MODULE, DEF_AR_XMIT_CHANNEL, &cardIndex, &module, &archan);
ar_receive_params->cardIndex = cardIndex;
ar_receive_params->module = module;
ar_receive_params->channel = archan;
if (!bQuit)
{
bContinue = TRUE;
naiapp_utils_LoadParamMenuCommands(AR_FUNCGEN_CMD_COUNT, AR_FuncGenMenuCmds);
while (bContinue)
{
/* Reset the channel */
check_status(naibrd_AR_ChannelReset(cardIndex, module, archan));
/* Disable Tx/Rx */
check_status(naibrd_AR_SetTxEnable(cardIndex, module, archan, AR_DISABLE));
check_status(naibrd_AR_SetRxEnable(cardIndex, module, archan, AR_DISABLE));
/* Set for Bounded Tx FIFO */
check_status(naibrd_AR_SetTxFifoBounded(cardIndex, module, archan, AR_ENABLE));
/* Set the Tx Fifo Almost Full Threshold to 800 and Almost Empty Threshold to 200 */
check_status(naibrd_AR_SetTxFifoThresholds(cardIndex, module, archan, 200, 800));
/* Set gap time */
naibrd_AR_SetTxIntervalRate(cardIndex, module, archan, 6);
naiapp_display_ParamMenuCommands((int8_t *)"AR Receive Mode Menu");
printf("\nType AR command or %c to quit : ", NAI_QUIT_CHAR);
bQuit = naiapp_query_ForQuitResponse(sizeof(inputBuffer), NAI_QUIT_CHAR, inputBuffer, &inputResponseCnt);
if (!bQuit)
{
if (inputResponseCnt > 0)
{
bCmdFound = naiapp_utils_GetParamMenuCmdNum(inputResponseCnt, inputBuffer, &cmd);
if (bCmdFound)
{
switch (cmd)
{
case AR_FUNCGEN_CMD_TX_IMMEDIATE:
case AR_FUNCGEN_CMD_TX_TRIGGERED:
AR_FuncGenMenuCmds[cmd].func(APP_PARAM_COUNT, (int32_t*)ar_receive_params);
break;
default:
printf("Invalid command entered\n");
break;
}
}
else
printf("Invalid command entered\n");
}
}
else
bContinue = FALSE;
}
}
return;
}