OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 8332|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 a& g+ ]$ z1 G, y2 ^- Q; V
  1. [code]EDMA sample test application
    0 `, O8 S" \. W8 w
  2. /*7 [9 x0 Q6 ]" {& e1 L0 R& p5 B9 a
  3. * edma_test.c
    1 p5 M4 K9 d3 X- [
  4. *
    $ B& Y* N5 _5 u# x4 }
  5. * brief  EDMA3 Test Application! i8 k' G- a2 Q$ X, ]
  6. *
    3 a' j/ w. N; m/ I- a3 G
  7. *   This file contains EDMA3 Test code.$ }9 |* ~) }; h5 C0 n
  8. *
    6 J8 L6 c; a, h. r/ t! F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) }+ l- B6 ?" t8 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 i( ]; e1 s9 X4 z" v% m
  11. *         TO CHANGE.6 A2 M: ~% ~/ N" ~& Z! L
  12. *
    : ^1 g1 l% M! Q) n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 V% r. I) Z2 g0 _
  14. *8 y0 C2 L- e: s. z! o7 V
  15. * This program is free software; you can redistribute it and/or; I7 ?! u5 D; v7 J" o
  16. * modify it under the terms of the GNU General Public License as
    " Q$ k  H; E2 q# F. _
  17. * published by the Free Software Foundation version 2.+ H/ u. n! ]8 ~/ h
  18. *
    3 G7 C8 [+ s: b2 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : h9 j9 q- n) p  R2 {% v
  20. * kind, whether express or implied; without even the implied warranty0 _- C. s3 O$ e  [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 [$ c; @& y& F$ F" N
  22. * GNU General Public License for more details.+ A+ F/ A' m, q+ m. y, M+ D
  23. */7 j9 @; Y3 M: M' m6 M. f. r% [
  24. $ V( _- L# I1 `6 i
  25. #include <linux/module.h>' c! ?  c6 i. ?6 N) F% b
  26. #include <linux/init.h>
    ; w  B3 o4 S) a. x% I8 d6 E
  27. #include <linux/errno.h>
    6 U+ w  {, V) }' C/ \7 V; R
  28. #include <linux/types.h>( ~5 [+ e2 u5 y0 B8 Y* q0 t0 @% C
  29. #include <linux/interrupt.h>
    ) d/ W: e" D( }9 f# P+ y/ U
  30. #include <asm/io.h>
    # |" P- \( }+ y# n- q
  31. #include <linux/moduleparam.h>
      C( A4 Z- I% K7 n/ y
  32. #include <linux/sysctl.h>' Q2 C+ x+ V( d3 [$ E9 E
  33. #include <linux/mm.h>. ~% L+ d+ u% N& B; F8 A
  34. #include <linux/dma-mapping.h>  @0 |0 z" {( c7 @6 L+ _

  35. * K7 A8 O) ~, V/ R2 Y2 t' s9 X/ n
  36. #include <mach/memory.h># x4 h4 i% u- R) x3 [3 H: ^
  37. #include <mach/hardware.h>0 K1 \) U2 ?% y, t% o  w8 ]
  38. #include <mach/irqs.h>
    * M, x/ Y! {5 M2 E2 l% H% Q
  39. #include <asm/hardware/edma.h>% U/ g- q# d( n6 O8 q; H6 ~
  40. 1 X. U9 ^# p7 i" [1 A. d2 N! ~1 v0 @
  41. #undef EDMA3_DEBUG+ G6 a1 I; q$ N" Y0 g) f
  42. /*#define EDMA3_DEBUG*/' u. }1 K8 N: g

  43.   i1 W+ D2 q3 w  s* D" d( c5 Q
  44. #ifdef EDMA3_DEBUG  Z9 Y2 r# W3 L2 N: y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( F& @- {0 u3 X! R& {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 }6 k! r$ r/ z% U8 o* H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), ]+ i7 V; O( E8 c! K. R
  48. #else2 q: e! l! |- x* y" b( v
  49. #define DMA_PRINTK( x... )6 [! a0 o7 N1 i0 ^9 t  C+ d: f
  50. #define DMA_FN_IN
    . G: O6 S$ ?: b( w$ D: ]
  51. #define DMA_FN_OUT! F& Z% U/ m0 G/ H7 G, \) O6 T$ \
  52. #endif0 A1 N- r( k8 M" X0 p6 [
  53. * u: h5 ]* D% ~5 d4 m9 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" S6 V8 ^6 J/ h1 S1 m2 I' L2 r
  55. #define STATIC_SHIFT                3
    ! n& s. d5 N4 ]2 M
  56. #define TCINTEN_SHIFT               20
    , }& M; X/ s' Z3 p/ h' ]: n( |1 o
  57. #define ITCINTEN_SHIFT              21. }  C) V2 C7 U
  58. #define TCCHEN_SHIFT                22& H+ u+ V3 w7 y/ F0 e- ^2 N
  59. #define ITCCHEN_SHIFT               23
    & J: N1 w2 V/ e, H

  60. 4 Z. f- L" `  a' `$ G  Z' q
  61. static volatile int irqraised1 = 0;% p5 Q0 Q1 x3 ]8 t. [  W4 w
  62. static volatile int irqraised2 = 0;
    3 r3 o& p+ a1 n6 Q. c1 j& s2 u1 L
  63. 3 i0 ]$ Z. W4 C) S' s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 Q+ I. s- ?, U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: z+ ^: {8 X5 l1 M$ \0 R. h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # _9 ^9 k" T" G+ j

  67. ' y. _& u1 {% M# B
  68. dma_addr_t dmaphyssrc1 = 0;- W' G) L* e" r. K. k
  69. dma_addr_t dmaphyssrc2 = 0;
    ! r4 e9 {$ L$ V4 |
  70. dma_addr_t dmaphysdest1 = 0;
    ( ]$ t2 \6 X# ]2 s) O6 J  }; i/ U
  71. dma_addr_t dmaphysdest2 = 0;+ [- ~% `% Z. e) e. y

  72. . ^$ T7 D3 F; H6 `
  73. char *dmabufsrc1 = NULL;
    - N; A+ ^3 k, c% G" g9 }
  74. char *dmabufsrc2 = NULL;2 A8 ?3 ?7 w5 f* F% g5 r" ^
  75. char *dmabufdest1 = NULL;
    8 D, @( q. }7 l1 _% q
  76. char *dmabufdest2 = NULL;& }0 d5 F9 a: R
  77. + R7 k" Y0 F& Y; f
  78. static int acnt = 512;: W" p4 B5 m/ d
  79. static int bcnt = 8;
    6 _4 l* g* \( ?4 b- H/ B
  80. static int ccnt = 8;
    9 m! H6 K% t0 Z" a

  81. 0 o7 _+ g5 X& ~; X- z2 p6 A/ D- G
  82. module_param(acnt, int, S_IRUGO);
    , r7 A% ?! _. \9 W
  83. module_param(bcnt, int, S_IRUGO);
    - V( _# C- }. i& k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 U( U" U& K2 K- E
( ~6 a8 U! v! z8 ^8 j5 Y2 q" T& x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 w& Y" v- K! h( Xarm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, ^5 R- |1 Q" w9 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ?5 L, p7 d. ]5 d: k! y( m. n
+ g4 M& v0 ]4 M9 m! C" n8 E, b7 Y( E- i0 y/ Q- g, I. m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2025-11-16 12:20 , Processed in 0.037220 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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