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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& i+ X4 G  A6 F& j
  1. [code]EDMA sample test application# A$ v6 e1 [* |# C$ C9 F
  2. /*
    * C9 n, ?) {; `8 [' u. O5 t
  3. * edma_test.c8 q3 o" \9 f. o. x: @
  4. *: {/ Q9 e" i0 s% K
  5. * brief  EDMA3 Test Application
    * G% l' o& s5 m
  6. *' C7 _/ w7 |- X' g" U
  7. *   This file contains EDMA3 Test code./ \* O2 `" P) Z) H. }  R  u# E4 b
  8. *
    7 @( w. z; J0 u8 j2 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      n# `- u* C& D' b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 O4 v: c% ]" S4 [% N& r$ {
  11. *         TO CHANGE.7 c& X8 |, G. V, c- u
  12. *, [1 k# s# A( e# O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 u" B, C! V) j4 S( \0 a
  14. *
      A5 w) M+ l; @/ X8 a
  15. * This program is free software; you can redistribute it and/or- A# h% L$ _# O
  16. * modify it under the terms of the GNU General Public License as
    * a5 H, K$ Z# y5 p) O) m
  17. * published by the Free Software Foundation version 2.
    - F4 R- R6 n6 [4 j+ O8 Q: u
  18. *
    6 ]$ ]0 }; T% O# I1 H6 W$ C: J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; w, Y( |5 d$ z
  20. * kind, whether express or implied; without even the implied warranty
    & T( ]% ^& q) r; X3 M! L7 C& N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 B0 t+ L  k* S) U7 L
  22. * GNU General Public License for more details.; A  W0 C8 \0 w. [' [
  23. */
    2 w( {# p0 u* x# y) t% ~

  24. ; `4 J* P% ^& t
  25. #include <linux/module.h>( ]: v8 p. K( ?' G
  26. #include <linux/init.h>- o3 X+ V$ F2 c" A
  27. #include <linux/errno.h>  _( ^& ]% b0 U+ t# l! c8 m4 \7 R
  28. #include <linux/types.h>
    # O# W+ }1 }0 o5 G5 h- @# u
  29. #include <linux/interrupt.h>
    ; p# D1 f. f+ f4 n3 I0 N
  30. #include <asm/io.h>) q' `( E$ Z* A: r/ w
  31. #include <linux/moduleparam.h>! E7 `. E6 I) j4 P* D, b% [5 u
  32. #include <linux/sysctl.h>2 g( s. z7 V  V: ]0 X5 I
  33. #include <linux/mm.h>
    ; V/ W" d- k# M* c$ @6 E
  34. #include <linux/dma-mapping.h>  |9 i/ A% U  d$ I! [0 m
  35. $ k6 _9 o* G2 W7 \% I& z
  36. #include <mach/memory.h>% f. Q) ^+ M$ N
  37. #include <mach/hardware.h>& }1 \9 T4 k: j7 C8 S( u- H
  38. #include <mach/irqs.h>8 q% s5 `8 `( C- b
  39. #include <asm/hardware/edma.h>- s+ c7 I% D& f& U) x+ o2 Y" l

  40. ' n4 x% y* R3 g. d! Z
  41. #undef EDMA3_DEBUG
    / J1 j; n! b- ]0 [& S* I/ [2 W* m
  42. /*#define EDMA3_DEBUG*/
    * Z6 Y: X4 Q% O0 U' L; L

  43. 0 r  S- e; \3 B; A% A. U
  44. #ifdef EDMA3_DEBUG
    - @- h) c: ~2 Q4 r# X" p$ E5 i+ A8 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) J- p% e8 k) N* ~, x+ ^1 ^; `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! P- e, j: }' T4 `0 Q, [$ z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 a1 N3 {! }3 d% Z$ |  \1 H. a
  48. #else
    7 x2 e7 B; f3 Q- n: }
  49. #define DMA_PRINTK( x... )
    & L7 [# O. z; ~/ {4 G7 @9 o. ]( p# e( Z
  50. #define DMA_FN_IN
    6 S& ~& P! g* _0 S4 K$ W7 ^
  51. #define DMA_FN_OUT5 h: a/ M  U( v4 x( W
  52. #endif
      x% \6 z# G4 w7 H" ~! Y) h, R
  53. 0 c% F0 E0 y2 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / K4 Y5 {$ Q0 s0 e7 b% ?
  55. #define STATIC_SHIFT                3
    ) [/ Y  U% u% a8 a) z8 B0 c3 m
  56. #define TCINTEN_SHIFT               20
    % l/ T. K5 {  G* K' D3 I( g5 i' T6 l
  57. #define ITCINTEN_SHIFT              213 H+ P' {* L. C* t
  58. #define TCCHEN_SHIFT                22  Y4 W6 H& X9 ^5 q8 t2 j
  59. #define ITCCHEN_SHIFT               23
    . W5 u  l8 U+ w" c5 ^* n* D

  60. 0 x) u; ~  r& X" {( l( W
  61. static volatile int irqraised1 = 0;
    8 s: d7 D- o9 ?& d: G0 i& a4 X7 r2 V0 A
  62. static volatile int irqraised2 = 0;
    ! ~  x/ q7 I* _8 p- ]

  63. / D) C  _4 I+ n2 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: i1 Q& O' ?% w! r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / j" U2 b6 e; h! E' ~3 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: V1 T' X0 g* {. _8 @- S  _
  67. ! t/ X4 o! C' [, f0 a8 A
  68. dma_addr_t dmaphyssrc1 = 0;
    & [$ `' ^2 |7 X1 ?
  69. dma_addr_t dmaphyssrc2 = 0;
    " R8 ^" y( N8 N$ g" E
  70. dma_addr_t dmaphysdest1 = 0;
    / |7 w7 R4 ^- ~: [2 X# }! w
  71. dma_addr_t dmaphysdest2 = 0;- Z3 Z* _" N8 q& z

  72. 5 ~. L, M* W  m# B' x( e
  73. char *dmabufsrc1 = NULL;
    ( G+ p8 t# a0 Q) ~4 E# V2 N
  74. char *dmabufsrc2 = NULL;. I- a& S/ A* j& _6 R" X  @' t
  75. char *dmabufdest1 = NULL;* o% N% x: l; `& B$ ?: I
  76. char *dmabufdest2 = NULL;2 h; |* |/ g' h

  77. 4 e* |6 F$ E# [. W7 _
  78. static int acnt = 512;1 \) P9 P6 c/ ?. Q, B6 `
  79. static int bcnt = 8;
    " |# A5 p) N, p, O
  80. static int ccnt = 8;
    * }# f' g$ G+ e% C

  81. 3 Q: M2 ?$ \0 S6 G& k3 e
  82. module_param(acnt, int, S_IRUGO);
    1 D0 N9 y3 a/ h2 [
  83. module_param(bcnt, int, S_IRUGO);
    ' o4 S- e1 m3 u' T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 |7 P  N% Q6 w( |( j& E2 ?
: P! b: [$ g+ |6 ^- A; I2 v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 D; |& Y5 B, tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 e8 j2 A6 [) u; Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ o- A: W& [5 E- z/ C# u6 ^* @, J

: ~* C7 i8 E+ s, Z) H0 L! u9 E& [% a- b9 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 16:25 , Processed in 0.040875 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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