aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/arc/jump-around-jump.c
blob: 1b453283656c9863be05229db7e3a4db93f11889 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* { dg-do compile } */
/* { dg-options "-Os -mlock -mswape -mrtsc -fno-reorder-blocks" } */

/* This caused an ICE in arc_ifcvt when the 1->3 state change was not
   implemented for TYPE_UNCOND_BRANCH in arc_ccfsm_post_advance.  */

typedef long __kernel_long_t;
typedef __kernel_long_t __kernel_time_t;

struct timespec {
 __kernel_time_t tv_sec;
 long tv_nsec;
};


struct module;
struct device {
 struct device *parent;
};

struct rtc_time {
 int tm_sec;
 int tm_min;
 int tm_hour;
 int tm_mday;
 int tm_mon;
 int tm_year;
 int tm_wday;
 int tm_yday;
 int tm_isdst;
};
struct rtc_wkalrm {
 unsigned char enabled;
 unsigned char pending;
 struct rtc_time time;
};

struct rtc_class_ops {
 int (*open)(struct device *);
 void (*release)(struct device *);
 int (*ioctl)(struct device *, unsigned int, unsigned long);
 int (*read_time)(struct device *, struct rtc_time *);
 int (*set_time)(struct device *, struct rtc_time *);
 int (*read_alarm)(struct device *, struct rtc_wkalrm *);
 int (*set_alarm)(struct device *, struct rtc_wkalrm *);
  //int (*proc)(struct device *, struct seq_file *);
 int (*set_mmss)(struct device *, unsigned long secs);
 int (*read_callback)(struct device *, int data);
 int (*alarm_irq_enable)(struct device *, unsigned int enabled);
};

struct rtc_device
{
 struct device dev;
 struct module *owner;

 int id;
 char name[20];

 const struct rtc_class_ops *ops;
  // struct mutex ops_lock;

  // struct cdev char_dev;
 unsigned long flags;

 unsigned long irq_data;
  //spinlock_t irq_lock;
  //wait_queue_head_t irq_queue;
  //struct fasync_struct *async_queue;

  //struct rtc_task *irq_task;
  //spinlock_t irq_task_lock;
 int irq_freq;
 int max_user_freq;

  //struct timerqueue_head timerqueue;
  //struct rtc_timer aie_timer;
  //struct rtc_timer uie_rtctimer;
  //struct hrtimer pie_timer;
 int pie_enabled;
  //struct work_struct irqwork;

 int uie_unsupported;


  //struct work_struct uie_task;
  //struct timer_list uie_timer;

 unsigned int oldsecs;
 unsigned int uie_irq_active:1;
 unsigned int stop_uie_polling:1;
 unsigned int uie_task_active:1;
 unsigned int uie_timer_active:1;

};

extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm);
extern struct rtc_device *rtc_class_open(const char *name);
extern void rtc_class_close(struct rtc_device *rtc);


int rtc_set_ntp_time(struct timespec now)
{
 struct rtc_device *rtc;
 struct rtc_time tm;
 int err = -19;

 if (now.tv_nsec < (1000000000L >> 1))
  rtc_time_to_tm(now.tv_sec, &tm);
 else
  rtc_time_to_tm(now.tv_sec + 1, &tm);

 rtc = rtc_class_open("rtc0");
 if (rtc) {


  if (rtc->ops && (rtc->ops->set_time || rtc->ops->set_mmss))
   err = rtc_set_time(rtc, &tm);
  rtc_class_close(rtc);
 }

 return err;
}