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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 Z- E0 ^) M7 H5 i/ Q9 D. x  e
  1. [code]EDMA sample test application
    * ]! s- I0 L$ b1 L, Y3 v/ Z( b5 {
  2. /*5 X# ~9 N# P) u; r& X8 c
  3. * edma_test.c
    . l* G* z' R. G% y5 W' A4 D7 [
  4. *
      \* R# k. |* a% O! t
  5. * brief  EDMA3 Test Application: o" s- w+ H) y
  6. *1 ~. _; A3 Y; Q! [; ]
  7. *   This file contains EDMA3 Test code.
    6 _  ^6 G1 }7 C
  8. *
    % A; H5 N( |5 t3 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 B# Y* U( u% k; `5 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' X2 r  W  {( n3 S) U- T
  11. *         TO CHANGE.: v8 r& C# i+ y
  12. *2 e! r- V; `6 e) }1 B) z3 U' O( P' q. U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; R' |1 t( I, c+ S: a
  14. *
    ( G5 x+ g: z* L2 O# ^) y
  15. * This program is free software; you can redistribute it and/or
    ) W$ n' [1 P- {. U: a; n% p3 Z
  16. * modify it under the terms of the GNU General Public License as9 ]6 S  Z) l! V& V6 c4 _$ e
  17. * published by the Free Software Foundation version 2.
    3 h8 ~3 E6 Q. @, q  s3 ?! ]9 T, N
  18. *
    ) s3 S% ~3 m. @3 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" i; U8 N" r! P$ P  D
  20. * kind, whether express or implied; without even the implied warranty; `4 W; j. O2 e9 m1 V9 c* u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 ^, j5 c$ f4 s  O. m+ }; \0 l
  22. * GNU General Public License for more details.4 z2 T( }1 j- _  J: v4 |
  23. */9 B. F/ k( p, D" g! W

  24. ( r8 X5 B- @; R: E' e
  25. #include <linux/module.h>2 F4 u6 W' E" s. r4 L3 Z
  26. #include <linux/init.h>* |! ^' x* y2 y# Z6 f. B( M6 M
  27. #include <linux/errno.h>4 x7 u0 C" k7 g! ^5 {
  28. #include <linux/types.h>
    / r+ y$ T+ |2 a/ Z
  29. #include <linux/interrupt.h>- @+ \8 {2 j& ?1 T1 |  O  V
  30. #include <asm/io.h>0 T; ?, c' p9 U8 N
  31. #include <linux/moduleparam.h>4 T) s! J1 Q1 ~; B
  32. #include <linux/sysctl.h># P; w; `% c: _5 m
  33. #include <linux/mm.h>
    ) \+ @/ U/ B$ P+ C) F+ ^  G
  34. #include <linux/dma-mapping.h>9 |/ ?8 i) f% ~: [4 M1 v

  35. : i. O' F0 A% y- {7 m
  36. #include <mach/memory.h>
    % e3 d' k7 \; |; Q9 v
  37. #include <mach/hardware.h>  w, i2 }& \  j$ |8 Q4 h  y0 m3 @
  38. #include <mach/irqs.h>
    , s, D" I" l0 ]  t3 T$ b
  39. #include <asm/hardware/edma.h>
    : T# b  E: b6 y* I

  40. 7 M) I) y1 b, J  B
  41. #undef EDMA3_DEBUG1 R/ y3 j5 @4 S' A
  42. /*#define EDMA3_DEBUG*/
    ( s/ a, T; k) f
  43. , E* w! q4 _( ~
  44. #ifdef EDMA3_DEBUG
    % n' Y, g' O2 g! n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) J% c5 R2 C# |- p( u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 d. ~; V% X% `: g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . g- ^$ x# M9 {3 z0 `
  48. #else
    1 Q/ M" K8 i4 ^7 y) k9 G
  49. #define DMA_PRINTK( x... )
    ) h1 u4 E3 b' N
  50. #define DMA_FN_IN0 |, l) [0 \! b; f( R4 y5 y( v4 I  R
  51. #define DMA_FN_OUT
    9 R) b  \" K, ?1 w3 `
  52. #endif/ Z) k/ H! v- l8 n9 l7 S

  53. 5 @7 L2 N$ P, g3 j# R! ~7 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' S& J) W* W& U% r3 x) [" U- A
  55. #define STATIC_SHIFT                3
    ) `$ v9 G8 r- G# q; g9 I
  56. #define TCINTEN_SHIFT               205 G, {* l. a* t/ j3 B# s/ p( p
  57. #define ITCINTEN_SHIFT              21
    ' h. ]6 C' [2 ~" b6 r; r1 A. q( b
  58. #define TCCHEN_SHIFT                22* K* E$ e* u) a( R) o
  59. #define ITCCHEN_SHIFT               232 T, H% C2 e0 }7 I6 H1 `  _+ V* M

  60. 8 K; m" u( t& K3 a' N
  61. static volatile int irqraised1 = 0;
    6 Y5 q0 o8 N# X# q
  62. static volatile int irqraised2 = 0;
    1 m& N) F0 w6 }6 k" b1 Z! D+ ]

  63. 7 j4 o! ~, ~5 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , ]3 t$ z* g3 u, ]( V% _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P6 b7 G2 f8 {& ^0 \1 Z1 w' \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! k9 T- w% H5 R+ X& L
  67. & i, K5 r. S! ]
  68. dma_addr_t dmaphyssrc1 = 0;% m5 l* D* e9 R3 e+ v6 ~
  69. dma_addr_t dmaphyssrc2 = 0;
    2 x5 I* S  v- d
  70. dma_addr_t dmaphysdest1 = 0;0 E# d) C+ m6 @. h( n! i
  71. dma_addr_t dmaphysdest2 = 0;* C7 S; v! g% O- Z9 A) h3 N2 \) C
  72. 9 R+ |- w! E6 V6 x2 t0 Q4 O/ G2 g. ]
  73. char *dmabufsrc1 = NULL;9 E6 O) l% g! }0 O
  74. char *dmabufsrc2 = NULL;/ l! s0 ?+ w! ~3 d
  75. char *dmabufdest1 = NULL;
    + I' S) f$ R2 ?; [6 T- D. k4 N
  76. char *dmabufdest2 = NULL;
    . ~) c4 z1 ]* A$ }6 M+ Z9 H# j
  77. + i. u  s) P1 H% \' C7 c
  78. static int acnt = 512;
    3 b9 o8 ]. c4 c/ P- b
  79. static int bcnt = 8;
    ( @$ I+ O+ [* u! p$ ^4 `
  80. static int ccnt = 8;. ^+ i) ^# p7 r& x  G# C- H$ V! n5 e
  81. & o' t& r" Y! L8 t( K6 k& N' q
  82. module_param(acnt, int, S_IRUGO);/ ?4 S9 i' X; l/ ]$ g
  83. module_param(bcnt, int, S_IRUGO);
    7 _4 k5 ^% `5 L0 J2 q5 U, }' k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 i1 ]3 }9 i2 ~. h* R
- Y( w; t! k+ t7 ~: @% R) f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ ?$ A# y/ j; F  B+ Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: L: E. W. h! u9 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, l/ `3 G/ d( a9 ~- T7 F+ P! g7 s; C. Y
% `3 m" K) v# |( a. q" c

/ s* Y/ c7 Y! s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 19:06 , Processed in 0.051495 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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