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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 p' ^% h/ i. Y$ K
  1. [code]EDMA sample test application
    8 R0 L, y& l! ?9 x5 I% `
  2. /*( W6 Q4 G+ d" F) I9 l/ @; Q. |6 n$ Y
  3. * edma_test.c, _( ^. e- h+ l( y: l  v% n3 }
  4. *. V$ y& E3 j, l; M7 N( x( o
  5. * brief  EDMA3 Test Application
    " Y4 Q% s( q; ^" `7 @( q$ O3 X2 n( T
  6. *
    5 j' p2 q4 t9 D) Z) d" z
  7. *   This file contains EDMA3 Test code.
    % p7 l' |3 _# D4 t5 B
  8. *
    " S& F. J. S& K% w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ j- K7 r7 R  ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; N+ U5 F7 P" B8 k5 _' M
  11. *         TO CHANGE.
    7 Y( Y8 ?2 ~. Z
  12. *
    $ C1 \  x- S, z0 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 e6 z' C( B4 t! ?* Y- T9 @" k
  14. *
    ) m! y) O+ y* b0 C6 U% Q6 d8 H
  15. * This program is free software; you can redistribute it and/or
      O( Q) g# i" H
  16. * modify it under the terms of the GNU General Public License as) x* ~% J/ G, M& X9 b9 p
  17. * published by the Free Software Foundation version 2.
    . }% [5 l3 b3 s/ C
  18. *
    ) T$ w/ Q+ G- F  B; N  V) j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 ]* y) O. R6 z7 t1 [
  20. * kind, whether express or implied; without even the implied warranty- C6 x% N; x' L& K* q5 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 h* B6 V3 W% ~! ?- {: q$ q0 n
  22. * GNU General Public License for more details.* ^& t" m4 U" u; T1 s$ w
  23. */: g6 ^% \! e  u! ]

  24. ' @/ ^, h, Y6 _2 s" M# J3 l# C0 ]
  25. #include <linux/module.h>
    " r) g5 `8 H; I% i5 w
  26. #include <linux/init.h>2 P. M/ O3 B5 s, W
  27. #include <linux/errno.h>
    4 g" j$ Z9 u0 T
  28. #include <linux/types.h>) r* P+ o; |+ x2 b1 Z& o6 {* P
  29. #include <linux/interrupt.h>/ P* m+ `9 K# f8 G3 }" s
  30. #include <asm/io.h>$ V1 |, a( ~8 j6 h* I, S
  31. #include <linux/moduleparam.h>8 Y; y* [/ K3 L7 M7 n6 z
  32. #include <linux/sysctl.h>
    7 r8 M. E. w' C" c4 f+ }; \1 j
  33. #include <linux/mm.h>5 p0 Z* X: @: ]- v" r
  34. #include <linux/dma-mapping.h>
    ; s/ w& y! O. _$ N( `0 d! P
  35. . W. b2 [" o' p
  36. #include <mach/memory.h>
    # f1 S; v- k( K4 y
  37. #include <mach/hardware.h>$ m0 V; T# c9 P. s' G* X$ @
  38. #include <mach/irqs.h>
    8 y# m) W2 K/ `( ~) Y2 r
  39. #include <asm/hardware/edma.h>
    2 j' S- F$ b, C/ F
  40. ( x5 v% q. P7 h1 c3 v" B1 X
  41. #undef EDMA3_DEBUG0 T0 |; s! y9 u4 ~0 f, b: x/ G
  42. /*#define EDMA3_DEBUG*/
    0 {8 h3 B: w! e+ [) p' V

  43. # S3 J! h7 K& p$ B& c3 g$ r% P  [
  44. #ifdef EDMA3_DEBUG, {/ {/ Q/ ?/ \* ^1 y6 a# I, i/ O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # I4 b( ]4 K9 X% w: Y% u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ y  E/ |9 ]; c0 x1 P% @- F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 {, |( o- x5 _0 w( j
  48. #else- c! Y1 c1 W( @) m8 q# H
  49. #define DMA_PRINTK( x... )
    + K9 P2 o& h% Z+ s6 ^/ t6 {; k+ s
  50. #define DMA_FN_IN
    . R  T5 Y/ z1 [( L/ L
  51. #define DMA_FN_OUT
    + W: E% X9 O, S/ e
  52. #endif2 S/ g9 _6 w. Z- h! m. X

  53. 0 ?3 `% l0 Z* b! p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; Z1 b- X+ V& r8 `
  55. #define STATIC_SHIFT                3/ x, A0 d+ r5 B, n! i
  56. #define TCINTEN_SHIFT               20
    & d+ ]6 [/ i. C$ i
  57. #define ITCINTEN_SHIFT              211 q5 [& ~  L- Q9 ]# P
  58. #define TCCHEN_SHIFT                22
    * z% a, e0 |( i
  59. #define ITCCHEN_SHIFT               236 ?3 n8 ^2 F) M9 g
  60. 7 ]  M2 Q9 W$ n9 D+ |
  61. static volatile int irqraised1 = 0;8 O9 w% g- K6 {6 s) g% j
  62. static volatile int irqraised2 = 0;
    - W+ W, s/ W4 M$ @' i

  63. 7 u, N/ v) {& G2 B+ t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& H1 e1 Y# v8 ?& V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; O8 _) u% a0 O" z- C) v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, M0 a+ s3 j: V

  67. ) L; [! z- O+ B
  68. dma_addr_t dmaphyssrc1 = 0;
    6 a7 Y- T' K( M" b
  69. dma_addr_t dmaphyssrc2 = 0;
    * l7 X  p0 q# H4 m" ?" }8 }* n( q' ^
  70. dma_addr_t dmaphysdest1 = 0;/ t* D) ^  n- a! q
  71. dma_addr_t dmaphysdest2 = 0;# Y0 t9 V. V' w6 i) U( `
  72. 8 @, X0 W2 n$ O6 K! E# P6 t
  73. char *dmabufsrc1 = NULL;
    - Y8 t3 f) C3 i" C4 i( W3 K  ^7 n
  74. char *dmabufsrc2 = NULL;
    : w4 }8 m9 `2 Q' g; x
  75. char *dmabufdest1 = NULL;
    5 B' A% j; G9 K# z- {6 L. h# ^
  76. char *dmabufdest2 = NULL;6 w- L$ R' \4 p) u5 |0 b$ w  M
  77. , l% m- Z( i: ]% ~( @( B6 ?, `8 A
  78. static int acnt = 512;
    1 z8 t) d8 h/ O2 C; B
  79. static int bcnt = 8;
    + M! y- ^% D( v, ~6 o
  80. static int ccnt = 8;
    8 O" c; {" n1 X( P4 D

  81. 8 Y! I) l8 @9 y* T
  82. module_param(acnt, int, S_IRUGO);! p2 ]4 i0 A+ X& i. b0 q
  83. module_param(bcnt, int, S_IRUGO);/ A2 H3 N& Q: Y' e1 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 I; @( i, j- Y% {' J) d! `8 S! i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) `2 X" D, K2 l, R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' g& j% ~  N5 V; }: b1 R# b) f9 V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 d1 T8 V8 I% X1 h: y% p3 e7 e+ t. A3 H  D! @8 D8 Y% Q
$ u4 G. g; g& C$ @, R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 16:07 , Processed in 0.038959 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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