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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 `5 q( N3 _: w9 r2 V! i% D
  1. [code]EDMA sample test application
    4 Q. {* l8 m' h
  2. /*# C, g8 H9 K* r" O' ]. O
  3. * edma_test.c
    / a0 n, n" y: r+ y! g* A
  4. *& Y2 u: M% v$ j! d. \& r
  5. * brief  EDMA3 Test Application
    - m  d& W8 z6 t! U
  6. *# R+ Y# f1 G$ P- u5 E
  7. *   This file contains EDMA3 Test code.
    + e2 s, p/ \  o4 S4 }* t
  8. */ I' H' M7 t, S9 m. x  ]2 P6 y+ S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( P7 V1 X; |& N! f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) o7 s) W( Q% ^; u( c( ?" g! o
  11. *         TO CHANGE.9 H4 e) s2 p- @) x; b# M" N- S
  12. *
    ' x2 w5 p7 s4 L; ]% j' n9 s/ P- C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : @# s: [- S  n4 B
  14. *
    3 ~  e: W9 o( C8 f  w. R% L8 e: o
  15. * This program is free software; you can redistribute it and/or% b4 d7 I, j( K2 v$ l
  16. * modify it under the terms of the GNU General Public License as
    $ D. a6 @, H; ]8 k; p5 r( [4 h$ b
  17. * published by the Free Software Foundation version 2.% T2 j3 I8 f4 D6 L. |
  18. ** b) q4 n- n* ^) e+ R8 H% _4 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( j; I* E2 n- ~  Q" L* ~0 c1 j
  20. * kind, whether express or implied; without even the implied warranty
    ) U/ \; ^, n1 K4 d$ ~5 E- }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 Z1 i. O, O2 x  e
  22. * GNU General Public License for more details.
    0 r* Z7 W# z" s( G
  23. */
    4 l% k+ P4 L' b5 u/ I- t0 D6 ~

  24. ' F4 b" p2 Y0 }& ]7 K/ z) K
  25. #include <linux/module.h>/ g/ B5 ]) V6 H! O+ d
  26. #include <linux/init.h>5 `6 a% v; `' r' d
  27. #include <linux/errno.h>8 k+ p8 R3 c: r+ X+ _: ^
  28. #include <linux/types.h>/ b; ~$ c; D2 e8 ~
  29. #include <linux/interrupt.h>
    ) W5 ]4 T, O' [5 T; ?
  30. #include <asm/io.h>
    % s5 d5 q7 v& H. C: ^
  31. #include <linux/moduleparam.h>
      k0 i: j( b* Q7 ^0 p
  32. #include <linux/sysctl.h>, u; B* `1 f3 i$ i, c. |$ C
  33. #include <linux/mm.h>/ z% n. Y+ e3 H9 _2 N6 U  a* k
  34. #include <linux/dma-mapping.h>
    . A3 G* u# y* w7 W, w- P

  35. 5 F: I$ m, r) P0 Y2 J6 q% E
  36. #include <mach/memory.h>
    0 ]2 q1 H' h- L3 W' q
  37. #include <mach/hardware.h>
    1 {" _; y( y& t! r: l3 `! A1 o
  38. #include <mach/irqs.h>
    4 q$ s1 y5 P& J* S6 \/ I8 b
  39. #include <asm/hardware/edma.h>
    3 p. h7 T% V5 W0 @' s  I

  40. , H$ I. c5 W& ^( _5 ]
  41. #undef EDMA3_DEBUG
    0 o2 i0 Z6 R8 P7 w* j) J; \
  42. /*#define EDMA3_DEBUG*/
    , w( D. I! a5 X
  43. $ W7 V% l8 X- D5 a1 }
  44. #ifdef EDMA3_DEBUG
    8 }8 z# n% M; N; _7 E4 R$ f/ G9 a  X  i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 |* D/ U* a' Q5 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; n0 z  a& P2 D9 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - @3 l# l5 b- r9 O2 o
  48. #else
    . H- b8 X, p: W3 x
  49. #define DMA_PRINTK( x... )
    0 g( R* I+ X2 a# h% J
  50. #define DMA_FN_IN
    ( f' x1 ?8 w' J2 W, u3 ?
  51. #define DMA_FN_OUT
    ' M; d. O3 F8 F! Y6 C6 c5 \
  52. #endif
    9 q) S! p( n6 X9 D; Z3 s# w

  53. * X$ m& i  e4 A/ L* t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). T8 ^+ v! H2 h
  55. #define STATIC_SHIFT                3
    3 p1 }; n. E4 C0 T0 S$ V! T- u
  56. #define TCINTEN_SHIFT               20
    7 Q/ e# `" L0 O2 K2 h1 A/ Y
  57. #define ITCINTEN_SHIFT              21
    4 Y8 o; I! d( q" o4 R8 c: D
  58. #define TCCHEN_SHIFT                22
    " ?  H! s# A2 b( i
  59. #define ITCCHEN_SHIFT               23# a7 r! L: K) \7 v* Q

  60. 2 B' P3 I/ W# F: m9 Z1 }: F& R5 K
  61. static volatile int irqraised1 = 0;
    8 o* P& W) Y; j. X" K' C* o
  62. static volatile int irqraised2 = 0;3 q6 }& H2 p/ }  v

  63. , m! d! A% a6 ~' n3 t7 t% ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . W% J9 C9 T# Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' J$ ?2 D! d' x- ?; K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; G! z! g. R+ ~. h" k
  67. 2 H# p# a2 b- z% U, V1 ~; \
  68. dma_addr_t dmaphyssrc1 = 0;! s) H' Q, M$ ?9 C6 P
  69. dma_addr_t dmaphyssrc2 = 0;
    6 J! V8 i0 w0 G6 W& n
  70. dma_addr_t dmaphysdest1 = 0;
    ( h7 K. f- F0 A0 m2 x
  71. dma_addr_t dmaphysdest2 = 0;
      c+ q) X2 e# x! w8 |. e

  72. 9 q" o& O5 U( }
  73. char *dmabufsrc1 = NULL;7 q5 b, y* {4 {% x9 g0 V. p
  74. char *dmabufsrc2 = NULL;
    ( W6 H. [4 O! X; V5 N$ @
  75. char *dmabufdest1 = NULL;6 z/ R8 Q4 g& {7 H7 t
  76. char *dmabufdest2 = NULL;
    . v% G8 l  M5 J- E! i, [

  77. & y# z4 _2 H/ N5 w4 K' {* |( R
  78. static int acnt = 512;7 J9 _+ t/ Y- R" O. {3 V0 W
  79. static int bcnt = 8;
      x/ \1 `4 _, |# D7 N# P( Y+ |
  80. static int ccnt = 8;
    ! _7 t: _( ?5 r* N/ x" ?+ q

  81. + L' ^+ L: s, F$ R
  82. module_param(acnt, int, S_IRUGO);
    2 A! ?$ d& l" z- \8 d, a1 l- @
  83. module_param(bcnt, int, S_IRUGO);( |- L* `0 K. R- E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 T. Y0 @1 i; y# F. e2 \: Q+ c! ~6 L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( A# y4 Q7 Q# j, Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( k' a- t" p9 v- D" O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. |/ N) R; v0 m8 V1 H

" i1 G( t1 U) ]- E6 m% x' S$ F
$ x/ _0 `' q% M! h# \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 11:22 , Processed in 0.042938 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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