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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 M$ z2 _8 a0 c. A6 W6 F
  1. [code]EDMA sample test application2 z0 l. j* R) o7 M% M
  2. /*! ]3 I- H" z& r+ {% o: m& k4 b
  3. * edma_test.c
    - r6 @: T6 W2 M. t& Y3 p
  4. *' e# H. e( g7 k+ y& m' g6 F$ u
  5. * brief  EDMA3 Test Application, X2 P7 y. k3 i$ i! P' i
  6. *
    , N  H) A5 B! ^
  7. *   This file contains EDMA3 Test code.! g" d- F. S  L9 g! @% W, k# `
  8. *( t7 \/ B! k3 U" D. I- l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. D/ y3 F8 J- g9 \; ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( f, r8 R2 I# _$ |! w
  11. *         TO CHANGE.
    & p% D, k" `- s. w' S! P+ L
  12. *. w- V6 J7 @3 P2 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! N' t6 y! A: }* g. S- h
  14. *0 G1 N. c, E1 S- [. T
  15. * This program is free software; you can redistribute it and/or& t+ u7 Y- ~! H; H/ \/ D
  16. * modify it under the terms of the GNU General Public License as
    9 S1 W+ w1 I6 {7 s. ^% m6 {4 A
  17. * published by the Free Software Foundation version 2.
    * X7 U7 ?2 [/ j" g+ y
  18. *
    2 E/ Y5 ~! x. H! @; `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- `: v' X. o$ ~' i6 E( ?  f
  20. * kind, whether express or implied; without even the implied warranty
    - t& L9 i4 _+ n3 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% Q9 [/ M+ ?: N: d' v
  22. * GNU General Public License for more details.. m, @5 }! Z8 y# G  c  l1 R
  23. */
      Z! Z% U8 V$ n% R6 G

  24. 4 i: x1 g9 H# W2 N; m3 O4 U
  25. #include <linux/module.h>& J2 q/ q* j, |) S) ?6 T% M
  26. #include <linux/init.h>* v: W. H9 p% o$ W/ S/ I% u5 a
  27. #include <linux/errno.h>) M) U, j  G# H. e
  28. #include <linux/types.h>! z/ c: j5 \$ n4 y- R4 O$ U- g
  29. #include <linux/interrupt.h>. {3 D7 U  p# B+ [
  30. #include <asm/io.h>
    ) t( C$ h' c. V8 L
  31. #include <linux/moduleparam.h>
    1 j. }5 n& j& q( l: Y
  32. #include <linux/sysctl.h>
    8 l2 I5 h. K/ Q5 A( j' b
  33. #include <linux/mm.h>0 S$ }8 ^1 O% D6 U. U4 P( L
  34. #include <linux/dma-mapping.h>
    " t3 H' F9 @4 O

  35. 4 P1 s% a: U; y* Q( i, |  B! h
  36. #include <mach/memory.h>+ @8 \9 W! s; c% S7 O
  37. #include <mach/hardware.h>
    ( w6 R+ K, d$ u3 Z& _7 l, }
  38. #include <mach/irqs.h>
    ( J; |+ k8 q2 m+ W8 o9 ]( i
  39. #include <asm/hardware/edma.h>7 ]- G% t) {7 n- ~& ~/ S5 F
  40. + w. |7 p$ P8 W. _7 u0 R6 w/ M0 ?) Z2 i
  41. #undef EDMA3_DEBUG' `6 i! n4 a2 W1 D$ Q1 B
  42. /*#define EDMA3_DEBUG*/4 E8 y3 S, q0 d' L4 s8 p5 m
  43. ; i1 L1 D! P6 T9 X" {' @8 {6 v) L0 r
  44. #ifdef EDMA3_DEBUG
    9 y  h# Z  |& Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- s# c' f0 g$ a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : v2 K0 j! Y1 W# S3 p8 E8 R" C, F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 n! C/ T) i( V1 g" o; S- t
  48. #else
      N& P8 M. c1 h9 k
  49. #define DMA_PRINTK( x... )* p* a4 x% \: E" j
  50. #define DMA_FN_IN
    9 n8 U& e' S, m  m# R& A* V: l
  51. #define DMA_FN_OUT
    ' `1 Y  i  P" R) w# A& f: d# i1 P
  52. #endif+ ~4 L% x. C0 B/ n# j+ y6 ]
  53. / ]$ S# e" L: v, A5 c, v2 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % h$ V5 J* f9 V) m' G
  55. #define STATIC_SHIFT                3
    7 r8 w$ n& }+ c" M% Z) J1 l; D
  56. #define TCINTEN_SHIFT               20' j5 U, w1 f: l! J
  57. #define ITCINTEN_SHIFT              21& W  r" e" q  m' v0 X
  58. #define TCCHEN_SHIFT                229 ?: w5 {3 S* u5 P& {" O2 _
  59. #define ITCCHEN_SHIFT               23
    ( b. E$ a4 z6 F& \& t" K2 G5 `

  60. , ~7 u8 C; u8 x0 f: b; [
  61. static volatile int irqraised1 = 0;3 ~3 \7 L  T$ ]$ s6 Q6 L- |1 C
  62. static volatile int irqraised2 = 0;
    ( U0 o' P6 g% j0 I! F  y+ m* Q

  63. ' @+ L1 w+ C( c; i, f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 A. W7 V6 f; p$ d& l% K* g3 o8 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 E9 n2 e( x4 w3 C$ H1 k' o2 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' d5 G( M& R" Z: E

  67. 7 @* Y- L3 `1 e- t2 e0 [7 f" b
  68. dma_addr_t dmaphyssrc1 = 0;
    * D# G+ h2 Z( n
  69. dma_addr_t dmaphyssrc2 = 0;
    * c3 \" }' G/ s0 W
  70. dma_addr_t dmaphysdest1 = 0;& q8 ~" a/ D7 V1 d) O
  71. dma_addr_t dmaphysdest2 = 0;0 w. j# Y% X0 s9 `9 z

  72. 4 ?! p2 x' u) g3 F+ E
  73. char *dmabufsrc1 = NULL;6 ]0 E7 X: A$ H, m4 I
  74. char *dmabufsrc2 = NULL;3 o# P& m7 p. i( N. |& O! F% R
  75. char *dmabufdest1 = NULL;) M" s( G2 Y8 [/ }% D
  76. char *dmabufdest2 = NULL;
    0 Y# n/ Q& S% x4 ^" \$ a; P
  77.   @: r  B+ _" c8 K
  78. static int acnt = 512;
    . I. E6 Y0 U# y3 s7 X
  79. static int bcnt = 8;
    ! _5 D7 l( L6 c
  80. static int ccnt = 8;
    $ Z- ?( m$ c! L* ]1 r) T

  81. * r4 ?5 ?, i3 y( a
  82. module_param(acnt, int, S_IRUGO);& p  O8 E& U6 k) M/ Q) `
  83. module_param(bcnt, int, S_IRUGO);' I9 T- V! ?3 a' R) G5 w" a' m1 |2 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" t! Y( F; y3 S4 k
4 p+ ~9 x$ g# g1 \. N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ l1 \" Z+ `# j5 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# u/ G$ e: q, \0 ?  d- A! v9 |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ N3 z6 T* V7 X, w" b3 t( c
; d, ^% V+ Y) D+ t8 a+ H

) H2 d' `" P( w9 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 02:49 , Processed in 0.040041 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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