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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, S3 b! L8 Q7 j( H! d7 }0 @
  1. [code]EDMA sample test application' U7 w9 e& s0 \) G- y: d
  2. /*
    - t& v1 v3 F* x: w
  3. * edma_test.c4 _$ r7 V9 u/ q. J1 [
  4. *
    2 M- B$ e& V1 D2 B2 A, g: V
  5. * brief  EDMA3 Test Application
    6 N' M  w* H5 p+ X' }; M. p
  6. *& S; l) q: _. f: h
  7. *   This file contains EDMA3 Test code.
    ! r; L) n# D* \6 H0 n! @& e& p8 B5 B
  8. *9 @3 u4 J5 I0 J, G4 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 Y% t) E& k3 W9 g1 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( ?5 d) I  b4 k
  11. *         TO CHANGE.7 x  ]3 M- s& }
  12. *
    . C7 M; w  S, C! J) ?2 N* |$ p: [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . b/ J3 ^! \8 u* Q8 s
  14. *! Y8 J8 O! A* n. j% X2 E7 F
  15. * This program is free software; you can redistribute it and/or+ d- J: n4 b) i4 X
  16. * modify it under the terms of the GNU General Public License as# q! ~  {. b  H' P
  17. * published by the Free Software Foundation version 2.
    6 r, N4 t; U1 F  z) H" O/ C. [
  18. *
    6 s% o5 |- n% ?+ @# }2 z0 l3 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 B1 r  z4 [; w2 _0 d
  20. * kind, whether express or implied; without even the implied warranty
    ( G1 E% `5 [2 l  n6 ]6 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 p2 e; n3 ]2 P! l
  22. * GNU General Public License for more details.' ~9 K: \2 O1 G) k$ ]0 y1 P
  23. */9 i4 O  O9 m' s, Z% R) f1 u1 n
  24. ' E$ C; j) |8 k( J* K. |* x1 ^
  25. #include <linux/module.h>( ]0 H2 k7 E& ?0 D" [9 e
  26. #include <linux/init.h>
    * s2 X1 ^  Q& r9 v. R
  27. #include <linux/errno.h>* |$ n" z& \6 ?- U" U! y
  28. #include <linux/types.h>: }4 q) `: w% _, B* f6 ~: Q: c
  29. #include <linux/interrupt.h>
    5 b/ H  @2 ^5 l! d* j! u: |
  30. #include <asm/io.h>7 A8 z* `) x. d: |; f
  31. #include <linux/moduleparam.h>
    / N4 G& b# ~7 L9 U$ d3 t+ k
  32. #include <linux/sysctl.h>/ i2 q# l! D8 r9 i% s) x3 s
  33. #include <linux/mm.h>
    7 ]" m( j. s# N, q
  34. #include <linux/dma-mapping.h>
    ! g. c4 t0 o  f" ?$ |% D

  35. 1 n; \; `1 ~, o7 e) I# l
  36. #include <mach/memory.h>, X" Z' [% `# u
  37. #include <mach/hardware.h>6 B& T0 q5 [: w1 i' A
  38. #include <mach/irqs.h>" r% y- @  n% P5 j* ^+ W1 F  t+ M
  39. #include <asm/hardware/edma.h>8 L4 ^2 i& I# ~: L$ N
  40. 9 f7 Y4 ?8 ~) h6 @
  41. #undef EDMA3_DEBUG3 j2 l2 Z  H+ {+ ^8 x
  42. /*#define EDMA3_DEBUG*/( a* n, v1 W" Z# f+ w1 A
  43. " b2 j, k, W# D: V' U
  44. #ifdef EDMA3_DEBUG1 l1 R8 E5 W9 }6 i8 I1 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / k+ G- e$ c5 K" e0 l& l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 y: Q  g! i$ S; ^1 Z: j; l0 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ ^3 u% }/ y- c) o' ]
  48. #else
    8 e( D) A5 b" b2 O: D
  49. #define DMA_PRINTK( x... )8 L9 J. Q- h2 W* ]
  50. #define DMA_FN_IN+ p' {; e. s5 g
  51. #define DMA_FN_OUT
    " j. L7 `' w0 w8 m9 s% K( U
  52. #endif" z2 Z4 `# X& F
  53.   m. h$ l6 f& T5 {- t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 V& j# a+ R& ~' s. o4 j& f2 |
  55. #define STATIC_SHIFT                3# m9 L1 h) O8 V6 E# u
  56. #define TCINTEN_SHIFT               20
    2 [: K  x  |, k" a6 q
  57. #define ITCINTEN_SHIFT              21
    - v. U0 N. W. t$ M" F" A9 {* f
  58. #define TCCHEN_SHIFT                22
    6 f- N6 w/ j$ _3 w+ C. S  V
  59. #define ITCCHEN_SHIFT               23! i, P8 N  E4 _& z. X0 H

  60.   ]- m$ s: o, U; w0 h4 ?3 s+ ?' y1 n
  61. static volatile int irqraised1 = 0;- R' G3 I+ |9 k# H% m1 h
  62. static volatile int irqraised2 = 0;; N: X4 \+ a" l; ~& N

  63. 6 s! M8 B  P$ Q, e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ]* }+ J3 n  y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. Z; m0 z+ M. ~* F8 E0 \% |6 [4 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 q  D8 n% ~# `1 ]6 o4 @
  67. 1 P' b& a! m; a2 [  H
  68. dma_addr_t dmaphyssrc1 = 0;
    * |- w9 M: h! w4 L% s& R$ `' D, i
  69. dma_addr_t dmaphyssrc2 = 0;
    2 m4 S/ w) n2 Z% l
  70. dma_addr_t dmaphysdest1 = 0;
    6 ^5 ~3 j, Y. t" U$ I7 _1 k! O
  71. dma_addr_t dmaphysdest2 = 0;' h2 j% O: O# B( a- q

  72. 0 q5 R; J) ]9 ^. N
  73. char *dmabufsrc1 = NULL;1 H' E0 B3 ?: c' a2 d% G
  74. char *dmabufsrc2 = NULL;
    : Y% o+ `3 m# d! s' x
  75. char *dmabufdest1 = NULL;
    $ S8 {; G: x1 E
  76. char *dmabufdest2 = NULL;- W1 P9 v( x- I" H

  77. * M) y" u: E; _' |6 w! M1 r, U8 E
  78. static int acnt = 512;: i6 k! p8 q! j& D7 p" z" O0 T
  79. static int bcnt = 8;
    % Y+ w" E3 N6 D' b5 L' P
  80. static int ccnt = 8;
    9 B( H1 ~! B% T+ ?; Z9 ]/ l( {% _

  81. " F' D+ n, [. \, t: V) p& `
  82. module_param(acnt, int, S_IRUGO);
    $ h7 q5 j6 m1 i4 W
  83. module_param(bcnt, int, S_IRUGO);  `0 G) y  |! w. a, ?6 B/ F/ M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 o+ [, t( G4 Q5 K: C& e  c+ o: B% y% L9 ]* ^: \2 h) L8 s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 f( J+ _$ l" E: r6 `& k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ P. {  }/ _8 ]" o( z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ P9 U0 U4 M: z( @" M. {2 w8 J5 B5 x/ z' y$ c6 R5 K5 h
$ D  d6 T, G: K0 ^% l% k% _( F- n" S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 15:25 , Processed in 0.043894 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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