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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 D" u  i- G7 G; P
  1. [code]EDMA sample test application* ?& Z9 X  H: O8 B9 k
  2. /*6 Z* T1 h+ ^3 ?, p! v* H
  3. * edma_test.c( @2 {9 h, B) e' d; H
  4. *
    1 ]& O/ f+ R, k& o8 K
  5. * brief  EDMA3 Test Application
    + R" r+ ^: Y  y- e. k. N
  6. *, V4 a4 b# D' n9 ^8 u( ?" j
  7. *   This file contains EDMA3 Test code.
    ' T' T+ u. W2 c8 H" M& H- P
  8. *8 ?5 ^  O  I( ^  R, r+ F: R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 c9 o  Q; U, j+ ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 R) E- R. m# O2 T* R: v6 M' o+ o
  11. *         TO CHANGE.
    & r  e7 X) [& d% |& n% `* g
  12. *5 I3 `1 T# F8 z9 B0 g+ H! D4 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 k. L: l+ F0 r# h- m4 z$ Q
  14. *( h8 B/ Z: x! {. {' _  z' W# \
  15. * This program is free software; you can redistribute it and/or# v6 b1 v( b( L6 F9 `
  16. * modify it under the terms of the GNU General Public License as, F* |8 E! B# j/ p6 w  h
  17. * published by the Free Software Foundation version 2.0 e) K/ d+ j5 S# r4 k0 u
  18. *( E# d7 O% \( l) U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 i2 Q2 e$ ?# e+ f
  20. * kind, whether express or implied; without even the implied warranty
    ; v4 T: E, i/ |* S. F6 r5 _# v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " ~1 o5 n9 I' `% O3 |* T- b
  22. * GNU General Public License for more details.
    8 ~" Z' u# _$ a8 H
  23. */
    1 Y% X) }& \0 ^( ~3 A
  24. , K, D3 g" U+ T! G% W/ {% K8 t
  25. #include <linux/module.h>
    * Q# v) V- v: O7 H9 A  V
  26. #include <linux/init.h>* ^: k' s) K; W! B. Z: b
  27. #include <linux/errno.h>; i+ G- k; i3 K" [' {
  28. #include <linux/types.h>, H1 A! b0 f: U( f
  29. #include <linux/interrupt.h>7 c9 Q* u9 j! Q8 {
  30. #include <asm/io.h>, u2 B$ D0 U6 a  e- c# R
  31. #include <linux/moduleparam.h>& V: M# u, X$ q8 ~% V' c# H
  32. #include <linux/sysctl.h>
    * D( r) I3 a7 D% l+ m7 @1 `
  33. #include <linux/mm.h>- z& E$ |; Q3 N, y$ y) [& k4 W
  34. #include <linux/dma-mapping.h>
    - D% e) i  b- H- }

  35. 6 Q0 c; \! s" J
  36. #include <mach/memory.h>
    + l! M# Z6 ~9 U' z! s# |, z
  37. #include <mach/hardware.h>
    + c0 j4 J( ?* o3 Z" I7 m
  38. #include <mach/irqs.h>) C2 I5 w: y0 p' I) ?
  39. #include <asm/hardware/edma.h>
    , p" o8 q8 [- `4 e7 m/ e

  40. # |# q  a% J! @
  41. #undef EDMA3_DEBUG
    1 |7 v8 o% T4 P4 x- D7 {
  42. /*#define EDMA3_DEBUG*/
    - p, R4 p8 ?$ s- J5 C

  43. 3 g9 ~- Y1 f% S
  44. #ifdef EDMA3_DEBUG
    # Y8 X7 v, S8 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! U. k3 q! C! Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 t1 ~& |8 _, d* ~, W& M; k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" m. K- w1 W/ G0 f5 J0 D
  48. #else9 P0 L) P8 v9 u( D1 ~* T# S
  49. #define DMA_PRINTK( x... )
    3 X6 f/ h5 a# j2 ]
  50. #define DMA_FN_IN  g! q  J: }+ @
  51. #define DMA_FN_OUT
    0 q" Q( t7 p  o; k  g* M: c9 _
  52. #endif2 J2 ^" _0 h- U8 Q3 {; [: }# ^
  53. . X' w4 L. g6 d4 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). `- S3 P- C$ ~8 M+ [7 s! d& Z) u
  55. #define STATIC_SHIFT                3) a* ~* d# M' r  R8 M
  56. #define TCINTEN_SHIFT               20
    $ B* s! M( C, A3 B& R7 E2 ?
  57. #define ITCINTEN_SHIFT              21
    ( @: `# C! x/ I
  58. #define TCCHEN_SHIFT                22/ O% M$ y6 n/ e! c& k7 r. k
  59. #define ITCCHEN_SHIFT               234 ~  d1 c# e' U/ f
  60. ; {7 B7 C  T4 t1 J8 b
  61. static volatile int irqraised1 = 0;, |6 V( v  E6 L; r* m' z* H
  62. static volatile int irqraised2 = 0;9 W# p6 D0 |' O& ?5 ~/ Q

  63. ! ~( m2 j) A9 P( [5 p( R% K7 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - F+ \7 e6 E2 a! f# _. L# \, f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 g) Q' K) x& Q' d8 [4 L$ j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# v1 j4 B, V, Z* M
  67. % M( c5 R9 D, q7 K+ G
  68. dma_addr_t dmaphyssrc1 = 0;2 [$ _% t! E, L! h. M
  69. dma_addr_t dmaphyssrc2 = 0;
    . h2 n& y) O" X  s4 F
  70. dma_addr_t dmaphysdest1 = 0;, W  E! R; o' G* I
  71. dma_addr_t dmaphysdest2 = 0;
    " G4 u* i' f; [/ Q! _( J2 ]7 }
  72. 6 T0 R$ S) O$ j4 Z5 Y& P
  73. char *dmabufsrc1 = NULL;7 W3 M: i5 V, N+ _
  74. char *dmabufsrc2 = NULL;: a, ?& K5 ^1 F: G9 `9 M/ b- d
  75. char *dmabufdest1 = NULL;
    2 J8 }# f( j" q! w4 `6 f! C4 T5 Z
  76. char *dmabufdest2 = NULL;
    ; m  V% ^5 j) ?; q

  77. / l. y7 |! b4 ?
  78. static int acnt = 512;# h  z5 K+ ~# A; b# D0 f
  79. static int bcnt = 8;
    4 \- `) S( p0 k! K' P) O" P1 U
  80. static int ccnt = 8;% H% e; n9 G+ p" n$ G
  81. " Q8 ~# S% U1 d) S) {0 a* w
  82. module_param(acnt, int, S_IRUGO);+ J. d% Q3 R. p5 T6 T( }
  83. module_param(bcnt, int, S_IRUGO);
    - c& L4 _5 k4 J5 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: ~6 i6 |6 S1 n' {  E2 _; B

% |4 x( Q" b6 z, {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 y9 H2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 Y5 c+ l6 d5 {9 C% ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, L4 [1 f9 T3 N& q
2 |! x# D* \1 R# s0 u3 h

6 d- |7 L- c* q5 R3 @: N7 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 16:44 , Processed in 0.039890 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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