~ubuntu-branches/ubuntu/wily/grub2/wily-proposed

« back to all changes in this revision

Viewing changes to include/grub/cmos.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Zielcke, Robert Millan, Felix Zielcke
  • Date: 2010-01-26 19:26:25 UTC
  • mfrom: (1.13.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20100126192625-coq6czap2ofjollf
Tags: 1.98~20100126-1
* New Bazaar snapshot.
  - Includes mipsel-yeeloong port.

[ Robert Millan ]
* config.in: Lower priority of grub2/linux_cmdline_default.

[ Felix Zielcke ]
* Drop `CFLAGS=-O0' workaround on powerpc. Should be fixed correctly now.
* Ship grub-bin2h and grub-script-check in grub-common.
* Terminate NEWS.Debian with a blank line like lintian would suggest
  if that check would be working correctly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  GRUB  --  GRand Unified Bootloader
 
3
 *  Copyright (C) 2008, 2009  Free Software Foundation, Inc.
 
4
 *
 
5
 *  GRUB is free software: you can redistribute it and/or modify
 
6
 *  it under the terms of the GNU General Public License as published by
 
7
 *  the Free Software Foundation, either version 3 of the License, or
 
8
 *  (at your option) any later version.
 
9
 *
 
10
 *  GRUB is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
#ifndef GRUB_CMOS_H
 
20
#define GRUB_CMOS_H     1
 
21
 
 
22
#include <grub/types.h>
 
23
#include <grub/cpu/io.h>
 
24
#include <grub/cpu/cmos.h>
 
25
 
 
26
#define GRUB_CMOS_INDEX_SECOND          0
 
27
#define GRUB_CMOS_INDEX_SECOND_ALARM    1
 
28
#define GRUB_CMOS_INDEX_MINUTE          2
 
29
#define GRUB_CMOS_INDEX_MINUTE_ALARM    3
 
30
#define GRUB_CMOS_INDEX_HOUR            4
 
31
#define GRUB_CMOS_INDEX_HOUR_ALARM      5
 
32
#define GRUB_CMOS_INDEX_DAY_OF_WEEK     6
 
33
#define GRUB_CMOS_INDEX_DAY_OF_MONTH    7
 
34
#define GRUB_CMOS_INDEX_MONTH           8
 
35
#define GRUB_CMOS_INDEX_YEAR            9
 
36
 
 
37
#define GRUB_CMOS_INDEX_STATUS_A        0xA
 
38
#define GRUB_CMOS_INDEX_STATUS_B        0xB
 
39
#define GRUB_CMOS_INDEX_STATUS_C        0xC
 
40
#define GRUB_CMOS_INDEX_STATUS_D        0xD
 
41
 
 
42
#define GRUB_CMOS_STATUS_B_DAYLIGHT     1
 
43
#define GRUB_CMOS_STATUS_B_24HOUR       2
 
44
#define GRUB_CMOS_STATUS_B_BINARY       4
 
45
 
 
46
static inline grub_uint8_t
 
47
grub_bcd_to_num (grub_uint8_t a)
 
48
{
 
49
  return ((a >> 4) * 10 + (a & 0xF));
 
50
}
 
51
 
 
52
static inline grub_uint8_t
 
53
grub_num_to_bcd (grub_uint8_t a)
 
54
{
 
55
  return (((a / 10) << 4) + (a % 10));
 
56
}
 
57
 
 
58
static inline grub_uint8_t
 
59
grub_cmos_read (grub_uint8_t index)
 
60
{
 
61
  grub_outb (index, GRUB_CMOS_ADDR_REG);
 
62
  return grub_inb (GRUB_CMOS_DATA_REG);
 
63
}
 
64
 
 
65
static inline void
 
66
grub_cmos_write (grub_uint8_t index, grub_uint8_t value)
 
67
{
 
68
  grub_outb (index, GRUB_CMOS_ADDR_REG);
 
69
  grub_outb (value, GRUB_CMOS_DATA_REG);
 
70
}
 
71
 
 
72
#endif /* GRUB_CMOS_H */