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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 m6 z# A( D% I0 s' ?4 b% B1 P7 N
  1. [code]EDMA sample test application4 |1 x* a( Z; l: z5 Y
  2. /*9 q4 N; i7 o' [
  3. * edma_test.c+ r* a) U# V5 A0 H! R/ Q! U  J/ }/ X
  4. *% H, o* f" U4 q* V* Q4 T6 M% z/ T
  5. * brief  EDMA3 Test Application
    1 T" m) g4 r- |' o: {" z
  6. *
    - V/ s) p& U2 k' ^; a5 ]
  7. *   This file contains EDMA3 Test code.
    , a6 s7 J) W% o& z. ]  j( V
  8. *0 R+ Z1 a7 ]2 q& f, S  j: Z8 C" R8 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) M0 }" w# C- _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 ?% D& E: r. ]' _! b3 N" n9 v
  11. *         TO CHANGE.
    0 f  o$ ?- C% v* U4 t
  12. *2 d4 D" X( [: [8 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 V/ w/ U! c" V4 F
  14. *
    " Y) k4 \% \) C$ [
  15. * This program is free software; you can redistribute it and/or
    ) [' _% r8 Q0 z% t
  16. * modify it under the terms of the GNU General Public License as
    ; s' I# }& g, _" w% U* |
  17. * published by the Free Software Foundation version 2.
    0 {- M' j/ |! r
  18. *$ X4 o; d, O( u" J+ H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + V2 b" e/ L8 w6 V, t
  20. * kind, whether express or implied; without even the implied warranty( X1 }2 C2 \7 ]) q% D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) e* ]- n7 s7 x- ~2 r5 l* k
  22. * GNU General Public License for more details.
    ; j% f1 E( \. S4 X" r
  23. */# T& W  j, f, X/ o  v" r/ N0 p$ H

  24. 6 A2 m6 t, `9 S% o. Y
  25. #include <linux/module.h>+ ~" H6 b5 X4 \& k" \
  26. #include <linux/init.h>3 i2 H3 b% O" k4 C
  27. #include <linux/errno.h>
    4 g3 n+ x' k( F
  28. #include <linux/types.h>; C* [* @4 r( X% N+ w7 @
  29. #include <linux/interrupt.h>4 I% m  ]1 D" U) S4 [% v9 R, _% l
  30. #include <asm/io.h>9 T' x$ X8 Z+ ~5 U5 v! |
  31. #include <linux/moduleparam.h>( p5 A+ w5 k* [
  32. #include <linux/sysctl.h>
    2 E* l3 V" |* s1 f8 l7 X
  33. #include <linux/mm.h>5 ^1 s2 U& I  m' R* w  p
  34. #include <linux/dma-mapping.h>
    . G" H' H4 a1 D$ l5 |" |2 `
  35. 9 ]4 ]% l. ~- j4 Q" X5 J
  36. #include <mach/memory.h>
    6 |7 [# Z/ t" t2 \! f( {
  37. #include <mach/hardware.h>
    3 \2 t3 T5 ?. `/ {
  38. #include <mach/irqs.h>  r9 w# W( I% V; A0 D
  39. #include <asm/hardware/edma.h>
    ; m/ J6 F2 K! u, s, E: @/ S

  40. 5 }$ \# P9 |/ d1 J; U
  41. #undef EDMA3_DEBUG
    ( n2 c) ~  ]& ^0 E; G: {3 g# P  Z, y
  42. /*#define EDMA3_DEBUG*/
    4 W4 T, M7 c+ Q# V

  43. + B* o, S, [+ ~- r. `0 f
  44. #ifdef EDMA3_DEBUG
    + ~( r& z3 J3 }0 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- M2 N' h! N* f  f  L4 `8 B8 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 U$ W: ]; g/ _( s, b3 X0 i' Y' `1 V" f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 A* s: g: j% y$ s! l6 j
  48. #else
    4 p' y4 @* |5 Y: c+ k* X9 ]& w) M
  49. #define DMA_PRINTK( x... )3 E+ h5 _- f: w
  50. #define DMA_FN_IN
    * d% ~0 |5 e/ D( u' k* W
  51. #define DMA_FN_OUT
    " {, a2 C. }8 h
  52. #endif) Z7 e* P; \" N( D- C0 X7 o' a

  53. 3 H& U  I$ B8 ~$ B! T7 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ M& c" U; w, R. v# g
  55. #define STATIC_SHIFT                3
      x2 H7 ]7 h6 ~" k
  56. #define TCINTEN_SHIFT               20
    ) f% N# L4 N$ _  B/ u5 \6 O+ G# v
  57. #define ITCINTEN_SHIFT              21
    & \6 q7 K2 N" q+ E5 W7 A* c8 L8 J! Y
  58. #define TCCHEN_SHIFT                22' U( R* `' A' r) n8 Z, `5 p
  59. #define ITCCHEN_SHIFT               23
    4 d# L8 R  u& x, R0 x6 r
  60. * y6 r1 a" n7 Y. b) ~  M
  61. static volatile int irqraised1 = 0;
    # C' H# @, {% W- Z6 n* h4 X8 v- I5 T
  62. static volatile int irqraised2 = 0;: K( T; u4 r6 @! D
  63. . l% x5 l5 I# V. e* Z3 B& p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 J! B( h% W9 d# A; W* x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , }% p+ ?# B! t7 M: K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : S9 a, j: W, w. a6 _

  67. 4 S' F- t, I( W7 j# g6 e5 W
  68. dma_addr_t dmaphyssrc1 = 0;! R7 S/ t1 A2 K+ I' m7 u- z7 C' Z
  69. dma_addr_t dmaphyssrc2 = 0;. @4 \+ s# }* k' y" m& {
  70. dma_addr_t dmaphysdest1 = 0;
      D& b* I% H) j9 n$ l5 B/ X/ G
  71. dma_addr_t dmaphysdest2 = 0;  _: z7 o$ M% ?* c
  72. " s& H6 @. J2 m2 a
  73. char *dmabufsrc1 = NULL;
    . {  f" q, X) v, d, \. k& \* d0 v
  74. char *dmabufsrc2 = NULL;4 H$ {2 C5 a7 A$ ~0 E& X
  75. char *dmabufdest1 = NULL;8 K" f, N2 ^" @1 i0 Q) f
  76. char *dmabufdest2 = NULL;: N, U/ K7 U6 |/ Y$ @6 z& f
  77. . Z7 N: }: m" Q
  78. static int acnt = 512;2 z  }, l6 U" M$ t
  79. static int bcnt = 8;% }7 R, v% [  U  w
  80. static int ccnt = 8;
    1 F/ x0 d( b. ~9 h) n% F  S5 K
  81. - n5 r+ N2 P- O4 N
  82. module_param(acnt, int, S_IRUGO);% ]0 h% ]% Z. O* Q9 P& y2 e
  83. module_param(bcnt, int, S_IRUGO);" [% c/ c: y& T, d9 R+ V+ \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% ]# B5 v0 ]8 i# t, t
7 `1 h4 r) |$ M- r5 W( N: s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# q! D+ A* P% ~! Y1 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 Z/ q' f; _5 X& O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ j4 N: k, V* G# |: ~! I1 a
% v  f3 a! m0 ?1 M- i' v

$ X5 _  a# G; I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 20:35 , Processed in 0.040648 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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