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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ J, P+ C+ }+ o/ n* M8 U$ n
  1. [code]EDMA sample test application
    5 H5 ~; @7 w1 }" o4 u  m6 P, k; w
  2. /*+ Y- `! x! Y3 {) T
  3. * edma_test.c
    " p" W* Z, z; E& d& ?
  4. *
      p) X! z$ M" l1 \9 [
  5. * brief  EDMA3 Test Application- c4 z9 H6 D4 T; I; Q$ u- y/ H9 y7 d
  6. *
    . w/ }& g& z  c1 C$ O; _
  7. *   This file contains EDMA3 Test code.
    8 s$ ?3 f) D+ L: o" d
  8. *# U0 n: k  L6 }' Q9 H& Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- u  b, P% _% y' }3 \8 n: r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 A2 Y  P0 z: M$ V% t
  11. *         TO CHANGE.
    3 l  J" @/ ]( @/ |) a
  12. *$ Y$ g( x" s. Z: |8 r6 I4 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      ?$ Z/ P3 d2 S: h" k
  14. *
    3 n$ V, K  p; b. h( p
  15. * This program is free software; you can redistribute it and/or) m- y3 N  `9 c
  16. * modify it under the terms of the GNU General Public License as8 T$ J' v3 i! C9 i, Q& ^" x
  17. * published by the Free Software Foundation version 2.
    - v5 V1 l' F, `3 T1 ^) T! B$ Q
  18. *
    1 A, W- g# a5 w$ M" z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 `* a8 G- c9 v
  20. * kind, whether express or implied; without even the implied warranty
    + k/ [# Y7 p( @* C5 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ y1 ?3 M6 z6 O* o
  22. * GNU General Public License for more details.
    ! a! H, N1 o! p/ D# J6 }3 o3 m! o
  23. */7 T. T* c' [: ?! V3 x3 X! h' c7 |

  24. 9 ?3 ?# k1 t$ Q3 R8 L6 |4 T$ P
  25. #include <linux/module.h>
    3 y0 l9 @7 C% l
  26. #include <linux/init.h>
    4 T6 k7 O* i6 j, I* v8 v
  27. #include <linux/errno.h>3 N. m9 z* [2 ]6 T( o
  28. #include <linux/types.h>
    7 j* |5 B- M' C+ z
  29. #include <linux/interrupt.h>9 p2 U1 j  F2 S1 D& o) i1 m
  30. #include <asm/io.h>: [( m1 Z. ?2 y4 |9 Q  q( H0 k, G, g' e
  31. #include <linux/moduleparam.h>
    . `6 I9 _0 T  q- t6 d
  32. #include <linux/sysctl.h>
    2 Z, [" x* b: R3 p! f2 `; F
  33. #include <linux/mm.h>4 o" d0 ^. x- X- J
  34. #include <linux/dma-mapping.h>
    9 }: P5 r: w% o' M% [# I
  35. 3 v) o2 M9 R4 L& z
  36. #include <mach/memory.h>
    6 n/ ]3 E1 c3 s, A# |7 W% N
  37. #include <mach/hardware.h>
    " m; w' g' Z' I" D$ s. O
  38. #include <mach/irqs.h>
    ) d; r2 z8 S( V$ F. ~! y; X% y) n
  39. #include <asm/hardware/edma.h>  v8 \" Q. j& {7 ~! D5 J

  40. 8 a% [  _; H/ @! e
  41. #undef EDMA3_DEBUG
    0 \5 O: e# V' q! [& i1 {. M
  42. /*#define EDMA3_DEBUG*/: f: _, U/ Y6 u* y! s) Q9 q; {

  43. + W" i; M( S/ e2 c5 |' H/ i$ n& [+ v
  44. #ifdef EDMA3_DEBUG2 H2 Q) ~% u3 L( W" V& ~8 B- H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' m, X' F  L6 X! h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 @1 u" P, O3 e; ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- N7 k" y8 J- @& x% P
  48. #else, @; [$ C5 y8 i; M* d, P9 {
  49. #define DMA_PRINTK( x... )! B" {* ?) u$ `+ H7 C
  50. #define DMA_FN_IN/ P9 F" C6 e' @9 O% t
  51. #define DMA_FN_OUT
    - J$ F( X% K  ?2 v. Y1 z
  52. #endif5 V: g1 h$ h) Z5 D% d

  53. ) d" F+ j; J; z  e( H; C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), g: i) B1 J5 L% m
  55. #define STATIC_SHIFT                3
    - e; {. c* x4 d. @
  56. #define TCINTEN_SHIFT               20
    * e8 L4 W5 F) B& l
  57. #define ITCINTEN_SHIFT              21
    4 C0 b" A$ H; t
  58. #define TCCHEN_SHIFT                22
    , I& K6 X& q: N
  59. #define ITCCHEN_SHIFT               23- H- l0 Q/ ~- m3 B6 R
  60. 1 Y; ^0 e+ m# i5 r& ]
  61. static volatile int irqraised1 = 0;; a1 \! k* C) v* @- k' _
  62. static volatile int irqraised2 = 0;
    " m+ Z  V0 Q  r& y
  63. # @9 j" a7 O. Q) |- t0 ?1 }! B5 w6 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, x2 H7 U6 M1 _& T+ {7 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; _4 A, B  i" {* j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 i( w* P5 t) x7 A
  67. 1 k8 O/ N0 e' A% n# t2 T, E
  68. dma_addr_t dmaphyssrc1 = 0;
    ( `  ]2 V/ }/ G& Y; m9 T
  69. dma_addr_t dmaphyssrc2 = 0;
    & S4 @, N* i- g. l% v% ?* A
  70. dma_addr_t dmaphysdest1 = 0;- Q* |5 o5 w# P' h$ Y
  71. dma_addr_t dmaphysdest2 = 0;5 L& Z  f7 Q7 B. z3 I

  72. 7 G& ^) x' r  V0 v0 b
  73. char *dmabufsrc1 = NULL;+ ^' @% B0 q: K7 N) b' [
  74. char *dmabufsrc2 = NULL;
    - |$ [+ {0 i9 ]; m$ n
  75. char *dmabufdest1 = NULL;
    % h) E2 k0 w$ [! Y7 p0 O1 O
  76. char *dmabufdest2 = NULL;
    6 P' ^+ u: Q/ {; m# T& B4 S
  77. 0 U, i3 `1 X. C! X! n4 v& ]! T
  78. static int acnt = 512;* N( p2 m' f4 n2 ^" e
  79. static int bcnt = 8;) |2 ^5 J9 D9 f2 A. u
  80. static int ccnt = 8;
    $ O: ]- }# A' l' W+ L" u
  81.   C; a; l& b! U( U' k2 A8 i8 `
  82. module_param(acnt, int, S_IRUGO);9 e. W/ p; P  E4 ?
  83. module_param(bcnt, int, S_IRUGO);
    - s: u7 K, Q: x/ p3 f) h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# T' V2 q3 I0 }! Z/ r! @
4 K& {/ m* s% q4 z+ a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 h5 p2 K1 q/ n* N8 w4 Y+ V6 n% j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 Q: [" E1 |# T" d. k7 T& Z# y2 c( V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ v( y( C2 ~! ^

8 c% U+ C6 o7 D- L8 @9 }6 R
! f2 t* ^+ z. s& G2 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 06:39 , Processed in 0.040245 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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