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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 D0 f7 s9 q( I! m. @; v
  1. [code]EDMA sample test application$ E4 X% O, F) V0 M$ @
  2. /*9 d5 f! b6 |: N3 ~( B/ f
  3. * edma_test.c- P4 W0 }0 |! r; s( ~: S
  4. *2 U4 B7 {" e& H( b6 i
  5. * brief  EDMA3 Test Application
    + s  k* c# ~5 T
  6. *# w( i" ?! z' U; g8 i4 U
  7. *   This file contains EDMA3 Test code.
    0 y+ L$ u5 t3 h1 j8 H3 K) N' U3 L
  8. *
    - X7 s: a) y! Y  T0 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) f# [+ ]0 T6 \, c; L( D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % u: K8 }! u1 ?: r# V  w- p1 b( C. u
  11. *         TO CHANGE.4 H  D1 l  a6 {. l. y& f
  12. *2 p) N8 w, s& d- Z! c. ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ g5 V( X$ {5 h4 b
  14. *
    ; T/ O) r6 o/ [% f# N8 L
  15. * This program is free software; you can redistribute it and/or2 c0 `9 k( N- T
  16. * modify it under the terms of the GNU General Public License as" W) C) W0 O& J# c
  17. * published by the Free Software Foundation version 2.
    , {0 [8 V' B( {0 H. R# @
  18. *4 t# U) x) [( {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 E5 L; T, A1 X4 p3 Z" M% |
  20. * kind, whether express or implied; without even the implied warranty, J7 m" z& J  f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 m1 F  I$ \0 H7 N) r
  22. * GNU General Public License for more details.' f$ K- H: o: d; D& b& l
  23. */
    2 y% i2 |2 |3 u& W, K0 f
  24. 2 V8 W  d, X5 n2 f: Z% g
  25. #include <linux/module.h>6 C2 r# C4 |2 x7 }- R
  26. #include <linux/init.h>
    ! B2 |+ i: ?4 t4 u( i" e
  27. #include <linux/errno.h>
    ) I) @/ c6 R0 a- I" k
  28. #include <linux/types.h>1 M! k8 C9 a: y% e2 B. F8 ^
  29. #include <linux/interrupt.h>3 p( w- ~  t) F3 g6 g- z
  30. #include <asm/io.h>
    5 R: q9 Q: B$ g- w6 S( C" d
  31. #include <linux/moduleparam.h>  j" F' v, m  s' R  n
  32. #include <linux/sysctl.h>
    " G5 n2 N7 u3 t! [" D" W
  33. #include <linux/mm.h>7 N/ E# v* n, g: b
  34. #include <linux/dma-mapping.h>
    ! D7 A. k) e4 e" I) Q. U, {
  35. " J- U0 `. b; }0 \4 O; p; S4 w& {
  36. #include <mach/memory.h>
    ( v7 B- Y" m2 p4 C6 F3 X2 `8 D
  37. #include <mach/hardware.h>. e5 ^4 u1 l8 C) C
  38. #include <mach/irqs.h>" i1 Y8 l/ J! k' u
  39. #include <asm/hardware/edma.h>
      ^3 \* A6 o  w- J( x" p1 S

  40. 6 A' r; a  ^) I1 F$ k
  41. #undef EDMA3_DEBUG
    7 X6 E6 ^, P* d* e2 F# T
  42. /*#define EDMA3_DEBUG*/
    ) V) C' _1 r1 U- w& r( u/ J# ~

  43. ( \8 `. O7 j9 J; S  S, D3 n" _- C
  44. #ifdef EDMA3_DEBUG
    9 }7 i7 |* M9 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 I2 u( U. o2 x3 i" q( {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& Q' {4 u( ]0 d8 H# G- Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . W# v# K7 D  B! I
  48. #else! }! Q6 o9 K8 s! Y! O2 D
  49. #define DMA_PRINTK( x... )
    , A* z# r1 I5 }. J8 m- ]2 o! J2 N
  50. #define DMA_FN_IN
      f; W! J, G; O6 h6 \
  51. #define DMA_FN_OUT
    * \6 W2 M- Q" V# C+ G, p% _9 w5 u/ M
  52. #endif
    ' |! T& H* V: \5 E5 c: S/ O( R
  53. ( T) y, s0 F5 S- b" N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 F- W, u# C  l. R! y6 ]
  55. #define STATIC_SHIFT                3! t! j) b  y# K) w" j8 ^: R
  56. #define TCINTEN_SHIFT               20
    3 e. n$ J& @3 }2 D: F5 M
  57. #define ITCINTEN_SHIFT              21
    ) b, Q4 z9 a* j+ _3 B% Q
  58. #define TCCHEN_SHIFT                22
    - `+ F- |7 f4 L% C$ m0 k
  59. #define ITCCHEN_SHIFT               23
    % t% P. u8 f6 C% x0 `  H" t" N- b
  60. 3 N5 \( ~* U' c6 p1 ?
  61. static volatile int irqraised1 = 0;- C3 Y: i: a1 x* W/ U7 F: T
  62. static volatile int irqraised2 = 0;6 L5 s9 f0 ?! U

  63. ' {2 g" |) _+ ~; }) |1 K7 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 z6 k" h1 s' T" y; M( N! @, W0 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , O  O. A3 o2 G, G) ]7 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( {  J4 A1 I9 i, @+ b
  67. & K3 c8 c8 X7 W- u& p' l
  68. dma_addr_t dmaphyssrc1 = 0;
    $ @( }0 u" W' _
  69. dma_addr_t dmaphyssrc2 = 0;( \' I8 B9 I+ |( c6 M( o% \
  70. dma_addr_t dmaphysdest1 = 0;
    0 v' O* ^2 ^& D+ E: c& i6 I
  71. dma_addr_t dmaphysdest2 = 0;
    . i4 K* q7 p0 h$ K7 ^4 H

  72. , S5 R0 U( a5 D2 w$ X
  73. char *dmabufsrc1 = NULL;
    % d& P, q. h+ B9 r; G% G$ L
  74. char *dmabufsrc2 = NULL;
    , L6 \# x# V  c, f4 O: `
  75. char *dmabufdest1 = NULL;
    0 t$ x' ]' w, o1 v
  76. char *dmabufdest2 = NULL;' H8 t0 \/ e0 L# Y: x
  77. / G; @4 }! }! \& U5 e' q  C3 j
  78. static int acnt = 512;2 l! u, p# z8 h  o
  79. static int bcnt = 8;; k1 y0 o' |2 @4 b" ^3 c  z0 H
  80. static int ccnt = 8;
    " n4 A  h* n! r) W3 v( G

  81. , A) U/ q! k$ U
  82. module_param(acnt, int, S_IRUGO);
    " Z' r: ~* d/ O. l+ X
  83. module_param(bcnt, int, S_IRUGO);. A; P9 p, z+ Y$ \4 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 i: z9 x2 J0 M/ [6 f( q+ M# t  |6 n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 g4 }( j" S/ M+ iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. F8 |+ O$ k& S7 D# C, |9 G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 T4 ^# A- \* U9 j% ]" f% h5 P

, ]0 X8 ^# V( y$ d# ^* [- j* M4 `) u2 m  ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 11:18 , Processed in 0.039459 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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