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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 m# O. ]& Q( \3 c+ T$ z. a. F
  1. [code]EDMA sample test application
    ) M$ D" ?$ X$ n% }
  2. /*
    0 [+ n+ S% B* I' B
  3. * edma_test.c
    0 N) `% r3 E; x. a( k, X
  4. *
    4 L4 @7 D) r8 _. ?5 k/ K. f
  5. * brief  EDMA3 Test Application7 a2 O9 F, d2 @
  6. *& a, Y' H* p1 h! j  l
  7. *   This file contains EDMA3 Test code.
    6 c' Q6 v3 R5 w/ t
  8. *
    $ h% b1 i# w% J, Y6 J& G2 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 Y9 [; g! v1 D1 `: r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! k8 G6 U* s$ o' J" U) t: V/ d. ~
  11. *         TO CHANGE.
    # }" u, P9 D4 p& J# `, W
  12. *
    . @2 k# D! z" b& g/ J$ `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 \+ q: Y; }- V/ I
  14. *
    8 h* w2 j% n& c
  15. * This program is free software; you can redistribute it and/or5 ^" r: A" h4 A1 ^) N( C
  16. * modify it under the terms of the GNU General Public License as
    % D5 g0 J6 n8 k0 B! p9 ]
  17. * published by the Free Software Foundation version 2.
    ; ]0 ]" R0 h5 x2 u- d- v3 n# B3 Z
  18. *
    - g7 m" ?0 V; ~2 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & g' L5 \6 h9 L/ l" Y0 d3 O) F
  20. * kind, whether express or implied; without even the implied warranty/ f5 z0 k* @- m5 I7 G9 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  n3 Y5 c: W' E- m, L
  22. * GNU General Public License for more details.7 O5 q+ c7 B, ^* V/ s2 o7 d
  23. */9 Q: n9 |; K! t2 ^
  24. 5 ?& |& a* F7 K8 J
  25. #include <linux/module.h>
    9 ~- s) t4 q+ B3 G8 I$ F# I. S" n( y
  26. #include <linux/init.h>
    % x! `6 z( D+ S3 n5 r0 ?! S9 J3 k
  27. #include <linux/errno.h>: S5 e8 s, N" r; U2 m) W
  28. #include <linux/types.h>
    2 O3 v4 ~9 p1 Y; {- o
  29. #include <linux/interrupt.h>/ a5 k5 g- W8 m# ]5 @
  30. #include <asm/io.h>8 {; v, F7 J. E8 y/ n$ @- c" H
  31. #include <linux/moduleparam.h>% [4 e; t% k- o$ b
  32. #include <linux/sysctl.h>; u1 f, X$ D% O$ \5 `
  33. #include <linux/mm.h>: s  [- `5 }* p$ V! E7 I0 T
  34. #include <linux/dma-mapping.h>  M7 k0 _+ i- A" N/ [( F! Y$ Q  f3 {5 g
  35.   K5 k! W" ?, l7 H& L" B
  36. #include <mach/memory.h>! T: b6 y+ ]9 K5 H; G, e
  37. #include <mach/hardware.h>* [: F5 M7 y( T* s2 F, `1 h
  38. #include <mach/irqs.h>
    4 i* T8 N% R5 R& F
  39. #include <asm/hardware/edma.h>
    $ S$ |1 I0 F1 ]# \

  40. : I' E) n2 i9 R; u, ~6 {
  41. #undef EDMA3_DEBUG7 @4 C" c/ I+ ?1 p
  42. /*#define EDMA3_DEBUG*/
    " S- w  W- T" X% V; [( t. \/ X

  43. . q4 O5 m- A2 L8 a9 Y$ [, A! Y
  44. #ifdef EDMA3_DEBUG
    . |' p; e  s( i' s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! R) @# ~7 R0 h. ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & K; @" ?6 G- n0 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), u# y/ }, ~5 x
  48. #else
    4 [. M+ N1 c, }) d9 [- b5 d
  49. #define DMA_PRINTK( x... )
    , `/ s0 n2 S+ B$ a# f& f0 c& M* A7 \
  50. #define DMA_FN_IN
    # m, h% W" w8 W7 h: E' Y6 u
  51. #define DMA_FN_OUT
    0 n, t2 [. A+ m0 e. [
  52. #endif% z3 w& B. d/ }' _
  53. 1 y8 k' j- T! D% t2 h- s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! b" Z! R/ w& @% \2 t: p8 e
  55. #define STATIC_SHIFT                3
    1 C9 }' @3 W, u5 f0 b3 V
  56. #define TCINTEN_SHIFT               20
    + _( `. ]& n) A- g3 W; ^
  57. #define ITCINTEN_SHIFT              21
    4 {' W( O1 z" T  G
  58. #define TCCHEN_SHIFT                22
    4 z$ F8 _- E8 u/ z1 W
  59. #define ITCCHEN_SHIFT               23
    6 X/ b7 z) d0 z# o
  60. 7 u/ u$ o2 S, n& h7 c+ _
  61. static volatile int irqraised1 = 0;
    + s4 {/ N; `! k5 ]
  62. static volatile int irqraised2 = 0;+ k' P- F: Z' S0 X2 _8 h: `

  63. & \- h, I, Z: M# b/ N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) v9 a2 s) u$ Z2 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' P+ f1 T* l& d' \1 }% V7 V2 J( \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ?! n% O5 V4 G. B7 Y

  67. , Q! O; U& P% n; q0 D
  68. dma_addr_t dmaphyssrc1 = 0;* V+ i3 _/ X! V
  69. dma_addr_t dmaphyssrc2 = 0;
    3 A7 x# I& V" \6 A
  70. dma_addr_t dmaphysdest1 = 0;
      T, x# J0 j  H" ~: e
  71. dma_addr_t dmaphysdest2 = 0;+ p4 j1 s/ B% D6 n" R+ n
  72. 5 X; Q$ U# h1 P$ d4 N& b
  73. char *dmabufsrc1 = NULL;, c$ m+ s" ]0 n4 N
  74. char *dmabufsrc2 = NULL;, ~( l$ U: h6 D" J
  75. char *dmabufdest1 = NULL;
    # V# r7 f% Q+ T, ?% A
  76. char *dmabufdest2 = NULL;
    & p% q. @1 O8 J5 F1 I4 Y& }

  77. ' O6 o& W5 @4 ?
  78. static int acnt = 512;
    ) H9 u+ Y9 t3 u8 n6 d1 i
  79. static int bcnt = 8;
    5 [! w' J, K, R
  80. static int ccnt = 8;
    ) z) e7 n: k7 K& |

  81.   x- s- p) A4 o( \6 E
  82. module_param(acnt, int, S_IRUGO);
    6 f, t1 u# `! @
  83. module_param(bcnt, int, S_IRUGO);- n# ?* E, [5 X5 C- J8 g% z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: j" T& B. F8 P0 N! y- h: o- N8 c5 ~# T1 g! V5 h, \5 G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) S6 {/ C) f$ k" barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 M: m* ~5 |' \  L  ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 i5 b9 L* h/ n
5 U2 W( S4 ~- @$ O
, c5 M$ z* W# Y6 J; u+ v5 q' ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 15:12 , Processed in 0.039371 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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