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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # K9 I' Y. m( \8 g, {
  1. [code]EDMA sample test application& \, e9 H3 R1 |3 F, S% [
  2. /*
    % `5 F% L7 C2 Y9 \
  3. * edma_test.c: @! ^# m; q, r  w$ v
  4. *3 h. g1 y0 Y: R# i( G
  5. * brief  EDMA3 Test Application/ O/ m& }1 }9 X; g- t5 X; {
  6. *
    ; J0 P0 s) {6 i- m
  7. *   This file contains EDMA3 Test code.
    , J6 |" }0 E8 J. J. k" f8 ]' j1 v" g
  8. *. Y% G! n$ Z9 ]3 ?: Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 h: F6 a+ I! s6 r9 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , S  \5 L1 B/ e$ x
  11. *         TO CHANGE.' s, x- A+ G" v) ]1 Y& H' H
  12. *
    . [4 Q% W( g6 j  U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 n) L. O8 f1 U5 d* m9 k8 f7 y! P
  14. *6 n7 d  |' g& t  u) G
  15. * This program is free software; you can redistribute it and/or$ n. d: J0 @+ ^8 r. b6 b- N; z
  16. * modify it under the terms of the GNU General Public License as: U4 |) D# y1 g
  17. * published by the Free Software Foundation version 2.0 N5 A+ v  j! X8 {: m0 |' y5 [
  18. *+ `7 u" t) C: |2 \. `# N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 a: o3 Q7 k1 _( i6 O7 W1 [. U
  20. * kind, whether express or implied; without even the implied warranty# E6 n2 i/ `& @  t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 f" t  Y9 C1 ?. J/ L( W6 K  V
  22. * GNU General Public License for more details.
    2 I% d" z8 C. W! H2 ~
  23. */, {4 C5 A9 `8 b/ s/ M, Q

  24. 9 j1 p( L" T/ n8 C& n
  25. #include <linux/module.h>' l  F9 b4 W. p% j0 Y
  26. #include <linux/init.h>
    1 w/ p! M$ R) g. Q9 [& g
  27. #include <linux/errno.h>
    2 O& }7 ~# |" g/ ~7 ^4 h. ^3 l
  28. #include <linux/types.h>
    7 Q) U$ \. K" F
  29. #include <linux/interrupt.h>
    " C1 w2 F  P4 [7 \8 Z1 b, o
  30. #include <asm/io.h>5 s" ]" t2 m* T6 m/ A! u0 Z( P4 h! E
  31. #include <linux/moduleparam.h>3 v  J6 P$ u6 E! ]( h
  32. #include <linux/sysctl.h>
    3 m0 V" {( Q1 b" A0 n, R
  33. #include <linux/mm.h>
    ! f0 ?1 b7 a" w+ v7 I0 Z
  34. #include <linux/dma-mapping.h>
    8 D! G/ v) F2 S2 A6 ^- r
  35. 9 s' U) U6 s6 N
  36. #include <mach/memory.h>
      }2 L- h0 U$ E& j
  37. #include <mach/hardware.h>
    ' l. i( [5 i. @6 ]" J0 D
  38. #include <mach/irqs.h>8 u- G7 I' ^- ~! B4 R+ |
  39. #include <asm/hardware/edma.h>, U% Y% C2 s1 ~8 D* y0 E1 V9 ]

  40. & X9 l' C- H* v$ t
  41. #undef EDMA3_DEBUG1 k4 t7 p! [+ ]) w* w
  42. /*#define EDMA3_DEBUG*/, G, ^% W7 H4 k+ t

  43. ( w6 Z; z  a3 f+ Y& Q  _
  44. #ifdef EDMA3_DEBUG
    & I7 V& V! J6 g$ l# Q5 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# I. h" A& t! L) S6 }; Y1 M) |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! l6 E. m8 E' }* v. u# e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 R7 C: B( k6 h7 T
  48. #else
    6 X$ }  R. X( c  X3 Q+ X, Z1 p- l
  49. #define DMA_PRINTK( x... )
    / \, ]1 x6 @% r1 G
  50. #define DMA_FN_IN
    ' Z. o+ G8 q  h" |
  51. #define DMA_FN_OUT
    % s4 _! F0 h5 f$ J7 }- D
  52. #endif2 \/ v' D. s$ s( Z6 K$ j% `

  53. ( V) }( }6 l& F* n( Z4 Q) n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) B9 L* B& _' @' z
  55. #define STATIC_SHIFT                31 }$ i+ j- @1 y; ^3 K" j
  56. #define TCINTEN_SHIFT               20  j* n& E2 c0 G! f
  57. #define ITCINTEN_SHIFT              21
    - h9 ]  G% l7 D8 y1 N/ |$ y
  58. #define TCCHEN_SHIFT                227 ?* z' x2 V3 L9 C
  59. #define ITCCHEN_SHIFT               238 v: N1 ?9 Z) p6 E+ K( K
  60. ( o) s% F. c. W& ?
  61. static volatile int irqraised1 = 0;
    * W% ~3 x- \% {. }- Y: B
  62. static volatile int irqraised2 = 0;
    $ P8 M/ `0 V6 r1 N" P: }) ~- y

  63. 2 Z' D& L8 R# U: k+ y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  N7 A+ P7 L% ?, V0 _, l, X( ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 j( q2 s3 K+ Z( z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 S0 u3 z' H8 v6 j

  67. 8 K3 n/ x! _! ~' G' W
  68. dma_addr_t dmaphyssrc1 = 0;3 H6 `+ `# A4 `# \! J: u
  69. dma_addr_t dmaphyssrc2 = 0;
    $ D0 C: F; p* Y: Q
  70. dma_addr_t dmaphysdest1 = 0;' L' N1 H: u1 n: A) \6 G: N
  71. dma_addr_t dmaphysdest2 = 0;
    4 d% C' t9 E9 B) E2 g& ?: k
  72. / H' F& m5 O3 f0 t5 h0 W
  73. char *dmabufsrc1 = NULL;) _! }: Q2 n$ i4 s4 y( N
  74. char *dmabufsrc2 = NULL;
    9 d+ y) ?; r: O0 z7 o2 S. R
  75. char *dmabufdest1 = NULL;1 z7 u, g, d2 {+ z5 S
  76. char *dmabufdest2 = NULL;
    7 M7 x" t9 `3 u( S! v

  77. & }$ v3 y1 j9 e& k" ]" _: q# l4 I
  78. static int acnt = 512;# Q2 S0 X8 k- a& J
  79. static int bcnt = 8;0 i9 ?9 B" l( x% v
  80. static int ccnt = 8;
    7 g* `( L$ v+ }" `: q
  81. * z9 w8 r" O/ C: @0 ?
  82. module_param(acnt, int, S_IRUGO);1 `& F( m6 E# s. o' e
  83. module_param(bcnt, int, S_IRUGO);
    " C5 {0 k6 `! h% l  ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) E$ R; P! s. e: i; ~8 p. R8 Q& ^
$ N$ l) T0 V; _) \+ v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 \, @: B9 c; J4 P2 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 D8 L) b. r0 i, P0 v- S  w9 \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 ~7 Z6 D  G" F0 ]5 U

; u5 ]  A& _6 R6 d  _) R
4 W3 w' T: l8 Q' j7 y. i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 08:58 , Processed in 0.040331 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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