搜索
bottom↓
回复: 5

ZLG的LM3S8962例程编译通不过,请大家帮忙。

[复制链接]

出0入0汤圆

发表于 2010-8-28 09:23:06 | 显示全部楼层 |阅读模式
/****************************************Copyright (c)****************************************************
**                            Guangzhou ZHIYUAN electronics Co.,LTD.
**                                      
**                                 http://www.embedtools.com
**
**--------------File Info---------------------------------------------------------------------------------
** File name:               hibernateRTC.c
** Latest modified Date:    2007-09-16
** Latest Version:          1.0
** Descriptions:            The hibernate function example template
**
**--------------------------------------------------------------------------------------------------------
** Created by:              Zhao shimin
** Created date:            2007-09-16
** Version:                 1.0
** Descriptions:            The original version
**
**--------------------------------------------------------------------------------------------------------
** Modified by:            
** Modified date:           
** Version:                 
** Descriptions:            
**
*********************************************************************************************************/

/*  系统库函数头文件  */
#include "hw_ints.h"
#include "hw_memmap.h"
#include "hw_types.h"
#include "gpio.h"
#include "sysctl.h"
#include "hibernate.h"
#include "interrupt.h"
/********************************************************************************************************/
#define   PIN1        GPIO_PIN_4                                         /*  PA4控制LED               */
#define   PIN2        GPIO_PIN_5                                         /*  PA5控制LED               */
#define   PINS       (PIN1 | PIN2)
#define   HIBCTL   (*(volatile unsigned long *) 0x400FC010)              /*  休眠控制寄存器             */
/********************************************************************************************************/

/*********************************************************************************************************
** Function name:           HIBRTCMatch0wake
**
** Descriptions:            用wake管脚唤醒中断服务程序,用于唤醒CPU
**
** input parameters:        NONE
** output parameters:       NONE
**
** Returned value:          NONE
**
** Created by:              Zhao shimin
** Created Date:            2007/09/16
**--------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**--------------------------------------------------------------------------------------------------------
*********************************************************************************************************/

void HIBRTCMatch0wake (void)
{
   
   HIBCTL &= ~(1<<1);                                                   /*  清除休眠标志                */
   /*  清除所有休眠中断标志    */
   HibernateIntClear(HIBERNATE_INT_PIN_WAKE    | HIBERNATE_INT_LOW_BAT |
                         HIBERNATE_INT_RTC_MATCH_0 | HIBERNATE_INT_RTC_MATCH_1);
   
   HibernateRTCSet(0);                                                  /*  RTC计数初值设为0            */
   GPIOPinWrite(GPIO_PORTA_BASE, PIN2, ~PIN2);

}


/*********************************************************************************************************
** Function name:           main
**
** Descriptions:            主函数初始化休眠模块,使LED闪烁并进入休眠状态
**
** input parameters:        NONE
** output parameters:       NONE
**
** Returned value:          NONE
**
** Created by:              Zhao shimin
** Created Date:            2007/09/16
**--------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**--------------------------------------------------------------------------------------------------------
*********************************************************************************************************/

int main (void)
{
    unsigned long    i, k;
       
    SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);                    /*  给休眠模块提供时钟          */
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);                        /*  给GPIOA提供时钟             */

    GPIOPadConfigSet(GPIO_PORTA_BASE, PINS, GPIO_STRENGTH_2MA,
                     GPIO_PIN_TYPE_STD);                                /*  设置管脚为上拉驱动          */
    GPIODirModeSet(GPIO_PORTA_BASE, PINS, GPIO_DIR_MODE_OUT);           /*  设置管脚为输出              */
       
    HibernateEnable();                                                  /*  使能休眠模块                */
    HibernateClockSelect(HIBERNATE_CLOCK_SEL_DIV128);                   /*  对输入时钟进行128分频       */
   
    HibernateRTCEnable();                                               /*  RTC使能                     */
    HibernateRTCSet(0);       
    for( i = 0 ;i < 20000; i++);                                        /*  延时用于休眠模块寄存器写操作*/
    HibernateRTCMatch0Set(HibernateRTCGet() + 10);                      /*  设定匹配值10s               */
    for( i = 0 ;i < 20000; i++);                                        /*  延时用于休眠模块寄存器写操作*/

    HibernateWakeSet(HIBERNATE_WAKE_RTC);                               /*  设置RTC匹配唤醒            */
    HibernateIntEnable(HIBERNATE_INT_RTC_MATCH_0);                      /*  使能RTC匹配唤醒             */

    /*  清除休眠模块的所有中断源的中断标志            */
    HibernateIntClear(HIBERNATE_INT_PIN_WAKE    | HIBERNATE_INT_LOW_BAT |
                      HIBERNATE_INT_RTC_MATCH_0 | HIBERNATE_INT_RTC_MATCH_1);
       
    IntEnable(INT_HIBERNATE);                                           /*  允许休眠模块中断            */
    IntMasterEnable();                                                  /*  开放总中断                  */
                 
    while (1)  {

            for (k = 0; k < 16; k++) {
                for (i = 0; i < 200000; i++);
                GPIOPinWrite(GPIO_PORTA_BASE, PIN1, ~PIN1);
                for (i = 0; i < 200000; i++);
                GPIOPinWrite(GPIO_PORTA_BASE, PIN1, PIN1);

        }
                                                   
        GPIOPinWrite(GPIO_PORTA_BASE, PIN2, PIN2);     
        HibernateRequest();                                             /*  使CPU进入休眠状态           */
   }

}
/*********************************************************************************************************
  END FILE
*********************************************************************************************************/

