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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 y  p: a1 p- K0 i; D+ G3 I
  1. [code]EDMA sample test application
    9 S- x; p+ s: x$ Z9 c
  2. /*/ ], |$ u! P2 r6 ^6 Y, k5 j) i8 ?
  3. * edma_test.c. X2 `5 q+ S, h& J* w, C% ~- O/ K
  4. *0 e1 Q* R- U* ?
  5. * brief  EDMA3 Test Application
    8 B7 w% ^( B: h' J
  6. *
    # z( x  F* b; F7 S- x3 p
  7. *   This file contains EDMA3 Test code.
    . h2 p# ]9 V6 K' X3 \& H
  8. *' h+ \. ^; V3 j# z; H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . e$ ]: V. l7 D9 L3 q, v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : V  j9 o9 o& m5 @& H
  11. *         TO CHANGE.& ~3 E( O4 l. J7 b" _; S$ I
  12. *" ]' C* }9 t. T4 @+ O/ v/ T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . c6 G' E( E/ D, U' Z( c' T+ o
  14. *; j! \- T" m5 {5 E
  15. * This program is free software; you can redistribute it and/or' W. Z. p: N+ e  O2 C  n4 o; X' U
  16. * modify it under the terms of the GNU General Public License as7 d+ Z9 [+ p; {' F5 M# V: S4 L
  17. * published by the Free Software Foundation version 2.7 l$ T+ I' f, }* F) w
  18. *
    , ~+ F. U: Q8 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) D8 [: V3 S5 g
  20. * kind, whether express or implied; without even the implied warranty
    ' G' u# ]- Q  a, B  x: i; b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 j1 A2 Y& N: k! a
  22. * GNU General Public License for more details.
    4 w; @' g5 P7 w% o, a
  23. */
    $ e* X. [8 ^3 {! ?

  24. 6 Q1 n- j& o2 T1 q0 @
  25. #include <linux/module.h>
    7 c  k) a4 V8 e# Z* S
  26. #include <linux/init.h>
    0 Y- u. N" V7 S6 s& x+ V' \
  27. #include <linux/errno.h>. K+ U  z/ Q. @1 t
  28. #include <linux/types.h>9 _" \1 W" h* T& v
  29. #include <linux/interrupt.h>: }* V5 s9 G4 t" ]) }7 T; ^7 ~
  30. #include <asm/io.h>! l1 r- n% h  C, o% J
  31. #include <linux/moduleparam.h>5 w  P* ?% A$ D4 Z- B) v3 r1 G
  32. #include <linux/sysctl.h>
    # D; M8 x5 l$ L- Z+ {' w: G
  33. #include <linux/mm.h>0 m4 v' N" Q3 J
  34. #include <linux/dma-mapping.h>
    % D" [1 O' ]- s5 }$ k

  35. 4 ~) ?5 R1 `4 X& ], |
  36. #include <mach/memory.h>
    / J- i% Q4 Q  [; u2 `+ o
  37. #include <mach/hardware.h>$ r; q% x& H6 O) l
  38. #include <mach/irqs.h>
    ! }$ c- n3 t! a$ k: h  R
  39. #include <asm/hardware/edma.h>$ y+ F4 o* j! T: x' q/ b( i
  40. : C' m6 s  v) g! T5 M: g; i
  41. #undef EDMA3_DEBUG' ^% n4 u2 T. @& a9 H* v( f0 A' `% m
  42. /*#define EDMA3_DEBUG*/1 |3 |& e$ @% N% J' U+ a8 M

  43. 2 k4 e: q$ N! e, N  R
  44. #ifdef EDMA3_DEBUG
    ) q( y9 N2 F. ]) n, A5 S. ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 E! r, |- N: P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , S6 G8 Y. M% T- p/ Y4 i0 P- ^( K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ l" M8 Q: M3 f/ K4 E3 i
  48. #else9 U' M# h0 o. ?5 r! x
  49. #define DMA_PRINTK( x... )% p  S7 k8 d* m% x
  50. #define DMA_FN_IN, m4 A8 P" U& r% n; A  ^
  51. #define DMA_FN_OUT
    3 z/ j4 G' |2 \# I" @/ v! i- [$ P
  52. #endif" `6 {! G' W1 p6 A
  53. 2 S$ g  u7 ]2 v5 H0 w6 s0 g/ Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - T; |3 p2 u% ]3 L- g2 E
  55. #define STATIC_SHIFT                3
      v9 u( R0 h0 R7 X
  56. #define TCINTEN_SHIFT               20
    , N6 ?3 c7 k2 Y( u
  57. #define ITCINTEN_SHIFT              21
    7 a0 P8 ?3 W% @, o
  58. #define TCCHEN_SHIFT                22
    8 K3 S' G! t. m- j
  59. #define ITCCHEN_SHIFT               23$ p9 j4 d! I$ N) g. e
  60. / U0 F* z  s% R1 d* G4 Z' Z9 x0 Q
  61. static volatile int irqraised1 = 0;# _5 I/ N: z( b0 a' g
  62. static volatile int irqraised2 = 0;* {6 W; z! j0 w4 o

  63.   t+ P# D: h2 M: Z& K1 ]9 H5 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 _$ n" W1 @: e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , t; p2 n+ _; m5 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& k/ W3 m  S$ v) Q

  67. " I+ x) y( c. B1 v+ b
  68. dma_addr_t dmaphyssrc1 = 0;8 T- i7 O0 W" z  @
  69. dma_addr_t dmaphyssrc2 = 0;1 r9 |1 X' p; B4 p2 g3 |' F: T) R
  70. dma_addr_t dmaphysdest1 = 0;
    , J" u  _0 z( J5 n
  71. dma_addr_t dmaphysdest2 = 0;
    1 _% l8 ]: }7 [% E5 W3 e8 O4 H: S
  72. 7 w  V- {2 y- q+ O2 B8 K5 E" ?
  73. char *dmabufsrc1 = NULL;
    2 V/ ?4 T) w. F# w+ H- R1 F
  74. char *dmabufsrc2 = NULL;
    " o8 f: e9 R& T- R  R
  75. char *dmabufdest1 = NULL;
    2 t, X8 a/ l- e0 G$ u
  76. char *dmabufdest2 = NULL;
    7 K& Y, y9 E) H0 X

  77. 7 k( j8 P8 u/ o
  78. static int acnt = 512;
    ! _, \) T+ e( K1 ]% H4 |2 T5 S
  79. static int bcnt = 8;
    ' Y0 R* V9 w+ e& G
  80. static int ccnt = 8;& N! Y& [/ J6 }1 |; P

  81. 4 R2 S$ ]! t2 }" a6 l3 h. C
  82. module_param(acnt, int, S_IRUGO);
    + x" y  i) b' T- C; D
  83. module_param(bcnt, int, S_IRUGO);$ j' x8 j- O# K* H  ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 C9 [" `/ T6 d4 l$ J& X/ [; \" ^. e2 F: E  V+ r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! J: Q- ~; P$ Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ `( E# Z* u. K0 w5 ]% j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* b. R; D* ^" V8 q
, V3 U& a2 l$ E1 t

6 r% Q3 a2 B9 T  ^" y# u( C& S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 10:25 , Processed in 0.038541 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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