Skip to content
Snippets Groups Projects
Commit b543cf22 authored by Alexander Ivanov's avatar Alexander Ivanov
Browse files

Fixed ioctl() calls, removed some dead code.

git-svn-id: https://redoubt.ligo-wa.caltech.edu/svn/advLigoRTS/trunk@3394 6dcd42c9-f523-4c6d-aada-af552506706e
parent 4a5d51e5
No related branches found
No related tags found
No related merge requests found
...@@ -76,18 +76,19 @@ static int symmetricom_release(struct inode *inode, struct file *filp) ...@@ -76,18 +76,19 @@ static int symmetricom_release(struct inode *inode, struct file *filp)
return 0; return 0;
} }
static volatile unsigned int *gps;
// Read current GPS time from the card // Read current GPS time from the card
void get_cur_time(unsigned long *req) { int get_cur_time(unsigned long *req) {
unsigned int timeSec; unsigned int timeSec;
unsigned int timeUsec; unsigned int timeUsec;
if (card_present && card_type == 1) { if (card_present && card_type == 1) {
getGpsTimeTsync(&timeSec, &timeUsec); int sync = getGpsTimeTsync(&timeSec, &timeUsec);
req[0] = timeSec; req[1] = timeUsec; req[2] = 0; req[0] = timeSec; req[1] = timeUsec; req[2] = 0;
return sync;
} else if (card_present && card_type == 0) { } else if (card_present && card_type == 0) {
getGpsTime(&timeSec, &timeUsec); lockGpsTime();
int sync = getGpsTime(&timeSec, &timeUsec);
req[0] = timeSec; req[1] = timeUsec; req[2] = 0; req[0] = timeSec; req[1] = timeUsec; req[2] = 0;
return sync;
} else { } else {
// Get current kernel time (in GPS) // Get current kernel time (in GPS)
struct timespec t; struct timespec t;
...@@ -95,7 +96,9 @@ void get_cur_time(unsigned long *req) { ...@@ -95,7 +96,9 @@ void get_cur_time(unsigned long *req) {
t = current_kernel_time(); t = current_kernel_time();
t.tv_sec += - 315964819 + 33; t.tv_sec += - 315964819 + 33;
req[0] = t.tv_sec; req[1] = 0; req[2] = t.tv_nsec; req[0] = t.tv_sec; req[1] = 0; req[2] = t.tv_nsec;
return 1;
} }
// Never reached
} }
#ifdef HAVE_UNLOCKED_IOCTL #ifdef HAVE_UNLOCKED_IOCTL
...@@ -108,20 +111,9 @@ static int symmetricom_ioctl(struct inode *inode, struct file *filp, unsigned in ...@@ -108,20 +111,9 @@ static int symmetricom_ioctl(struct inode *inode, struct file *filp, unsigned in
switch(cmd){ switch(cmd){
case IOCTL_SYMMETRICOM_STATUS: case IOCTL_SYMMETRICOM_STATUS:
{ {
unsigned long req; unsigned long req[3];
if (card_present && card_type == 1) { unsigned long res = get_cur_time(req);
req = (((volatile TSYNC_REGISTER *)gps)->SUB_SEC >> 31) & 1; if (copy_to_user ((void *) arg, &res, sizeof (res))) return -EFAULT;
} else if (card_present && card_type == 0) {
unsigned int time0 = gps[0x30/4];
if (time0 & (1<<24)) {
//printk("Symmetricom unlocked\n");
req = 0;
} else {
//printk ("Symmetricom locked!\n");
req = 1;
}
} else req = 1;
if (copy_to_user ((void *) arg, &req, sizeof (req))) return -EFAULT;
} }
break; break;
case IOCTL_SYMMETRICOM_TIME: case IOCTL_SYMMETRICOM_TIME:
...@@ -153,7 +145,7 @@ procfile_gps_read(char *buffer, ...@@ -153,7 +145,7 @@ procfile_gps_read(char *buffer,
/* fill the buffer, return the buffer size */ /* fill the buffer, return the buffer size */
unsigned long req[3]; unsigned long req[3];
get_cur_time(req); get_cur_time(req);
return sprintf(buffer, "%d.%02d\n", req[0], req[1]/10000); return sprintf(buffer, "%ld.%02ld\n", req[0], req[1]/10000);
} }
// Never reached // Never reached
} }
...@@ -203,7 +195,6 @@ static int __init symmetricom_init(void) ...@@ -203,7 +195,6 @@ static int __init symmetricom_init(void)
//printk("Symmetricom GPS card not found\n"); //printk("Symmetricom GPS card not found\n");
//goto out_unalloc_region; //goto out_unalloc_region;
card_present = 0; card_present = 0;
gps = 0xdeadbeaf;
} }
if (!card_present) { if (!card_present) {
/* Try looking for Spectracom GPS card */ /* Try looking for Spectracom GPS card */
...@@ -217,7 +208,6 @@ static int __init symmetricom_init(void) ...@@ -217,7 +208,6 @@ static int __init symmetricom_init(void)
//printk("Symmetricom GPS card not found\n"); //printk("Symmetricom GPS card not found\n");
//goto out_unalloc_region; //goto out_unalloc_region;
card_present = 0; card_present = 0;
gps = 0xdeadbeaf;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment