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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 k, q) }) D6 B- z7 J
  1. [code]EDMA sample test application; g3 r4 X6 h( t! b
  2. /*
    2 V0 i4 X( n9 M) e. z
  3. * edma_test.c" J" I# j& I! \
  4. *9 j. S4 I- H" @. F
  5. * brief  EDMA3 Test Application
    ! d' y8 K) T/ P2 l- T
  6. *
    & U, x- S8 p* v5 F' m3 D7 n( }
  7. *   This file contains EDMA3 Test code.
    6 E0 o6 W) W& L' S: h
  8. *% w1 R9 K; n$ V% D# m% d' v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' L6 E- m. i2 h. ~5 H. j, H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 j4 d6 E  i4 D+ a  }" T0 G
  11. *         TO CHANGE.
    / ~, Y! c$ u$ U( K0 v
  12. *
    / V7 T  O% k* |5 d9 B8 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 Y9 r9 @. N, b  h  z" x: H' r# L
  14. *) Z/ f/ A' H6 O: z9 z4 @
  15. * This program is free software; you can redistribute it and/or
    9 o2 y7 \% d3 O" |5 L. H
  16. * modify it under the terms of the GNU General Public License as, u. |0 U8 i+ t' `  N. N* ?
  17. * published by the Free Software Foundation version 2.
    ) s5 o$ t2 i5 e& P: U* G/ o
  18. *
    ) R$ H5 o3 O% E9 t5 A+ r$ g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: p4 A- b7 x; V4 {% e2 b1 ^
  20. * kind, whether express or implied; without even the implied warranty/ b: n! K2 S; h. R9 B( _, G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' d+ B! ^. U9 }$ H7 }
  22. * GNU General Public License for more details.
    7 K$ \& E) j/ _8 z& |3 @
  23. */- l4 _) x/ r) [: @

  24. 3 p* u6 |0 `9 Z: X
  25. #include <linux/module.h>7 s/ |2 s* l; t
  26. #include <linux/init.h>
    ; u' Z' l& ]% h4 r2 M
  27. #include <linux/errno.h>
    " v5 J2 s) }  Q: ^2 b( [' C
  28. #include <linux/types.h># w3 Q$ a# \8 f$ ^# }' j6 K/ J4 J
  29. #include <linux/interrupt.h>, Y4 Y6 H+ c4 h$ h- G# t  F
  30. #include <asm/io.h>' {: d' v5 s* `* F
  31. #include <linux/moduleparam.h>) K1 h! s) b( D1 N$ @
  32. #include <linux/sysctl.h>
      b1 C8 }; w, O
  33. #include <linux/mm.h>
    # ~% g  {. O0 ?
  34. #include <linux/dma-mapping.h>
    - F# b; N4 G9 u4 D  F; V; L
  35. 9 D) e9 w* `! R8 Z
  36. #include <mach/memory.h># ^! N# e4 T2 }5 X$ W
  37. #include <mach/hardware.h>
      ^% L8 ^+ x# r
  38. #include <mach/irqs.h>1 M! o* k! D* N9 D! Y% c7 [0 Q9 C
  39. #include <asm/hardware/edma.h>5 _1 R: O2 n3 H, X, V/ O: V

  40. % [' c9 b1 t; v1 {0 r+ X% j
  41. #undef EDMA3_DEBUG8 `8 s2 U6 [- H& M; g: m; H( [& G* |
  42. /*#define EDMA3_DEBUG*/0 h; @- w0 S; Y% {# Q  s# P7 ]
  43. % _, F5 ^2 p2 u4 j3 S: x
  44. #ifdef EDMA3_DEBUG. K+ K2 t2 I3 b: q! K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* ^: b% p) s$ `& Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( h" G. @; a1 g  H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 d9 C0 {( N, U; Y! L& m  s& ]/ t
  48. #else3 }  H" W% T% X  {& Z( w  S
  49. #define DMA_PRINTK( x... )
      q* p. }% ^6 V0 {. L: W
  50. #define DMA_FN_IN
    0 C9 L/ L. `* e6 O) y2 H; @) z
  51. #define DMA_FN_OUT
    ; I  |1 ?& [6 o, S( |& z
  52. #endif
    6 e& V' A  e- s. n; w
  53. # T6 c- Y  p* B" {* w$ Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : ^) H% F+ k2 ]$ F1 L, \
  55. #define STATIC_SHIFT                3
    2 D! `; I2 h% }6 G% F
  56. #define TCINTEN_SHIFT               20
    " n, D2 W+ O, I* n& V
  57. #define ITCINTEN_SHIFT              21
    . Q) O6 N) C+ G6 v: X2 b
  58. #define TCCHEN_SHIFT                22
    - W2 c1 _2 ]( X9 B
  59. #define ITCCHEN_SHIFT               23
    8 |8 @; `" i7 c$ ^& o; X' D

  60. + n* @, S6 r! v& S6 E7 u
  61. static volatile int irqraised1 = 0;5 e* i; A% T5 M
  62. static volatile int irqraised2 = 0;
    & P, `: a+ l# D3 S6 u: m

  63. . F' y& x* @1 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* x" k: q* ~4 C. v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 Q& R, y5 b3 J6 Y" ^4 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( w" Z$ }8 O7 a5 ?) a( l
  67. ) z- A1 T3 k' N# `/ n
  68. dma_addr_t dmaphyssrc1 = 0;3 Q  Z0 Q# c0 h9 ?1 b3 |  B
  69. dma_addr_t dmaphyssrc2 = 0;5 a1 M7 b3 P* a8 Q% m8 n' {
  70. dma_addr_t dmaphysdest1 = 0;
    # ^1 b9 {, z7 D: |7 P
  71. dma_addr_t dmaphysdest2 = 0;- _/ c6 V% T/ M  r
  72. 5 }* g1 c# ^# w, Y0 }, ^1 ^. f& q$ [
  73. char *dmabufsrc1 = NULL;
    + B2 L4 a$ Z) [8 B) o4 A3 P4 v- G  d
  74. char *dmabufsrc2 = NULL;+ o3 q/ G7 m9 p. F% f7 g* Q
  75. char *dmabufdest1 = NULL;5 n9 t+ ]1 V: S
  76. char *dmabufdest2 = NULL;
    . |$ V  t8 E; y( f0 m& K: ?
  77. 4 j4 y1 \8 z9 _3 g5 H4 H  N9 N
  78. static int acnt = 512;- s3 h) {: O7 ^/ Y
  79. static int bcnt = 8;
    " B& I  E5 Z6 }: I* @# W8 u! v4 `6 v
  80. static int ccnt = 8;
    % I1 \" I: T, n; C0 `" Y: Z& \
  81. + a2 w$ y- m2 b
  82. module_param(acnt, int, S_IRUGO);/ a- r; U" q" m( j/ \
  83. module_param(bcnt, int, S_IRUGO);; r- n- I$ V  a) s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 m! B! x2 |+ I9 B- @/ t, p  A- d# l  e: p; O7 [8 Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 v1 T+ \$ R6 w! q$ S3 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ d, v  e- V7 R6 m2 [; i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 s/ U8 K3 R: d6 T" w  z

. I2 e. i, ~" ~/ o* g
/ u7 Z$ o' F0 d& [, A4 T- c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 19:35 , Processed in 0.045616 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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