Ingenic Jz4740:

* Clean up header file a bit
  * Add information about the IPU
  * Add original license
  * Add Ingenic Media Extension Instruction Set header file


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19621 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Maurus Cuelenaere 2008-12-31 01:57:07 +00:00
parent e25505daa4
commit 54919ae917
2 changed files with 2064 additions and 51 deletions

View File

@ -1,3 +1,39 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2008 by Maurus Cuelenaere
* Copyright (C) 2006-2007 by Ingenic Semiconductor Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
/*
* linux/include/asm-mips/mach-jz4740/jz4740.h
*
* JZ4740 common definition.
*
* Copyright (C) 2006 - 2007 Ingenic Semiconductor Inc.
*
* Author: <lhhuang@ingenic.cn>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/*
* Include file for Ingenic Semiconductor's JZ4740 CPU.
*/
@ -12,9 +48,9 @@
#endif /* !ASSEMBLY */
//----------------------------------------------------------------------
// Boot ROM Specification
//
/*************************************************************************
* Boot ROM Specification
*/
/* NOR Boot config */
#define JZ4740_NORBOOT_8BIT 0x00000000 /* 8-bit data bus flash */
@ -28,9 +64,9 @@
#define JZ4740_NANDBOOT_B16R2 0x00000000 /* 16-bit bus & 2 row cycles */
//----------------------------------------------------------------------
// Register Definitions
//
/*************************************************************************
* Register Definitions
*/
#define CPM_BASE 0xB0000000
#define INTC_BASE 0xB0001000
#define TCU_BASE 0xB0002000
@ -4945,4 +4981,175 @@ do{ \
#endif /* !__ASSEMBLY__ */
#ifndef _IPU_H_
#define _IPU_H_
// IPU_REG_BASE
#define IPU_P_BASE 0x13080000
#define IPU__OFFSET 0x13080000
#define IPU__SIZE 0x00001000
struct ipu_module
{
unsigned int reg_ctrl; // 0x0
unsigned int reg_status; // 0x4
unsigned int reg_d_fmt; // 0x8
unsigned int reg_y_addr; // 0xc
unsigned int reg_u_addr; // 0x10
unsigned int reg_v_addr; // 0x14
unsigned int reg_in_fm_gs; // 0x18
unsigned int reg_y_stride; // 0x1c
unsigned int reg_uv_stride; // 0x20
unsigned int reg_out_addr; // 0x24
unsigned int reg_out_gs; // 0x28
unsigned int reg_out_stride; // 0x2c
unsigned int rsz_coef_index; // 0x30
unsigned int reg_csc_c0_coef; // 0x34
unsigned int reg_csc_c1_coef; // 0x38
unsigned int reg_csc_c2_coef; // 0x3c
unsigned int reg_csc_c3_coef; // 0x40
unsigned int reg_csc_c4_coef; // 0x44
unsigned int hrsz_coef_lut[20]; // 0x48
unsigned int vrsz_coef_lut[20]; // 0x98
};
typedef struct
{
unsigned int coef;
unsigned short int in_n;
unsigned short int out_n;
} rsz_lut;
struct Ration2m
{
float ratio;
int n, m;
};
// Register offset
#define REG_CTRL 0x0
#define REG_STATUS 0x4
#define REG_D_FMT 0x8
#define REG_Y_ADDR 0xc
#define REG_U_ADDR 0x10
#define REG_V_ADDR 0x14
#define REG_IN_FM_GS 0x18
#define REG_Y_STRIDE 0x1c
#define REG_UV_STRIDE 0x20
#define REG_OUT_ADDR 0x24
#define REG_OUT_GS 0x28
#define REG_OUT_STRIDE 0x2c
#define REG_RSZ_COEF_INDEX 0x30
#define REG_CSC_C0_COEF 0x34
#define REG_CSC_C1_COEF 0x38
#define REG_CSC_C2_COEF 0x3c
#define REG_CSC_C3_COEF 0x40
#define REG_CSC_C4_COEF 0x44
#define HRSZ_LUT_BASE 0x48
#define VRSZ_LUT_BASE 0x98
// REG_CTRL field define
#define IPU_EN (1 << 0)
#define RSZ_EN (1 << 1)
#define FM_IRQ_EN (1 << 2)
#define IPU_RESET (1 << 3)
#define H_UP_SCALE (1 << 8)
#define V_UP_SCALE (1 << 9)
#define H_SCALE_SHIFT (8)
#define V_SCALE_SHIFT (9)
// REG_STATUS field define
#define OUT_END (1 << 0)
// REG_D_FMT field define
#define INFMT_YUV420 (0 << 0)
#define INFMT_YUV422 (1 << 0)
#define INFMT_YUV444 (2 << 0)
#define INFMT_YUV411 (3 << 0)
#define INFMT_YCbCr420 (4 << 0)
#define INFMT_YCbCr422 (5 << 0)
#define INFMT_YCbCr444 (6 << 0)
#define INFMT_YCbCr411 (7 << 0)
#define OUTFMT_RGB555 (0 << 16)
#define OUTFMT_RGB565 (1 << 16)
#define OUTFMT_RGB888 (2 << 16)
// REG_IN_FM_GS field define
#define IN_FM_W(val) ((val) << 16)
#define IN_FM_H(val) ((val) << 0)
// REG_IN_FM_GS field define
#define OUT_FM_W(val) ((val) << 16)
#define OUT_FM_H(val) ((val) << 0)
// REG_UV_STRIDE field define
#define U_STRIDE(val) ((val) << 16)
#define V_STRIDE(val) ((val) << 0)
#define VE_IDX_SFT 0
#define HE_IDX_SFT 16
// RSZ_LUT_FIELD
#define OUT_N_SFT 0
#define OUT_N_MSK 0x1
#define IN_N_SFT 1
#define IN_N_MSK 0x1
#define W_COEF_SFT 2
#define W_COEF_MSK 0xFF
// function about REG_CTRL
#define stop_ipu(IPU_V_BASE) \
REG32(IPU_V_BASE + REG_CTRL) &= ~IPU_EN;
#define run_ipu(IPU_V_BASE) \
REG32(IPU_V_BASE + REG_CTRL) |= IPU_EN;
#define reset_ipu(IPU_V_BASE) \
REG32(IPU_V_BASE + REG_CTRL) |= IPU_RESET;
#define disable_irq(IPU_V_BASE) \
REG32(IPU_V_BASE + REG_CTRL) &= ~FM_IRQ_EN;
#define disable_rsize(IPU_V_BASE) \
REG32(IPU_V_BASE + REG_CTRL) &= ~RSZ_EN;
#define enable_rsize(IPU_V_BASE) \
REG32(IPU_V_BASE + REG_CTRL) |= RSZ_EN;
#define ipu_is_enable(IPU_V_BASE) \
(REG32(IPU_V_BASE + REG_CTRL) & IPU_EN)
// function about REG_STATUS
#define clear_end_flag(IPU_V_BASE) \
REG32(IPU_V_BASE + REG_STATUS) &= ~OUT_END;
#define polling_end_flag(IPU_V_BASE) \
(REG32(IPU_V_BASE + REG_STATUS) & OUT_END)
/* parameter
R = 1.164 * (Y - 16) + 1.596 * (cr - 128) {C0, C1}
G = 1.164 * (Y - 16) - 0.392 * (cb -128) - 0.813 * (cr - 128) {C0, C2, C3}
B = 1.164 * (Y - 16) + 2.017 * (cb - 128) {C0, C4}
*/
#if 1
#define YUV_CSC_C0 0x4A8 /* 1.164 * 1024 */
#define YUV_CSC_C1 0x662 /* 1.596 * 1024 */
#define YUV_CSC_C2 0x191 /* 0.392 * 1024 */
#define YUV_CSC_C3 0x341 /* 0.813 * 1024 */
#define YUV_CSC_C4 0x811 /* 2.017 * 1024 */
#else
#define YUV_CSC_C0 0x400
#define YUV_CSC_C1 0x59C
#define YUV_CSC_C2 0x161
#define YUV_CSC_C3 0x2DC
#define YUV_CSC_C4 0x718
#endif
#endif /* _IPU_H_ */
#endif /* __JZ4740_H__ */

1806
firmware/export/jz_mxu.h Normal file

File diff suppressed because it is too large Load Diff