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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . B$ M1 I. ^+ X, c6 t
  1. [code]EDMA sample test application& K! s* R( {; i9 J
  2. /*( x: [, }3 b5 G- R% k  Z/ T
  3. * edma_test.c7 s: }5 L# q0 Z3 y/ l' ]# Q
  4. */ ]9 i, K! \7 K/ S! g
  5. * brief  EDMA3 Test Application, {$ S8 R! O% T% V! r0 B
  6. *# p6 ]$ d6 u( B5 Y) G5 l! {/ H
  7. *   This file contains EDMA3 Test code.4 Y/ \- h! r/ v/ u9 M5 M5 x+ _. U
  8. *1 Z1 r- E$ {+ \: ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ M$ N3 E/ q$ I. d7 P6 D1 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , E3 D2 e% H! V' {& _) L1 K, {
  11. *         TO CHANGE.
    8 |/ Y; m) U- L* y* R% @
  12. *. J0 y; B$ a+ e3 _9 A+ G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - U8 g& ~/ r5 a+ I+ s* T
  14. *+ O4 Z" }+ C) W5 F9 C" l
  15. * This program is free software; you can redistribute it and/or
    , ~& G$ m8 f4 N3 v3 M5 Y- s: ^- n
  16. * modify it under the terms of the GNU General Public License as
    3 D9 S3 i( |; P# Q
  17. * published by the Free Software Foundation version 2.+ d: h; z& R! I5 X8 y+ i
  18. *
    . ]$ F2 L# s) k. t! |+ u; K4 b0 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ J% ~* z4 H6 w: l; j  V
  20. * kind, whether express or implied; without even the implied warranty" m0 ~% h: X0 V1 O- w: y) {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; i8 V% Y. Z2 a1 o& ]3 G
  22. * GNU General Public License for more details.
    . w. R# b) |5 I$ c% n6 C
  23. */3 ~! R5 h2 J8 O4 z

  24. # K& {) ]) p0 }0 ^, z3 Z+ R
  25. #include <linux/module.h>
    2 r( F/ }6 o# d- ]5 {
  26. #include <linux/init.h>1 i* \# u+ w/ s; k% R! R
  27. #include <linux/errno.h>' G! K8 s  g: L0 p
  28. #include <linux/types.h>3 \1 P, j. U$ U# I5 ~4 o
  29. #include <linux/interrupt.h>
    . m/ j- |6 n6 N( u& j4 U5 b% f9 N' I
  30. #include <asm/io.h>/ k  {- G- P7 @& r# b+ B
  31. #include <linux/moduleparam.h>6 N! d3 e# m, Z$ |. J
  32. #include <linux/sysctl.h>- V, P( w6 {" k/ m" o6 X
  33. #include <linux/mm.h>
    * X! ^. l' z+ k
  34. #include <linux/dma-mapping.h>6 }/ Y" Z0 j5 V0 w7 T

  35. ! E) ^5 J) P4 w6 k' `' N( g
  36. #include <mach/memory.h>9 i2 P7 E- h" l2 o; `1 _
  37. #include <mach/hardware.h>
    6 c9 f' V+ P0 y6 @
  38. #include <mach/irqs.h>
    / [% j# s* c. {1 z
  39. #include <asm/hardware/edma.h>( S- Y; s  m5 ]* `8 R/ n

  40. ' |+ L2 b. m. y9 ~
  41. #undef EDMA3_DEBUG
    7 P  J. a" i% l/ W, l2 X  i
  42. /*#define EDMA3_DEBUG*/
    . g3 v# j3 z  T: s( ~5 H' c* [- w- T: z

  43. + T& _" O9 \$ \4 O/ I3 F% n
  44. #ifdef EDMA3_DEBUG+ v) V6 m) m: z1 e; \( F7 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) }( S8 [1 r. P1 g. J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 C% p. G! x+ R* d8 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      U5 b; x3 i; w
  48. #else% B; g3 G9 ?& D! N3 O
  49. #define DMA_PRINTK( x... )1 d' r# w0 L$ e+ H( s; i% Q
  50. #define DMA_FN_IN( O) }/ N- e8 E: J6 t6 B  }
  51. #define DMA_FN_OUT7 M4 y) _5 l. l- N# v, a% e
  52. #endif
    1 x- A3 j4 F+ u/ P9 Z

  53. - o- d3 i. g. c* F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * p& d! r7 e9 r( L, P1 Q6 i8 l
  55. #define STATIC_SHIFT                30 x2 F+ {9 A* z
  56. #define TCINTEN_SHIFT               20
    9 j8 m2 P( @$ e! j
  57. #define ITCINTEN_SHIFT              21
    ( D1 D/ T+ V# H( l: F1 |6 K4 h
  58. #define TCCHEN_SHIFT                22
    / u: y8 a+ s+ L
  59. #define ITCCHEN_SHIFT               23; ]+ y8 l) f- G9 d

  60. ; J( J# @3 h  e$ {3 z, X" c5 `
  61. static volatile int irqraised1 = 0;2 d: F5 \, y  k: d  o
  62. static volatile int irqraised2 = 0;2 ?$ @9 d" t2 [# \' K

  63. 9 @8 D  G5 J6 [( G/ y, g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 R8 q( W- l! u7 Y" D0 h$ U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , v5 o7 g- Z/ A/ Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 J3 ?& Y3 P* l! D2 o
  67. 9 n* m- {7 z$ R' g
  68. dma_addr_t dmaphyssrc1 = 0;
    , S7 X$ Y3 `; u: m3 W" F
  69. dma_addr_t dmaphyssrc2 = 0;/ V8 d* ]! s8 P/ r! s
  70. dma_addr_t dmaphysdest1 = 0;
    0 a9 o9 T. [" S3 T' v' }
  71. dma_addr_t dmaphysdest2 = 0;+ j2 @; b' N1 Z: J

  72. ; I) D8 n- i; E5 H+ r
  73. char *dmabufsrc1 = NULL;/ y/ _$ @( [4 R8 Z
  74. char *dmabufsrc2 = NULL;% _& S5 B. e. i3 s1 i7 X- g
  75. char *dmabufdest1 = NULL;
    : F. Y! ?) P, a, ^# @% c
  76. char *dmabufdest2 = NULL;
    5 U1 s3 Z* o+ e( {1 ?2 ]/ F

  77. 7 _, i0 A8 ]: O- f
  78. static int acnt = 512;
    8 r. z1 S0 H( I/ g+ I" o6 _! ~8 P
  79. static int bcnt = 8;2 l9 Z: a$ L# u3 r
  80. static int ccnt = 8;
    ) g1 ?. o! B; i& t7 B

  81. 6 V- Z& D, U  d7 ]
  82. module_param(acnt, int, S_IRUGO);$ |1 M& U) P  U0 }; Y) q0 e
  83. module_param(bcnt, int, S_IRUGO);+ s$ G! o0 {+ d/ ]8 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* ^( X, B4 l" V9 r+ H/ b

2 E3 P" A1 _: t. j/ h( W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& `7 c8 V$ `. }: y! E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* I, k( F- h& p2 g+ M1 ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 w9 m4 I! J$ D7 [+ w8 x: a' f

2 j4 W( D/ a2 S# C; }8 I" I0 t& v" C5 W# A( C, T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 18:52 , Processed in 0.045121 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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