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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   b' r. k# H# c" `4 @& g
  1. [code]EDMA sample test application/ v; J! w. f2 Q8 d2 B. ]1 q% ?$ O2 l
  2. /*8 c* q" `% g3 O: M/ v3 T* |
  3. * edma_test.c5 E9 M4 Y# O% e/ ^/ B; F/ U
  4. *) |4 L" S+ G$ _) O: I, L
  5. * brief  EDMA3 Test Application! m  t( d+ t" H- T' B$ M
  6. *7 j5 \. u6 [) P4 E' X
  7. *   This file contains EDMA3 Test code.4 ^, B( G0 L  f8 R
  8. *
    / d2 M1 {, S) V# ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ P3 D$ s. R* Q) {  }2 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 Y3 D0 X, k' E. O" l
  11. *         TO CHANGE.
    7 V# Z% N0 E  z
  12. *
    6 L1 F! _( g( t6 h6 W" R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 \. v& P! Z/ [- c! _$ L
  14. *5 T) [5 o2 a3 g" N! v; \0 c9 b
  15. * This program is free software; you can redistribute it and/or
    8 |2 ~, U6 {8 f( L
  16. * modify it under the terms of the GNU General Public License as* l) {; p; J. U( n. B0 m+ ]
  17. * published by the Free Software Foundation version 2.
    - I  ]0 U4 B; r  v, k2 u; M" d- x
  18. *6 v8 j7 N7 ~, n$ D( g  @) a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 y- I+ t4 X* b7 p* ?
  20. * kind, whether express or implied; without even the implied warranty! M. q4 x, G1 s8 q8 i9 O) u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 e8 ^; _" P: M+ b% w- z
  22. * GNU General Public License for more details.# u# D- Y/ |: R8 G4 x3 t) b- x
  23. */+ }) I' J, q) U$ L" p. Q

  24. / b7 d  ]! j8 j9 U) \3 Z
  25. #include <linux/module.h>
    4 p% B2 T& U, R0 X$ {
  26. #include <linux/init.h>& y9 N8 X5 v0 @, u8 T9 Z5 D% x9 t
  27. #include <linux/errno.h>
    1 p$ `# F" H$ c( T
  28. #include <linux/types.h>6 V4 h. O7 j  B3 J4 L
  29. #include <linux/interrupt.h>. z; j# p7 F& z. [; y& `+ y
  30. #include <asm/io.h>, \: {1 R3 |1 }1 A! r
  31. #include <linux/moduleparam.h>" ^7 U; t% @8 L) ~7 n  o$ @1 ~1 n
  32. #include <linux/sysctl.h>
    0 e, j. j4 U$ Y. b; R4 |" z& M
  33. #include <linux/mm.h>
    ; ^! S' L# P$ W% g0 B% x/ C
  34. #include <linux/dma-mapping.h>+ C. E/ a# A" o* ^1 A$ h
  35. # x9 p. A4 F* A# U
  36. #include <mach/memory.h>& \* u% u' U* k& L3 Y- U+ i
  37. #include <mach/hardware.h>- L: K0 t5 }9 ~1 u2 _
  38. #include <mach/irqs.h>2 M8 h6 u7 X1 `% E
  39. #include <asm/hardware/edma.h>
    ; j! m" m+ {' J* q$ f2 t# H
  40. $ m0 B' Q7 ^4 d" p
  41. #undef EDMA3_DEBUG' i" ^  d6 l6 ^% i- v/ k( E4 f
  42. /*#define EDMA3_DEBUG*/: U$ ^1 h& A6 T, B9 p
  43. : E" {! Q& ?& c3 i3 u* I7 |2 ?
  44. #ifdef EDMA3_DEBUG
    - z, i1 H/ H$ n$ G  M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - E6 S* J( {4 [5 E  d+ ^& D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 f! o3 P. U4 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 v4 |$ V% s5 H$ v
  48. #else9 ?' u/ _. i9 _: i: I* N* h# g5 J
  49. #define DMA_PRINTK( x... )
    $ J/ C4 G" o- K7 k+ w
  50. #define DMA_FN_IN
    & A* U; H6 u7 ?2 \6 G8 C
  51. #define DMA_FN_OUT
    2 R' @, l5 u' k
  52. #endif2 s" l" n9 t& W3 O$ v$ B# @6 f
  53. . N) d- ~5 t) I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + Q" Z) r' Y+ v7 J  v6 F
  55. #define STATIC_SHIFT                3
    ' K/ ]3 p- b, w% v- Z0 p+ i
  56. #define TCINTEN_SHIFT               20: D. _! B7 Q/ |: f
  57. #define ITCINTEN_SHIFT              21
    . V- X3 `1 ]- c8 h2 [. S, F8 T' I
  58. #define TCCHEN_SHIFT                22
    / U1 j6 C' l: T1 Q; p1 x
  59. #define ITCCHEN_SHIFT               23( ?' b+ d! |; E
  60. 4 {/ y0 H! ^2 l( d2 W+ C9 L
  61. static volatile int irqraised1 = 0;
    7 P8 r. p: h% X7 x
  62. static volatile int irqraised2 = 0;' K/ g: E, O/ U; M( ?
  63.   W% k' x- L' ^; D- [- c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) j. U5 J, ]# G; F. V" C  M; L2 ?7 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) C8 W# E  `, U. o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , O9 h+ J, J6 ?) X0 Q3 i1 K7 o
  67. ) I% i0 ]6 f2 t" ~
  68. dma_addr_t dmaphyssrc1 = 0;2 K3 n" H( f+ Y: R
  69. dma_addr_t dmaphyssrc2 = 0;
    + u; i( c; D. t
  70. dma_addr_t dmaphysdest1 = 0;
    0 {/ H. q3 d: M  @! f3 k( `
  71. dma_addr_t dmaphysdest2 = 0;& i! v! j0 E* C+ K

  72. ; r7 X% K, V# J% w/ G; \. i
  73. char *dmabufsrc1 = NULL;" W: C. h5 H5 v7 }8 k5 B' k  M! K
  74. char *dmabufsrc2 = NULL;
    3 P( V. w9 m$ {1 O
  75. char *dmabufdest1 = NULL;/ g$ o3 l" s7 m2 S1 z
  76. char *dmabufdest2 = NULL;1 o2 b, J* h/ e' ~$ P" L0 I

  77. % _5 L; M1 v' f) F
  78. static int acnt = 512;
    # {/ X/ m6 ~5 p, a& v6 P1 q
  79. static int bcnt = 8;6 Z" K4 _& {; C* U1 M# V  c0 M
  80. static int ccnt = 8;
    . v+ H+ E; t5 [9 e

  81. & G6 E4 b" b. u( S
  82. module_param(acnt, int, S_IRUGO);  ]: v. @; @- u6 `+ H
  83. module_param(bcnt, int, S_IRUGO);
    . K( p, J! W$ P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 m1 D$ B& K" d7 ~2 V7 b' L

$ J5 N3 o* z0 ?% ~" u9 y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 f$ r5 w; B* g4 @/ D2 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! L( s% D5 k, O  t; H( s7 A6 U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 M1 T1 h' X* K3 r0 U- o' q, [7 V% d
: h6 w5 g) T$ q9 n( K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-26 02:15 , Processed in 0.044728 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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