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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 O7 {! n9 @9 j
  1. [code]EDMA sample test application
      L; }: F0 H8 ~7 }+ M: n
  2. /*
    ' l9 [, O# D4 b: a. `) J5 S, J  t
  3. * edma_test.c
    5 G3 y. F0 t# X8 q4 B6 W
  4. *
    / y5 q' [5 Q4 g+ T; X
  5. * brief  EDMA3 Test Application
    2 _* z5 {; c+ c) A8 Z0 N
  6. *& [# W+ @& A& U& t3 K
  7. *   This file contains EDMA3 Test code.
    ) v8 L: q. M0 l+ I" K
  8. *
    - `/ g5 b2 C# @* d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# C8 C% R! Q4 N+ X7 f3 J0 y' Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 `1 G7 L/ [" }; U( o: X
  11. *         TO CHANGE.$ T5 s1 p) @% J/ m
  12. *; i5 H. q1 M' R; I7 ^1 }* ~1 k# s+ d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! A  v. E7 ^' e7 `
  14. *( h9 K" A. K% r' U& V
  15. * This program is free software; you can redistribute it and/or+ z! [# w$ V) }: n* h5 P
  16. * modify it under the terms of the GNU General Public License as
    ' b0 `: t! E% `
  17. * published by the Free Software Foundation version 2.
    / k) o- p5 M8 \5 q
  18. *
    # p% ?5 J8 ?8 f7 m6 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 y% s4 K8 {8 w, P( d
  20. * kind, whether express or implied; without even the implied warranty
    ! M' H+ x4 z3 f+ ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * H% P" y% i& e0 h
  22. * GNU General Public License for more details.
    , h- V, x+ W5 w: H% u
  23. */
    & g! @4 \: y; N. r9 h7 D
  24. + E6 L( N  [" ]+ }5 U. i1 f8 r
  25. #include <linux/module.h>
    $ K: y3 A6 P+ V
  26. #include <linux/init.h>* o0 K4 V3 t3 d/ p" G8 X
  27. #include <linux/errno.h>7 ]# X0 u9 ]1 m' C
  28. #include <linux/types.h>
      H/ g7 v- A- D4 b) W
  29. #include <linux/interrupt.h>
    0 Z, B! M2 z( f5 ^" m/ N1 B( R; c
  30. #include <asm/io.h>
    6 D8 x" `$ s8 f% ?8 i' a
  31. #include <linux/moduleparam.h>
    9 J* ]1 M' ?1 _/ W& P- p
  32. #include <linux/sysctl.h>$ _1 J5 s: _1 P, u
  33. #include <linux/mm.h>
    % [' G5 g: f" |5 Z
  34. #include <linux/dma-mapping.h>2 d7 S8 O# e" Z# e8 T- A
  35. ' \8 R  {! \2 y
  36. #include <mach/memory.h>& }$ h5 x  \' n* J" ?: |6 s
  37. #include <mach/hardware.h>) D! G: r9 g4 |/ P( i/ q
  38. #include <mach/irqs.h>
    2 G+ I2 ]& H7 m% F0 u  W
  39. #include <asm/hardware/edma.h>
    % Y$ Q( I4 U6 Z! F3 ^

  40. # {! r+ V( d: m0 q5 \8 m
  41. #undef EDMA3_DEBUG
    7 D* l* _2 |# ~7 j- m  h1 L2 e# j& w
  42. /*#define EDMA3_DEBUG*/
    & w" `/ _/ R0 C5 s
  43. 8 M7 Y5 R7 b' l/ [( b! ?
  44. #ifdef EDMA3_DEBUG
    ; r6 b2 Q, d! `6 A( N8 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 H" q4 B/ m& }9 ?" I: v8 y, D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 W* ~8 X# ]# t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & e6 k+ O1 _9 C' G( R8 j& Z( m
  48. #else) A, e4 [+ ?. `* Y* {4 C8 P
  49. #define DMA_PRINTK( x... )
    3 ~6 u, M8 T  l
  50. #define DMA_FN_IN9 Q$ C' T: O2 o# E. L; c! y( b
  51. #define DMA_FN_OUT
    1 s% p% y/ N9 p; |+ E* d" |
  52. #endif) I7 U8 p4 a, k& A6 A1 C

  53. % n' R. k3 y! E, J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , r  s+ c& @1 \: x% a
  55. #define STATIC_SHIFT                3
      b& _7 Y! M! C9 D0 C- |( Y
  56. #define TCINTEN_SHIFT               20! q: @0 I6 W5 i& f' L6 {5 s# ^
  57. #define ITCINTEN_SHIFT              21: z6 z' _$ K7 r/ @, T( Y
  58. #define TCCHEN_SHIFT                22
    7 f$ H5 Z% Q4 |( |) J
  59. #define ITCCHEN_SHIFT               23) ^& d( N( @: ?( J0 s

  60. % Z" K2 O$ S) s
  61. static volatile int irqraised1 = 0;7 v. u# u, I9 U/ e) E/ X  q
  62. static volatile int irqraised2 = 0;
    / H2 i" [" m& R/ E: p
  63. * z4 J5 f& w. N; S# V) Y; `: W9 S. f7 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) q& o# ?6 P/ u4 E8 p+ h; T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) @8 S' h% \4 g/ a& k) f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 h: C% Q' G5 @4 g3 ?( O: Q

  67. # F6 x# j* H+ U, y
  68. dma_addr_t dmaphyssrc1 = 0;
    # u5 S  i; y: ]: b" }
  69. dma_addr_t dmaphyssrc2 = 0;8 h( g4 S0 c3 k: V1 R) c
  70. dma_addr_t dmaphysdest1 = 0;
    / D* ]7 ]2 t6 s$ u, P) z+ p- U  j
  71. dma_addr_t dmaphysdest2 = 0;" n0 z' X, f  L" _. D3 d' M
  72. 9 u) x# e+ S) B- L- s
  73. char *dmabufsrc1 = NULL;
    - Y+ K: R; K, f. L
  74. char *dmabufsrc2 = NULL;' @, s5 b2 T* w! ]& }3 e2 f& G
  75. char *dmabufdest1 = NULL;- b' G, v9 X( x% N
  76. char *dmabufdest2 = NULL;% J4 N6 h$ i2 a  k6 J0 R* `9 M
  77. $ |- M7 Q' `7 c3 E2 S) u
  78. static int acnt = 512;8 g8 k6 M0 E2 r0 z/ |
  79. static int bcnt = 8;
    6 s  g0 H1 {% t9 O6 B" V
  80. static int ccnt = 8;& c, m/ t- y! K% `  z& w

  81. 3 b9 y/ Q' d$ `
  82. module_param(acnt, int, S_IRUGO);- L2 h" n+ j' x6 Y  r- g
  83. module_param(bcnt, int, S_IRUGO);0 S* H  v! L, `" `/ X- z* O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. t* S8 l8 n1 }' o. G* P

' J& j4 w& b( \$ ?/ N( ^" P; Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ k! y  p% _  \6 c- H* I3 k+ @* rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ ^( o; N- l0 `$ q4 T0 s/ [$ M2 G; N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  B6 A2 D3 G  D$ m0 t& {/ k4 V+ H2 X, n! V8 n. |; _1 {
; V6 M$ W  F. v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 04:51 , Processed in 0.039762 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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