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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' P, }( V1 F$ x; y9 X! R. K
  1. [code]EDMA sample test application* e7 K$ Z7 u1 }
  2. /*
    1 G" K& w: k, d8 O6 f1 T
  3. * edma_test.c
    ) E5 k4 @# }& i7 |; ~: _
  4. *5 j3 M0 q# ^2 q0 H+ D
  5. * brief  EDMA3 Test Application- R  X9 t8 A* |) i2 q3 l$ y
  6. *5 Q3 i3 f$ A8 [6 e9 ~0 ^
  7. *   This file contains EDMA3 Test code.
    6 q" ~) R) d& {# Y. Y
  8. *+ G# Y. [0 Y- A% |4 r! _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# Y& r# S5 O& w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 x) t9 V- M0 N; V* r
  11. *         TO CHANGE.6 ?. W. s# _3 |
  12. *
    4 \8 P6 M4 M" b' N6 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 l/ K6 B7 [" z3 Q" \
  14. *
    . v% @: t, N! _
  15. * This program is free software; you can redistribute it and/or- [1 ~  u! @' \# v+ O
  16. * modify it under the terms of the GNU General Public License as
    / V0 \6 d5 E4 C4 Z- @
  17. * published by the Free Software Foundation version 2.5 o% S/ n: l2 C+ ]6 T
  18. *& ^4 \# D8 C! g% c; n% R( D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 O* k  c; w1 e' W! o, k8 l
  20. * kind, whether express or implied; without even the implied warranty* q; Y8 z2 k: k( q: a0 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- |( u+ {; g2 W
  22. * GNU General Public License for more details.. Y( y5 e& ?4 y( p3 l( B2 n
  23. */
    ' a5 K' G% c4 m2 ]4 ]8 ^9 o

  24. . M. ^9 {# a8 j( J* E$ ^: B! r
  25. #include <linux/module.h>
    - W) b7 w( V) Y
  26. #include <linux/init.h>
    6 ^2 r& O# p4 m2 o- i
  27. #include <linux/errno.h>
      \5 E& q% V/ V1 l
  28. #include <linux/types.h>1 ~1 E1 [% p* S7 ~. m
  29. #include <linux/interrupt.h>
    6 |. a8 B) ], J# S) W+ s% i
  30. #include <asm/io.h>( f7 ~. n; s3 z  m. y
  31. #include <linux/moduleparam.h>
    1 {0 ~4 Y9 u3 `. V
  32. #include <linux/sysctl.h>+ Z# t$ W4 d8 G
  33. #include <linux/mm.h>
    . f* `' x- m/ P
  34. #include <linux/dma-mapping.h>
    % D9 y9 J& T. K- S5 F

  35. ! g7 v+ r) z7 q, c- t# S
  36. #include <mach/memory.h>. j+ y. \' c6 B3 u% `# K. k
  37. #include <mach/hardware.h>
    . T, m& Y. K5 s
  38. #include <mach/irqs.h>7 r+ u/ j/ N4 w7 n: u
  39. #include <asm/hardware/edma.h>
    $ Z: Y5 W5 y+ @

  40. 4 U" @/ P2 c. f6 `
  41. #undef EDMA3_DEBUG
    0 \* j" h7 q' Z& J+ L5 ^1 }
  42. /*#define EDMA3_DEBUG*/
    8 [( X) o3 L  _( L8 r' Y; l5 ~! _

  43. ; ]( o& P& S5 X9 T: _6 |: Z
  44. #ifdef EDMA3_DEBUG
    6 S7 y* M4 U% h1 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' v( q: a$ |! t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 ^" q2 |+ S4 j. _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 d8 x3 z+ m  a
  48. #else+ a$ m1 v: I" O6 U
  49. #define DMA_PRINTK( x... )
    1 @2 b- H+ ^; R; s$ R6 [) u" _
  50. #define DMA_FN_IN1 O& t' @3 s8 |' ~3 z
  51. #define DMA_FN_OUT9 @7 T2 W! u+ l
  52. #endif
    ! a5 J3 m- C0 q! w9 A- Q, {
  53. / W# K# V7 F, ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 [# a  x7 l4 L3 ?2 L! o) T5 T
  55. #define STATIC_SHIFT                30 g6 [7 i/ y: a6 i& [
  56. #define TCINTEN_SHIFT               20
    - K$ S2 D% P7 W. I% V
  57. #define ITCINTEN_SHIFT              21, |2 X/ [! u/ ^7 m- E9 M6 Z1 p" ?9 @
  58. #define TCCHEN_SHIFT                22" O: _! r1 M! s; u/ G
  59. #define ITCCHEN_SHIFT               23% b) S( q" U% H6 [% }; V" I$ i
  60. 0 K* [6 E9 L' v3 |
  61. static volatile int irqraised1 = 0;
    + p2 @( `. u  B- U& y- ]
  62. static volatile int irqraised2 = 0;2 S* p+ f9 N, [7 x; d2 g* K
  63. % v1 P  E* g+ b0 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) l# t: h/ G6 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& D6 h8 R+ M7 @3 D. G& Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' J$ C: ]( ~: S9 i0 o* Q

  67. - I+ }/ Q8 F9 q/ G
  68. dma_addr_t dmaphyssrc1 = 0;( D1 w: @  a; h1 _- K8 k' D
  69. dma_addr_t dmaphyssrc2 = 0;
    : ~$ Z' V9 h, ^
  70. dma_addr_t dmaphysdest1 = 0;% @& F* ]' B+ N$ A/ g* d' O
  71. dma_addr_t dmaphysdest2 = 0;% t! e+ W+ K  [" e* P9 ?$ a

  72. ! V$ o# k) `) V
  73. char *dmabufsrc1 = NULL;" v$ P: [% }& P# k7 W
  74. char *dmabufsrc2 = NULL;
    1 ^* i& {, t+ N" n* y
  75. char *dmabufdest1 = NULL;
    3 V4 W# d' P" ~  o7 {
  76. char *dmabufdest2 = NULL;
    9 F; M3 h3 x& ~9 o$ [

  77. $ G* J+ R$ g+ y8 P* P& \
  78. static int acnt = 512;
    0 G1 R8 a* Z$ l* M) H$ V5 I- f
  79. static int bcnt = 8;! S1 s) ~: c# Q: \6 x7 D
  80. static int ccnt = 8;
    ) `8 V6 ]# G; u4 |; @) H9 R

  81. $ Z4 \8 x: a7 P" Y' Y5 h) L
  82. module_param(acnt, int, S_IRUGO);: ~# v+ n% Q% y. F4 _; G4 a
  83. module_param(bcnt, int, S_IRUGO);0 o# c- [1 g& s) `! e% [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* z# B9 L+ A* P
. h8 E3 O& a; x& M* O, e8 D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- `" Y! B$ m' E9 z0 R% C$ ^" S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 ^1 x; n0 ^- ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 a5 O% Y- ~: Y4 b

4 x* e  r# Q  I7 V0 \
0 P: f7 x* T( \. n9 T4 E% b' f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 23:05 , Processed in 0.045459 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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