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

added front panel led inhibit

parent 86ab93fb
......@@ -7,7 +7,7 @@
void WriteFrontLED (unsigned char LED, unsigned char Red, unsigned char Green, unsigned char Blue){
WriteFPGA(FP_LED_OFFSET+LED, Blue<<16|Red<<8|Green);
//printf("0x%.8X, 0x%.2X, 0x%.2X, 0x%.2X\n",FP_LED_OFFSET, Blue, Red, Green);
//printf("0x%.8X, 0x%.2X, 0x%.2X, 0x%.2X\n",FP_LED_OFFSET+LED, Blue, Red, Green);
}
......@@ -28,6 +28,12 @@ int deinit_IOleds(void){
}
void InhibitFrontLED(unsigned int led_mask) {
//printf("%.8x %.8x\n", FP_LED_OFFSET+FP_LED_INHIBIT, led_mask);
WriteFPGA(FP_LED_OFFSET+FP_LED_INHIBIT, led_mask);
}
void *FadeLEDsThreadRGB (void *vargp){
while(1){
for(int k = 0; k < MAX_BRIGHTNESS; k++){
......@@ -69,3 +75,5 @@ while(1){
}
}
......@@ -2,24 +2,25 @@
/**Frontpanel LEDs**/
#define FP_LED_OFFSET (0x300>>2)
#define FP_LED_0 FP_LED_OFFSET+0x0
#define FP_LED_1 FP_LED_OFFSET+0x1
#define FP_LED_2 FP_LED_OFFSET+0x2
#define FP_LED_3 FP_LED_OFFSET+0x3
#define FP_LED_4 FP_LED_OFFSET+0x4
#define FP_LED_5 FP_LED_OFFSET+0x5
#define FP_LED_6 FP_LED_OFFSET+0x6
#define FP_LED_7 FP_LED_OFFSET+0x7
#define FP_LED_8 FP_LED_OFFSET+0x8
#define FP_LED_9 FP_LED_OFFSET+0x9
#define FP_LED_10 FP_LED_OFFSET+0xA
#define FP_LED_11 FP_LED_OFFSET+0xB
#define FP_LED_12 FP_LED_OFFSET+0xC
#define FP_LED_13 FP_LED_OFFSET+0xD
#define FP_LED_14 FP_LED_OFFSET+0xE
#define FP_LED_15 FP_LED_OFFSET+0xF
#define FP_LED_16 FP_LED_OFFSET+0x10
#define FP_LED_17 FP_LED_OFFSET+0x11
#define FP_LED_0 FP_LED_OFFSET+0x0
#define FP_LED_1 FP_LED_OFFSET+0x1
#define FP_LED_2 FP_LED_OFFSET+0x2
#define FP_LED_3 FP_LED_OFFSET+0x3
#define FP_LED_4 FP_LED_OFFSET+0x4
#define FP_LED_5 FP_LED_OFFSET+0x5
#define FP_LED_6 FP_LED_OFFSET+0x6
#define FP_LED_7 FP_LED_OFFSET+0x7
#define FP_LED_8 FP_LED_OFFSET+0x8
#define FP_LED_9 FP_LED_OFFSET+0x9
#define FP_LED_10 FP_LED_OFFSET+0xA
#define FP_LED_11 FP_LED_OFFSET+0xB
#define FP_LED_12 FP_LED_OFFSET+0xC
#define FP_LED_13 FP_LED_OFFSET+0xD
#define FP_LED_14 FP_LED_OFFSET+0xE
#define FP_LED_15 FP_LED_OFFSET+0xF
#define FP_LED_16 FP_LED_OFFSET+0x10
#define FP_LED_17 FP_LED_OFFSET+0x11
#define FP_LED_INHIBIT 0x12
#define FADE_ON 0x01
#define FADE_OFF 0x00
......@@ -40,3 +41,4 @@ void RGBFadeLEDs (int fadetime, char status);
void *FadeLEDsThreadMonoCol (void *vargp);
void *FadeLEDsThreadRGB (void *vargp);
int deinit_IOleds(void);
void InhibitFrontLED(unsigned int led_mask);
......@@ -46,8 +46,8 @@
*****************************************************************************/
int initContCounter(void) {
uiod_cdma = "/dev/uio0";
uiod_axitimer = "/dev/uio2";
uiod_cdma = "/dev/uio4";
uiod_axitimer = "/dev/uio5";
reenable = 1;
error_count = 0;
......
......@@ -3,7 +3,7 @@
int current_ram_address;
int last_valid_ram_addr;
int read_ram_base_addr;
int sum_data_sets;
unsigned int sum_data_sets;
int initContCounterDone;
......
......@@ -63,16 +63,16 @@ int FunctionCall(zmq_data *zmq_data_struct){
unsigned int funcArg[zmq_data_struct->NrOfBytes-2];
unsigned int command = zmq_data_struct->data[0];
int nbytes = 0;
int value = 0;
int value = 1;
FunctionNumber = zmq_data_struct->data[1];
//printf("bytes: %d\n", zmq_data_struct->NrOfBytes);
//printf("func nr: %.8x\n", FunctionNumber);
//zmq_data_struct->data +=4;
for(int i = 0; i < ((zmq_data_struct->NrOfBytes)>>2)-2; i++){
funcArg[i] = *(unsigned int *)zmq_data_struct->data;
funcArg[i] = zmq_data_struct->data[2+i];
//printf("%d ", funcArg[i]);
zmq_data_struct->data +=4;
}
switch (FunctionNumber){
......@@ -84,8 +84,9 @@ int FunctionCall(zmq_data *zmq_data_struct){
case GET_DATA:value = PiLC2GetRamData(funcArg[0],funcArg[1],zmq_data_struct->socket);break;
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;
}
if(value == 0){
if(value == 1){
//echo the command
nbytes = 4;
zmq_send (zmq_data_struct->socket, &command, nbytes, 0);
......@@ -293,13 +294,13 @@ int GetNrOfData(zmq_data *zmq_data_struct)
buffer[0] = (current_ram_address);
buffer[1] = (read_ram_base_addr);
buffer[2] = (last_valid_ram_addr);
//printf("%i \n", buffer[1]);
/* Unlock the mutex */
pthread_mutex_unlock(&lock);
zmq_send (zmq_data_struct->socket, buffer, 12, 0);
free(buffer);
return 1;
return 0;
}
/*
......@@ -320,7 +321,10 @@ int PiLC2GetRamData(unsigned int RAMBaseAddress, unsigned int numofdata, void *s
zmq_send(socket, ps_mem_dest_base_addr+RAMBaseAddress, numofdata*4, 0);
read_ram_base_addr = read_ram_base_addr +numofdata*4;
//read_ram_base_addr = read_ram_base_addr +numofdata;
/*printf("%.8x ", *(ps_mem_dest_base_addr+RAMBaseAddress));
printf("%.8x ", *(ps_mem_dest_base_addr+RAMBaseAddress+1));
printf("%.8x\n", *(ps_mem_dest_base_addr+RAMBaseAddress+2));*/
if(read_ram_base_addr == last_valid_ram_addr){
read_ram_base_addr = 0x00000000;
......@@ -329,7 +333,7 @@ int PiLC2GetRamData(unsigned int RAMBaseAddress, unsigned int numofdata, void *s
pthread_mutex_unlock(&lock);
return 1;
return 0;
}
int PiLC2GetIOCards(zmq_data *zmq_data_struct) {
......@@ -357,11 +361,10 @@ int PiLC2GetIOCards(zmq_data *zmq_data_struct) {
zmq_send (zmq_data_struct->socket, buffer,10*16, 0);
free(buffer);
return 1;
return 0;
}
int getPiLCinet(zmq_data *zmq_data_struct){
//int getPiLCinet(void){
unsigned int *buffer;
......@@ -397,10 +400,8 @@ int getPiLCinet(zmq_data *zmq_data_struct){
strcat(hostname, mac);
strcat(hostname, ";");
strcat(hostname, ipaddr);
printf("%s\n", hostname);
len = strlen(hostname);
printf("%i\n", len);
buffer = (unsigned int *)malloc(len*sizeof(char));
......@@ -411,3 +412,12 @@ int getPiLCinet(zmq_data *zmq_data_struct){
return 0;
}
void LedSetInhibit(zmq_data *zmq_data_struct) {
unsigned int inhibit;
inhibit = zmq_data_struct->data[2];
InhibitFrontLED(inhibit);
}
......@@ -18,6 +18,7 @@
#define GET_DATA 0x5
#define GET_IO_CARDS 0x6
#define GET_PILC_INET 0x7
#define LED_SET_INHIBIT 0x8
typedef struct {
void *socket;
......@@ -41,8 +42,7 @@ int GetNrOfData(zmq_data *zmq_data_struct);
int PiLC2GetRamData(unsigned int RAMBaseAddress, unsigned int numofdata, void *socket);
int PiLC2GetIOCards(zmq_data *zmq_data_struct);
int getPiLCinet(zmq_data *zmq_data_struct);
//int getPiLCinet(void);
void LedSetInhibit(zmq_data *zmq_data_struct);
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