DSP芯片CSL的使用
来源:互联网 发布:淘宝客优惠券网站模板 编辑:程序博客网 时间:2024/04/29 22:41
CCS V5中使用CSL库的方法 基于TMS320C6455讲解
前言:
芯片支持库(CSL)提供了一个用于配置和控制片上外设的C语言接口。它有各个分立的模块组成,并被编译成为库文件。每个模块对应一个单独的外设,除了个别提供通用程序支持的模块。使用CSL可以方便片上外设的使用,缩短开发周期,提高程序的可移植性,硬件抽象。
1.CSL库的下载
下载地址:http://processors.wiki.ti.com/index.php/Chip_support_library?keyMatch=CSL&tisearch=Search-CN-Everything
下载完成并解压重命名为CSL。
注意:这里应该选择对应系列和型号的DSP芯片支持库(CSL),这里是以TMS320C6455为例
2.在CCS5.2中指定头文件路径
具体路径更具个人情况而定。
本例路劲为E:\CSL\03.00.10.02\6455\6455_default_package\default_package\csl_c6455\inc
E:\CSL\03.00.10.02\6455\6455_default_package\default_package\csl_c64xplus_intc\inc
设置如图所示:
3.在CCS5.2中指定库文件路径
TMS320C6455需要的CSL库有csl_c64xplus_intc.lib和csl_c6455.lib
本例路径为:E:\CSL\03.00.10.02\6455\6455_default_package\default_package\csl_c6455\lib
E:\CSL\03.00.10.02\6455\6455_default_package\default_package\csl_c64xplus_intc\lib
设置如图所示:
4.在CCS5.2中设置预定义符号
对于TMS320C6455所需要的预定义符号有CHIP_C6455和_INCLUDE_NIMU_CODE
设置如图所示:
5.下面给出一个TMS320C6455GPIO的CSL使用代码
GPIO头文件:
#ifndef _GPIO_H#define _GPIO_H/* GPIO 引脚 */typedef enum { /** Gpio pin 0 */ GPIO_PIN0, /** Gpio pin 1 */ GPIO_PIN1, /** Gpio pin 2 */ GPIO_PIN2, /** Gpio pin 3 */ GPIO_PIN3, /** Gpio pin 4 */ GPIO_PIN4, /** Gpio pin 5 */ GPIO_PIN5, /** Gpio pin 6 */ GPIO_PIN6, /** Gpio pin 7 */ GPIO_PIN7, /** Gpio pin 8 */ GPIO_PIN8, /** Gpio pin 0 */ GPIO_PIN9, /** Gpio pin 10 */ GPIO_PIN10, /** Gpio pin 11 */ GPIO_PIN11, /** Gpio pin 12 */ GPIO_PIN12, /** Gpio pin 13 */ GPIO_PIN13, /** Gpio pin 14 */ GPIO_PIN14, /** Gpio pin 15 */ GPIO_PIN15} GPIO_PIN;/* GPIO 方向 */typedef enum { GPIO_DIR_OUTPUT,/**<<b>: Output pin</b>*/ GPIO_DIR_INPUT /**<<b>: Input pin</b>*/} GPIO_DIRCFG;/* GPIO配置值 */typedef enum {GPIO_SET_BIT = 4,GPIO_CLEAR_BIT = 5}GPIO_VAl;int gpio_init();void gpio_ctl(Uint32 gpioPin, Uint32 val);#endif
GPIO源文件:
/* ============================================================================ * Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005 * * Use of this software is controlled by the terms and conditions found * in the license agreement under which this software has been supplied. * ============================================================================ */#include <csl_gpio.h>#include <csl_intc.h>#include <stdio.h>#include <string.h>#include <csl_intcAux.h>#include <cslr_dev.h>#include "gpio.h"int gpio_init(){Bool gpioEn; /* Unlock the control register */ CSL_FINST(((CSL_DevRegs*)CSL_DEV_REGS)->PERLOCK, DEV_PERLOCK_LOCKVAL, UNLOCK); /* Enable the GPIO */ CSL_FINST(((CSL_DevRegs*)CSL_DEV_REGS)->PERCFG0, DEV_PERCFG0_GPIOCTL, ENABLE); do { gpioEn = (Bool) CSL_FEXT(((CSL_DevRegs*)CSL_DEV_REGS)->PERSTAT0, DEV_PERSTAT0_GPIOSTAT); } while (gpioEn != TRUE);return 0;}/* * ============================================================================= * @func gpioInternalLoopbackDemo * * @arg * NONE * * @desc * Gives demo for the internal loopback mechanism for the interrupt path; * the value sent on a output pin can trigger a Rising or Falling edge * interrupt. * * @return * NONE * * ============================================================================= */void gpio_ctl(Uint32 gpioPin, Uint32 val){ CSL_GpioPinConfig config; CSL_GpioPinNum pinNum; CSL_Status status; CSL_GpioContext pContext; CSL_GpioObj gpioObj; CSL_GpioHwSetup hwSetup;CSL_GpioHandle hGpio; /* Initialize the GPIO CSL module */ status = CSL_gpioInit(&pContext); if (status != CSL_SOK) { printf("GPIO: Initialization error.\n"); return; } /* Open the CSL module */ hGpio = CSL_gpioOpen(&gpioObj, CSL_GPIO, NULL, &status); if ((hGpio == NULL) || (status != CSL_SOK)) { printf("GPIO: Error opening the instance.\n"); return; } /* Setup hardware parameters */ hwSetup.extendSetup = NULL; /* Setup the General Purpose IO */ status = CSL_gpioHwSetup(hGpio, &hwSetup); /* Configure pin 5 to generate an interrupt on Rising Edge, and * configure it as an output, then set the data High (Low->High). * Set Trigger: */ config.pinNum = gpioPin; config.direction = GPIO_DIR_OUTPUT; /* configure the gpio pin */ status = CSL_gpioHwControl(hGpio, CSL_GPIO_CMD_CONFIG_BIT, &config); if (status != CSL_SOK) { printf("GPIO: GPIO pin configuration error.\n"); return; } pinNum = gpioPin; status = CSL_gpioHwControl (hGpio, val, &pinNum); if (status != CSL_SOK) { printf("GPIO: Command to set bit... Failed.\n"); return; }status = CSL_gpioClose(hGpio); if (status != CSL_SOK) { printf("GPIO: Unable to Close the instance.[status = 0x%x].\n", status); }}
编译工程成功 ,则说明CSL库环境搭建成功
- DSP芯片CSL的使用
- DSP CSL的使用(cache,timer)
- DSP CSL的使用(cache,timer)
- DSP中CSL介绍
- DSP芯片的特点
- 纯新手DSP编程--5.29--基于CCS的DSP片级支持库CSL
- DSP芯片的定点运算
- DSP芯片的定点运算
- DSP芯片的基本结构
- DSP芯片
- DSP/BIOS与CSL是什么关系?
- DSP/BIOS与CSL是什么关系?
- DSP CSL 片上支持库 EMIF
- DSP集成的AIC23芯片的音频接口
- TMS320系列DSP芯片的命名方法
- DSP和其他微芯片的比较
- 使用Philips ARM7 LPC2119 通过SPI与炬力ATT7022B电力DSP芯片的通讯
- DSP芯片介绍
- 有感于STL的内存管理
- Mybatis插件原理和PageHelper结合实战分页插件
- 关于ruby on rails 的事务回调不触发,使用update_column
- Android Studio 三种添加插件的方式
- recv send 阻塞和非阻塞
- DSP芯片CSL的使用
- go语言模版
- nginx 修改配置文件后reload
- UIImagePickerController不调用代理
- 39. Combination Sum
- Caffe深度学习框架安装(Ubuntu14.04+cuda8.0)
- java 基础 字符串 StringBuilder和StringBuffer
- Spring Boot中使用Swagger2构建RESTful APIs
- anroid工程名冲突修改方法