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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 D; }' k% x0 y
  1. [code]EDMA sample test application  w* v' m- y: w3 u6 \
  2. /*( i9 H  J/ t: P. L- j- \  L
  3. * edma_test.c
    ' q; J" w! p9 R" Y' I4 y7 W' K
  4. *
    & h5 x* j% v; w9 z
  5. * brief  EDMA3 Test Application
    . o1 l, O9 F' F+ T1 N3 h2 X
  6. *
    . J4 j  j3 @, V* K
  7. *   This file contains EDMA3 Test code.% t$ x5 d7 J; V2 J# p  G% F, |6 H
  8. *& ?$ `8 l4 x/ t* g1 d4 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 T$ i% H/ w1 c" h9 V0 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, U5 ]8 z% \; n* `6 H7 M' m3 I5 @
  11. *         TO CHANGE.
    ( C+ v0 o! M" N
  12. */ A- o6 i9 h- h8 Y3 M1 @2 a: }$ K6 M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& F1 j2 p( `2 j+ {$ P  m0 r5 u
  14. *
    . `0 G$ }8 }( ~
  15. * This program is free software; you can redistribute it and/or$ G% x  e2 I$ a* s5 G
  16. * modify it under the terms of the GNU General Public License as  _& \' ~# l! X* n& l+ U, w+ f( B
  17. * published by the Free Software Foundation version 2.
    " C& ?9 `, m8 W1 ~
  18. *1 D) _& B" w# U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* L! p/ s7 @3 |2 O
  20. * kind, whether express or implied; without even the implied warranty
    / b0 {8 I7 i* N5 ?; _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 I+ c7 K2 R4 F1 T8 z$ h4 z) b* `
  22. * GNU General Public License for more details.
    / |( K2 u: D* x* W
  23. */
    % j0 x8 u' y' @( ?

  24. $ q- X" {; i$ \5 i$ @+ k
  25. #include <linux/module.h>' T: I' o  Y* V/ H3 m2 Y
  26. #include <linux/init.h>
    " j2 O. o8 Q8 {' u/ c, t
  27. #include <linux/errno.h>
    # |' j* f3 m& ~
  28. #include <linux/types.h>4 k$ _; U+ |1 l( q. X# o3 t2 I* F
  29. #include <linux/interrupt.h>
    7 o- d2 H+ n3 g) A
  30. #include <asm/io.h>
    7 X  p6 v/ y6 g9 R' W8 k2 A
  31. #include <linux/moduleparam.h>
    ( W2 u- K: ~$ {4 [! r0 {
  32. #include <linux/sysctl.h>$ d7 ~' o) o) g. k/ X
  33. #include <linux/mm.h>
    8 h+ ~5 w6 ~& g" L+ m7 J
  34. #include <linux/dma-mapping.h>
    2 O$ E- U* H4 I" u' o7 ]4 _
  35. ! z3 h6 b4 ~$ Y3 O
  36. #include <mach/memory.h>2 [9 x8 u2 U4 q6 t) ~. I+ @8 f; b
  37. #include <mach/hardware.h>0 U! C4 \" P8 U
  38. #include <mach/irqs.h>
    ) D; O. A- d0 N3 ?
  39. #include <asm/hardware/edma.h>! Z, n: x( n9 C: H: u+ R: [+ s

  40. ) }( K) D( b+ [7 q5 z4 k! I
  41. #undef EDMA3_DEBUG# d/ K* X: m( m2 }
  42. /*#define EDMA3_DEBUG*/4 W) z* z, l( a! b& r7 G
  43. 2 k* R: ~& X0 ~2 `, T( p; k
  44. #ifdef EDMA3_DEBUG) n* T, A9 k$ m- z$ ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). G2 E1 w& a: |# V9 h$ W9 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% q" F2 n3 }! z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  d: U. \$ s0 ^! f7 d& q3 Q
  48. #else# m6 Q( K2 R( I$ b( @) I5 E0 {
  49. #define DMA_PRINTK( x... )3 |" c- ~+ o4 L; e$ J
  50. #define DMA_FN_IN
    3 r+ Z. p6 k( j- {8 V
  51. #define DMA_FN_OUT
    ( g! d' d6 E$ P( w5 w( ^
  52. #endif
    ! E0 F4 R7 }  y8 E* Z

  53. + i3 u0 ?! Z, A  n, R! @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): @4 B7 R. D6 e( \5 R  o
  55. #define STATIC_SHIFT                30 K# j& h2 ^3 O, _# B
  56. #define TCINTEN_SHIFT               20
    * `& b$ z/ w; T& S! A' e4 J
  57. #define ITCINTEN_SHIFT              21
    ' \) J' \5 a1 K% o
  58. #define TCCHEN_SHIFT                22
    2 J/ t1 W" }  L% I
  59. #define ITCCHEN_SHIFT               23
    1 M9 a$ K0 E" x3 m

  60. 1 d5 U5 P" a3 |! x
  61. static volatile int irqraised1 = 0;
    ; X+ ^! ~4 k: W; h: ]/ \
  62. static volatile int irqraised2 = 0;
    , D, g+ ~* G. N/ f/ i9 V/ z! b; {

  63. * e% U" _% u# i* A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . t: b: O9 m4 a: g' v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      ]% c4 e1 v. u) ^& y3 o. F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Z( }1 O5 P  l4 n$ M% q0 s

  67. 4 e% y) m8 s1 ^( w) R9 p
  68. dma_addr_t dmaphyssrc1 = 0;
    $ K8 q* u$ b2 j; A: L' _
  69. dma_addr_t dmaphyssrc2 = 0;+ x8 I( l$ q! @$ n0 g
  70. dma_addr_t dmaphysdest1 = 0;
      c( ]: Y% U9 Y9 U; m
  71. dma_addr_t dmaphysdest2 = 0;' F! x% D! \' U0 F$ y

  72. + ]: l, m& a* u
  73. char *dmabufsrc1 = NULL;
    8 h4 R& L  T5 e# W
  74. char *dmabufsrc2 = NULL;& [  E/ i  \( z
  75. char *dmabufdest1 = NULL;5 ^6 d  ^4 f# e6 g) {/ t7 H
  76. char *dmabufdest2 = NULL;0 k0 [6 V, ]0 }- H) M

  77. 4 M$ G% J" _1 X5 L
  78. static int acnt = 512;
    ; S, F. F( ~9 ^
  79. static int bcnt = 8;
    7 j$ I# q% f' h) R
  80. static int ccnt = 8;
    + A0 z& M) A: x" N0 ]( `5 m1 @5 T0 ~& j
  81. ( r% m- {+ ]& m% h0 ^
  82. module_param(acnt, int, S_IRUGO);8 }, p* U1 q/ [; x4 i
  83. module_param(bcnt, int, S_IRUGO);
    " Y# F% z: ?) X" M: [0 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ U2 e; M3 o' A) \1 T# S0 Q- f, A: M, K1 A' Q. n$ Z! W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( j+ g5 A* m# u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 s* _# W7 n' i: \7 ]0 @) B% X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 X  ]5 R; X! I) i& B  Y$ X) D$ B& f: z# ^2 T. [9 M

- p$ Z& n5 @/ y' }) y$ g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-12 08:26 , Processed in 0.041123 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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