⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tcpu.c.svn-base

📁 最新火热的CX32 源代码
💻 SVN-BASE
字号:
/************************************************************************/
/*                                                                      */
/* This file is a Toshiba TMP91CU27UG-9999 Boot Register setting file   */
/* Application          : DPTV                                          */
/* MCU                  : TMP91CU27UG-9999                              */
/* Main Clock           : fc=27MHz                                      */
/*                                                                      */
/* Copyright (C) Trident Multimedia Technologies (Shanghai) Co., Ltd.   */
/*                    2005  All rights reserved.                        */
/* Revision:                                                            */
/* 12/10/2005     Created by Lewis                                      */
/************************************************************************/

#include "IOCtrl.h"
#include "Tdefs.h"
//#include "TCPU.h" 
#include "C91Cx27U.h"
#include "tio.h"
#include "tvconfig.h"

#define wOSCKHz_int  27000
#define MAGICNUM_int 10

/*******************************/
/* Description: CPU initialize */
/*******************************/
#ifdef _CX32_LCD203_ENABLE_
void SystemInitial(void)
{
#ifdef USE_T_QUAD
    P3FC = 0x07;  //00000111
                  //||||||||_1:P30 functions as RD
                  //|||||||__1:P31 functions as WR
                  //||||||___1:HWR
                  //|||||____00000:No such pins

    P4CR = 0x07;
    P4FC = 0x07;
    g_p4cr_buf = 0x07;//00000111
    g_p4fc_buf = 0x07;//00000101
                       //||||||||_11:P40 functions as CS0, 8051_CS2CX
                       //|||||||__10:P41 functions as IO,  SB_PWR
                       //||||||___11:P42 functions as CS2, PS
                       //|||______00:No such pins
#else
    P3FC = 0x03;  //00000011
                  //||||||||_1:P30 functions as RD
                  //|||||||__1:P31 functions as WR
                  //||||||___0:Don't care
                  //|||||____00000:No such pins

    P4CR = 0x07;
    P4FC = 0x05;
    g_p4cr_buf = 0x07;//00000111
    g_p4fc_buf = 0x05;//00000101
                       //||||||||_11:P40 functions as CS0, 8051_CS2CX
                       //|||||||__10:P41 functions as IO,  SB_PWR
                       //||||||___11:P42 functions as CS2, PS
                       //|||______00:No such pins
	P41 = 0;//YYM_06_06_02 add for[POWER ON STANDBY]
#endif
    P6FC = 0x00;
    P6CR = 0x07;
    P6 = 0x01;
    g_p6cr_buf = 0x07;//00000111
    g_p6fc_buf = 0x00;//00000000
                       //||||||||_00:P60 functions as IO
                       //|||||||__00:P61 functions as IO
                       //||||||___10:P62 functions as IO
                       //|||||____00:P63 functions as IO
                       //||||_____00:P64 functions as IO
                       //|||______00:No such pins         


    g_p7cr_buf = 0x14; //00010100
    P7CR = g_p7cr_buf; 
    g_p7fc_buf = 0x00;
    P7FC = g_p7fc_buf; //00000000
                       //||||||||_00:P70 functions as IO, default input. EEPROM SDA
                       //|||||||__00:P71 functions as IO, default input. EEPROM SCL
                       //||||||___10:P72 functions as IO, output. EEPROM WP
                       //|||||____00:P73 functions as IO, input. HDMI_HOTPLUG
                       //||||_____10:P74 functions as IO, output. BKLT_CNTL
                       //|||______00:No such pins                      
    P7 = 0x00;//YYM FOR P74 = 0 BACK LIGHT;

    //g_p8cr_buf = 0x0C;
    // g_p8fc_buf = 0x03;
    P8 = 0x0C;
    P8CR = 0x0C; //00001100
    P8FC = 0x03; //00000011
                       //||||||||_01:P80 functions as INT5 pin, input. Remoter
                       //|||||||__01:P81 functions as INT6 pin, input. RX_INT#
                       //||||||___10:P82 functions as IO, output. LED_R
                       //|||||____10:P83 functions as IO, output. LED_G
                       //||||_____00:No such pins

#ifdef _TK204B_
    g_p9cr_buf = 0xED;
#else
    g_p9cr_buf = 0xED;//YYM_06_05_22 modify from[0xE9] to [0xED]
#endif    
    P97 = 0;
    P92 = 0;
    P95 = 1;
    g_p9fc_buf = 0x08;
    P9CR = g_p9cr_buf; //11101101
    P9FC = g_p9fc_buf; //00001000
                       //||||||||_10:P90 functions as IO, output. BKLT_PWR
                       //|||||||__00:P91 functions as IO, input. SCDT
                       //||||||___00:P92 functions as IO, input. Detect_VGA
                       //|||||____11:P93 functions as TXD1, output. TXD
                       //||||_____00:P94 functions as RXD1, input. RXD
                       //|||______00:P95 functions as IO. UART1 not use clk

    ODE  = 0x0C;//0x00; //Robin 2006-04-04, open-drain mode for I2C
    //Interrupt prioty setting
    INTAD  = INT_PRIORITY_OFF;                    //AD convert
    INT0   = INT_PRIORITY_OFF;                    //INT0, EX INT#
    INT6   = INT_PRIORITY_OFF;                    //INT6, HMDI RX_INT#
    INT5   = INT_PRIORITY_A;                      //INT5, Remoter
    INTTA0 = INT_PRIORITY_B;                      //TimerA01, 1ms timer
    INTTA1 = INT_PRIORITY_C;                     
    INTTA2 = INT_PRIORITY_OFF;//INT_PRIORITY_E;                    //TimerA23
    INTTA3 = INT_PRIORITY_OFF;//INT_PRIORITY_E;
    INTTA4 = INT_PRIORITY_OFF;                    //TimerA45
    INTTA5 = INT_PRIORITY_OFF;
    INTTB00 = INT_PRIORITY_OFF;                     //TimerB0, 20ms timer
    INTTB01 = INT_PRIORITY_OFF;                   //TimerB1 
    INTTBOF0 = INT_PRIORITY_OFF;                  //TB0 overflow
    INTRX0 = INT_PRIORITY_OFF;
    INTTX0 = INT_PRIORITY_OFF;
#ifndef USE_T_QUAD    
    INTRX1 = INT_PRIORITY_OFF;
    INTTX1 = INT_PRIORITY_OFF;
#endif
    INTSBI = INT_PRIORITY_OFF;
    INTRTC = INT_PRIORITY_OFF;
    INTTC0 = INT_PRIORITY_D;  //INT_PRIORITY_OFF;
    INTTC1 = INT_PRIORITY_OFF;
    INTTC2 = INT_PRIORITY_OFF;
    INTTC3 = INT_PRIORITY_OFF;
    DMA0V = 0x00;
    DMA1V = 0x00;
    DMA2V = 0x00;
    DMA3V = 0x00;
#ifdef USE_T_QUAD
    INTCLR = 0x0F;
#else
    INTCLR = 0x00;
#endif
    DMAR = 0x00;
    DMAB = 0x00;
    IIMC = 0x00;                                  //Intterrupt on rising edge
    //TimerA01,TimerA23,Timer45 and TimerB0 setting
    TA01MOD = 0x03;//0x41
    TA23MOD = 0X05;  //0x42;
    TA45MOD = 0xdd;
    TB0MOD  = 0x27;
    
    TA1FFCR = 0x00;
    TA3FFCR = 0x00;
    TA5FFCR = 0x0b;
    TB0FFCR = 0xC3;

    TA0REG = (((Word)wOSCKHz_int - MAGICNUM_int)/128 -1) & 0xFF;
    //TA1REG = (((Word)wOSCKHz_int*20 - MAGICNUM_int)/8 -1)>> 8;
    TA1REG = 20;

    TA2REG = 0x01;//(((Word)wOSCKHz_int*20 - MAGICNUM_int)/32 -1) & 0xFF;
    TA3REG = 0xFF;//(((Word)wOSCKHz_int*20 - MAGICNUM_int)/32 -1)>> 8;

    TA4REG = (((Word)wOSCKHz_int*8/25 - MAGICNUM_int)/8 -1) & 0xFF;
    TA5REG = (((Word)wOSCKHz_int*8/25 - MAGICNUM_int)/8 -1)>> 8;

    TB0RG0L = (((Word)wOSCKHz_int*20 - MAGICNUM_int)/8 -1)& 0xFF;
    TB0RG0H = (((Word)wOSCKHz_int*20 - MAGICNUM_int)/8 -1)>> 8;

    TA01RUN = 0x07;
    TA23RUN = 0x05;
    TA45RUN = 0x07;
    TB0RUN  = 0x0C;
    //UART setting
#ifndef USE_T_QUAD 
    SC1CR = 0x00;
    SC1MOD0 = 0x29;
    BR1CR = 0x0B; //38400
#endif
    //ADC setting
    ADMOD1 = 0xC3;   // 11000001b//hogan 2k60301,modified fo adc2 and adc3
    ADMOD0 = 0x07;   // 00000111b
    //Watchdog setting
    WDMOD = 0x00;
    WDCR = 0xB1;
    
    // initialzie UART
#ifndef USE_T_QUAD 
	#ifdef _USE_STi7710_
    	tdUARTLowInit(UART_COM1, UART_BAUD_19200);
	#else
    	tdUARTLowInit(UART_COM1, UART_BAUD_115200);
	#endif
#endif

    // initialize cpu system timer.
    tdInitTimer(27000); 
    
    // enable cpu interupt
    CpuEnableInt();
}
#elif defined(_CX32_LCD250A_ENABLE_)
#elif defined(_CX12_FB202A_ENABLE_)
#elif defined(_CX12_FB201A_ENABLE_)
#endif





⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -