Commit c857bdbc authored by Joshua Supra's avatar Joshua Supra
Browse files

added Request 9-13

parent ed0c7b2d
......@@ -51,7 +51,7 @@ int main (int argc, char *argv[]){
IOMuxAutoConfig(IOCards);
GetIOCards(IOCards);
InitIOCards(IOCards);
......
......@@ -58,7 +58,7 @@ void initpilc2(IOCardStruct *IOCard){
exit(1);
}else {printf("Init FPGA Register ok\n");}
GetIOCards(IOCard);
InitIOCards(IOCard);
//pthread_t thread_id;
//pthread_create(&thread_id, NULL, CheckIOCards, NULL);
......@@ -178,7 +178,7 @@ const char* IOCardType(unsigned char IOCard_ID){
* @note None.
*
*****************************************************************************/
char GetIOCards (IOCardStruct *IOCard){
char InitIOCards (IOCardStruct *IOCard){
unsigned char num_IO_cards = 0;
/* check each card slot for HW version */
......@@ -190,6 +190,14 @@ char GetIOCards (IOCardStruct *IOCard){
IOCard[i].DataDirection = (ReadFPGA(PILC_IO_GPIOS_OFFSET + PILC_IODDR_CFG_REG)>>i)&0x1;
if (IOCard[i].TypeID == NIM_TTL) {
IOCard[i].Register_value = ReadIOCard(IOCARD_NIMTTL_RSTATUS);
}else if(IOCard[i].TypeID == DIFF_ADC){
IOCard[i].AdditionalData = ReadIOCard(IOCARD_DADC_FILTER);
}else if(IOCard[i].TypeID == ADC){
IOCard[i].AdditionalData = ReadIOCard(IOCARD_ADC_OFFSET);
}else if(IOCard[i].TypeID == THERMO){
IOCard[i].AdditionalData = ReadIOCard(IOCARD_THERMO_TYPE);
}else if(IOCard[i].TypeID == PT100){
IOCard[i].AdditionalData = ReadIOCard(IOCARD_PT_SENSOR);
}
/* if a card is present the card information will be printed */
if (IOCard[i].TypeID != 0x00 && IOCard[i].TypeID != 0xFF){
......@@ -233,16 +241,14 @@ int GetIOCardRegister(IOCardStruct *IOCard) {
switch(IOCard[i].TypeID) {
case NIM_TTL: break;
case ADC: IOCard[i].Register_value = getADCvalue(i);break;
case ADC: IOCard[i].Register_value = getADCvalue(i);;break;
case DAC: IOCard[i].Register_value = getDACvalue(i);break;
case DIFF_ADC: IOCard[i].Register_value = getDADCvalue(i/2);break;
case DIFF_ADC: IOCard[i].Register_value = getDADCvalue(i/2);;break;
//printf("%i: %.x8\n",i+1, IOCard[i].Register_value);break;
case ADAPTER: //printf("%i: %i\n",i, IOCard[i-1].TypeID);
if (IOCard[i-1].TypeID == DIFF_ADC) {
case ADAPTER: if (IOCard[i-1].TypeID == DIFF_ADC) {
IOCard[i].Register_value = getDADCRawvalue((i-1)/2);
} else if (IOCard[i-1].TypeID == THERMO) {
IOCard[i].Register_value = getThermoRawvalue(((i-1)/2+16));
......
......@@ -72,7 +72,7 @@ void initpilc2(IOCardStruct *IOCard);
int GetGpioConfig(pilcIOGpioStruct *pilcIOcfg);
void setIODDR(unsigned int channel, unsigned int config);
/**PILC2 Selftest IO card functions**/
char GetIOCards (IOCardStruct *IOCard);
char InitIOCards (IOCardStruct *IOCard);
int SelftestIOCards (IOCardStruct *IOCard);
int TestNIMTTLCard (IOCardStruct *IOCard);
int GetIOCardStatus(IOCardStruct *IOCard);
......
......@@ -23,6 +23,15 @@
#define IOCARD_NIMTTL_NIM_IN 0x03
#define IOCARD_NIMTTL_NIM_OUT 0x04
#define IOCARD_THERMO_ERROR 0x05
#define IOCARD_THERMO_TYPE 0x06
#define IOCARD_ADC_OFFSET 0x03
#define IOCARD_DADC_FILTER 0x05
#define IOCARD_PT_SENSOR 0x05
/************************** Variable Definitions *****************************/
int ret, fd;
......
......@@ -85,6 +85,7 @@ int FunctionCall(zmq_data *zmq_data_struct){
case GET_IO_CARDS:value = PiLC2GetIOCards(zmq_data_struct);break;
case GET_PILC_INET:value = getPiLCinet(zmq_data_struct);break;
case LED_SET_INHIBIT: LedSetInhibit(zmq_data_struct);break;
case INIT_IO_CARDS: PiLC2InitIOCards();break;
}
if(value == 1){
//echo the command
......@@ -421,3 +422,8 @@ void LedSetInhibit(zmq_data *zmq_data_struct) {
InhibitFrontLED(inhibit);
}
void PiLC2InitIOCards(void) {
InitIOCards(IOCards);
}
......@@ -19,6 +19,7 @@
#define GET_IO_CARDS 0x6
#define GET_PILC_INET 0x7
#define LED_SET_INHIBIT 0x8
#define INIT_IO_CARDS 0x9
typedef struct {
void *socket;
......@@ -43,6 +44,7 @@ int PiLC2GetRamData(unsigned int RAMBaseAddress, unsigned int numofdata, void *s
int PiLC2GetIOCards(zmq_data *zmq_data_struct);
int getPiLCinet(zmq_data *zmq_data_struct);
void LedSetInhibit(zmq_data *zmq_data_struct);
void PiLC2InitIOCards(void);
void *context;
void *client_responder;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment