Mitsubishi Electric MELSEC Q Series User Manual page 183

Hide thumbs Also See for MELSEC Q Series:
Table of Contents

Advertisement

(c) Sample program
Illustrated below is an example of the sequential processing program.
/* Individual identification information read-out processing */
#include <vxWorks.h>
#include "pciConfigLib.h"
#include <taskLib.h>
void readIdentify(void){
/* Variable declaration */
unsigned short
Identify[3];
STATUS status = OK;
int Index = 0;
int BusNo = 0;
int DeviceNo = 0;
int FuncNo = 0;
UINT32 BaseAddr = 0;
ULONG* EERD = NULL;
int i = 0;
int j = 0;
/* 1) Device setting register address acquisition */
status = pciFindDevice( 0x8086, 0x10D3, Index, &BusNo, &DeviceNo, &FuncNo);
if(status == OK){
status = pciConfigInLong ( BusNo, DeviceNo, FuncNo, 0x10, &BaseAddr );
if(status == OK){
/* 2) Read register (EERD) address calculation */
EERD = (ULONG*)(BaseAddr + 0x0014);
/* 3) Individual identification information read-out */
for(i = 0; i <= 2; i++ ){
*EERD = (i << 0x02 ) + 1;
while(( *EERD & 2 ) == 0 ){
taskDelay( 1 );
j++;
if(j == 1000){
break;
}
}
if(j == 1000){
break;
}
Identify[i] = ( *EERD >> 16 ); /* Acquire read-out data */
}
}
}
return;
}
For "-LS", consult with the
partner (operating system vendor).
/* Individual identification information storage area */
/* Function execution status */
/* Index */
/* PCI bus No. */
/* PCI bus device No. */
/* PCI function No. */
/* Base address */
/* Read register (EERD) address */
/* Counter */
/* Counter */
/* Read individual identification information */
/* Set read address and START bit */
/* Wait until DONE bit rises */
CHAPTER 11 BASIC FUNCTIONS
181
11

Advertisement

Table of Contents
loading

Table of Contents