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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 N1 t) s. j! d8 k' X1 [- n" @
  1. [code]EDMA sample test application* e/ L! i7 D: U! D( n' a3 u6 Z
  2. /*! v3 X+ y8 x3 O
  3. * edma_test.c
    2 t$ I& C- F/ y3 O2 [7 o: S) w6 S
  4. *
    4 K  ~: D! r! g% |
  5. * brief  EDMA3 Test Application
    4 i, a) F7 f: O. A
  6. *
    3 f, m+ D- i  Z/ t; v7 _$ @3 t2 A
  7. *   This file contains EDMA3 Test code.# `0 y8 v5 g/ _3 }" w% W! m! Q
  8. *$ q6 O& l; T5 Z% r8 N( p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 P) S$ v- K0 s0 h+ _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , f. ~& s+ C2 G
  11. *         TO CHANGE.
    - w0 c$ |$ x: z; e0 K  k" c# K6 H
  12. *1 A% e$ N; t$ L( k6 L; J6 @' w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// p" V1 \( d5 t" w7 s% Z" ~
  14. *
    & [' N3 Q, b/ |$ ?7 Z5 Y
  15. * This program is free software; you can redistribute it and/or
    . _8 n# w/ F' T7 f0 Q' ?  ?& r
  16. * modify it under the terms of the GNU General Public License as" j8 W& z- L6 M0 c8 s# s
  17. * published by the Free Software Foundation version 2.
    ; o% p& @& M! o
  18. *0 m# L; r2 x" G* E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 _9 }- H- T) R& m: N
  20. * kind, whether express or implied; without even the implied warranty
    & [( p( s( k! D& v) }2 a* Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      {. L/ W6 P, V
  22. * GNU General Public License for more details.$ y; ^9 d% E5 v6 t: x1 V2 G1 ~
  23. */
    ! w+ r6 ^" E1 _+ Y' l; R1 z( L/ l6 T
  24. + [# ]+ m% x0 e+ Z1 K0 N
  25. #include <linux/module.h>9 ?; K% O+ C! q- D* r
  26. #include <linux/init.h>% f: F! m# e6 Z, c2 F
  27. #include <linux/errno.h>
      c7 F/ ], Z; i. d
  28. #include <linux/types.h>7 b0 u. N! a' {3 q0 n; f" c$ S
  29. #include <linux/interrupt.h>
    9 o7 g; N; R: J) B) v: {( }( M9 j
  30. #include <asm/io.h>
    % t: f% @/ i  Q! E2 A
  31. #include <linux/moduleparam.h>
    2 K2 w; p) J9 E* v
  32. #include <linux/sysctl.h>: D/ @* u" C# k. H. L0 Q
  33. #include <linux/mm.h>
    - s% n7 [/ u. z+ S! f! Y2 S8 a
  34. #include <linux/dma-mapping.h>4 K( A+ q7 j; H! y( D' J0 Z, ]* K# {
  35. & g, C1 _+ Z: n# o
  36. #include <mach/memory.h>8 g; [2 G2 y) {4 i
  37. #include <mach/hardware.h>
    7 c# c0 G! O1 s& j
  38. #include <mach/irqs.h>
    ) v" J0 }9 M! M2 U" P
  39. #include <asm/hardware/edma.h>
    / ^  E0 z, S4 T+ e2 A9 d- k
  40. ' A7 b! e8 B2 ^4 L# k# t. l. _
  41. #undef EDMA3_DEBUG0 V- f. O/ l3 q* X" u8 W3 f
  42. /*#define EDMA3_DEBUG*/+ O; Z; R7 C. ], T0 r
  43. 1 ~7 \% r+ P" [0 T5 ^
  44. #ifdef EDMA3_DEBUG5 B2 z+ J) N! F4 `# N# J3 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 {7 Q' O1 D% p# Z! s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; C- f3 t& k, c! c. v  x+ ]- J; Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 I3 h7 y5 Q% V! G& G- y/ g
  48. #else# R$ E+ ^9 |: R( b, \4 ~2 G
  49. #define DMA_PRINTK( x... )
    ( q3 b# R+ u0 w  E1 j3 F5 Y: W! I. c
  50. #define DMA_FN_IN* c: p  q4 d# u
  51. #define DMA_FN_OUT1 P, F- }, o2 F
  52. #endif
    ; T. u6 Z* T5 {5 u, o

  53. 8 O: r2 }0 C& v! s. \/ e; V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ ?4 @! d  J  Z9 N1 Y' M' _. v% U
  55. #define STATIC_SHIFT                3  \* |+ p( v1 C! V
  56. #define TCINTEN_SHIFT               20
    ( T) J, d" D+ v* q; j  P. _
  57. #define ITCINTEN_SHIFT              21  N" E. V% K; I* ]
  58. #define TCCHEN_SHIFT                22& }  k, ?- F& _% ]6 ^1 Y1 M
  59. #define ITCCHEN_SHIFT               23
      R& r+ t% P8 Q+ `( c) ?0 r% D

  60. 7 v8 l7 m1 K. `9 d  s3 p
  61. static volatile int irqraised1 = 0;
    * ^! V$ F5 V! k$ f5 u/ E
  62. static volatile int irqraised2 = 0;
    3 ^4 y# U; {' T

  63. ) v$ {& {3 q& R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; b: H; A" Q4 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 E  P1 {, _) H5 d8 k5 g1 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 L9 g  Z6 k6 \) u- j1 i

  67. ' ?7 \* z# S% T: Z, p
  68. dma_addr_t dmaphyssrc1 = 0;# K' T0 L+ E% N; f2 ]( ?! B- z
  69. dma_addr_t dmaphyssrc2 = 0;
    % u' y3 I/ T0 E4 Z2 C
  70. dma_addr_t dmaphysdest1 = 0;- d+ o9 {/ {5 i5 U6 F
  71. dma_addr_t dmaphysdest2 = 0;
    ) w  }* ~3 B% t/ b

  72. 9 o3 ?. P/ l+ ]; r. H) z
  73. char *dmabufsrc1 = NULL;
    1 ~0 q6 x4 y8 W7 x) r
  74. char *dmabufsrc2 = NULL;
    5 i) I' R. b, B2 a3 c) S5 {7 @
  75. char *dmabufdest1 = NULL;' o+ i5 B) r- w0 I  G, y# i
  76. char *dmabufdest2 = NULL;
    ' x4 |# G4 ?% A7 H* D6 g7 m4 l7 n
  77. & d; e' g& F6 G' A) ?# B  j% `
  78. static int acnt = 512;
    % S# |  u9 C) K8 p% w' ~, `% ~/ |# S
  79. static int bcnt = 8;4 d% M; H9 U" p, f1 G2 i
  80. static int ccnt = 8;- u+ E# X1 d  k7 G* n# N

  81. $ U( E+ J, Z; J- E
  82. module_param(acnt, int, S_IRUGO);) @8 S: g; z! B  K
  83. module_param(bcnt, int, S_IRUGO);
    - X" H, g: `! w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# e- h% F% V+ |1 [* G

/ ^) W7 \3 w* H1 O9 f( p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* A  }9 n: e; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; z7 W6 J; f. L. s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% e$ C% b; C( m! l5 l4 U3 ?

) M2 t/ ?  [1 D$ G" r, K! X7 i" \$ C/ }! d4 I1 Y4 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-10 04:28 , Processed in 0.044937 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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