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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 _- Q" Q- T0 d% c# L
  1. [code]EDMA sample test application
    6 C* l$ N$ W4 T+ W
  2. /*
    1 O0 w! U! m& V  L' K
  3. * edma_test.c/ {! {( z% \. s3 N; A3 E, m8 Y8 O
  4. *
    ) N. x' Y' y- K; G4 H/ p
  5. * brief  EDMA3 Test Application- K( l4 }9 X' C" o
  6. *
    % [8 {/ M6 v* i' E& \8 k1 G, r
  7. *   This file contains EDMA3 Test code.$ C, n5 _. q; P0 a& A
  8. *
    2 D+ p3 R- ]' U. ]( h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 b6 M8 j, @* x' N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 m7 F8 E0 x% v1 ]$ b, g/ w  V
  11. *         TO CHANGE.
    # I: z5 r( i  Z: e/ i
  12. *
    8 U8 Q% C/ A$ f% x7 I- m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & H' e" ?8 |/ g3 p
  14. *( p$ ^: ~8 k; ?' ^  |+ X3 f6 a/ N
  15. * This program is free software; you can redistribute it and/or4 }5 a1 z7 g4 P3 C% X) b
  16. * modify it under the terms of the GNU General Public License as+ V& O9 [% l5 T* o* f! ?( `  y
  17. * published by the Free Software Foundation version 2.& f7 p; H" L& I* @
  18. *
    , g% [2 F9 \# K' z& I; D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 K" a) Q1 M# G0 g( i1 M
  20. * kind, whether express or implied; without even the implied warranty* K- ?& l5 X- r- W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ q" P6 S: S+ Z! V% i2 B
  22. * GNU General Public License for more details.
    4 P8 M+ U. o6 l( S3 D9 l
  23. */
    2 ^6 ?' @6 |: a1 Q: z

  24. / L' i3 n3 n0 C0 K
  25. #include <linux/module.h>% _$ i$ N5 ~0 g% t% L# e
  26. #include <linux/init.h>
    + B! l. @! F2 @, s  i1 x
  27. #include <linux/errno.h>
    / I( K5 r9 [& U8 U# m
  28. #include <linux/types.h>
    / F! q, y: y7 p% i: t# N" Z
  29. #include <linux/interrupt.h>
      N+ |! \; E1 g) V& O
  30. #include <asm/io.h>
    ) M# z2 m: P3 y1 _& \( U. a
  31. #include <linux/moduleparam.h>
    ) _1 O* X8 K* R9 z. u  d4 l/ a* t% q; r
  32. #include <linux/sysctl.h>/ {; `! U) ]- n/ X! c) S' ~7 }) X) @
  33. #include <linux/mm.h>
    4 Q' C9 F' E/ G2 O9 s4 d& M9 \
  34. #include <linux/dma-mapping.h>
    8 B  G" d4 B$ e* K: S- L
  35. ! I8 C2 w0 g% p4 X3 b
  36. #include <mach/memory.h>4 G; F6 s3 ~! R# \* W/ N
  37. #include <mach/hardware.h>
    1 h2 B3 B/ _, M2 g
  38. #include <mach/irqs.h>& x0 {! u' t7 X! C2 V0 N
  39. #include <asm/hardware/edma.h>
    : k8 B9 Q5 [8 c
  40. 4 e7 Z* w( o7 g5 \* w
  41. #undef EDMA3_DEBUG% C. y; U6 u1 @# L; B  f
  42. /*#define EDMA3_DEBUG*/
    1 X& @6 B% v6 U) H% l
  43. 8 g' @2 b! v9 `4 Q3 P. \0 K
  44. #ifdef EDMA3_DEBUG
    % r) C$ X& C( C* D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ F- R  d# Q6 W! x0 @6 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . N2 o7 `' ^* [% @5 a4 U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 l! T3 V+ l0 U/ v# Z5 J
  48. #else' k; O  H3 c5 {& S2 ]6 Q
  49. #define DMA_PRINTK( x... )
    * d9 p5 b: j' |6 `% j8 A# i% A
  50. #define DMA_FN_IN% `7 `! Q, H. ^5 i' _0 A/ E
  51. #define DMA_FN_OUT" n6 J- T4 z" Z! M0 U
  52. #endif0 S8 }. V# E  J  Z5 L2 q
  53. 9 N8 ]6 p' |: D% S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " F. m$ E. d+ f6 T3 h9 T
  55. #define STATIC_SHIFT                3" a4 b, e: {: o5 \) y: J' G9 ^1 Q, A
  56. #define TCINTEN_SHIFT               20
    3 c+ u# _  K' U+ L0 ^- k' q+ I$ Y
  57. #define ITCINTEN_SHIFT              21" A, M- L& H5 b' F; \
  58. #define TCCHEN_SHIFT                22
    : V/ H8 x: i8 D( s% h6 D  p8 W8 E9 ?- A- F
  59. #define ITCCHEN_SHIFT               239 h4 u; m, |0 v4 ~  i% D) [' y
  60. 6 B& V0 Q& o3 h4 B& I  I
  61. static volatile int irqraised1 = 0;& j+ U8 j0 r2 Y! G* o/ w: W
  62. static volatile int irqraised2 = 0;
    9 `+ [, K) x/ B! k6 T5 C
  63. + ?! O1 Z9 F, K' U7 j3 L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 D- N. i) R# \0 \: f* X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 x9 ~, w/ }& ~; D) V$ N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, {# [$ _6 E5 v: J+ X

  67. , \9 k* p2 ^9 b& O4 `  r
  68. dma_addr_t dmaphyssrc1 = 0;  Y. v" g3 R4 x. X5 D0 X
  69. dma_addr_t dmaphyssrc2 = 0;& E8 o6 z0 [- y7 J2 n
  70. dma_addr_t dmaphysdest1 = 0;
    ' Z' z6 o/ y$ ]3 Y: T) S3 v
  71. dma_addr_t dmaphysdest2 = 0;
    5 C& `$ s! H+ W* z+ }% j
  72. 4 y2 ~, w7 U" C2 t
  73. char *dmabufsrc1 = NULL;
    . Y% P" f5 }+ A! j4 x1 `! E
  74. char *dmabufsrc2 = NULL;
    ; g- P* y/ @/ K
  75. char *dmabufdest1 = NULL;1 O/ B6 k5 U, K2 d
  76. char *dmabufdest2 = NULL;+ G( ~" m6 E) j) P6 i- |) ]3 o
  77. * L$ y' Q6 y5 ^- ]% o) x. a0 \
  78. static int acnt = 512;  l. e" [. E$ X% O
  79. static int bcnt = 8;2 O3 }# C! t& x/ C9 S
  80. static int ccnt = 8;
    ' X* ~; t4 D3 F( j' [3 @
  81. " U* v" k% U/ X5 c
  82. module_param(acnt, int, S_IRUGO);
    8 N% I! B1 c+ \7 v1 E. z7 M. C5 h
  83. module_param(bcnt, int, S_IRUGO);
    4 U, H: o+ r* G' B# ^' a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ f' T9 E! E  u2 Y
6 J) p  H# R2 k6 @$ ^, K, s+ K. |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 q" |" b/ r. E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ k* l4 K9 c5 \, T4 w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" m  T% \% i$ E, E' ~. _- ~( Y5 x. E( k) M! ^% }" L7 d

/ [1 ^, V7 q3 j8 _+ L, @1 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 10:58 , Processed in 0.047908 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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