📄 rpc.c
字号:
/*-----------------------------------------------------------------------------@@@@ (Summary) : RPC driver source file@@@@ (Comment) :@@@@ (Author) : @@@@ (History) : Date Modifier Comment@@@@ (RCS ID) :@@-----------------------------------------------------------------------------*/#define RPC_C/*+include files*************************************************************//* *//* *//****************************************************************************/#include "rpc.h"/******************************************************************************@@@@ [Name] : apd_RPCInit@@@@ [Summary] : The function to initialize RPC@@@@ [Argument] : None@@@@ [Return] : None@@@@ [Desc] : Set the divider of XCLK, select the clock source for@@ the peripherals, control the bus master priority for@@ the system bus arbiter, and control ASB bridge.@@@@ [History] : Date Modifier Comment@@@@ [END]******************************************************************************/void apd_RPCInit(void){ /* set CPU Clock Control register */ *APD_RPC_CPUClkCtrl = (unsigned short)APD_RPC_BCLK; /* set Macro Clock Select register */ *APD_RPC_MacroClkSel = (unsigned short)(APD_RPC_UART2_CLK | APD_RPC_UART1_CLK | APD_RPC_UART0_CLK | APD_RPC_USB_CLK | APD_RPC_IRDA_CLK); /* set Arbitration Priority Control */ *APD_RPC_Arbitration = (unsigned short)APD_RPC_ARBPR; /* set Write Buffer inside ASB Bridge */ *APD_RPC_ASBBridgeCtlr = (unsigned short)APD_RPC_ABC;}/******************************************************************************@@@@ [Name] : apd_RPCSetMode@@@@ [Summary] : The function to set the system power mode@@@@ [Argument] : mode: Power mode (either of the following)@@ APD_RPC_POWER_ACTIVE@@ APD_RPC_POWER_STANDBY@@ APD_RPC_POWER_SLEEP@@ APD_RPC_POWER_STOP@@ APD_RPC_POWER_STOP2@@@@ [Return] : None@@@@ [Desc] : Set the system power mode, according to the argument mode.@@ But you can set Stop2 mode, only if PLLCLK is selected as@@ SYSCLK.@@@@ [History] : Date Modifier Comment@@@@ [END]******************************************************************************/void apd_RPCSetMode(APD_RPC_POWER_MODE mode){ *APD_RPC_PowerMode = (unsigned short)mode;}/******************************************************************************@@@@ [Name] : apd_RPCStartClock@@@@ [Summary] : The function to control several peripheral clock@@@@ [Argument] : assort: Specify the peripheral to start the clock(IO_CLOCK)@@ APD_RPC_CLK_IRDA for IrDA module@@ APD_RPC_CLK_USB for USB module@@ APD_RPC_CLK_LCDC for LCDC module@@ APD_RPC_CLK_SPI for SPI module@@ APD_RPC_CLK_PWM0 for PWM0 module@@ APD_RPC_CLK_PWM1 for PWM1 module@@ APD_RPC_CLK_PWM2 for PWM2 module@@ APD_RPC_CLK_PWM3 for PWM3 module@@ APD_RPC_CLK_UART0 for UART0 module@@ APD_RPC_CLK_UART1 for UART1 module@@ APD_RPC_CLK_UART2 for UART2 module@@ APD_RPC_CLK_CT0 for CT0 module@@ APD_RPC_CLK_CT1 for CT1 module@@ APD_RPC_CLK_CT2 for CT2 module@@ Set the value, which is operated 'or' each module's@@ symbol, to argument when you start two or more@@ module's clocks at the same time.@@ Example)@@ Start clock of IrDA and USB at the same time.@@ APD_RPC_CLK_IRDA |APD_RPC_CLK_USB@@@@ [Return] : None@@@@ [Desc] : Provide the clock of the corresponding peripheral@@ according to the argument@@@@ [Note] :@@@@ [History] : Date Modifier Comment@@@@ [END]******************************************************************************/void apd_RPCStartClock(APD_RPC_IO_CLOCK assort){ *APD_RPC_MacroClkCtrl &= (~assort);}/******************************************************************************@@@@ [Name] : apd_RPCStopClock@@@@ [Summary] : The function to control several peripheral clock@@@@ [Argument] : assort: Specify the peripheral to stop the clock(IO_CLOCK)@@ APD_RPC_CLK_IRDA for IrDA module@@ APD_RPC_CLK_USB for USB module@@ APD_RPC_CLK_LCDC for LCDC module@@ APD_RPC_CLK_SPI for SPI module@@ APD_RPC_CLK_PWM0 for PWM0 module@@ APD_RPC_CLK_PWM1 for PWM1 module@@ APD_RPC_CLK_PWM2 for PWM2 module@@ APD_RPC_CLK_PWM3 for PWM3 module@@ APD_RPC_CLK_UART0 for UART0 module@@ APD_RPC_CLK_UART1 for UART1 module@@ APD_RPC_CLK_UART2 for UART2 module@@ APD_RPC_CLK_CT0 for CT0 module@@ APD_RPC_CLK_CT1 for CT1 module@@ APD_RPC_CLK_CT2 for CT2 module@@ Set the value, which is operated 'or' each module's@@ symbol, to argument when you start two or more@@ module's clocks at the same time.@@ Example)@@ Start clock of IrDA and USB at the same time.@@ APD_RPC_CLK_IRDA |APD_RPC_CLK_USB@@@@ [Return] : None@@@@ [Desc] : According to the argument, stops the clock of@@ the corresponding peripheral@@@@ [History] : Date Modifier Comment@@@@ [END]******************************************************************************/void apd_RPCStopClock(APD_RPC_IO_CLOCK assort){ *APD_RPC_MacroClkCtrl |= (unsigned short)assort;}/******************************************************************************@@@@ [Name] : apd_RPCSetMMap@@@@ [Summary] : The function to control the memory map@@@@ [Argument] : map: Select memory map (either of the following)@@ APD_RPC_MEMORY_MAP0@@ APD_RPC_MEMORY_MAP1@@@@ [Return] : None@@@@ [Desc] : Remap if the argument is APD_RPC_MEMORY_MAP1.@@@@ [History] : Date Modifier Comment@@@@ [END]******************************************************************************/void apd_RPCSetMMap(APD_RPC_MEM_MAP map){ *APD_RPC_MemoryMap = (unsigned short)map;}/******************************************************************************@@@@ [Name] : apd_RPCControlReset@@@@ [Summary] : The function for control output nRESETO pin@@@@ [Argument] : res : Value of nRESETO output (either of the following)@@ APD_RPC_RESET_HIGH : drive nRESETO high@@ APD_RPC_RESET_LOW : drive nRESETO low@@@@ [Return] : None@@@@ [Desc] : According to the argument, control output nRESETO pin@@@@ [History] : Date Modifier Comment@@@@ [END]******************************************************************************/void apd_RPCControlReset(unsigned char res){ *APD_RPC_SoftReset = (unsigned short)res;}/******************************************************************************@@@@ [Name] : apd_RPCReadResetStatus@@@@ [Summary] : The function for reading Reset Status register@@@@ [Argument] : None@@@@ [Return] : The value of Reset Status register@@@@ [Desc] : Read Reset Status register@@@@ [History] : Date Modifier Comment@@@@ [END]******************************************************************************/unsigned char apd_RPCReadResetStatus(void){ return ((unsigned char)*APD_RPC_ResetStat);}/******************************************************************************@@@@ [Name] : apd_RPCClearRflag@@@@ [Summary] : The function to clear te Reset Status flags@@@@ [Argument] : flg : Flag cleared Reset Status (either of the following)@@ APD_RESET_CLEAR_POR@@ APD_RESET_CLEAR_WDT@@ APD_RESET_CLEAR_POR | APD_RESET_CLEAR_WDT@@ (Case of clearing all reset status flag)@@@@ [Return] : None@@@@ [Desc] : Clear the corresponding Reset Status flags@@@@ [History] : Date Modifier Comment@@ 2001/1/15 Kazuko FUKUDA@@ [END]******************************************************************************/void apd_RPCClearRflag(unsigned char flg){ *APD_RPC_ResetStatClear = (unsigned short)flg;}/******************************************************************************@@@@ [Name] : apd_RPCReadID@@@@ [Summary] : The function to read the ID about the chip@@@@ [Argument] : None@@@@ [Return] : the value of ID register@@@@ [Desc] : Reading the ID register provides identification information@@ about the chip.@@@@ [History] : Date Modifier Comment@@ 2001/1/15 Kazuko FUKUDA@@ [END]******************************************************************************/unsigned long apd_RPCReadID(void){ return ((unsigned long)*APD_RPC_ID);}/* ---------- end of file 'apd_rpc.c' ---------- */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -