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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( J. E& v3 ]$ ]% T) u
  1. [code]EDMA sample test application
    + E  C$ W$ |- l; g$ c
  2. /** p& s+ G! {! P4 c5 D7 o
  3. * edma_test.c
    4 w8 N1 B# K2 T( o1 ^! @8 v
  4. *) S% C& q' t* V5 H# c7 p
  5. * brief  EDMA3 Test Application
    - {5 m. U1 K: k& Y! v. d
  6. *! W3 H! t* F; X- \
  7. *   This file contains EDMA3 Test code.
    + i5 Y# }( X' X
  8. *
    ! R( [# h& D6 s! T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 r$ R; \- d$ x" H  i1 m+ A- t( n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , p6 u$ m. A% y: t1 Y1 G
  11. *         TO CHANGE.
    ! \' T! L# u5 ]( Z4 u* {
  12. *- G  S5 u' c9 b, `' N, ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 O0 S. ^0 Q# E. T
  14. *
    $ @+ n$ W- q' |' ?5 k7 _& N* n" ?
  15. * This program is free software; you can redistribute it and/or" y/ u! D4 w: Q/ d
  16. * modify it under the terms of the GNU General Public License as
    ( ?) N0 ^7 p- L* N
  17. * published by the Free Software Foundation version 2.
    ' A$ e" q8 K- n- X/ W" ]4 P
  18. *4 M2 E2 c' Q0 @4 S5 p0 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 s# o& S. ?  e0 u0 n$ Z
  20. * kind, whether express or implied; without even the implied warranty+ B8 k* K7 j: ?& G% R3 b* U( `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; r7 }# E# d8 G) n+ D' ?' k
  22. * GNU General Public License for more details.2 D: `0 l* n! `4 ~) d' d+ D8 u9 d
  23. */
    ' ?0 p6 Q: C% R" v& Q2 G7 Y
  24. 8 W( K8 q5 w; _0 T! F
  25. #include <linux/module.h>
    : s6 K( d$ V6 R( J" O* h3 i* B
  26. #include <linux/init.h>* |+ K5 J: w# L% _* u/ x& K
  27. #include <linux/errno.h>
    / }+ }9 J$ K' q7 w5 H
  28. #include <linux/types.h>  K  A" b! M, e- C" ^8 `) F
  29. #include <linux/interrupt.h>
    + c# N8 V7 z+ u/ ~" f. H4 f$ C
  30. #include <asm/io.h>" Z0 }# d# j9 v2 a
  31. #include <linux/moduleparam.h>
    6 X) v9 [$ H& [# R1 g" }! W" P
  32. #include <linux/sysctl.h>
    , x( B) X6 h, M( q6 p: d
  33. #include <linux/mm.h>
    : O$ {3 p. r9 A) X9 F. E
  34. #include <linux/dma-mapping.h>
    / H5 `0 g+ `- t& N- d

  35. ! Q2 j: b7 \2 }2 E; `
  36. #include <mach/memory.h>. A2 P- m1 H- c: W" M. f6 e
  37. #include <mach/hardware.h>& v0 v. P! M3 o7 g* p" e3 n( P
  38. #include <mach/irqs.h># o( p3 J5 f, _$ Y. J/ s/ y
  39. #include <asm/hardware/edma.h>
    " e5 b4 L- T- w
  40. 6 e- x0 c' I6 x  |. m, R% Z; b) M% M
  41. #undef EDMA3_DEBUG# ]6 Y9 r" C8 S+ m% C! }) @% c
  42. /*#define EDMA3_DEBUG*/9 Z  ], k7 w6 D$ q7 V# R
  43. : R5 z+ h1 b/ F" R+ x$ Q
  44. #ifdef EDMA3_DEBUG5 a: I1 F6 j, d( w) c0 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# F6 A! A! x- A5 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : l) w) O* s' Q, J4 E2 m, w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& ?; c3 ]1 p# \- J
  48. #else
    ( G, `/ b8 `" I+ o6 [9 I
  49. #define DMA_PRINTK( x... )
    : P8 N# ^) N/ w
  50. #define DMA_FN_IN8 Q; m! B8 [( O8 l. @" a; n
  51. #define DMA_FN_OUT/ i, m+ d, u6 l, L- i5 r/ w6 O2 s
  52. #endif
    % i% o/ w. L; ~3 _. q% U
  53. / W# a% ^% S! Q  H. v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 M/ g  K+ V( @) s6 H1 g4 G/ F
  55. #define STATIC_SHIFT                3/ G2 M+ d5 y6 G! }
  56. #define TCINTEN_SHIFT               20
    4 j5 o/ {+ f* @6 m% j1 h
  57. #define ITCINTEN_SHIFT              21
    , i& m1 c* n1 |$ a- X
  58. #define TCCHEN_SHIFT                22- C. y1 Y/ Y8 U, z" [7 f( B9 p
  59. #define ITCCHEN_SHIFT               23
    3 Y! h, p+ A3 c5 s: X1 D* f
  60.   [+ U$ Z- G9 x& l* a! `
  61. static volatile int irqraised1 = 0;
    6 f- O9 [( i* s; j1 E+ {# v0 @. g- S
  62. static volatile int irqraised2 = 0;
    0 D' r$ t* ~" J. [: }9 ]: a+ j6 \
  63. " K# e# \  [9 S! Q; N, p6 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 `& V, s& V& H  `' I, y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, V/ \* z3 b' V$ z4 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 W. ]9 K- O; r; F, R3 @; q' Y

  67. + J9 w. ^7 _: \5 i7 l! @+ A
  68. dma_addr_t dmaphyssrc1 = 0;' T9 C3 h, S0 f8 W4 I0 R) Z) b
  69. dma_addr_t dmaphyssrc2 = 0;4 e% X/ p, S. J. [* k
  70. dma_addr_t dmaphysdest1 = 0;# I, q% X3 D; E+ O/ W( l2 q
  71. dma_addr_t dmaphysdest2 = 0;6 ~8 ]8 b& p0 p+ j

  72. - p) S7 p; d' q: T4 O1 b4 N
  73. char *dmabufsrc1 = NULL;4 U, r. J3 o* w2 d  n
  74. char *dmabufsrc2 = NULL;
    , d' O5 c) k' V5 b, m4 j3 X5 [! Z
  75. char *dmabufdest1 = NULL;
    8 W- _6 F4 v+ N/ f* ~1 h
  76. char *dmabufdest2 = NULL;/ P# ~& I) v6 O* f4 E8 B+ d% v+ g

  77. ( l( Y. }, g. B" ?$ v
  78. static int acnt = 512;, D1 J. P) `1 v7 W
  79. static int bcnt = 8;6 F* U' H( F! l% ?
  80. static int ccnt = 8;
    ; K8 k# X! g. [+ _/ w8 M7 h# U) A/ Z8 T
  81. ' z, p! s9 ]* x' b
  82. module_param(acnt, int, S_IRUGO);, [) c6 r5 d) g( S+ d9 D
  83. module_param(bcnt, int, S_IRUGO);( D4 p7 {' R# X6 j* W: `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- q" M/ P- H1 j2 ?$ c. B" g1 P- _

6 \% l# x1 l7 s( C, h9 K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 G: h, Y9 C7 p( T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* H) P8 f) i6 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. O1 h; g: I" T6 }+ s9 u3 \3 Y3 W
% D/ n1 P8 p5 M: L8 ^5 @0 F5 p4 b
0 F; D4 Z. `" P8 K7 \( f0 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 04:16 , Processed in 0.038669 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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