OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 k7 o9 Y/ Z! g; W- s, T( S
  1. [code]EDMA sample test application/ R- T7 n0 M; Q5 _6 r
  2. /*; Z( n% F8 d4 ?) l% j
  3. * edma_test.c: u! g: y7 E4 P& V
  4. *
    4 m& D+ p1 p3 m1 g) w% ]
  5. * brief  EDMA3 Test Application
    6 `+ m2 ^- E  d; M7 C/ o; k
  6. *6 L" C6 c4 Y/ {: W, m
  7. *   This file contains EDMA3 Test code.* H3 F5 L* N& \# o& u9 {- ^: {
  8. *
    + }; o& Z2 ]9 V8 t3 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      Q6 m( \6 d8 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 x( n5 \  B) P8 A; q  ]; G
  11. *         TO CHANGE.* c6 ?" ]6 _/ M
  12. *5 Q- Q( `4 H/ V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 J% \4 I' t; `  B( p+ Z; j2 e
  14. *
    ) k/ n& Y. j- n+ |8 f4 Y( Z, T
  15. * This program is free software; you can redistribute it and/or+ i/ V3 a' n* i
  16. * modify it under the terms of the GNU General Public License as$ W1 T7 i2 P$ m' `  }0 Q8 l; U4 v- f$ B
  17. * published by the Free Software Foundation version 2.
    ; l. Y2 ~- W+ }( q1 @! w2 H
  18. *
    3 L/ A; `7 d5 }9 d9 `- N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 S5 Y! o  y6 M/ d* x) s0 o3 O
  20. * kind, whether express or implied; without even the implied warranty# R$ Z* [; Y( m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & j( `% K$ b- e8 D9 @  w
  22. * GNU General Public License for more details.8 ~5 {) b+ B- w1 {) m* a
  23. */! b2 J8 X* d0 K
  24. " y; p. z1 a3 S
  25. #include <linux/module.h>
    - h- d( h3 l! P* |$ F% N
  26. #include <linux/init.h>
    # p  Z  z( E- s: N5 l1 l( @7 R
  27. #include <linux/errno.h>3 z3 H8 n) N' Y. y
  28. #include <linux/types.h>
    0 G$ B0 [6 N& W9 q! l
  29. #include <linux/interrupt.h>, O: P/ N; A! \1 F
  30. #include <asm/io.h>
    : D8 ]' y% D' T3 D
  31. #include <linux/moduleparam.h>
    ( A+ ]+ ~% n& ]! w
  32. #include <linux/sysctl.h>, `# s& l) C) z$ a& O
  33. #include <linux/mm.h>
      {$ j) D9 L. x* D/ m7 R
  34. #include <linux/dma-mapping.h># J' N5 m3 b6 ?/ K& K

  35. $ H' z1 o! B7 n6 d8 J
  36. #include <mach/memory.h>
    ! W' L( o( U: E4 A# `- Z( W
  37. #include <mach/hardware.h>
    6 [9 M: w. n4 J% P% O& Q
  38. #include <mach/irqs.h>
    ( N  `5 q$ K  p) g
  39. #include <asm/hardware/edma.h>8 O. I4 G$ Y$ W# N3 a3 Y. D3 ]
  40. ) `& s. s% J- G" T$ f* c! r7 g& C
  41. #undef EDMA3_DEBUG
    1 Q6 m6 g) ?: t4 D+ s& a
  42. /*#define EDMA3_DEBUG*/
    5 |+ K% i- h) v  |3 ^, _

  43. 9 Y1 Z4 E- R5 G+ p0 B
  44. #ifdef EDMA3_DEBUG
    4 Y# i1 c) f+ C# C" m- G% k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 u) C9 F) O7 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! n) {! D) s3 A( E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# a0 i( o* Z' N0 s, @( [$ B' r" d- R
  48. #else
    ; V8 P1 }% f! M; F
  49. #define DMA_PRINTK( x... )
    ; X+ L1 a3 \3 h8 {; \
  50. #define DMA_FN_IN
    2 k: p9 x; |9 m' X6 s9 s
  51. #define DMA_FN_OUT
    1 m; M" U# G/ ^
  52. #endif5 ~& U7 q3 b3 f  B

  53. 9 x9 R. ]9 N  v+ ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# W3 J7 N9 M4 f6 A% \3 ^
  55. #define STATIC_SHIFT                32 f" e5 a& o% x: h' g
  56. #define TCINTEN_SHIFT               204 }# B. q1 q7 f) f6 h2 h
  57. #define ITCINTEN_SHIFT              21
    - k# D: n2 j4 C/ m
  58. #define TCCHEN_SHIFT                22% C7 S( G' S4 S+ |) ~1 }& M* V
  59. #define ITCCHEN_SHIFT               23' E, h6 r# w( x4 C
  60. 4 e2 t' V& D; ]. ]$ ?/ g
  61. static volatile int irqraised1 = 0;
    : Y) _& k. m7 i/ G* k8 F& m- Y8 y
  62. static volatile int irqraised2 = 0;6 a& r8 Z! @" u! ^- B% z/ p

  63. , H% Q1 v1 j! B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % H6 {4 Q" C' q0 K+ g* M! E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 g4 s$ b3 c0 d, R$ L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 ^% e* h; d7 p1 G
  67. $ p# H' Y+ j2 u, E# \/ w( Z% e1 P! P8 A5 C
  68. dma_addr_t dmaphyssrc1 = 0;
    & q  q4 {( ]. h6 Q
  69. dma_addr_t dmaphyssrc2 = 0;: }- J& a# W* q3 O1 _! J8 i; _
  70. dma_addr_t dmaphysdest1 = 0;* Z$ [/ E( ]$ h" H8 t
  71. dma_addr_t dmaphysdest2 = 0;
    / V* V3 v  E! e* c" v
  72. 6 x* H2 @! K& C; h7 b
  73. char *dmabufsrc1 = NULL;
    $ ?* C: c4 `% J
  74. char *dmabufsrc2 = NULL;! t9 }/ o0 X8 a7 y6 K/ x2 p( S
  75. char *dmabufdest1 = NULL;$ e: A3 {+ f. |7 E# z8 G9 H9 V
  76. char *dmabufdest2 = NULL;2 [; P, P# X# E, O/ o

  77. / a4 r: D- ]) J* S! V8 v
  78. static int acnt = 512;
    5 m( U' j  Y# \1 w$ ?
  79. static int bcnt = 8;
    ; ?- V$ A7 e+ }' j) X* L7 z
  80. static int ccnt = 8;3 t1 @9 F7 }* p9 l/ O6 Y  I% }
  81. , q) b" H$ P, x  W! R' N6 N
  82. module_param(acnt, int, S_IRUGO);1 V/ S5 m, b6 L" E; Y
  83. module_param(bcnt, int, S_IRUGO);7 v( t  p2 |. h7 A  a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ D' D" m6 T$ J: H2 P- _2 D

0 I4 b/ |$ y1 @5 B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: f: ]+ z/ D2 P
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, J. R8 m  v* ?& H% K+ q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  _2 Z  m( M9 P( }

! y/ j* \1 h) x! Q/ _" o& Q: B: _6 e8 j: o- O4 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-2-26 02:24 , Processed in 0.039041 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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