OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " L- @/ l7 b& v% ?8 Q. o
  1. [code]EDMA sample test application
    0 ]5 {0 s4 ^$ H9 C
  2. /*
    5 s( A6 A* T, {; Z3 D+ x: q$ h$ E. ]
  3. * edma_test.c" k) E3 X6 [8 P, y) H6 v, Y4 n
  4. *8 w3 U! y. U/ P; ~- G4 T& m
  5. * brief  EDMA3 Test Application# O1 u5 Q) v7 D5 T
  6. *
    - X# j0 \/ X. e  x
  7. *   This file contains EDMA3 Test code." R# I( b: W: p1 _
  8. *4 n2 F6 g1 d4 C2 f" a5 G& D$ G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ j5 L3 t4 m! T4 _! @2 z0 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# i- U6 A" h5 L1 T  r
  11. *         TO CHANGE.
    5 j# j' W( K0 M, e: B7 b, ~8 n
  12. *
    3 v; J' x! t; n7 I" r: M/ r( V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ J  h3 r; L; F0 c# m& z
  14. *
    * i; m5 u8 X. N3 P
  15. * This program is free software; you can redistribute it and/or2 ^* J+ ]1 T3 W4 X+ }
  16. * modify it under the terms of the GNU General Public License as. B$ z# C. U  O3 S; w: F: E$ Z2 P0 u
  17. * published by the Free Software Foundation version 2.
    % H$ i6 W% z1 O; k, A$ n
  18. *
    " X  R5 _/ m# x0 }+ {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 _- c& o; o; V
  20. * kind, whether express or implied; without even the implied warranty, w. a- L# Y1 f) D& C. ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* b9 V' {8 x: {. B1 Q
  22. * GNU General Public License for more details.
    : K+ }+ \6 N' R
  23. */( T  F6 J& ~4 y0 N0 Y  H% r
  24. 5 @, b' J  W" v/ ~! V
  25. #include <linux/module.h>
    1 u, H+ h8 v" {- Y) H) K
  26. #include <linux/init.h>
    ; U( y5 |; C- x6 e
  27. #include <linux/errno.h>; u& D- @# p# h/ f9 ]# n. Z* j
  28. #include <linux/types.h>0 M4 x; F7 s4 q  N  ?. O
  29. #include <linux/interrupt.h>
    $ ^& T% F- ?0 f/ P
  30. #include <asm/io.h>
    " s) h/ W# _5 A: W: L1 U  l
  31. #include <linux/moduleparam.h>  `# R. G( ^8 {! y, M) P( A
  32. #include <linux/sysctl.h>
    5 `5 U; t7 v% Q# n! l
  33. #include <linux/mm.h>2 O! q/ {# T/ C6 R: H0 j
  34. #include <linux/dma-mapping.h>6 c& a: C8 c' E* f5 Q
  35. - L- ^! R. D+ _; I: M/ z
  36. #include <mach/memory.h>
    / ?" D5 L# }# _/ o# C
  37. #include <mach/hardware.h>
    : R4 c% {2 u( [) i: @/ a* A# t, s
  38. #include <mach/irqs.h>
    . H  M( u; D" V& |! i0 S
  39. #include <asm/hardware/edma.h>
    9 f% V: M+ d7 ?' G5 a3 Y% @
  40. / _# c4 ~& L- x6 [
  41. #undef EDMA3_DEBUG
    ) U2 \: D- B/ V- j' S6 R
  42. /*#define EDMA3_DEBUG*/
    : M0 m6 L+ [! {/ F

  43. 8 _) W7 Z* t8 }5 A
  44. #ifdef EDMA3_DEBUG
    : I. w# z+ z  X, z' i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ]1 x, B# y0 K+ Q$ T) s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 F0 d0 w* W1 t3 K+ i8 ~+ j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 C& @. ]8 h# e* g  u# U! O' x
  48. #else
    ( Z( ]2 `. H8 V# |
  49. #define DMA_PRINTK( x... )
    ( i* ~; y' y, \
  50. #define DMA_FN_IN
    3 }9 t' G! \+ j  d8 y! I
  51. #define DMA_FN_OUT% i; \6 S/ R( a9 q2 d
  52. #endif/ u& D8 X7 y+ E4 |

  53. * Q; H+ g. X/ D' u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - m6 d. j' t) ^. K# }6 f5 O. T
  55. #define STATIC_SHIFT                3) }- \/ {# `6 s0 g# Q9 k
  56. #define TCINTEN_SHIFT               20+ _/ [: I" z7 @& t
  57. #define ITCINTEN_SHIFT              21: |. o5 j. ~! F& A
  58. #define TCCHEN_SHIFT                22
    4 |1 B) ?6 K; y
  59. #define ITCCHEN_SHIFT               23
    ' }( F+ J" r/ D0 ]' S2 k
  60. - s( E8 O$ \- c6 w
  61. static volatile int irqraised1 = 0;
    " x& @4 a7 j9 R% D$ o, x* ?8 Y
  62. static volatile int irqraised2 = 0;& h# H. _1 w: z0 F" h+ D/ n  y  l
  63.   G8 Y+ \) q8 O" n$ \+ l7 Q  P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & F# n' l  U& }/ \8 x' _2 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# z8 Z% i+ V+ I% |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 _$ `: D7 S' M4 T# P6 s; \: y

  67. * e6 M" ]- ^7 g1 M5 e! e7 D
  68. dma_addr_t dmaphyssrc1 = 0;. g: C2 y; o% B' i# s8 S  U
  69. dma_addr_t dmaphyssrc2 = 0;+ }+ Y) I: v$ L* I  ^5 n: l
  70. dma_addr_t dmaphysdest1 = 0;
      T3 O: t+ W; i! C, K* h$ q) c
  71. dma_addr_t dmaphysdest2 = 0;
    2 t1 M3 n/ f5 |

  72. 1 p+ U, }- |2 p2 w" P
  73. char *dmabufsrc1 = NULL;
    ) s# Z: k7 T; k+ l2 K8 `
  74. char *dmabufsrc2 = NULL;- i# n1 ^* S; O) u5 c1 q' p0 Y/ A
  75. char *dmabufdest1 = NULL;/ M- ~% f4 q- J- L4 U" Q6 i9 i
  76. char *dmabufdest2 = NULL;
    8 x( T4 O% q+ e! B

  77. 0 X- j3 U* n# B
  78. static int acnt = 512;# A% ~) w& O/ f8 w+ H! i* H
  79. static int bcnt = 8;
    " N4 k9 _1 ~; \% E
  80. static int ccnt = 8;" I+ j" H' }  D' k& M, n5 Q' C" R
  81. 6 l& J$ {: J$ {
  82. module_param(acnt, int, S_IRUGO);2 L3 q+ m7 N9 g/ B3 E
  83. module_param(bcnt, int, S_IRUGO);
    : b' `8 y+ V" O6 H# J8 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 X  |5 B# _2 m7 Q- s$ S
' Y( p) K9 Z: X7 c& ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 k5 ?* K& n2 Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ k9 w' ^; K* z2 \- V2 Q& p1 N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 q( H3 a# C& P, X
: W" L( }- {: P2 B
9 Y7 P" D& K3 S# G) ?. Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 01:53 , Processed in 0.041877 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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