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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' d4 W$ B* u: s
  1. [code]EDMA sample test application# {  U/ D' |. N4 l8 v
  2. /*
    8 I. T3 q' s7 F8 f) l) b' J0 }
  3. * edma_test.c6 n4 V1 e. m  x9 s( k  t% [$ C
  4. ** W/ b) @4 w" N6 f) ?4 W$ Y
  5. * brief  EDMA3 Test Application3 Z- i1 y( l# D, A8 G- V
  6. *
    2 A/ W# M7 i' p
  7. *   This file contains EDMA3 Test code.: y! K5 V8 |0 ^4 b7 P' J9 x* J7 r
  8. *( `  k, ~+ Q5 O9 @' d0 B  y- F! n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ k6 M8 i5 j5 y- F- \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * |( c4 |  d* I6 F. |# l# H
  11. *         TO CHANGE.4 A( c: A+ ~3 I( c) t
  12. *3 e7 M7 D3 F. Z+ Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 O( Q7 U1 }8 ]8 u
  14. *- h9 f4 c) U! i  |1 i
  15. * This program is free software; you can redistribute it and/or' a' G3 u. `- e$ E# c
  16. * modify it under the terms of the GNU General Public License as) n/ n3 a3 L$ |6 l3 j; v' u
  17. * published by the Free Software Foundation version 2.
    ) r* K) }+ @2 _4 J1 D9 z
  18. *9 M1 f4 `( t# u, @0 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . A$ V8 H( _" ?  K: ^
  20. * kind, whether express or implied; without even the implied warranty: k8 ]2 V; ?# X; G1 o, W& |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) @+ q' Z& _. A/ y
  22. * GNU General Public License for more details.
    1 ~+ Z9 \# g! T$ A' P
  23. */
    " Z  t* e% \# r3 X" Z
  24. ' _+ O5 S' n/ f% k) X* q
  25. #include <linux/module.h>7 A- o% P  x; F: Q
  26. #include <linux/init.h>
    - u1 m1 R  X7 W
  27. #include <linux/errno.h>9 }9 V- r  ]7 U8 C: i- o
  28. #include <linux/types.h>3 w% p3 a8 z' G( b5 |* k
  29. #include <linux/interrupt.h>
    1 {" [2 ?8 I8 i+ y5 Y2 e& Z: n
  30. #include <asm/io.h>* c( c) O2 A) c4 Z/ v1 ?. u- s6 M
  31. #include <linux/moduleparam.h>( c3 c( M+ S0 i; x& R
  32. #include <linux/sysctl.h>+ j' z' C. n) s8 M8 }& a* s
  33. #include <linux/mm.h>
    ! B- T4 w  E/ m  m
  34. #include <linux/dma-mapping.h>* T2 l  k* t# q, b/ I
  35. . f, v3 B( y7 R! H2 l4 h
  36. #include <mach/memory.h>/ d* H7 D$ e0 v5 P6 ?( y5 z
  37. #include <mach/hardware.h>
    # x* L2 B; e. c# A7 K
  38. #include <mach/irqs.h>
      Q/ w# k/ {# H4 Z# t
  39. #include <asm/hardware/edma.h>
    . ]- R4 p5 w' }7 w1 S% Y; W) q
  40. 6 m5 F# X9 q( W9 {5 {2 @
  41. #undef EDMA3_DEBUG
    * \1 Q7 [! M& k  k: C# R2 I
  42. /*#define EDMA3_DEBUG*/' ^4 ]' w7 u' @0 f
  43. ! f8 d* o; B$ X/ s4 q% E
  44. #ifdef EDMA3_DEBUG
    $ i! V5 e7 J1 m4 t! C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), X/ e. e  ~4 W5 d) ~2 Z8 a) ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% ]9 K7 M) d! N" S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 b/ ~7 p5 G0 u
  48. #else0 R0 |; C+ A5 S+ \+ ?! W% J
  49. #define DMA_PRINTK( x... )
    4 b7 I# O; Q4 }' ]' F6 h
  50. #define DMA_FN_IN4 Z% S$ \% M9 T3 E1 I
  51. #define DMA_FN_OUT
    ; {% U5 T9 _& g0 j$ W+ p- w
  52. #endif7 b3 Z- q. I5 r* z
  53. ) C7 N# L8 J4 m+ F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : {; W8 d/ ?  z: U2 f. ~
  55. #define STATIC_SHIFT                3
      O1 u; s$ p4 B; A% X' R6 ]
  56. #define TCINTEN_SHIFT               20/ r. O2 I  L7 J+ N
  57. #define ITCINTEN_SHIFT              21
    ' ?4 L6 T! l4 n4 y. \  ?# [1 Y
  58. #define TCCHEN_SHIFT                229 ^: Y% S: }3 H3 H
  59. #define ITCCHEN_SHIFT               23
    , i: x+ P# F1 Y. H7 x3 g5 d* Q

  60. 0 K4 r; E+ ]/ l7 L. w- ]
  61. static volatile int irqraised1 = 0;
    . T% j2 Q4 f) A
  62. static volatile int irqraised2 = 0;
    # e4 ~1 J5 m# K  c3 j3 F
  63. " f0 ^( b, Q  b  x5 a6 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! e( k1 r# f& Y. ?2 U4 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' O9 j  V- @2 m; t  b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& n* t. u7 u0 A, {9 |6 h! ?
  67. $ [4 C* ?5 e- c* f
  68. dma_addr_t dmaphyssrc1 = 0;
    * D6 p) z$ ~. u4 x& Y5 Y8 f" D. f
  69. dma_addr_t dmaphyssrc2 = 0;
    3 \; J7 h1 I( d. y/ J* F
  70. dma_addr_t dmaphysdest1 = 0;
    ; a- a$ r6 R% R8 C  J
  71. dma_addr_t dmaphysdest2 = 0;( l8 }5 |! B" Q) b+ |, E# ]

  72. 7 t. c5 {' S& H  j/ W7 d. P2 r
  73. char *dmabufsrc1 = NULL;
    # F4 s6 b! }- H% [" ~' c
  74. char *dmabufsrc2 = NULL;
    ' y& }7 b1 T" |9 Q( d2 W
  75. char *dmabufdest1 = NULL;
    ! z9 M0 S0 E0 {0 @* d
  76. char *dmabufdest2 = NULL;& z8 L5 d2 I$ D7 k1 n- @$ D

  77. / i/ @( `8 G3 V, O0 Q6 i2 U
  78. static int acnt = 512;0 U2 Y. a2 k; Q. i' h1 V$ C
  79. static int bcnt = 8;; H5 a: Z) O7 P2 I* F
  80. static int ccnt = 8;5 ]  t  i; R( r7 i9 y4 }/ \
  81. ( t% @  g; o1 \" k  x6 C
  82. module_param(acnt, int, S_IRUGO);6 k3 W" L1 y$ F
  83. module_param(bcnt, int, S_IRUGO);# q0 L- H) G* z9 f6 C3 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 C5 H! w5 ?* @9 g- k4 f7 V
& B6 k5 F( E* ?9 B+ l# E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" j$ E$ O5 O, C5 n" f2 b$ @. `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ n/ T' |7 N7 N  K) V' }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 ~; Y7 ?" @5 J0 Z$ R
/ a" O. n" {0 ^' ~& w
% S4 _! y3 ^, i$ n+ w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 10:14 , Processed in 0.039301 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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