OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 ]6 H" ^1 S& R3 e& P# F
  1. [code]EDMA sample test application5 f  ]& X0 c, G9 O& R- J9 b2 _/ g' `+ R( v
  2. /*- P4 h  O! Z9 M7 ~
  3. * edma_test.c
    % }8 c' u8 ]* H5 y0 H: J1 R5 _
  4. *
    6 Q. u) p6 V6 }* D* p
  5. * brief  EDMA3 Test Application
    9 ?6 `1 u( ]# ~
  6. *: _8 l, [! q" M# o+ `# u, X
  7. *   This file contains EDMA3 Test code.
    ( i+ K( O: V) p* q: P
  8. *
      ]5 B) k& w( J- P0 n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      y# k. H" m4 @% ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 e. g7 r% i2 {2 {8 i8 M0 I9 V% c% V
  11. *         TO CHANGE.5 U. I8 o2 s1 @0 P0 S
  12. *
    ; e% v7 r- J; x7 \5 v. S9 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / p" l" X- ~0 l, u
  14. *" _2 N7 v0 B: A) u  K
  15. * This program is free software; you can redistribute it and/or$ i" R2 t% C, i
  16. * modify it under the terms of the GNU General Public License as
    * q1 I) l+ Y, k$ \
  17. * published by the Free Software Foundation version 2.
    9 n, q4 x1 J$ D0 F: j# p
  18. *, M4 U; e  `( ~3 {' {6 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( }: L7 ]! v' M: f
  20. * kind, whether express or implied; without even the implied warranty" O. `7 o4 Y. O. ~: N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % Q3 {" P% ^: u
  22. * GNU General Public License for more details./ K0 ]* s  J7 y! v% Q4 M3 L' v4 d
  23. */
    : \. Z; b+ y, K5 ?

  24.   a: b( U1 L1 T6 K
  25. #include <linux/module.h>, o; s# a" \  T- G2 t) j
  26. #include <linux/init.h>4 ]% t0 ]. F9 s2 A% O9 h
  27. #include <linux/errno.h># M3 c+ }5 k/ j& x8 ^) L
  28. #include <linux/types.h>% W0 N; P" @: r
  29. #include <linux/interrupt.h>; J4 I5 r0 z- @# Z
  30. #include <asm/io.h>: u+ h2 E8 ?4 @7 |( ~
  31. #include <linux/moduleparam.h>
    3 P  u2 H8 s9 j4 \, T2 B* j% n9 x; B
  32. #include <linux/sysctl.h>5 {" J& z6 C8 b
  33. #include <linux/mm.h>3 v1 f3 K6 a8 M1 O% d% I
  34. #include <linux/dma-mapping.h>
    + p0 t9 S/ c* e1 `+ _

  35. - b4 L6 s2 T6 ~, h$ ]2 T
  36. #include <mach/memory.h>% `, I& t( ~# _* ]/ J# _$ R: p
  37. #include <mach/hardware.h>' c+ A, ~) P6 s$ K% b$ s! J
  38. #include <mach/irqs.h>
    / t& Y  x' A# Y
  39. #include <asm/hardware/edma.h>
    ) y: l: q0 {1 `7 B0 a+ G
  40. ( x; m7 V/ X1 G
  41. #undef EDMA3_DEBUG
    1 X9 V! N) C7 C8 _3 z
  42. /*#define EDMA3_DEBUG*/6 V: s+ E( t$ e1 H) u; H: z
  43. # M) n; Q7 [+ R3 Q7 E6 u
  44. #ifdef EDMA3_DEBUG
    * v8 Y3 j$ h# H8 W2 O# r7 q& k7 c2 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); \* y9 K' O1 l# \( W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 S% J6 L% a' c" \; d2 o  V1 A: |! q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 w, z1 |- _" c! n% _1 M" }) Y
  48. #else
    0 |: H! |8 R" ~! `, b
  49. #define DMA_PRINTK( x... )% ]- h* h8 W: F' Z- r1 I
  50. #define DMA_FN_IN
    5 u$ E6 Z  P: X& J- y" G) O
  51. #define DMA_FN_OUT5 l* f: b4 [, j
  52. #endif
    , g2 T" c7 q# u

  53. 4 T" `* z6 a( k# {. i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). P: W2 w  {2 |4 n% F7 ]0 {2 n* B) D; B
  55. #define STATIC_SHIFT                3
    - I. _: T9 k4 O* Z0 b
  56. #define TCINTEN_SHIFT               20
    - D3 a# a  U6 k; r6 [: r
  57. #define ITCINTEN_SHIFT              218 f) `7 U1 ]4 P) r
  58. #define TCCHEN_SHIFT                22
    # }% l5 j3 j$ y  a: N# J
  59. #define ITCCHEN_SHIFT               23
    0 U: M6 v( L7 w& _" R$ t

  60. + P4 E! R& ^  u1 W- l: ^
  61. static volatile int irqraised1 = 0;
    . o) d" z6 M7 E6 N
  62. static volatile int irqraised2 = 0;& B0 Y6 E( q& s' W; ]
  63. ' D* l1 W/ N7 N( x3 @- I! G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 X2 h" f+ B2 z9 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% [3 C  e9 m; h1 x7 R# n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " r7 o+ c2 ^9 B1 O& `* C
  67. 8 W5 r$ i0 I# ~+ g
  68. dma_addr_t dmaphyssrc1 = 0;; M9 q1 a1 V1 l* K6 O3 ^
  69. dma_addr_t dmaphyssrc2 = 0;
    9 V3 P# d* M9 ~9 T. @0 g6 \* |2 M
  70. dma_addr_t dmaphysdest1 = 0;: }2 O, ]9 I# U  ?( v4 t4 a
  71. dma_addr_t dmaphysdest2 = 0;
    * j) x1 f" p, S; q5 w' F" R8 C
  72. - a# z/ n' ~+ {1 G
  73. char *dmabufsrc1 = NULL;
    1 L# J2 O3 h3 W" t7 m- J5 T
  74. char *dmabufsrc2 = NULL;) T- p, G0 q& N- `
  75. char *dmabufdest1 = NULL;
      I5 B  R* N4 N: b
  76. char *dmabufdest2 = NULL;
    * Q+ j+ N. I! p) {# w& O$ s9 }

  77. $ D; w+ a, B6 O, v8 l) ^6 V8 C, @" K
  78. static int acnt = 512;1 H( N- ]( \1 C6 U  Q9 J
  79. static int bcnt = 8;7 j4 C# O* y4 b: u$ F
  80. static int ccnt = 8;
    3 @1 K& A0 G) b- V

  81. 7 G# }. F- B; \6 w. J6 d& p- ?
  82. module_param(acnt, int, S_IRUGO);9 y6 L1 [/ k" ^4 x
  83. module_param(bcnt, int, S_IRUGO);
    ) ]9 |# D5 S7 W6 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 @1 E0 r8 J# H$ O6 l1 s( |  r9 A

0 b# W7 o: I# i7 E5 R& K) E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: S  N4 \( N. ^3 N0 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" x2 h" G* x4 I' Q! {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 O8 C4 A! d5 a! P5 q3 l+ l5 d; X

+ e: i, e# z& ?' m) R. M. d, b. E
1 I5 I) {, K+ H5 C' [, D- R+ y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-11 08:03 , Processed in 0.038060 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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