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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. i- v5 G/ W: X/ j1 L% L* @
  1. [code]EDMA sample test application) I9 o/ J3 _2 B
  2. /*
    3 ]) e4 \* t* F) X: B4 d
  3. * edma_test.c
    % g2 q9 S! z2 a
  4. *
    ) z+ U7 D+ w; l
  5. * brief  EDMA3 Test Application
    * f: f0 b/ P7 E
  6. *
    2 V# Y0 e$ q2 l" |
  7. *   This file contains EDMA3 Test code.8 T& o; M$ V. x3 Q, k. }
  8. *8 e* T- j/ Q4 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. d7 c$ F. B6 s; k$ v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. }' Q0 h. S, c
  11. *         TO CHANGE.
    - _! U! V4 G/ A- z3 {+ B% q6 N
  12. *
    : [1 o. c$ o* P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) z* U; T* X# w7 {2 O% i
  14. *9 G& o$ U/ W' x! A
  15. * This program is free software; you can redistribute it and/or: t* z: ]0 A0 S4 R7 v( Z% M. T
  16. * modify it under the terms of the GNU General Public License as9 _% L; q$ i0 |6 t$ u
  17. * published by the Free Software Foundation version 2.) Q% e# b. f  `3 R
  18. *! d+ U1 e$ P7 ~4 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: {  h. v$ r" z1 e* F) {
  20. * kind, whether express or implied; without even the implied warranty
      w% r7 `  u& ^, V& s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, a& _, P; c; Y+ i
  22. * GNU General Public License for more details.$ O% [8 V: v2 \% i* n  i/ n1 Z; N( k- L
  23. */
    9 G: l' \& Z3 ?. F; Q; @- a# p3 h% x: ^

  24. $ l! B7 v9 B# V1 s: |5 n" m
  25. #include <linux/module.h>
    , w2 A- C2 c/ I
  26. #include <linux/init.h>" q+ x4 O; I+ U
  27. #include <linux/errno.h>
    3 q7 Z* g0 E5 ~. N+ r! h
  28. #include <linux/types.h>: s0 R/ l% E) a0 `, r
  29. #include <linux/interrupt.h>/ d$ G2 S$ ^0 n: Y: G
  30. #include <asm/io.h>$ L, Y! [1 H/ u& Q6 l
  31. #include <linux/moduleparam.h>/ W) h1 h3 c5 D; P2 O- `; r
  32. #include <linux/sysctl.h># e! ^7 |: D$ _, m2 J
  33. #include <linux/mm.h>
    + |/ t; N! o1 R* ~1 U/ W
  34. #include <linux/dma-mapping.h>
    1 C# A3 c/ P0 _) q/ {% `

  35. 4 u) `  |* l( g2 b! M& n
  36. #include <mach/memory.h>
    ; Q7 X" ?, m  r# L1 Q
  37. #include <mach/hardware.h>$ u- {6 g8 P# I1 Q& n) n# W
  38. #include <mach/irqs.h>$ b' N% \' f4 ^! a( m
  39. #include <asm/hardware/edma.h>
    7 x* `6 I8 B0 ~/ @$ S0 B2 @& b5 Q- w: f% A

  40. + [  y4 E8 D! B4 {# i& ^- U
  41. #undef EDMA3_DEBUG
    , ?  T- S9 [& X5 B, |0 t, x
  42. /*#define EDMA3_DEBUG*/
    6 t# x/ f! i* }/ {8 s% a* A

  43. ) U  q: e# g  v7 l
  44. #ifdef EDMA3_DEBUG! C7 E- X3 H% ]" _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' v8 O0 u+ s0 J4 S5 i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), q1 S# i4 ^; E8 q3 N9 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 W) g6 b7 `' \$ S
  48. #else* I6 c  h# f% i* V, u9 R" u
  49. #define DMA_PRINTK( x... )2 ~- S+ Y' ^5 o! a3 j; s9 p, [% y  b
  50. #define DMA_FN_IN
    * p0 ]# t; @& Y/ x$ D6 u3 `7 V8 c; N
  51. #define DMA_FN_OUT  H% Q. z" F/ [6 @( m
  52. #endif2 }) q% g0 A0 f2 t6 F' N* c7 e
  53. ; n3 Z5 E' n# B1 F3 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ n/ L: N6 O2 S9 i6 W: d
  55. #define STATIC_SHIFT                3. I; q3 n; L$ V6 {5 i: R- F
  56. #define TCINTEN_SHIFT               20  s' G  Q4 u# n- i5 E: Y, b* U
  57. #define ITCINTEN_SHIFT              21
    ( [. r" m. [1 }4 D  v
  58. #define TCCHEN_SHIFT                22* |9 X1 u8 W4 v* A6 p3 Z
  59. #define ITCCHEN_SHIFT               23. E* I) \! y" c* E

  60. ) @8 ?9 Q; I( O# x0 y
  61. static volatile int irqraised1 = 0;
    + [- i! G9 r2 |4 ?6 \
  62. static volatile int irqraised2 = 0;* ?! V0 G# H6 ]: N! I
  63. ) y. P4 W7 b" N4 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - v+ e* x0 d6 u( ~# `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) P  Q8 N: s  |: z4 D! l7 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 L% w. U, m/ x/ a5 v
  67. 5 a' V: r+ L: w3 Y
  68. dma_addr_t dmaphyssrc1 = 0;! v3 Z- H( z' C( `5 f
  69. dma_addr_t dmaphyssrc2 = 0;; C8 x  ]3 b9 l1 G% L5 x% ?
  70. dma_addr_t dmaphysdest1 = 0;
      X) H# h0 V9 L9 _
  71. dma_addr_t dmaphysdest2 = 0;
    / @$ t- w0 p# ?% N0 ^3 B  U4 ^3 ~/ g4 ]
  72. : M* W2 w5 B8 u# P& M$ K
  73. char *dmabufsrc1 = NULL;
    # J: |, D4 d* G+ [
  74. char *dmabufsrc2 = NULL;; `( F! F- y0 z# f
  75. char *dmabufdest1 = NULL;
    $ c  I4 I8 ]. A4 \% I
  76. char *dmabufdest2 = NULL;
    ) g9 s) P2 l2 L$ J% r% j0 g. {
  77. 1 o1 `# S" h4 x1 J, {
  78. static int acnt = 512;( H. M/ V/ L0 M) ]. _1 z
  79. static int bcnt = 8;& O; H0 A: Q4 h3 H8 X3 R2 C+ A0 J
  80. static int ccnt = 8;
    7 K, L) Y( [6 Z; L0 g' N5 ]3 U/ I
  81.   P* a  t) E% t/ n, K1 q
  82. module_param(acnt, int, S_IRUGO);
    * d. _7 J8 s% B$ |4 c
  83. module_param(bcnt, int, S_IRUGO);. Z1 }/ D+ L- q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 O$ K# E% X( t0 q, t% s. l$ u2 }$ k/ P) M; M' G+ Z* ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 N8 A. ], b$ J# P; \7 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 R; p% |6 m1 h/ a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ^5 r/ Z) Y; h. O
5 D% G' d" l$ g- f( P, s  i
' k  {" C2 I3 N; D6 d: p+ V- d. ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 16:52 , Processed in 0.040251 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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