arch/m68k/sun3x/time.c
Source file repositories/reference/linux-study-clean/arch/m68k/sun3x/time.c
File Facts
- System
- Linux kernel
- Corpus path
arch/m68k/sun3x/time.c- Extension
.c- Size
- 2075 bytes
- Lines
- 104
- Domain
- Architecture Layer
- Bucket
- arch/m68k
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/kd.hlinux/init.hlinux/sched.hlinux/kernel_stat.hlinux/interrupt.hlinux/rtc.hlinux/bcd.hasm/irq.hasm/io.hasm/machdep.hasm/traps.hasm/sun3x.hasm/sun3ints.htime.h
Detected Declarations
function sun3x_hwclkfunction sun3x_timer_tickfunction sun3x_sched_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* linux/arch/m68k/sun3x/time.c
*
* Sun3x-specific time handling
*/
#include <linux/types.h>
#include <linux/kd.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/kernel_stat.h>
#include <linux/interrupt.h>
#include <linux/rtc.h>
#include <linux/bcd.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/machdep.h>
#include <asm/traps.h>
#include <asm/sun3x.h>
#include <asm/sun3ints.h>
#include "time.h"
#define M_CONTROL 0xf8
#define M_SEC 0xf9
#define M_MIN 0xfa
#define M_HOUR 0xfb
#define M_DAY 0xfc
#define M_DATE 0xfd
#define M_MONTH 0xfe
#define M_YEAR 0xff
#define C_WRITE 0x80
#define C_READ 0x40
#define C_SIGN 0x20
#define C_CALIB 0x1f
int sun3x_hwclk(int set, struct rtc_time *t)
{
volatile struct mostek_dt *h =
(struct mostek_dt *)(SUN3X_EEPROM+M_CONTROL);
unsigned long flags;
local_irq_save(flags);
if(set) {
h->csr |= C_WRITE;
h->sec = bin2bcd(t->tm_sec);
h->min = bin2bcd(t->tm_min);
h->hour = bin2bcd(t->tm_hour);
h->wday = bin2bcd(t->tm_wday);
h->mday = bin2bcd(t->tm_mday);
h->month = bin2bcd(t->tm_mon + 1);
h->year = bin2bcd(t->tm_year % 100);
h->csr &= ~C_WRITE;
} else {
h->csr |= C_READ;
t->tm_sec = bcd2bin(h->sec);
t->tm_min = bcd2bin(h->min);
t->tm_hour = bcd2bin(h->hour);
t->tm_wday = bcd2bin(h->wday);
t->tm_mday = bcd2bin(h->mday);
t->tm_mon = bcd2bin(h->month) - 1;
t->tm_year = bcd2bin(h->year);
h->csr &= ~C_READ;
if (t->tm_year < 70)
t->tm_year += 100;
}
local_irq_restore(flags);
return 0;
}
#if 0
static irqreturn_t sun3x_timer_tick(int irq, void *dev_id)
{
unsigned long flags;
local_irq_save(flags);
/* Clear the pending interrupt - pulse the enable line low */
disable_irq(5);
enable_irq(5);
legacy_timer_tick(1);
local_irq_restore(flags);
return IRQ_HANDLED;
}
Annotation
- Immediate include surface: `linux/types.h`, `linux/kd.h`, `linux/init.h`, `linux/sched.h`, `linux/kernel_stat.h`, `linux/interrupt.h`, `linux/rtc.h`, `linux/bcd.h`.
- Detected declarations: `function sun3x_hwclk`, `function sun3x_timer_tick`, `function sun3x_sched_init`.
- Atlas domain: Architecture Layer / arch/m68k.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.