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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( C; r& o& Q; t& M' k# C
  1. [code]EDMA sample test application& @# e/ Y2 s0 f2 ^' Q) U
  2. /*
      G. m) s& }7 u; Z% \2 T4 A
  3. * edma_test.c- S: D: E3 ?: @  Y9 R
  4. *
    7 E/ m1 J% G# L- F" b
  5. * brief  EDMA3 Test Application
    " F6 X$ R% \* [2 H8 Y
  6. *
    # \  N7 }1 N( g6 m+ R: I- w! a
  7. *   This file contains EDMA3 Test code.8 V- O1 e5 F; I: E! T5 i# s
  8. *
    / F+ N7 Z# v4 c8 i, B; Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " R4 O2 v5 Z. Q, w: g' u9 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! q& w+ |: _: i9 B* ~" ?9 K
  11. *         TO CHANGE.. r$ X/ B" ]6 D& _
  12. *
    5 Q$ C* J5 m5 q. T7 H9 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 ?" g# u  P# a2 I' e0 v& S
  14. *- I8 S$ w+ o1 U4 c; H' ?3 k
  15. * This program is free software; you can redistribute it and/or$ [! r1 Z/ O$ H; x3 T
  16. * modify it under the terms of the GNU General Public License as) s/ g. y9 F1 L5 C: W: f( M
  17. * published by the Free Software Foundation version 2.- }# `" f. k: i  x4 U9 X1 h
  18. *0 W7 b9 E* [. P3 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % M* U4 b2 B( A7 L7 f3 L! s# T) l2 P
  20. * kind, whether express or implied; without even the implied warranty( w9 w7 U7 l- e5 i% L$ @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; V( |5 L+ E2 P$ y9 D
  22. * GNU General Public License for more details.
    # ], A" _$ i% m3 Y: w
  23. */0 K8 @4 a5 y; {  j
  24. 0 \% k: H# f- x
  25. #include <linux/module.h>
    4 }) x. Z% C2 n% O) z  I9 x4 e/ f6 E
  26. #include <linux/init.h>. V" R; ~5 H# c  v6 ~
  27. #include <linux/errno.h>: B2 `8 Y3 ?5 W: @: F: s
  28. #include <linux/types.h>% }( y  u, Y' Z$ B5 H8 }0 s8 X) b
  29. #include <linux/interrupt.h>
    ) c) W2 _# U+ n- _" w% g5 X& r% e
  30. #include <asm/io.h>
    * E2 |& t9 n; P
  31. #include <linux/moduleparam.h>
    9 r( h3 w& u, ~; D
  32. #include <linux/sysctl.h>, X7 r  `) j2 ]$ @6 X0 ?
  33. #include <linux/mm.h>5 h. {! ]: a) b6 ]8 T6 C' V
  34. #include <linux/dma-mapping.h>
    2 g( p8 r; ^6 L
  35. 1 A- J5 H& P% C" g, R
  36. #include <mach/memory.h>. A  \4 r% b% l; |* h3 W- w
  37. #include <mach/hardware.h>4 S9 K5 k8 }2 x
  38. #include <mach/irqs.h>
    8 O( q9 t( V/ Y6 L
  39. #include <asm/hardware/edma.h>1 \8 e* G+ ~0 Q# Y8 Z, k0 P

  40. ( {! P; V* u2 l+ E& `
  41. #undef EDMA3_DEBUG+ S: M. w& L2 A; w) a7 _5 G: L
  42. /*#define EDMA3_DEBUG*/
    * H3 u7 `0 I( }4 m

  43. - L& Z0 \0 l8 _8 i, L7 W
  44. #ifdef EDMA3_DEBUG6 y. {5 U. T$ l& T$ h. a) T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- X' ^. T6 h. A! v6 [( H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; w" H. X0 Z5 R' Q7 b9 D6 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 i, m( P, L* J% I- T
  48. #else
    ( Z# E  ^5 Z; A. b2 Q4 q
  49. #define DMA_PRINTK( x... )6 O! a  M' p  d: Z$ V
  50. #define DMA_FN_IN
    2 g$ Z$ F' y9 O( X+ c; A
  51. #define DMA_FN_OUT) b* v( l4 \9 T0 L
  52. #endif
    5 J% @* u3 a. T/ n; w4 e. O

  53. ! z( c  r; s( `2 n6 w$ H7 \/ S* j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 L6 r& U* \9 J. @
  55. #define STATIC_SHIFT                3) t. _1 L% j* u' o# F; j$ u# N3 t
  56. #define TCINTEN_SHIFT               20: `; I8 p! [' ]* G1 |4 O1 E( U
  57. #define ITCINTEN_SHIFT              21! _/ @; o: e3 w
  58. #define TCCHEN_SHIFT                225 u" C* i! m- p+ R+ d% k4 v* y! Z
  59. #define ITCCHEN_SHIFT               23
    6 R" D: ?1 m, v: G" ]! I5 @
  60. ; C$ B' v/ e3 S, E
  61. static volatile int irqraised1 = 0;7 ^: @, \8 l' v) ^1 h& G5 ~
  62. static volatile int irqraised2 = 0;
      A7 D1 y3 \8 v# t) Y

  63. " V& R* f6 P* Q) v! ]/ q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 M5 N% y4 p" |0 |$ Z( N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e. H7 z) [: Q* j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ h+ W( ?+ B( s  Q

  67. % U4 y8 p0 ]/ y
  68. dma_addr_t dmaphyssrc1 = 0;
    5 G  [: W7 F6 L) ?1 N1 R. K. W& t
  69. dma_addr_t dmaphyssrc2 = 0;/ a8 ^% r/ B4 L- N0 f
  70. dma_addr_t dmaphysdest1 = 0;
    ' H" M) G9 I5 {* @* o
  71. dma_addr_t dmaphysdest2 = 0;
    / c4 Q  ~7 t8 ?4 l0 h; Q

  72. ; W$ [) g! h: Z2 U/ z, _4 N
  73. char *dmabufsrc1 = NULL;0 a' U/ _9 {/ T# w. V
  74. char *dmabufsrc2 = NULL;
    0 j. D, R- k8 M6 M7 V: _0 H! U& t
  75. char *dmabufdest1 = NULL;
    $ J4 u5 L% c5 l
  76. char *dmabufdest2 = NULL;2 p6 E3 x  F' @/ Z) @6 p- d
  77. & R$ l' F8 h9 ^
  78. static int acnt = 512;
    ! m: P6 ~4 f* y" W
  79. static int bcnt = 8;
    5 t" t# n: L4 n0 z9 [+ H
  80. static int ccnt = 8;) ]7 t/ e7 N7 \, N

  81. & r# f: Z5 `# B1 A4 F
  82. module_param(acnt, int, S_IRUGO);7 @* ^" y8 E3 u
  83. module_param(bcnt, int, S_IRUGO);% k0 l2 I' u& y4 p8 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ G4 ~$ V' Q2 d2 N. R  z' G* e% l& D/ l) D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ i, P5 [0 g4 \$ \4 I' ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 I( B1 Y, ?$ T! ?7 u* b$ G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" J( s! B% M; ?- Y' v8 y
1 ^5 v' f$ {1 f; X/ i. N: R7 Z* O# O8 ?2 i- y* m" p8 n0 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 02:17 , Processed in 0.039881 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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