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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 i8 I; \. P% P. z5 K6 f" y2 a
  1. [code]EDMA sample test application4 X9 s: N) L# y
  2. /*
    5 E0 D) e' V$ j& S! x* _
  3. * edma_test.c, r7 O3 }3 }% ~! @* I% W
  4. *
    ) b% s% a% D, P: b; ?/ Y0 f) w
  5. * brief  EDMA3 Test Application2 T$ p2 Z; G. r6 _" C5 `( K8 D' G
  6. *5 `/ q$ ~, g$ v+ _
  7. *   This file contains EDMA3 Test code.
    0 q; {5 @, y9 |5 p
  8. *) C2 A$ i# K, h1 i4 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! H$ `# W) A5 g, P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) ^+ a) ~: z( ?7 @& f  [) Y
  11. *         TO CHANGE.( A! O: |1 k& R- @/ |' l7 |4 s
  12. *: B, g2 J: w; `  F; w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 q, P. d; G- f: Y
  14. *: u: T. k: g7 z, V0 N% e
  15. * This program is free software; you can redistribute it and/or
      L" p  `* i5 m' b: ]" ~  @. A
  16. * modify it under the terms of the GNU General Public License as8 L- \6 ?" ?# U3 K
  17. * published by the Free Software Foundation version 2.* y4 M0 Y7 [9 Y4 d$ u9 X
  18. *) b0 Q* z, p+ r& I5 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) k0 L8 J# I$ U" J
  20. * kind, whether express or implied; without even the implied warranty
    ) \6 V8 S+ c! p1 }9 _* q2 K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ h4 m( b! F9 ~
  22. * GNU General Public License for more details.
    ; j- s" ?' C, D! a: @; |- t8 O
  23. */
    # c- ~* m4 s& {6 X

  24. 0 Z! Q) R0 p$ ]
  25. #include <linux/module.h>8 c2 Y( o% t5 o' }2 ~
  26. #include <linux/init.h>, _1 N9 b. U& N6 z
  27. #include <linux/errno.h>9 G9 q8 B7 ~) ?. ]& q4 I
  28. #include <linux/types.h>
    5 a/ d! V. o% e6 t: o
  29. #include <linux/interrupt.h>
      }2 |6 q+ I1 c0 s% Q3 K# e
  30. #include <asm/io.h>
    2 K+ A  a& Z# m0 d2 t( L
  31. #include <linux/moduleparam.h>
    & }9 R2 w& n& ?  S% `  h( q# r4 v
  32. #include <linux/sysctl.h>
    / ~. X% ?* s$ A* k, [4 d/ k! H
  33. #include <linux/mm.h>
    ' l+ L; C. e- N& G
  34. #include <linux/dma-mapping.h>
    9 i$ I# T5 c( k+ z% F9 k3 X- N
  35. 6 x3 u  S% ~- l7 A6 z. }& g9 I
  36. #include <mach/memory.h>& x4 K; o6 P7 U6 X6 P4 ]: z! \
  37. #include <mach/hardware.h>- K8 ?& O: O: E& d$ O  K$ F
  38. #include <mach/irqs.h>, j3 F3 E+ y- ^' Q- |  u
  39. #include <asm/hardware/edma.h>
    2 B& b9 b& k) \4 @) f8 U5 [0 m# Q

  40. * x+ A9 b6 g1 o
  41. #undef EDMA3_DEBUG
    - ]$ ~5 o/ f' O# `6 x1 G
  42. /*#define EDMA3_DEBUG*/# H" F" l$ S5 w" s" V. b
  43. , W  c6 ^5 U; r% n
  44. #ifdef EDMA3_DEBUG/ e' I& d- I% n: U/ X; Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + J$ G% p- Y" K3 i- k: t$ T+ y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' h: d- w& Y* u' q- u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ a3 M1 ^  @1 W
  48. #else: n" C. p1 }5 [' R3 C$ x: p, G
  49. #define DMA_PRINTK( x... )
    3 q, g% C: u! F. n
  50. #define DMA_FN_IN
    - g1 Q2 N. l# P. P% i
  51. #define DMA_FN_OUT3 i- \: |- j6 R, x$ {
  52. #endif
    & W- n: _  G2 M8 C
  53.   K' L( h' j' {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! Q, j8 h0 f+ u: i/ Q0 ^; e
  55. #define STATIC_SHIFT                3
    . W9 }: U% [! a% C2 b3 r
  56. #define TCINTEN_SHIFT               20
    " ]  m: R0 R0 R
  57. #define ITCINTEN_SHIFT              21
    , f6 h2 ^, p# Y" b" t, P$ O: V$ D: d
  58. #define TCCHEN_SHIFT                22+ X) M# `8 P7 S: E5 n, s3 u
  59. #define ITCCHEN_SHIFT               23' B% J5 T% G+ \: I& ^$ _5 Z

  60. : b6 _$ _  Q) K5 F
  61. static volatile int irqraised1 = 0;( Z+ B% ?3 e6 ~
  62. static volatile int irqraised2 = 0;
    2 u, V* p* w6 k% U: `. r6 I
  63. ! D" |5 L3 R7 I& ~- y3 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ^2 P8 V# G) B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ~& e6 [: H  O+ N% [  B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " s1 Y0 W. h, t' I. I9 s' L" I
  67. 2 N7 O; K+ h5 v7 F9 R: g) _' S
  68. dma_addr_t dmaphyssrc1 = 0;4 y7 ^: b" f' o9 t" V( ~1 b
  69. dma_addr_t dmaphyssrc2 = 0;
    ! X3 O6 ]  U5 \, @0 `
  70. dma_addr_t dmaphysdest1 = 0;& x3 ^; u8 N! w) ^; }
  71. dma_addr_t dmaphysdest2 = 0;2 }' S' ?8 s! R: z! D

  72. - ^$ b0 u1 z+ `2 c8 d
  73. char *dmabufsrc1 = NULL;1 X' \- ]9 [* W0 o# p! j; N4 e
  74. char *dmabufsrc2 = NULL;, K0 R9 F' R; i8 Y1 M9 k' L
  75. char *dmabufdest1 = NULL;
    2 S9 P5 j+ M+ m3 o( |
  76. char *dmabufdest2 = NULL;
    ! L% F/ ]" `# a- O

  77. ) s. A) `" e$ A% N! V
  78. static int acnt = 512;6 @/ u' e$ l% M( t1 m% z& ~
  79. static int bcnt = 8;7 }' m7 W+ Q8 t# z1 e( w' M- j$ E' J% }
  80. static int ccnt = 8;
    ; a! L% U& a/ @( {  B0 B

  81. 3 l: P& V: s5 x3 L, Q
  82. module_param(acnt, int, S_IRUGO);
    * a7 p: h* Y! G" U# t( S3 R
  83. module_param(bcnt, int, S_IRUGO);
    5 A5 X$ N1 M5 d2 f" l% a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. P* ]+ v& J) R) `6 o, d3 a
- V* \8 z# }0 R9 X- N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) T  J/ A) o) d7 Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( j7 f7 ]4 Q7 q! s7 \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% b* Q5 b" O! x8 P7 c+ V" j$ o
' c0 ?- S1 y$ l9 \% M! h" o" W- r/ y. S5 D+ Y5 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-4 10:43 , Processed in 0.040128 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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