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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 [" G. E1 v/ L. ?" R
  1. [code]EDMA sample test application# y4 ^7 h) Q; x" S# L: r& F2 q0 k
  2. /*0 A3 H: `5 f% ^* }2 ~) l+ e7 \1 G
  3. * edma_test.c& @8 }. a* o  D, R; \/ u& m
  4. ** _5 q3 Y" y% @8 Z
  5. * brief  EDMA3 Test Application
    . C  S7 H. M' e9 f! F5 ^
  6. *
    8 J5 N( E3 ~/ y2 e  X+ t
  7. *   This file contains EDMA3 Test code.
    0 }& a3 F* M. x1 C! C1 l
  8. *' v% J7 h( o6 w6 Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ]7 z0 b) O0 F7 v6 T( D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , ]# m4 M" Z3 \8 g; H; r: X) G1 B, J; g* S
  11. *         TO CHANGE.
    4 ~5 M2 N; t- V: P- k
  12. *9 Z- Z- T; ]3 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 ~1 [: p3 L6 M* {' a
  14. *
    6 a5 E9 r' L0 ^3 c# ]
  15. * This program is free software; you can redistribute it and/or
    2 J8 V+ t7 \$ _; C1 M  X
  16. * modify it under the terms of the GNU General Public License as/ r9 h# Q/ M1 r  K
  17. * published by the Free Software Foundation version 2.
    & I! p7 G# L0 R& I. c7 f9 V
  18. *: f  w! {$ y# H& v4 {$ F) n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , d( ], z, z. `0 |4 I
  20. * kind, whether express or implied; without even the implied warranty
    - j) x/ p1 u5 {( J, G! s/ {1 M. L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      W4 O1 f2 Z3 b* M
  22. * GNU General Public License for more details.% k2 k. j6 b! K% m5 m
  23. */- s, w, n% e* G8 W5 Y; w& x9 v
  24. ; |% U: L1 p* M( Y( N
  25. #include <linux/module.h>
    . K3 b' Y/ N) @& m7 R6 K
  26. #include <linux/init.h>
    $ b0 z% K/ T0 \7 v# m( L
  27. #include <linux/errno.h>' z9 W, E; d9 X. d# ]
  28. #include <linux/types.h>
    5 F5 E0 i0 C& V5 M6 V
  29. #include <linux/interrupt.h>5 p0 n1 ^" g& I0 [* x
  30. #include <asm/io.h>
      j4 j2 Q2 p* Z9 L7 a
  31. #include <linux/moduleparam.h>/ ]. w% S% H: I: [' q4 U
  32. #include <linux/sysctl.h>6 `% T4 d- r, q+ S+ a3 E
  33. #include <linux/mm.h>2 e1 E* q' {% f) E+ [% {* }
  34. #include <linux/dma-mapping.h>  Y+ N8 \: w- W$ I5 n# h4 G

  35. ! O$ p: w5 Z  U' J$ c
  36. #include <mach/memory.h>
    5 f) J% j& i5 v& V2 N6 Z
  37. #include <mach/hardware.h>! k3 K+ z; ^  O. G& L
  38. #include <mach/irqs.h>: E4 M3 H: z9 U" [# E# X
  39. #include <asm/hardware/edma.h>
    9 @  Z5 p4 `1 g$ \, ^% H+ R3 O
  40. # W# z2 s: f( K' @' O6 Q4 q
  41. #undef EDMA3_DEBUG
    ! L( ^8 |, ?) i# c
  42. /*#define EDMA3_DEBUG*/7 E6 Z* z4 M2 l* I% \3 _/ W
  43. $ _% H8 j3 A6 X/ W/ E2 H
  44. #ifdef EDMA3_DEBUG
    ! K* Z0 V1 v: M; D; @+ [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ w3 S' \0 C) e& X4 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 y7 z2 G0 B7 K3 J: e$ h2 H  }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - I  I/ M0 x4 Y) Y+ o: m. g
  48. #else
    $ l: M9 ?# |$ ~' S( _
  49. #define DMA_PRINTK( x... )
    & P% T* T2 m9 q& ?2 k$ f# ?& a
  50. #define DMA_FN_IN# U& Z7 _! a6 l/ ~
  51. #define DMA_FN_OUT( E. h7 Y# s* b5 r# ?/ Q2 h
  52. #endif
    3 ^/ ~4 U& u: `0 \% m' M2 J  s

  53. 4 c( T0 w! ]5 X6 z' [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / W; r" \. u% P$ Y1 o
  55. #define STATIC_SHIFT                3
    % Z7 C$ Z# L3 c8 i; e0 Y7 _+ }# Y
  56. #define TCINTEN_SHIFT               20
    # A; G5 i0 R( \/ e! |6 ], q3 r
  57. #define ITCINTEN_SHIFT              21
    3 s% i. k  `9 w! |3 D
  58. #define TCCHEN_SHIFT                22
    7 G( g( T6 S; Q' x7 g5 o
  59. #define ITCCHEN_SHIFT               23
    2 c" d& x2 ?% O0 h1 D1 H' |' l" ]

  60. / n4 H! T; Y; O; ]2 N
  61. static volatile int irqraised1 = 0;$ u3 M4 i) K- ^) F0 W$ h
  62. static volatile int irqraised2 = 0;
    . e. P9 U+ ^1 \7 P) V

  63. ; I" J* P9 r6 h6 U6 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 g& j8 L0 ]* O& t9 O9 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" F- T/ e$ c: F9 Q: [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 u5 q+ D) s, J

  67. ( O# D' r/ B- T  c7 x+ M
  68. dma_addr_t dmaphyssrc1 = 0;$ Q# T; t3 }2 U, L. I, }0 W: M8 J: r
  69. dma_addr_t dmaphyssrc2 = 0;
    . B) i2 m% q: ]8 _) N
  70. dma_addr_t dmaphysdest1 = 0;! q1 b  T. a8 i3 x' P; m* O
  71. dma_addr_t dmaphysdest2 = 0;4 r. O7 X9 z  y6 U* R

  72. 6 L3 Y3 G  S$ ]  |. m
  73. char *dmabufsrc1 = NULL;: c9 k4 Y% I+ a# {" N# F- |) \
  74. char *dmabufsrc2 = NULL;. T4 }. O& s$ D" o
  75. char *dmabufdest1 = NULL;
    ; \% L! b1 a# y1 s0 V; m: E2 E+ T
  76. char *dmabufdest2 = NULL;9 I+ F% p' a& Z1 Y: e& d
  77. ( c' w9 H2 i" |; n6 I
  78. static int acnt = 512;
    # {  d! j8 \8 F) [/ Z' H& ?/ Y
  79. static int bcnt = 8;
    ' x& V( N) c# _0 e% H
  80. static int ccnt = 8;
    & j5 ~$ [2 J$ A! q

  81. 6 @) L- K. z/ u' V+ f
  82. module_param(acnt, int, S_IRUGO);8 d! i$ R; }3 Q2 N4 R" C
  83. module_param(bcnt, int, S_IRUGO);
    1 e+ d/ h3 E% D4 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 j' M! [; n6 t9 b5 S. J5 r2 D0 O
, Q* s; d, T, t0 ]: t6 V( F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% p& R, ~. S, S% a! l( n9 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% d2 Y  f- m' h* G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) m0 b4 s$ ]" Z

7 W: c5 s6 S5 D0 b6 O0 C. q  K- ]- G/ |. J# i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-12 01:26 , Processed in 0.049444 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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