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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  t8 [# V2 d- v* [
  1. [code]EDMA sample test application
    - U1 t& w4 u5 U. a  O, \0 c8 u
  2. /*5 G1 H) z: o' P3 i) \
  3. * edma_test.c% M3 m( u, T  S( h% N/ H' Z
  4. *
    8 S; P1 u% r# Z3 O; m: H/ g
  5. * brief  EDMA3 Test Application) G7 ^+ G; Y) G1 L1 [0 Q
  6. *
    5 m! |4 g* @1 z) {/ t# E9 M  P, L
  7. *   This file contains EDMA3 Test code.) a+ m( A, G: z% J' B8 w
  8. *$ z& I) H4 p2 ^& f2 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # ]: _2 W/ D: X) J/ Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 D1 n4 E: e9 F0 Y
  11. *         TO CHANGE.' w% i6 D2 c: r8 R1 @1 _5 @
  12. *4 J. t$ D6 ?3 Y* v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ `$ R- m5 I" H, O  s
  14. *, J4 `0 h( g( _+ P5 c, Z
  15. * This program is free software; you can redistribute it and/or
    ; X/ |5 G6 I- d
  16. * modify it under the terms of the GNU General Public License as4 F. X4 e& }# r6 g  L% p6 j' f
  17. * published by the Free Software Foundation version 2.  h% z" g8 g" m" h
  18. *. b- H7 x( c% Y+ {4 g. z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, X  g8 h8 k2 K' f0 G$ O+ `
  20. * kind, whether express or implied; without even the implied warranty
    ' ^  d" \. m& U7 d4 i" r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - h& X# [: e; R0 L: Q
  22. * GNU General Public License for more details." O% Q& f5 Z! B/ ?& v2 `" o
  23. */
    6 y- f) P) c/ L. B
  24. ( K! ?& A# ^" j6 s
  25. #include <linux/module.h>! q4 V8 N% G& z* N, l- D
  26. #include <linux/init.h>9 B: X, X5 y9 a7 c8 n) {
  27. #include <linux/errno.h>
    ( D7 _4 @: G8 a0 K7 V
  28. #include <linux/types.h>4 |' ]7 Q5 G( \4 V  r
  29. #include <linux/interrupt.h>- }; j. y- p/ P; \  G1 A. L
  30. #include <asm/io.h>
    1 W  c' r  }7 j5 A7 R
  31. #include <linux/moduleparam.h>! V' T0 y* R/ E+ A
  32. #include <linux/sysctl.h>% C; x& a: \* D( Y+ o
  33. #include <linux/mm.h>
    9 _3 {, A$ Q' _' n- f/ e
  34. #include <linux/dma-mapping.h>
    8 j" V7 o& \% D" A7 g

  35. " f! Y" m; ~- ?% ?7 F8 \
  36. #include <mach/memory.h>
    ) _0 U+ i. g) b+ g/ [1 V2 J& W, W
  37. #include <mach/hardware.h>7 \1 `, M" T; @
  38. #include <mach/irqs.h>% M  [7 {) G) t! {, D8 B
  39. #include <asm/hardware/edma.h>2 i7 D/ ~- A. x  p$ U
  40. 9 g6 ^9 {) x. F, e( v- q% U) I( K
  41. #undef EDMA3_DEBUG8 @/ x2 @. R. k9 ]* f1 ~
  42. /*#define EDMA3_DEBUG*/
    6 P  R7 O) w- x- Z+ `" |5 U
  43. , S" I: l; @9 p% \
  44. #ifdef EDMA3_DEBUG5 T+ n3 }- p( j( s, ]0 t/ n6 \6 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ h$ r0 d. U/ Q: |/ O9 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% a% E- Z+ C0 {" x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " n$ S  x) v$ R
  48. #else+ D4 E$ Q% b6 h. o0 `
  49. #define DMA_PRINTK( x... )
    ! J5 k* f! h3 I
  50. #define DMA_FN_IN
    ) j9 S% @+ B: |& f' B. X
  51. #define DMA_FN_OUT
    % @3 x1 o$ `3 D. {. b1 s9 l' e: s
  52. #endif
    ' U5 X; ~5 O/ P

  53. 3 _# a' r% r5 y+ u9 ^  d3 H3 m5 S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 N+ X2 F( G$ F: u
  55. #define STATIC_SHIFT                3
    ; m9 ?/ c1 M; a7 Q, F
  56. #define TCINTEN_SHIFT               20
    - Z( R  [# n8 o) J2 p/ u: o$ u+ j( |
  57. #define ITCINTEN_SHIFT              21
      v. [* N& B5 l4 F$ Y
  58. #define TCCHEN_SHIFT                22$ R5 ^) [! ]) m& d0 B. r% z
  59. #define ITCCHEN_SHIFT               237 j4 D6 U+ m8 c$ \9 M) M2 G, Y& n" V
  60. - R: m" k& @+ G
  61. static volatile int irqraised1 = 0;
    % L: }) j& U1 T
  62. static volatile int irqraised2 = 0;
    2 v2 k1 k/ r4 \1 S7 t
  63. ( r2 Q- E  O0 a0 w0 h" N' f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ d& u$ {' J0 O5 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 v% n2 e  i  x1 m7 F! W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' z* Z, M( C% Z8 u9 [9 ^
  67. & A' ~4 v2 P& q
  68. dma_addr_t dmaphyssrc1 = 0;
    % g9 ^9 F; }2 `1 O2 E) a2 N7 P/ y
  69. dma_addr_t dmaphyssrc2 = 0;
    7 p' Q  x0 n  h2 x* L7 Y7 T
  70. dma_addr_t dmaphysdest1 = 0;  `1 |6 c3 e: i! L& d: L+ o
  71. dma_addr_t dmaphysdest2 = 0;1 N* R- V. v6 t$ m) G4 ^+ t& f- f2 H
  72. / v& J8 V9 d! G) M  s. v
  73. char *dmabufsrc1 = NULL;" V+ H: e& n# {. c
  74. char *dmabufsrc2 = NULL;6 P% n2 W) s. }* d& V
  75. char *dmabufdest1 = NULL;0 t  \% F2 [  x. l5 a1 e
  76. char *dmabufdest2 = NULL;
    5 e  a: r3 Q! D# ]

  77. & q% M+ P2 H1 |( y1 _' g; l
  78. static int acnt = 512;
    8 i6 b: u4 V# G( ^
  79. static int bcnt = 8;
    . i* F1 [  w0 c$ a
  80. static int ccnt = 8;4 M2 t9 c+ _5 B( o( \

  81. # o; L  g8 S+ c; }5 V: v
  82. module_param(acnt, int, S_IRUGO);
    0 U' c' v7 }9 x$ m1 n! ^
  83. module_param(bcnt, int, S_IRUGO);
    & r6 |! N9 t# g: a  q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 [- S4 j. w  Q$ |+ o  V# S4 }. V: V* _8 v4 ?8 P) ^  w9 q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: D$ Y8 @9 ?3 @# B! w" q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 O, z. {) ]7 \* n* g& c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  x! h- \7 |- u! ^/ a" k

1 q( T0 {! g0 ^: Q9 c6 O9 a$ \
$ [4 q/ n9 L; W/ w4 R& M( q& Y- d& C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 20:04 , Processed in 0.043819 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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