在主函数中有一句有错误,    HibernateEnable();                                                  /*  使能休眠模块                */
这一句编译提示expect an expression
              too many arguments in function call
第一个提示是没有声明函数,第二个提示是多个代码段在调用函数。
请问哪位前辈编译过ZLG的例程啊,帮帮忙啊!

阿莫论坛20周年了!感谢大家的支持与爱护!!

曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……

出0入0汤圆

发表于 2010-8-28 13:32:44 | 显示全部楼层
源码上来,再截个图

出0入0汤圆

 楼主| 发表于 2010-8-28 16:58:51 | 显示全部楼层
下面上代码,
程序代码ourdev_578367.rar(文件大小:53K) (原文件名:4.6.1_hibernate.rar)

(原文件名:12.jpg)


(原文件名:13.jpg)

出0入0汤圆

 楼主| 发表于 2010-8-28 17:00:23 | 显示全部楼层
我用的是TI的板子,程序来自ZLG,KEIL MDK是 KEIL4 realview MDK for ARM V4.11

出0入0汤圆

发表于 2010-8-29 20:26:06 | 显示全部楼层
//*****************************************************************************
//
//! Enables the Hibernation module for operation.
//!
//! \param ulHibClk is the rate of the clock supplied to the Hibernation
//! module.
//!
//! Enables the Hibernation module for operation.  This function should be
//! called before any of the Hibernation module features are used.
//!
//! The peripheral clock will be the same as the processor clock.  This will be
//! the value returned by SysCtlClockGet(), or it can be explicitly hard-coded
//! if it is constant and known (to save the code/execution overhead of a call
//! to SysCtlClockGet()).
//!
//! This function replaces the original HibernateEnable() API and performs the
//! same actions.  A macro is provided in <tt>hibernate.h</tt> to map the
//! original API to this API.
//!
//! \return None.
//
//*****************************************************************************
void
HibernateEnableExpClk(unsigned long ulHibClk)
{
    //
    // Turn on the clock enable bit.
    //
    HWREG(HIB_CTL) |= HIB_CTL_CLK32EN;

    //
    // For Fury-class devices, compute the number of delay loops that must be
    // used to achieve the desired delay for writes to the hibernation
    // registers.  This value will be used in calls to SysCtlDelay().
    //
    if(CLASS_IS_FURY)
    {
        g_ulWriteDelay = (((ulHibClk / 1000) * DELAY_USECS) /
                          (1000L * LOOP_CYCLES));
        g_ulWriteDelay++;
    }
}
注意这里:
//! This function replaces the original HibernateEnable() API and performs the
//! same actions.  A macro is provided in <tt>hibernate.h</tt> to map the
//! original API to this API.

#ifndef DEPRECATED
#include "sysctl.h"
#define HibernateEnable(a)                         \
        HibernateEnableExpClk(a, SysCtlClockGet())
#endif

这里我也解释不好,感觉这个有问题,你可以不用HibernateEnable()
直接使用HibernateEnableExpClk(xxx),参数看下说明就可以了

出0入0汤圆

 楼主| 发表于 2010-8-30 08:02:40 | 显示全部楼层
回复【4楼】songzi2018
-----------------------------------------------------------------------

多谢了,问题已解决。呵呵!
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-8-25 12:25

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表