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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& q/ m" y; }3 n3 i0 \; W: [
  1. [code]EDMA sample test application# z& D4 G, i' v( }* I. _% J
  2. /*2 F3 [- \; e2 g/ O6 u
  3. * edma_test.c7 s7 ?) @5 L" V/ p7 A
  4. *; b  ?# l7 T+ @4 `, }3 |! s
  5. * brief  EDMA3 Test Application- q2 g- R) E8 }4 m% B+ q" X$ Y0 L
  6. *
    3 g4 e* q* x& a% c0 v
  7. *   This file contains EDMA3 Test code.8 R' L: e0 V+ H  q6 ?
  8. *$ S. r/ @! c$ |0 o6 q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" q/ e; I: p) G9 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ _$ ]+ ]' `* P$ e, D: |
  11. *         TO CHANGE.$ }3 M: C, e! x
  12. *
    ) F+ p8 Q6 w$ A+ X. o+ X* q( L' }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; a3 W' }, s9 k  b$ @' A5 a
  14. *) S7 j8 m" p9 D3 V; R
  15. * This program is free software; you can redistribute it and/or) F% r! U2 f' \4 d% J* x& g
  16. * modify it under the terms of the GNU General Public License as5 i' c- i% N( _" y( Q
  17. * published by the Free Software Foundation version 2., r' P, X7 w5 e! H0 X, ~1 d
  18. *( W3 Z- g. o: x! X9 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ Q- e5 o: o% L% |0 {% {/ S$ U
  20. * kind, whether express or implied; without even the implied warranty9 V8 v; w$ B% R" F2 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + d$ }) f$ [  u# Q/ B3 N
  22. * GNU General Public License for more details.
    ) D: f) t5 ~9 X& ?' K
  23. */
    8 n4 i, [5 b. b' N' }' v2 x

  24. 6 z  w2 I; H3 Q& z1 U; ~4 m5 j
  25. #include <linux/module.h>
    ( z' j% f$ c7 Z) N' p
  26. #include <linux/init.h>( L- A6 |) E( v' Z" D! Y
  27. #include <linux/errno.h>
    * [& {! v& W) i, N* t" D- I
  28. #include <linux/types.h>
    6 ~5 j8 h% T  H+ P9 U
  29. #include <linux/interrupt.h>
    5 M; d+ q$ o2 e) r
  30. #include <asm/io.h>0 ~5 T- \$ c% z/ b6 @! ]- }2 [# f( f
  31. #include <linux/moduleparam.h>3 l/ a9 r) o( U7 P- R- C. L
  32. #include <linux/sysctl.h>4 P9 j  o) E* e
  33. #include <linux/mm.h>8 S0 F) H7 C. T6 f
  34. #include <linux/dma-mapping.h>0 u8 O9 H' j) h* ]# x# i4 x! ~
  35. + O7 x% r% `$ H* W
  36. #include <mach/memory.h>
    . F% U: b. ?* M- R
  37. #include <mach/hardware.h>! h; }' Q- g; K
  38. #include <mach/irqs.h>! L! `( ~; w0 x0 P) l
  39. #include <asm/hardware/edma.h>; v6 e& W6 N9 s4 B0 R2 [
  40. ) T2 ^  b/ B5 N' d3 S
  41. #undef EDMA3_DEBUG) @! b) i7 h: O# j* ]/ G  J3 z
  42. /*#define EDMA3_DEBUG*/
    . \. ]' N/ B. I* B& M
  43. % u2 a/ L; m! ?" d( C' R$ G+ z* b
  44. #ifdef EDMA3_DEBUG
    3 K; z; J1 |3 U1 P; }% p4 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 Z! w2 Y5 t5 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" F8 E* n* L4 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" w  p( T0 n0 [- P( S
  48. #else
    8 S6 P0 ~- S" _/ c" _
  49. #define DMA_PRINTK( x... )- X- V" V$ g% M9 a: L
  50. #define DMA_FN_IN9 k- y3 l" c, N0 P9 T+ o/ f
  51. #define DMA_FN_OUT
    & x1 u% d! J% f& _
  52. #endif
    9 P2 Y( A, l- p2 ]7 ^  }  t( b# T4 k
  53. * M! c: \7 P& d1 l! B8 P# ^; C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 g- Q2 N; U2 j
  55. #define STATIC_SHIFT                3
    , V2 \6 X/ l) C4 c% X0 z( v( {
  56. #define TCINTEN_SHIFT               20+ A1 r4 z& d: u% X
  57. #define ITCINTEN_SHIFT              21
    & S7 J. C9 L3 ]# s. p, q( g
  58. #define TCCHEN_SHIFT                22/ i" }3 ]7 U% b& t
  59. #define ITCCHEN_SHIFT               23
    " Z# o: g% S# h+ V& _& G$ v3 k  i
  60. 3 X! l( G0 H/ r3 D. o1 a- u
  61. static volatile int irqraised1 = 0;
    8 a0 Y4 Q" T( l( I9 N
  62. static volatile int irqraised2 = 0;  O$ ]; R/ z% L( f0 X2 |

  63. 8 A9 V7 t8 \7 I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 O! c  k$ o7 B* h# h& k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 K; w2 ]3 ^5 O( j; @$ m2 j/ @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# M/ a* F8 L" D2 ~& s8 ~

  67. " `2 _! o; M- `! v! Q
  68. dma_addr_t dmaphyssrc1 = 0;: v1 H1 |% g$ X
  69. dma_addr_t dmaphyssrc2 = 0;
    ( A& v7 X, L+ ?
  70. dma_addr_t dmaphysdest1 = 0;
    9 t) P4 W1 b2 {
  71. dma_addr_t dmaphysdest2 = 0;
    + T) a% O. v% s6 M" }# E

  72. # q2 g+ t8 z3 \  N( I  F1 l
  73. char *dmabufsrc1 = NULL;
    - k* W1 v0 v) a0 }2 l% C( h0 G) ]
  74. char *dmabufsrc2 = NULL;
    ' R& |4 z9 A8 T( C4 \5 v8 P
  75. char *dmabufdest1 = NULL;
    ) l6 }0 h6 r0 G: t% m+ {
  76. char *dmabufdest2 = NULL;* k; n" V; `; x# i& ]6 q
  77. ; @9 `2 _% H) B7 D( }& g
  78. static int acnt = 512;" L! p. f+ F/ B/ ?2 A
  79. static int bcnt = 8;, i& W$ C5 k7 _  H& s6 H' G" C
  80. static int ccnt = 8;
    " R3 A% S* y6 o- T
  81. : i% W: Z& A: D0 U0 a) w5 y  ?& b
  82. module_param(acnt, int, S_IRUGO);4 e7 k0 V1 s+ Q* ?3 `  S
  83. module_param(bcnt, int, S_IRUGO);9 A" K. |4 Y' j  I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 d5 N) s: ?/ M. I

- n1 `! ]3 g. l) P* B9 C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ i! X9 I. D3 M. O7 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) ~# a/ t% Z0 @/ }; i3 F4 g+ |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 a9 f# T7 O% @) \: W# U" H
: B8 g( l9 P/ x0 G" F0 @& s& N+ Z' d9 f$ T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 02:52 , Processed in 0.041098 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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