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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ z1 b" f' Q& O% o9 n1 b' T
  1. [code]EDMA sample test application
      g2 I+ C9 G# l' s- A9 o
  2. /*; f$ v' Q8 m0 G
  3. * edma_test.c9 q* U+ ]9 h# b( h. ?! N
  4. *
    4 ]- j+ p! \! d. x& C3 z' x4 C
  5. * brief  EDMA3 Test Application3 Y+ X6 K' P" }8 c/ e1 a
  6. *  l# W, E# I! s
  7. *   This file contains EDMA3 Test code.* {) P+ Y$ g4 f; T; ]5 {
  8. *
    5 r8 m  w! X3 l- ~4 J, ~) j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  O: E& t- o- [( g7 _) L4 Q' b* t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) N6 U1 E* u# O% V% w
  11. *         TO CHANGE.6 N" G9 H, P" \% E- b
  12. *
    $ u: U. y" ]2 c* p1 H+ q0 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # K- K, `; Z- H/ {4 M6 j
  14. *
    . X# A) z: I3 f( b$ D, ]1 S
  15. * This program is free software; you can redistribute it and/or! t8 }  c' ?& N/ a. ~2 ]& N
  16. * modify it under the terms of the GNU General Public License as
    ) t: E' n4 n( x5 G$ c8 s- d
  17. * published by the Free Software Foundation version 2.
    / ~) W% b6 w, G; z: k4 O. M
  18. *
    / V. K3 J* D# Q. K. `% R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 n- U. S& w# y5 C/ @" E
  20. * kind, whether express or implied; without even the implied warranty
    % ^/ {4 X4 e: f; P" F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: `1 {- ?3 ~2 T+ i' u- f& \
  22. * GNU General Public License for more details.
    9 ^2 y% G, v) H! y
  23. *// r0 b, j' n* F( C

  24. / @( n: |7 y2 S6 l* m: k
  25. #include <linux/module.h>0 I: n% v" N8 s$ _1 j8 |0 |% _+ L
  26. #include <linux/init.h>0 \# L: U( X( i
  27. #include <linux/errno.h>. H! V" s7 D- l$ c9 R" V: r
  28. #include <linux/types.h>5 \8 Q0 P8 _' O& f
  29. #include <linux/interrupt.h>9 Z7 R- J$ l0 u' ?
  30. #include <asm/io.h>
    : A3 F, ?& O) F2 }/ o/ K3 l
  31. #include <linux/moduleparam.h>$ D0 `( q- X; ~
  32. #include <linux/sysctl.h>
    5 [. }9 q3 f5 G5 w, Q9 c
  33. #include <linux/mm.h>
    7 s7 l# |6 Q1 `) g$ S
  34. #include <linux/dma-mapping.h>) q( o- t0 p& O- v5 ~

  35. + M' r& u7 [  o
  36. #include <mach/memory.h>" N( C+ z/ }1 g( Z" t
  37. #include <mach/hardware.h>
    , w& D7 Q9 W$ U3 a8 p4 ]0 g
  38. #include <mach/irqs.h>- K; g+ T8 E0 \6 `0 x* n. l
  39. #include <asm/hardware/edma.h>
    9 ]' Y! l- L$ D/ ^/ L% Z1 Y

  40. - a- y, ^# n1 J; R. v; w7 j  Q" f2 g
  41. #undef EDMA3_DEBUG- N: T% s( x2 n0 _* _' L
  42. /*#define EDMA3_DEBUG*/
    8 ]5 d  p" y5 \( E: ~3 X

  43. ( G" F2 j4 I$ Z" w
  44. #ifdef EDMA3_DEBUG' t6 \! g9 M$ ~5 \9 ^5 I* [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- e/ K$ B' h, X0 H1 e5 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 A" z& N: m1 _' ~: g7 F+ @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / V: v  t" h  @2 i8 h9 w6 \
  48. #else: n, z# x' @# A! c% G* p0 ^( g
  49. #define DMA_PRINTK( x... ): j( r3 g$ f. O, b
  50. #define DMA_FN_IN
    8 o) w  ~* [8 E! k
  51. #define DMA_FN_OUT
    & e0 @, V. m0 E' B& O/ Z
  52. #endif
      W. l. H6 g: F0 h6 K6 w
  53. - Z; R4 ?6 w, d) m3 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# {1 o  c1 G- ]* F
  55. #define STATIC_SHIFT                3+ E; o' {1 [5 ]  q0 A
  56. #define TCINTEN_SHIFT               205 l% U, Q$ c8 r$ I1 U. t; o
  57. #define ITCINTEN_SHIFT              215 c- h; q) G, G3 b) G1 q( c
  58. #define TCCHEN_SHIFT                22
    : b2 ]3 L0 ~7 }8 Z4 a( ?
  59. #define ITCCHEN_SHIFT               23! r+ b  X7 T4 h, e! {

  60. * N+ K% S* o, \9 p) c5 {
  61. static volatile int irqraised1 = 0;0 l. L. U+ x. r$ Q$ K
  62. static volatile int irqraised2 = 0;. V" `6 q/ c0 z: W

  63. " Y9 V, F* \5 X, S) Q# t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 k. ?3 |/ [1 U1 B9 l6 C) o0 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 O* d5 a; }/ H$ Y& z/ ?9 y$ }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % P# I/ K3 y" Z7 t: s0 T* ?4 ~4 y

  67. 0 [# z( X" V+ [: |6 M
  68. dma_addr_t dmaphyssrc1 = 0;
    : v$ ?6 k7 K. w, h, l/ {+ Z- j
  69. dma_addr_t dmaphyssrc2 = 0;
    ! j9 x) a4 Y/ A
  70. dma_addr_t dmaphysdest1 = 0;& w+ N0 B* s; W  i8 t$ _
  71. dma_addr_t dmaphysdest2 = 0;: |2 {  c; O# B4 j! k1 v4 l

  72. % F0 b) `+ e  H1 Z! B+ M( N7 G3 q
  73. char *dmabufsrc1 = NULL;* F  Z8 C7 c6 v: U1 B' p
  74. char *dmabufsrc2 = NULL;" P. |2 D, R$ ^; c
  75. char *dmabufdest1 = NULL;8 N7 P# a: W9 ^
  76. char *dmabufdest2 = NULL;7 n' w# a6 d5 a  t, b! y; ^

  77. " V. x4 _! f; d7 h0 e4 j; E! ?
  78. static int acnt = 512;! B# l% l. f/ ]- w- [: W
  79. static int bcnt = 8;
    - k; H  B* K1 c
  80. static int ccnt = 8;
    - ~: w  v- \" T) r) ^$ W2 E' }/ \

  81. 2 o3 J/ T1 m$ @7 S
  82. module_param(acnt, int, S_IRUGO);: Y1 n+ p; X+ Y  h# ~: Q( c; }
  83. module_param(bcnt, int, S_IRUGO);
    ; J3 P3 Z" E/ P, g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. W% F0 F8 w- [# o, ~% @* o" M+ a/ x+ R; ]8 l/ W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, Z/ `1 n9 i: h  U$ A& L: w' B0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# h( M5 d( |3 h. `; z: A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 b6 v# ]- F$ y: M1 v8 i. p$ G5 f3 ~) U: l. c4 X7 ?0 s1 b; c
2 W4 _/ V% V) I: h" d6 v; B1 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 00:56 , Processed in 0.038557 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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