NanoPayload

Annotated stage2/minipc_claa070vc01.h

122:24d8d5589ab5
2016-02-24 Paul Boddie Switched to position-independent code to enable user mode execution. stage2-non-pic
paul@33 1
/*
paul@34 2
 * MiniPC panel-specific definitions
paul@33 3
 *
paul@33 4
 * Copyright (C) Xiangfu Liu <xiangfu@sharism.cc>
paul@112 5
 * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
paul@33 6
 *
paul@33 7
 * This program is free software; you can redistribute it and/or
paul@33 8
 * modify it under the terms of the GNU General Public License as
paul@33 9
 * published by the Free Software Foundation; either version 2 of
paul@33 10
 * the License, or (at your option) any later version.
paul@33 11
 *
paul@33 12
 * This program is distributed in the hope that it will be useful,
paul@33 13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
paul@33 14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
paul@33 15
 * GNU General Public License for more details.
paul@33 16
 *
paul@33 17
 * You should have received a copy of the GNU General Public License
paul@33 18
 * along with this program; if not, write to the Free Software
paul@42 19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
paul@42 20
 * Boston, MA  02110-1301, USA
paul@33 21
 */
paul@33 22
paul@33 23
#ifndef __MINIPC_CLAA070VC01_H__
paul@33 24
#define __MINIPC_CLAA070VC01_H__
paul@33 25
paul@112 26
#include "board.h"
paul@112 27
#include "minipc.h"
paul@39 28
paul@112 29
static inline void __lcd_set_backlight_level(u16 n)
paul@112 30
{
paul@112 31
	__gpio_as_pwm();
paul@112 32
	REG_PWM_DUT(0) = n;
paul@112 33
	REG_PWM_PER(0) = 7;
paul@112 34
	REG_PWM_CTR(0) = 0xc1;
paul@112 35
}
paul@112 36
paul@112 37
static inline void __lcd_close_backlight()
paul@112 38
{
paul@112 39
	__gpio_as_output(GPIO_PWM0);
paul@112 40
	__gpio_clear_pin(GPIO_PWM0);
paul@112 41
}
paul@39 42
paul@112 43
static inline void __lcd_display_pin_init()
paul@112 44
{
paul@112 45
	__gpio_as_output(GPIO_DISP_OFF_N);
paul@112 46
	__lcd_set_backlight_level(8);
paul@112 47
}
paul@39 48
paul@112 49
static inline void __lcd_display_on()
paul@112 50
{
paul@112 51
	__gpio_set_pin(GPIO_DISP_OFF_N);
paul@112 52
	__lcd_set_backlight_level(8);
paul@112 53
}
paul@39 54
paul@112 55
static inline void __lcd_display_off()
paul@112 56
{
paul@112 57
	__lcd_close_backlight();
paul@112 58
	__gpio_clear_pin(GPIO_DISP_OFF_N);
paul@112 59
}
paul@39 60
paul@33 61
#endif /* __MINIPC_CLAA070VC01_H__ */