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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * y4 P! ~8 o$ f1 m3 T4 `1 O5 H( f
  1. [code]EDMA sample test application0 l, V5 k7 p3 \1 b6 o1 a
  2. /*
    ! X6 C. N3 ^+ V  J3 ]5 @
  3. * edma_test.c9 k' s* L$ n0 h3 h
  4. *
    # c5 V5 m' ~" k3 \% ~2 g7 c
  5. * brief  EDMA3 Test Application# D( {8 y- [. m# f) Z6 s# u4 L
  6. *
    ) ]$ T" V3 X( q) G# o% H: x% p
  7. *   This file contains EDMA3 Test code.
    9 }7 E- B/ g. Y, u' D9 [( ^
  8. *
    # n1 Y. w6 s; W; Z2 b0 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 Z( c" N; Q1 U; S: U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ r4 b# v6 \! d7 G
  11. *         TO CHANGE.( p9 \- z+ R  q7 S- y
  12. *6 R/ w% I" O$ o" b( w( c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: |% t4 h7 e3 s6 W  h
  14. */ M8 {4 B1 G( @& A: q* P; E
  15. * This program is free software; you can redistribute it and/or
    3 e! `: G% h. f. }# D2 z$ w) X$ _
  16. * modify it under the terms of the GNU General Public License as
    3 f- H0 A' |2 h4 c
  17. * published by the Free Software Foundation version 2.
      ?) C$ t# t7 O) ~
  18. *. ~: R. i6 O" h6 U6 Z+ O  v' d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; O6 ]- V. A$ s
  20. * kind, whether express or implied; without even the implied warranty
    ! K3 [0 a3 a- X  ?5 @* y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 }! l2 O$ [$ p- E3 g- S2 G& a
  22. * GNU General Public License for more details.2 j- ]+ T* @3 ?1 \6 t
  23. */
    , S# m! a. G0 }4 B
  24. . g1 A5 u* l/ w1 g, j. o! K1 F
  25. #include <linux/module.h>
    1 j$ N  l3 z* |- W4 i5 u2 g3 Y
  26. #include <linux/init.h># c+ o3 B" O% l+ P- C( ~# l0 `. Y
  27. #include <linux/errno.h>
    # o( J( T! \/ ~6 L% x: M# w0 A
  28. #include <linux/types.h>* X! M& u( L$ y1 n# k# k( f
  29. #include <linux/interrupt.h>
    " S6 A7 _" ?) V: n6 _+ l: F
  30. #include <asm/io.h>
    3 M8 _- O6 c. E# b
  31. #include <linux/moduleparam.h>* Z; v" ]6 l7 h# T
  32. #include <linux/sysctl.h>* g, M- F4 _  a$ J: Q: z
  33. #include <linux/mm.h>, Z) ]* b4 s9 t8 X
  34. #include <linux/dma-mapping.h># Z1 n/ s+ M1 l- o8 P3 ^$ U
  35. . K" \0 N! @8 y( B
  36. #include <mach/memory.h># e# N% C8 y8 B; `' ]
  37. #include <mach/hardware.h>0 R: I+ {& b2 N4 a8 ?% G) ?
  38. #include <mach/irqs.h>
    . E/ Z+ @; W& f/ Q7 X
  39. #include <asm/hardware/edma.h>
    & P7 C0 E% Q$ z/ e

  40. 8 M. q$ b, g' S
  41. #undef EDMA3_DEBUG
    , j+ e, {' `1 M
  42. /*#define EDMA3_DEBUG*/# b- d9 c5 a# Q+ i6 \% c$ N( I
  43.   Q8 t( ]+ O6 }
  44. #ifdef EDMA3_DEBUG
    8 m5 q. C! E% z3 r2 M8 v- U0 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% C6 k1 s  o0 j2 w: C* r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 H" f$ Q1 N8 b: R6 g8 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' A! A( |! N" O( T' C* z6 Q
  48. #else4 q$ P+ }- r1 d/ K' N5 b
  49. #define DMA_PRINTK( x... )  v- _! [0 `9 F( J5 r8 m" j: k
  50. #define DMA_FN_IN
    3 V# K! Z% U; U) }
  51. #define DMA_FN_OUT& v: Z3 E1 z: S* r. ?
  52. #endif
    ( r  L4 D4 E7 ~8 H" O
  53. 4 V7 A! M/ x+ R0 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % l9 D/ T3 s) c0 y
  55. #define STATIC_SHIFT                3
      L+ S9 o9 t/ h1 I3 n! G
  56. #define TCINTEN_SHIFT               208 [# P$ i/ x/ p1 Y: p
  57. #define ITCINTEN_SHIFT              21. D7 \0 R% u5 E$ a- }( Z& @9 J
  58. #define TCCHEN_SHIFT                22  m; P! r$ s+ X: @1 W7 {% F
  59. #define ITCCHEN_SHIFT               23
    - A/ w7 u9 c) `+ ]) s, d

  60. ) R/ j. y3 W% x7 k
  61. static volatile int irqraised1 = 0;
    0 Y4 P4 \, E$ D- O' E7 {& c
  62. static volatile int irqraised2 = 0;
    ( _( Q6 y* c, L0 f) ?  s

  63. 6 z6 y5 O% k# O1 v" Z4 \) o/ n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- z9 l# E0 w) T7 O( W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % O8 T8 s4 D* h& ~6 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 Q, f' C8 s4 G* G

  67. 7 ^1 }( E) `+ a+ j8 U
  68. dma_addr_t dmaphyssrc1 = 0;8 D! v% Z( r+ `8 U. Q: {! x2 o7 g
  69. dma_addr_t dmaphyssrc2 = 0;. L0 y/ T3 i/ E3 B8 @
  70. dma_addr_t dmaphysdest1 = 0;/ z* Z9 D( r, o+ G) b
  71. dma_addr_t dmaphysdest2 = 0;0 t1 e: o. p( T, z! M

  72. 8 C$ w) u0 d6 U2 ^' {# l# n' d
  73. char *dmabufsrc1 = NULL;# p4 v8 O+ E1 q. J; p
  74. char *dmabufsrc2 = NULL;
    & {: u! `8 L# B% _- `) v
  75. char *dmabufdest1 = NULL;5 j* E7 Q/ O  b4 Y
  76. char *dmabufdest2 = NULL;7 S9 X: U8 \6 F

  77. 5 Y1 U, g/ Y9 x4 v3 h3 ], \; T
  78. static int acnt = 512;
    ) O1 F& b8 d. \4 w+ \$ j3 ^
  79. static int bcnt = 8;
    8 }8 T% o2 v  x
  80. static int ccnt = 8;7 D  w8 Z( s0 H& \2 j3 B
  81. 6 o, V0 P, D5 U7 `8 f% ?% U: _* S8 y
  82. module_param(acnt, int, S_IRUGO);8 A1 k# g* w( X
  83. module_param(bcnt, int, S_IRUGO);
    6 y4 r5 `; j. L9 J5 G0 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! ?, L2 m! a- N3 C& D. M  ]" ^. ^8 U4 ^* F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( E- O' L6 e0 M- a2 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# O9 a8 Z$ `5 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 z$ ~% `; d: B) P# g, e% A. `2 B$ }: |' M7 z, d% G/ A
- q0 U/ j/ l' |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-12 13:55 , Processed in 0.044230 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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