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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * N% j! k% |. ]! u8 r
  1. [code]EDMA sample test application
    ! L2 @6 ?9 @* f3 D4 M7 `( O! u
  2. /*
    " @9 N( P% p% ^  I% Z
  3. * edma_test.c
    ) E8 A; x2 q- ^4 @5 I  G9 y
  4. *6 o; X3 N# W- |3 L/ S/ u% e3 Q
  5. * brief  EDMA3 Test Application& M6 c9 X0 g3 P* I/ K
  6. *8 U8 ^! K0 s* x! n
  7. *   This file contains EDMA3 Test code.( f. F/ a  k& C- R
  8. *
    * q( ~. o4 N. O! \, D+ ?6 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # w6 Z. W4 m1 J# Y! V: f: j6 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " M' h$ I2 R- I5 t: G1 r" i
  11. *         TO CHANGE.
    $ V( x* p  _9 E4 j3 j
  12. *, o& m7 j* A' w( J: c9 j8 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % J; a7 g* ?- _9 @
  14. *$ m3 W& P1 _: K/ d" L/ X
  15. * This program is free software; you can redistribute it and/or
    " A- r- \6 a8 q  L! B. p2 L
  16. * modify it under the terms of the GNU General Public License as
    ( c( ^$ r) b% w  c4 ]
  17. * published by the Free Software Foundation version 2.
    " {' B3 r6 `6 S/ G+ W
  18. *8 j% n2 F0 K5 n- l/ ]  |3 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 J$ o* e- m  C
  20. * kind, whether express or implied; without even the implied warranty
    ( y6 [. P( g1 S, Y; T! i3 w; J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 _" F0 |) _+ j: }9 U4 o  M4 |
  22. * GNU General Public License for more details.4 i; N  W3 i  `4 F
  23. */  Q+ y4 m$ H9 g& \! v) D  g. Z! D) r
  24. & e. b2 m/ h3 ]! W8 x( g6 h7 j
  25. #include <linux/module.h>8 G) U4 `, z4 A9 p- i. O
  26. #include <linux/init.h>* |6 E! P& S& X. A' h1 ~) T
  27. #include <linux/errno.h>  b: ]2 i. p2 E' G9 f' A! x2 v
  28. #include <linux/types.h>
    4 ]5 I6 f9 c) z9 y7 I
  29. #include <linux/interrupt.h>
    # V9 N3 m* J6 s6 V" `
  30. #include <asm/io.h>
    ' M' J# J0 P* W  g! F+ c, A! r
  31. #include <linux/moduleparam.h>7 \9 y0 G9 M$ }
  32. #include <linux/sysctl.h>
    9 L  I1 {, j; K# t& M' W
  33. #include <linux/mm.h>
    9 F/ z: `7 H3 v
  34. #include <linux/dma-mapping.h># V/ J0 h' I/ s5 j. L1 s' D

  35. ) v. R+ h/ i- b6 o; R1 b
  36. #include <mach/memory.h>
    4 a* H: |. @+ d  P# C" r6 x7 b
  37. #include <mach/hardware.h>) J* t; R7 T1 r8 w9 {: `* _
  38. #include <mach/irqs.h>$ j3 T1 i  d* x" H
  39. #include <asm/hardware/edma.h>/ I; p. Q. d: k2 }: `
  40. ; K  K/ p+ C: L
  41. #undef EDMA3_DEBUG
    1 N/ b  _  C$ U7 V' e. S) T6 n
  42. /*#define EDMA3_DEBUG*/6 S; y  q* C7 ~0 N& w
  43. * Q# C7 u( H# V
  44. #ifdef EDMA3_DEBUG7 j* n0 b+ ?- ?: F) U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): i0 n" c+ [- r+ ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) H- E# h1 r' U# L7 ^/ m! Z( Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' l6 v! s. Q2 Q0 r: S6 F
  48. #else
    3 A; h3 d/ Z. Z& `( d
  49. #define DMA_PRINTK( x... )% b) r! T5 Z& m7 ?/ y& Y# M
  50. #define DMA_FN_IN2 ?) |7 a; `" r. S& T: N* y
  51. #define DMA_FN_OUT$ H# c+ B: P( }/ ?
  52. #endif: C4 M" B! H7 r, P/ Q. `3 Z

  53. " @  S' `4 g6 e: ]% h, K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). W, s5 t9 l( p* k7 F5 @; x
  55. #define STATIC_SHIFT                3: ]; o8 i# W/ w
  56. #define TCINTEN_SHIFT               20
    ( x9 l1 d7 {& R0 l
  57. #define ITCINTEN_SHIFT              21
    . ~% O. t) w2 S9 m
  58. #define TCCHEN_SHIFT                22
    8 @: h' U, L; d- d
  59. #define ITCCHEN_SHIFT               23
    % K. g4 n4 X& R8 X4 j

  60. 2 M% J* T% s: ]8 z
  61. static volatile int irqraised1 = 0;. \5 C& \( m; N; n: T! O5 z
  62. static volatile int irqraised2 = 0;1 K* q5 x' [5 ~$ r$ T( p

  63. , D/ M! U) }3 @% ^) @+ \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 S9 k9 u, u6 t6 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . m8 @# m+ j/ \2 S' z1 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 |1 _' G1 G) k' L

  67. * p0 H$ s% _5 \9 {
  68. dma_addr_t dmaphyssrc1 = 0;4 @6 l  i3 h7 {* _
  69. dma_addr_t dmaphyssrc2 = 0;
    ! [7 I9 v9 G+ b! L
  70. dma_addr_t dmaphysdest1 = 0;
    ' g6 V& c( Y+ {
  71. dma_addr_t dmaphysdest2 = 0;9 v$ h) i+ q( h5 X- Y) h/ X* m
  72. ; B5 q4 S# w6 `6 S1 _/ Y, {
  73. char *dmabufsrc1 = NULL;% l5 L, ^$ D/ s. h4 `$ m/ [; g6 x! S
  74. char *dmabufsrc2 = NULL;
    # ^/ c8 m( ]9 [) {. I" w  D! b
  75. char *dmabufdest1 = NULL;
    + ]( p# X9 u" G5 l$ S
  76. char *dmabufdest2 = NULL;
    % \' P: r% Q* ?5 P9 I# M5 r

  77. # [. x$ e# K, ?) M& H0 Q# f
  78. static int acnt = 512;
    , v) w  ?9 I" s
  79. static int bcnt = 8;
    3 H% D) p. r8 t" z6 z0 Q0 j' M8 e
  80. static int ccnt = 8;
    % M& M9 Q/ [- \! S1 h6 y
  81. , f1 J6 V5 h# j. J  x
  82. module_param(acnt, int, S_IRUGO);! H7 H; @$ {8 K/ S8 W0 ?, f
  83. module_param(bcnt, int, S_IRUGO);
    / J2 m; ?* x" r! j' S" _8 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& c4 ^% F. c5 z4 f6 c
- E' L- k9 E3 W, \1 \) I. {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 j1 b' c: v6 j) f8 B; X
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) P5 n4 W- n( I2 ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 s! C4 V6 n# |$ ?0 x6 ?/ a; F1 e: J3 ~4 u2 K* G; C' L
9 C% }* p) v% R( Y! z3 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 17:01 , Processed in 0.039940 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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