本文整理汇总了C++中RTC_PORT函数的典型用法代码示例。如果您正苦于以下问题:C++ RTC_PORT函数的具体用法?C++ RTC_PORT怎么用?C++ RTC_PORT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RTC_PORT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rtc_cmos_write
void rtc_cmos_write(unsigned char val, unsigned char addr)
{
lock_cmos_prefix(addr);
outb(addr, RTC_PORT(0));
outb(val, RTC_PORT(1));
lock_cmos_suffix(addr);
}
示例2: reserve_std_resources
static void __init
reserve_std_resources(void)
{
static struct resource standard_io_resources[] = {
{ "rtc", -1, -1 },
{ "dma1", 0x00, 0x1f },
{ "pic1", 0x20, 0x3f },
{ "timer", 0x40, 0x5f },
{ "keyboard", 0x60, 0x6f },
{ "dma page reg", 0x80, 0x8f },
{ "pic2", 0xa0, 0xbf },
{ "dma2", 0xc0, 0xdf },
};
struct resource *io = &ioport_resource;
size_t i;
if (hose_head) {
struct pci_controller *hose;
for (hose = hose_head; hose; hose = hose->next)
if (hose->index == 0) {
io = hose->io_space;
break;
}
}
/* Fix up for the Jensen's queer RTC placement. */
standard_io_resources[0].start = RTC_PORT(0);
standard_io_resources[0].end = RTC_PORT(0) + 0x10;
for (i = 0; i < N(standard_io_resources); ++i)
request_resource(io, standard_io_resources+i);
}
示例3: rtc_cmos_read
/* Routines for accessing the CMOS RAM/RTC. */
unsigned char rtc_cmos_read(unsigned char addr)
{
unsigned char val;
lock_cmos_prefix(addr);
outb_p(addr, RTC_PORT(0));
val = inb_p(RTC_PORT(1));
lock_cmos_suffix(addr);
return val;
}
示例4: rtc_init
void rtc_init(struct domain *d)
{
RTCState *s = domain_vrtc(d);
if ( !has_vrtc(d) )
return;
spin_lock_init(&s->lock);
init_timer(&s->update_timer, rtc_update_timer, s, smp_processor_id());
init_timer(&s->update_timer2, rtc_update_timer2, s, smp_processor_id());
init_timer(&s->alarm_timer, rtc_alarm_cb, s, smp_processor_id());
register_portio_handler(d, RTC_PORT(0), 2, handle_rtc_io);
rtc_reset(d);
spin_lock(&s->lock);
s->hw.cmos_data[RTC_REG_A] = RTC_REF_CLCK_32KHZ | 6; /* ~1kHz */
s->hw.cmos_data[RTC_REG_B] = RTC_24H;
s->hw.cmos_data[RTC_REG_C] = 0;
s->hw.cmos_data[RTC_REG_D] = RTC_VRT;
s->current_tm = gmtime(get_localtime(d));
s->start_time = NOW();
rtc_copy_date(s);
check_update_timer(s);
spin_unlock(&s->lock);
}
示例5: __initfunc
__initfunc(int rtc_init(void))
{
unsigned long flags;
#ifdef __alpha__
unsigned int year, ctrl;
unsigned long uip_watchdog;
char *guess = NULL;
#endif
printk(KERN_INFO "Real Time Clock Driver v%s\n", RTC_VERSION);
if(request_irq(RTC_IRQ, rtc_interrupt, SA_INTERRUPT, "rtc", NULL))
{
/* Yeah right, seeing as irq 8 doesn't even hit the bus. */
printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ);
return -EIO;
}
misc_register(&rtc_dev);
/* Check region? Naaah! Just snarf it up. */
request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc");
#ifdef __alpha__
rtc_freq = HZ;
/* Each operating system on an Alpha uses its own epoch.
Let's try to guess which one we are using now. */
uip_watchdog = jiffies;
if (rtc_is_updating() != 0)
while (jiffies - uip_watchdog < 2*HZ/100)
barrier();
save_flags(flags);
cli();
year = CMOS_READ(RTC_YEAR);
ctrl = CMOS_READ(RTC_CONTROL);
restore_flags(flags);
if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
BCD_TO_BIN(year); /* This should never happen... */
if (year > 10 && year < 44) {
epoch = 1980;
guess = "ARC console";
} else if (year < 96) {
epoch = 1952;
guess = "Digital UNIX";
}
if (guess)
printk("rtc: %s epoch (%lu) detected\n", guess, epoch);
#endif
init_timer(&rtc_irq_timer);
rtc_irq_timer.function = rtc_dropped_irq;
rtc_wait = NULL;
save_flags(flags);
cli();
/* Initialize periodic freq. to CMOS reset default, which is 1024Hz */
CMOS_WRITE(((CMOS_READ(RTC_FREQ_SELECT) & 0xF0) | 0x06), RTC_FREQ_SELECT);
restore_flags(flags);
rtc_freq = 1024;
return 0;
}
示例6: set_boot_successful
static void set_boot_successful(void)
{
/* Remember I successfully booted by setting
* the initial boot direction
* to the direction that I booted.
*/
unsigned char index, byte;
index = inb(RTC_PORT(0)) & 0x80;
index |= RTC_BOOT_BYTE;
outb(index, RTC_PORT(0));
byte = inb(RTC_PORT(1));
byte &= 0xfe;
byte |= (byte & (1 << 1)) >> 1;
/* If we are in normal mode set the boot count to 0 */
if(byte & 1)
byte &= 0x0f;
outb(byte, RTC_PORT(1));
}
示例7: add_rtc
static int __init add_rtc(void)
{
struct device_node *np;
struct platform_device *pd;
struct resource res[2];
unsigned int num_res = 1;
int ret;
memset(&res, 0, sizeof(res));
np = of_find_compatible_node(NULL, NULL, "pnpPNP,b00");
if (!np)
return -ENODEV;
ret = of_address_to_resource(np, 0, &res[0]);
of_node_put(np);
if (ret)
return ret;
/*
*/
if (res[0].start != RTC_PORT(0))
return -EINVAL;
np = of_find_compatible_node(NULL, NULL, "chrp,iic");
if (!np)
np = of_find_compatible_node(NULL, NULL, "pnpPNP,000");
if (np) {
of_node_put(np);
/*
*/
res[1].start = 8;
res[1].end = 8;
res[1].flags = IORESOURCE_IRQ;
num_res++;
}
pd = platform_device_register_simple("rtc_cmos", -1,
&res[0], num_res);
if (IS_ERR(pd))
return PTR_ERR(pd);
return 0;
}
示例8: rtc_exit
static void __exit rtc_exit (void)
{
cleanup_sysctl();
remove_proc_entry ("driver/rtc", NULL);
misc_deregister(&rtc_dev);
#ifdef __sparc__
if (rtc_has_irq)
free_irq (rtc_irq, &rtc_port);
#else
release_region (RTC_PORT (0), RTC_IO_EXTENT);
#if RTC_IRQ
if (rtc_has_irq)
free_irq (RTC_IRQ, NULL);
#endif
#endif /* __sparc__ */
}
示例9: add_rtc
static int __init add_rtc(void)
{
struct device_node *np;
struct platform_device *pd;
struct resource res[2];
int ret;
memset(&res, 0, sizeof(res));
np = of_find_compatible_node(NULL, NULL, "pnpPNP,b00");
if (!np)
return -ENODEV;
ret = of_address_to_resource(np, 0, &res[0]);
of_node_put(np);
if (ret)
return ret;
/*
* RTC_PORT(x) is hardcoded in asm/mc146818rtc.h. Verify that the
* address provided by the device node matches.
*/
if (res[0].start != RTC_PORT(0))
return -EINVAL;
/* Use a fixed interrupt value of 8 since on PPC if we are using this
* its off an i8259 which we ensure has interrupt numbers 0..15. */
res[1].start = 8;
res[1].end = 8;
res[1].flags = IORESOURCE_IRQ;
pd = platform_device_register_simple("rtc_cmos", -1,
&res[0], 2);
if (IS_ERR(pd))
return PTR_ERR(pd);
return 0;
}
示例10: maple_get_boot_time
unsigned long __init maple_get_boot_time(void)
{
struct rtc_time tm;
struct device_node *rtcs;
rtcs = of_find_compatible_node(NULL, "rtc", "pnpPNP,b00");
if (rtcs) {
struct resource r;
if (of_address_to_resource(rtcs, 0, &r)) {
printk(KERN_EMERG "Maple: Unable to translate RTC"
" address\n");
goto bail;
}
if (!(r.flags & IORESOURCE_IO)) {
printk(KERN_EMERG "Maple: RTC address isn't PIO!\n");
goto bail;
}
maple_rtc_addr = r.start;
printk(KERN_INFO "Maple: Found RTC at IO 0x%x\n",
maple_rtc_addr);
}
bail:
if (maple_rtc_addr == 0) {
maple_rtc_addr = RTC_PORT(0);
printk(KERN_INFO "Maple: No device node for RTC, assuming "
"legacy address (0x%x)\n", maple_rtc_addr);
}
rtc_iores.start = maple_rtc_addr;
rtc_iores.end = maple_rtc_addr + 7;
request_resource(&ioport_resource, &rtc_iores);
maple_get_rtc_time(&tm);
return mktime(tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec);
}
示例11: cmos_read_bank2
static inline unsigned char cmos_read_bank2(unsigned char addr)
{
outb(addr, RTC_PORT(2));
return inb(RTC_PORT(3));
}
示例12: cmos_write_bank2
static inline void cmos_write_bank2(unsigned char val, unsigned char addr)
{
outb(addr, RTC_PORT(2));
outb(val, RTC_PORT(3));
}
示例13: rtc_init
static int __init rtc_init(void)
{
#if defined(__alpha__) || defined(__mips__)
unsigned int year, ctrl;
unsigned long uip_watchdog;
char *guess = NULL;
#endif
#ifdef __sparc__
struct linux_ebus *ebus;
struct linux_ebus_device *edev;
#ifdef __sparc_v9__
struct isa_bridge *isa_br;
struct isa_device *isa_dev;
#endif
#endif
#ifdef __sparc__
for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) {
if(strcmp(edev->prom_name, "rtc") == 0) {
rtc_port = edev->resource[0].start;
rtc_irq = edev->irqs[0];
goto found;
}
}
}
#ifdef __sparc_v9__
for_each_isa(isa_br) {
for_each_isadev(isa_dev, isa_br) {
if (strcmp(isa_dev->prom_name, "rtc") == 0) {
rtc_port = isa_dev->resource.start;
rtc_irq = isa_dev->irq;
goto found;
}
}
}
#endif
printk(KERN_ERR "rtc_init: no PC rtc found\n");
return -EIO;
found:
if (rtc_irq == PCI_IRQ_NONE) {
rtc_has_irq = 0;
goto no_irq;
}
/*
* XXX Interrupt pin #7 in Espresso is shared between RTC and
* PCI Slot 2 INTA# (and some INTx# in Slot 1). SA_INTERRUPT here
* is asking for trouble with add-on boards. Change to SA_SHIRQ.
*/
if (request_irq(rtc_irq, rtc_interrupt, SA_INTERRUPT, "rtc", (void *)&rtc_port)) {
/*
* Standard way for sparc to print irq's is to use
* __irq_itoa(). I think for EBus it's ok to use %d.
*/
printk(KERN_ERR "rtc: cannot register IRQ %d\n", rtc_irq);
return -EIO;
}
no_irq:
#else
if (!request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"))
{
printk(KERN_ERR "rtc: I/O port %d is not free.\n", RTC_PORT (0));
return -EIO;
}
#if RTC_IRQ
if(request_irq(RTC_IRQ, rtc_interrupt, SA_INTERRUPT, "rtc", NULL))
{
/* Yeah right, seeing as irq 8 doesn't even hit the bus. */
printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ);
release_region(RTC_PORT(0), RTC_IO_EXTENT);
return -EIO;
}
#endif
#endif /* __sparc__ vs. others */
misc_register(&rtc_dev);
create_proc_read_entry ("driver/rtc", 0, 0, rtc_read_proc, NULL);
#if defined(__alpha__) || defined(__mips__)
rtc_freq = HZ;
/* Each operating system on an Alpha uses its own epoch.
Let's try to guess which one we are using now. */
uip_watchdog = jiffies;
if (rtc_is_updating() != 0)
while (jiffies - uip_watchdog < 2*HZ/100) {
barrier();
cpu_relax();
}
spin_lock_irq(&rtc_lock);
year = CMOS_READ(RTC_YEAR);
ctrl = CMOS_READ(RTC_CONTROL);
spin_unlock_irq(&rtc_lock);
//.........这里部分代码省略.........
示例14: native_read_tsc
retval = x86_platform.get_wallclock();
ts->tv_sec = retval;
ts->tv_nsec = 0;
}
unsigned long long native_read_tsc(void)
{
return __native_read_tsc();
}
EXPORT_SYMBOL(native_read_tsc);
static struct resource rtc_resources[] = {
[0] = {
.start = RTC_PORT(0),
.end = RTC_PORT(1),
.flags = IORESOURCE_IO,
},
[1] = {
.start = RTC_IRQ,
.end = RTC_IRQ,
.flags = IORESOURCE_IRQ,
}
};
static struct platform_device rtc_device = {
.name = "rtc_cmos",
.id = -1,
.resource = rtc_resources,
.num_resources = ARRAY_SIZE(rtc_resources),
示例15: std_rtc_write_data
static void std_rtc_write_data(unsigned char data, unsigned long addr)
{
outb_p(addr, RTC_PORT(0));
outb_p(data, RTC_PORT(1));
}