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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 e- N6 C! r# a
  1. [code]EDMA sample test application
    / W0 X1 B. B+ U$ _9 l- V  d; I+ J
  2. /*- D1 K; p& ]( w0 k$ x# A9 p
  3. * edma_test.c
    ! v9 j/ n/ T: u
  4. *4 ]5 c1 N/ _# Y) P  N
  5. * brief  EDMA3 Test Application7 S. |* f. B( @) t4 S
  6. *! o4 S4 m7 T6 f. c1 Q
  7. *   This file contains EDMA3 Test code.
    2 P$ X" N% B1 v! a+ |! v5 Y2 y' \
  8. *
    " d. ]+ K9 @% B+ R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( j+ B' A1 I4 }3 b1 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; ~  ]* ~8 C, N. k  ^) ]) L( [2 |
  11. *         TO CHANGE.
      M2 y/ {% g! a+ V1 r3 q" j
  12. *
    + n5 t3 z' W1 T! U4 I: P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( ]& v4 {+ k5 p4 _2 w
  14. *# p: B, B% @" y# z4 J
  15. * This program is free software; you can redistribute it and/or5 r2 M& M* X# i- G3 Q) L9 P0 B/ P  z
  16. * modify it under the terms of the GNU General Public License as
    2 r3 v% j4 G$ e# f
  17. * published by the Free Software Foundation version 2.' V+ y9 g) v( |; Y: Z
  18. *6 T; F; v+ ?7 n) A. ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 o# n6 c+ G# D8 v* {+ a
  20. * kind, whether express or implied; without even the implied warranty& \9 F$ e% u6 I9 f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 d9 Q8 @" E0 E/ Y, O& S( @! t: C
  22. * GNU General Public License for more details.
    # y: m2 k1 M. I0 T: H# X
  23. *// }& D( U7 z3 N! U6 y8 N) b+ Y
  24. ( S2 o3 m9 I% ?7 T9 {1 A, s
  25. #include <linux/module.h>8 M& e3 |" Y5 `
  26. #include <linux/init.h>
    - _3 ]4 y+ R0 l. c4 L
  27. #include <linux/errno.h>
    # X' k, {3 L! N; k% Q$ R
  28. #include <linux/types.h>+ N) J0 B6 A7 L! U0 n# d/ j7 L
  29. #include <linux/interrupt.h>
    , `& d/ Q0 Z) i. r
  30. #include <asm/io.h>
    * U' ~& c/ K( f4 ~. C4 B! g
  31. #include <linux/moduleparam.h>$ e, W8 l- N, J, Q
  32. #include <linux/sysctl.h>
    $ _  L* t- q: u+ d1 D
  33. #include <linux/mm.h>
      l! |& I: E0 V7 U: N& b
  34. #include <linux/dma-mapping.h>
    + J* ^$ l) o0 m3 n& s6 N
  35. % g% F- g+ ~! m1 ~1 ?4 f# e
  36. #include <mach/memory.h>
    1 {% Y- i6 f  y  ^
  37. #include <mach/hardware.h>
    . k& T6 X5 i; r- {7 t2 g+ }
  38. #include <mach/irqs.h>
    # [& B" l9 j) D5 A- c7 B% y9 ]# _
  39. #include <asm/hardware/edma.h>2 @" {: U5 J& F

  40. 2 G! n& k/ L) }2 ]+ D7 n2 d& o
  41. #undef EDMA3_DEBUG0 g/ N& I- L- R" L4 J4 n
  42. /*#define EDMA3_DEBUG*/$ [' U) r# E2 ~. g7 l
  43. - A* Z* l# e/ t( I+ O
  44. #ifdef EDMA3_DEBUG
    ) Q( p  o  h8 u! N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). W' ?: N( b. l5 D/ {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  M8 [, N/ d" X2 L# E8 A' u4 S3 x2 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- U7 ~+ _9 C/ ?6 p& ^  o! M
  48. #else; K: ]9 Z4 o% m0 Y: D5 U& u
  49. #define DMA_PRINTK( x... )+ Z* |8 ~* e: |0 f4 ^% Y" A
  50. #define DMA_FN_IN
    ' Z) V( ~1 k9 k
  51. #define DMA_FN_OUT
    4 `; F* r( P% H: F& Y
  52. #endif' U  N5 G  M4 b# v" w. e$ w1 Q& M9 k
  53. ! r1 W2 D" f, i% {$ p: a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). y2 b( M2 N$ R. e  X+ \2 `) |
  55. #define STATIC_SHIFT                3
    " _, z% E( }7 ~4 A
  56. #define TCINTEN_SHIFT               204 ]! w% n5 T) {& |, v
  57. #define ITCINTEN_SHIFT              216 z7 _- m7 g+ o# U( l* U2 H
  58. #define TCCHEN_SHIFT                22
    $ C: H# F2 Y; v. }+ V' w. n& G
  59. #define ITCCHEN_SHIFT               23
    + R$ w' y( O# P3 ]/ A3 p

  60.   x/ s2 O3 U2 @8 A* D% K
  61. static volatile int irqraised1 = 0;
    7 C& X; |+ k) A- v2 k
  62. static volatile int irqraised2 = 0;
    : V: K1 l' c$ Q2 o7 }0 B( u+ a
  63. : s/ W% W1 T; U) l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 r; K* n- e6 I* _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: _0 H, R7 q/ z3 |. Z) W& l' s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 y( V; q: v4 t6 ]8 v# S1 E

  67. 7 q$ n+ E9 b+ m, X1 X
  68. dma_addr_t dmaphyssrc1 = 0;
    ) Q2 R4 U, r" N* D: M3 z- w$ m3 o
  69. dma_addr_t dmaphyssrc2 = 0;
      x  ~- O" V+ i+ `
  70. dma_addr_t dmaphysdest1 = 0;5 _: d; G- s6 U7 Q" o" c0 v
  71. dma_addr_t dmaphysdest2 = 0;* y' Y- S# [/ i3 O$ X' c
  72. 3 G/ W, ^# ?3 ]4 f. j  l
  73. char *dmabufsrc1 = NULL;1 a4 l) \# \6 m9 q9 N0 ?
  74. char *dmabufsrc2 = NULL;( P1 y3 i" Q9 P9 d4 k, Y9 k
  75. char *dmabufdest1 = NULL;
    ' {8 M: s+ B0 m3 Y, z* Z* h
  76. char *dmabufdest2 = NULL;. A/ e7 \! ^6 V5 {/ ?& h! ~5 M

  77. . x- D4 y/ f0 ]/ G0 v: ~; N
  78. static int acnt = 512;/ h4 Q9 u8 T& Y7 X  G
  79. static int bcnt = 8;
      Q: t- D$ m1 t+ d! c* L
  80. static int ccnt = 8;
    / N9 z+ c: h! P' [5 E8 w
  81. ! L: s" R9 e! A5 h9 c4 S( |, p: E
  82. module_param(acnt, int, S_IRUGO);
    . J' @( r& b9 q
  83. module_param(bcnt, int, S_IRUGO);
    , M  t8 G* }' E1 {6 Y! Z5 x* \/ [5 n" V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 J2 f7 X( _- s+ c$ |- F: m2 S( r) k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: v( j- x& g+ V& y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; }: s* Q8 p# E! J- c* u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) l) ]0 X" @' {, i' {8 ]! j
8 F% i; J2 j0 j1 d5 @9 B  ~# D$ [
- I: F) E! u5 m7 |: n% J) s* ?) i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 16:19 , Processed in 0.041123 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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