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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 S0 w5 @7 o8 O+ R
  1. [code]EDMA sample test application1 d8 ~5 B; i' K) }- `
  2. /** \6 ?' t- `% {2 i# f' _; Q3 A5 E
  3. * edma_test.c$ {! `( L4 ?+ u+ @! f
  4. *
    : }1 t& {# T' E/ y5 ]
  5. * brief  EDMA3 Test Application. L/ B  s0 @0 z" m% F1 h
  6. *3 K1 ]/ }; D* z, K+ a1 _. k
  7. *   This file contains EDMA3 Test code.+ C: L8 r) T) e7 |* o
  8. *, r' K- K+ I) {1 W. o! P0 c3 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 @) Q7 R8 J" M7 J: h/ A- K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! T& ~" D2 D( M8 b) R
  11. *         TO CHANGE.  S* g, D2 u2 t5 R( k# n1 {
  12. *
    * ]' {) n! M8 B3 o* A% c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 }) n8 e9 g0 o; c# S8 a8 J1 K4 o& s
  14. *9 i9 S& H& C5 \' o. t) `
  15. * This program is free software; you can redistribute it and/or
    7 N+ w1 h3 d+ m/ A6 e9 z3 X  A
  16. * modify it under the terms of the GNU General Public License as9 `4 v% |1 n, l7 E$ E
  17. * published by the Free Software Foundation version 2.
    ( `7 h1 y% p% Y; R
  18. *
    ! I: K+ H% |/ F, h2 i5 ?$ S9 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 D/ ?  S! j  s9 W/ C! y% ]' x
  20. * kind, whether express or implied; without even the implied warranty
    & ?& @0 C( v& R9 @+ E9 g& Z+ q2 ~; S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - P. G* i$ S6 ^
  22. * GNU General Public License for more details.' \. J+ s! X+ T' y. b8 u# @
  23. */
    1 W* l- ?" C  m1 K7 `5 w
  24. ( \/ M$ J6 `) D
  25. #include <linux/module.h>$ f+ ^9 r! w" ]
  26. #include <linux/init.h>% L) R" V' N' ~
  27. #include <linux/errno.h>
    6 ~+ D! ^( H4 A# K  r  T6 w+ c! a
  28. #include <linux/types.h>
    $ r5 Y% i0 Z$ t# P6 s( u3 ^( W
  29. #include <linux/interrupt.h>; a2 v6 j, Z3 A8 S- o$ N& U8 l
  30. #include <asm/io.h>' |$ M+ C1 \  \
  31. #include <linux/moduleparam.h>
    - T+ u( t3 s: x+ e
  32. #include <linux/sysctl.h>
    ' ]4 s1 }) ~/ I% R9 a9 r, n
  33. #include <linux/mm.h>
    , n, j8 h9 \7 d3 V2 W4 ^9 n  N
  34. #include <linux/dma-mapping.h>
    6 f# l6 e; d2 U$ Y% Y4 J

  35. 2 C3 W- d4 M* Y
  36. #include <mach/memory.h>
    6 m  C5 F% ?, X8 S) f) u& V& g
  37. #include <mach/hardware.h>
    + S( Y! M! ?. P; [
  38. #include <mach/irqs.h>- D7 `$ n7 U, G/ |+ I% C
  39. #include <asm/hardware/edma.h>- R0 s' q7 `! o, M3 A2 ?

  40. - a6 ?& X$ C& }8 i
  41. #undef EDMA3_DEBUG6 @2 Y' M( J+ J* Z& s" I
  42. /*#define EDMA3_DEBUG*/! W9 Y, F. [/ y
  43. : p8 t; D( g5 ?3 n3 g0 C5 J
  44. #ifdef EDMA3_DEBUG
    ! y8 ?: Z! r( i' w4 R, Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; r4 M% f5 _/ v1 @8 t% w; h' e# |9 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . w& w% Y) Z1 ^6 Q+ q1 Q$ ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % u' T3 d8 e  A# R; e2 A( W* k' M
  48. #else
    % L, ^0 i6 p# Z
  49. #define DMA_PRINTK( x... )
    ' ?9 G) v# r( {6 @" o' z
  50. #define DMA_FN_IN6 z- h3 I% V* B& ]0 k/ Z/ p9 @
  51. #define DMA_FN_OUT6 N5 O9 ]1 @4 x
  52. #endif$ K& {3 \2 ?) D0 c; a( a+ R
  53. 4 h+ O& s2 `$ q/ }; ~* E, n" L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " q0 }4 V5 \& j, _
  55. #define STATIC_SHIFT                3, W0 [4 u2 A0 V* S& p( o0 a
  56. #define TCINTEN_SHIFT               202 |2 i6 u' H3 e  M. {0 D2 w
  57. #define ITCINTEN_SHIFT              21; a% Q0 Z% p5 `' n5 I
  58. #define TCCHEN_SHIFT                22
    - ^3 Q6 `& @, r- t( t
  59. #define ITCCHEN_SHIFT               23' X5 r- x1 C- F+ B
  60. 8 `, g- m7 @$ P- w
  61. static volatile int irqraised1 = 0;
    * {) N, m- J  r
  62. static volatile int irqraised2 = 0;
    & O. Y) H2 n6 I0 x, x

  63. - k/ L8 A8 U4 r: E1 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Z: h' @% ]; i3 J5 z& \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 d* c! s7 l3 v, ~1 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 X1 V* f4 P5 j2 _8 q3 K

  67. 9 ?6 B: q! ^3 A
  68. dma_addr_t dmaphyssrc1 = 0;
    $ u' @9 d( K6 X, W) w; Q  G
  69. dma_addr_t dmaphyssrc2 = 0;
    & b/ s# {7 A, `) F  D" r
  70. dma_addr_t dmaphysdest1 = 0;% x7 b/ U) K7 }" ?8 L) q0 S
  71. dma_addr_t dmaphysdest2 = 0;
    * I4 ]9 x, f$ L  `

  72. ) _9 Z2 i4 ^9 b3 }/ r9 r2 E
  73. char *dmabufsrc1 = NULL;
    ( L: d: C4 w  }) {" J7 W" T
  74. char *dmabufsrc2 = NULL;: @/ I0 o8 C  U
  75. char *dmabufdest1 = NULL;& r' v0 R# n% f8 `
  76. char *dmabufdest2 = NULL;
    3 `$ V# j) n- A  p1 |$ L* h$ n

  77. 9 ^3 `# W: G* t- e  t: q
  78. static int acnt = 512;) W3 o) _( `8 @9 A7 _
  79. static int bcnt = 8;
    2 ~7 J6 {& `, T: V8 D
  80. static int ccnt = 8;
    ; g* M) ^( l0 s$ c" q4 i
  81. : `( [: x/ V% R/ m% `. T
  82. module_param(acnt, int, S_IRUGO);
    ; n* H: Y# y: F: v3 v; M7 }
  83. module_param(bcnt, int, S_IRUGO);; e: I5 q$ S: U/ `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. v7 B) L; @/ L& r! W2 T8 I, Q; w: A; A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 g: g1 r1 P4 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* G7 m1 l. _! Y2 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 O% Y3 s# c! c$ h( r" ]; A: k1 P( U9 f/ o4 [% k$ ^% U; U
4 g$ Q# O. W1 o, c4 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 00:12 , Processed in 0.048436 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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