style: clang-format on all files
This commit is contained in:
parent
083468240d
commit
9b3a6cb5a4
9
.clang-format
Normal file
9
.clang-format
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
BasedOnStyle: LLVM
|
||||||
|
IndentWidth: 8
|
||||||
|
UseTab: AlignWithSpaces
|
||||||
|
BreakBeforeBraces: Linux
|
||||||
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
AllowShortFunctionsOnASingleLine: Empty
|
||||||
|
IndentCaseLabels: false
|
||||||
|
ColumnLimit: 80
|
||||||
|
AlignConsecutiveMacros: true
|
@ -14,10 +14,7 @@
|
|||||||
#define REGISTER_A 0x0A
|
#define REGISTER_A 0x0A
|
||||||
#define REGISTER_B 0x0B
|
#define REGISTER_B 0x0B
|
||||||
|
|
||||||
enum {
|
enum { CMOS_ADDRESS = 0x70, CMOS_DATA = 0x71 };
|
||||||
CMOS_ADDRESS = 0x70,
|
|
||||||
CMOS_DATA = 0x71
|
|
||||||
};
|
|
||||||
|
|
||||||
struct rtc_date {
|
struct rtc_date {
|
||||||
uint8_t second;
|
uint8_t second;
|
||||||
|
@ -8,6 +8,7 @@ int memcmp(const void *s1, const void *s2, size_t n)
|
|||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return 0;
|
return 0;
|
||||||
for (i = 0; str1[i] == str2[i] && i < n - 1; i++);
|
for (i = 0; str1[i] == str2[i] && i < n - 1; i++)
|
||||||
|
;
|
||||||
return str1[i] - str2[i];
|
return str1[i] - str2[i];
|
||||||
}
|
}
|
@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
char *strchr(const char *str, int c)
|
char *strchr(const char *str, int c)
|
||||||
{
|
{
|
||||||
char *start = (char *) str;
|
char *start = (char *)str;
|
||||||
|
|
||||||
while (*start)
|
while (*start) {
|
||||||
{
|
|
||||||
if (*start == c)
|
if (*start == c)
|
||||||
return start;
|
return start;
|
||||||
start++;
|
start++;
|
||||||
|
@ -4,12 +4,11 @@
|
|||||||
|
|
||||||
char *strstr(const char *haystack, const char *needle)
|
char *strstr(const char *haystack, const char *needle)
|
||||||
{
|
{
|
||||||
char *start = (char *) haystack;
|
char *start = (char *)haystack;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
len = strlen(needle);
|
len = strlen(needle);
|
||||||
while (*start != '\0')
|
while (*start != '\0') {
|
||||||
{
|
|
||||||
if (strncmp(start, needle, len) == 0)
|
if (strncmp(start, needle, len) == 0)
|
||||||
return start;
|
return start;
|
||||||
start++;
|
start++;
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
static uint16_t raw_read_register(uint16_t cmos_register)
|
static uint16_t raw_read_register(uint16_t cmos_register)
|
||||||
{
|
{
|
||||||
//selecting the register
|
// selecting the register
|
||||||
outb(CMOS_ADDRESS, cmos_register);
|
outb(CMOS_ADDRESS, cmos_register);
|
||||||
//read value of the selectect register
|
// read value of the selectect register
|
||||||
return inb(CMOS_DATA);
|
return inb(CMOS_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ static uint16_t read_register(uint16_t cmos_register)
|
|||||||
|
|
||||||
uint8_t bcd_mode_to_bin(uint8_t value)
|
uint8_t bcd_mode_to_bin(uint8_t value)
|
||||||
{
|
{
|
||||||
return (value & 0x0F) + ((value/ 16) * 10);
|
return (value & 0x0F) + ((value / 16) * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct rtc_date get_date(void)
|
struct rtc_date get_date(void)
|
||||||
|
@ -1,30 +1,18 @@
|
|||||||
#include "kprintf.h"
|
#include "kprintf.h"
|
||||||
#include "rtc.h"
|
#include "rtc.h"
|
||||||
|
|
||||||
void date()
|
void date(void)
|
||||||
{
|
{
|
||||||
static const char *months[12] = {
|
static const char *months[12] = {"January", "February", "March",
|
||||||
"January",
|
"April", "May", "June",
|
||||||
"February",
|
"July", "August", "September",
|
||||||
"March",
|
"October", "November", "December"};
|
||||||
"April",
|
static const char *week_days[] = {"Sunday", "Monday", "Tuesday",
|
||||||
"May",
|
"Wednesday", "Thursday", "Friday",
|
||||||
"June",
|
"Saturday"};
|
||||||
"July",
|
|
||||||
"August",
|
|
||||||
"September",
|
|
||||||
"October",
|
|
||||||
"November",
|
|
||||||
"December" };
|
|
||||||
static const char * week_days[] = {
|
|
||||||
"Sunday",
|
|
||||||
"Monday",
|
|
||||||
"Tuesday",
|
|
||||||
"Wednesday",
|
|
||||||
"Thursday",
|
|
||||||
"Friday",
|
|
||||||
"Saturday" };
|
|
||||||
struct rtc_date date = get_date();
|
struct rtc_date date = get_date();
|
||||||
|
|
||||||
kprintf(0, "%s. %d %s. %d %d:%d:%d\n", week_days[date.index_of_the_day], date.day, months[date.month], date.year, date.hour, date.minute, date.second);
|
kprintf(0, "%s. %d %s. %d %d:%d:%d\n", week_days[date.index_of_the_day],
|
||||||
|
date.day, months[date.month], date.year, date.hour, date.minute,
|
||||||
|
date.second);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user