industrialNETworXnetx

| 27.10.2008 | 13:31 | 5 replies

NETX_DPM_ARM_IO_DATA0

Hallo,
How can I read the contents of the "NETX_DPM_ARM_IO_DATA0" ?
For exampe:
1) Drv_HifPioGetInputs(NETX_DPM_ARM_IO_DATA0, &Data)
or:
2)
Data = PEEK(NETX_DPM_ARM_IO_DATA0)

best regards
Abslimo

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 27.10.2008 | 13:39

Hi Abslimo,

you can do both ways. But please keep in your mind, that the DRV_xxx funct5ions needs a valid handle.
Your example code must look like this:

RX_RESULT erXRes; 
RX_HANDLE hHifPio; 
DRV_HIFPIO_DATA_T tData; 
 
/* Get the Handle to a HIF PIO named ‘HOSTIO’ */ 
erXRes = Drv_HifPioIdentifyHifPio(“HOSTIO”,0,&hHifPio);
if (erXRes != RX_OK)
{
    error handling
}


/* Initialize the HIF PIO */
erXRes = Drv_HifPioInitializeHifPio(hHifPio)
if (erXRes != RX_OK)
{
error handling
}

/* Get the current input values */
erXRes = Drv_HifPioGetInputs(hHifPio, &tData);
if (erXRes != RX_OK)
{
error handling
}



Or you are doing this with your macro stuff peek and poke

Data = PEEK(Registeraddress)

| 27.10.2008 | 14:21

what could be the cause of an error in the function "Drv_HifPioIdentifyHifPio(“HOSTIO”,0,&hHifPio)" ?
I have written this code:
Config_netX:

/*
************************************************************
*   Definition of the Host-PIO Instances
************************************************************
*/

STATIC CONST FAR RX_HIFPIO_SET_T atrXHif[] = {
{
{"HOSTIO",RX_PERIPHERAL_TYPE_HIFPIO,0},
0x00000000, // Configure HIF-PIO 32 to 63 to be standard I/O
0x40000000, // Configure HIF-PIO 64 to 84 to be standard I/O
0xFFFFFFFF, // Configure HIF-PIO 32 to 63 Output-Driver to be outputs
0x001FFFFF, // Configure HIF-PIO 64 to 84 Output-Driver to be outputs
0x40000000, // Configure the I/O Mode
0x00000000, // Configure Arm specific configuration, no relevance
},
};

/*



TaskResource_Pulsrate_InitRemote:

TLR_RESULT TaskResource_Pulsrate_InitRemote(PULSRATE_RSC_T FAR* ptRsc, TLR_VOID FAR* pvInit)
{
TLR_RESULT eRslt;
UINT ulVal, ulKey;
RX_HANDLE hHifPio;

eRslt = TLR_S_OK;


// switch interface to pio
ulVal = PEEK(NETX_IO_CFG);
ulVal &= ~MSK_NETX_IO_CFG_if_select_n;
ulKey = PEEK(NETX_IO_CFG_ACCESS_KEY);
POKE(NETX_IO_CFG_ACCESS_KEY, ulKey);
POKE(NETX_IO_CFG, ulVal);

// Get the Handle to a HIF PIO named ‘HOSTIO’
if((eRslt = Drv_HifPioIdentifyHifPio("HOSTIO",0,&hHifPio))!=TLR_S_OK)
{
goto leave;
}

........

leave:
......



the function"Drv_HifPioIdentifyHifPioe" has a return of: "DRV_HIFPIO_INVALID"

best regards
Abslimo

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 27.10.2008 | 14:28

Hi,

what about:

/* HIF PIO Handle */
RX_HANDLE hHostIo;   

/* Get memory */
erXRes = rX_MemAllocateMemory(&hHostIo,DRV_HIFPIO_SIZE);

/* Create the GPIO Object now */
erXRes = Drv_HifPioCreateHifPio(hHostIo, &hHostIo[0]);



This must be done before you call the "Drv_HifPioIdentifyHifPio" function.

M T

M T

Hilscher Gesellschaft für Systemautomation mbH

| 27.10.2008 | 15:43

Or alternatively enter the HifPio Driver into the PostCfg structure (config.c)

STATIC CONST FAR RX_DRIVER_PERIPHERAL_CONFIG_T atrXDrvCfgPost[] = {
  {DrvHifPioInit,  RX_PERIPHERAL_TYPE_HIFPIO,         atrXHif,   MAX_CNT(atrXHif)},
....
}

which implicitely calls Drv_HifPioCreate on all defined structures.

Regards

MT

| 27.10.2008 | 15:57

Thanks

regards
Abslimo

Login