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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- i) e6 n/ {$ Q) y7 p7 J5 T
  1. [code]EDMA sample test application
    / \9 g3 F! j: t3 P' }- I6 W
  2. /*8 Y4 _9 b; |, A2 z: Y" \/ }
  3. * edma_test.c
    $ [, v1 A& I% @8 h5 D" B. ?( d* Z
  4. *9 e% w3 i1 Q9 D2 m+ K# o
  5. * brief  EDMA3 Test Application
    & s" r% p6 A8 {3 ]( @
  6. *1 J  Q# p/ v* E7 _% s* G/ F
  7. *   This file contains EDMA3 Test code.# V+ b7 o( _& ?% L3 u
  8. *
    6 `7 D/ G, H8 z# y  R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . I3 i' _0 n8 I- G2 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 w* i8 M* \, p2 U; y% I3 r
  11. *         TO CHANGE.* u) w2 S+ N  e  t# W! H, Q) V5 r3 d
  12. *- v0 [2 K& R" n: w2 ^' s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 _+ F8 Q; R3 `2 `5 ?  V) {7 c0 z
  14. *
    , v6 P) h+ c: B% Z. ]
  15. * This program is free software; you can redistribute it and/or0 C5 k2 q$ P1 F/ e( B! U
  16. * modify it under the terms of the GNU General Public License as5 O: w1 Y) n* l1 L  s
  17. * published by the Free Software Foundation version 2.
    / J  D( Z3 _$ ]' ?# g4 g. H
  18. ** U) s7 j' o% @' v9 i9 [% V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 I, q# p. s* k6 J
  20. * kind, whether express or implied; without even the implied warranty; H! U7 |4 g( ]+ a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & D! o1 ^' s5 ?* `" p
  22. * GNU General Public License for more details.
    , v8 W# o, b4 ~& O( a# N
  23. */
    , U1 o" e5 j; K

  24. , ^0 m. B% o( i8 i$ R+ F
  25. #include <linux/module.h>/ G1 R7 F1 S2 w' m! r4 ]
  26. #include <linux/init.h>0 J. K$ ]# |2 p7 a
  27. #include <linux/errno.h>( Q2 [+ I' g/ u( a; G
  28. #include <linux/types.h>
    : p" o% E! r/ v2 k7 ?
  29. #include <linux/interrupt.h>1 g# y! v( x8 Z4 ~: K! F
  30. #include <asm/io.h>
    0 e* B& S; E) F( G
  31. #include <linux/moduleparam.h>6 F# T5 G4 B3 _2 H. q! t2 y, ?
  32. #include <linux/sysctl.h>/ W4 K  t: s# K  p
  33. #include <linux/mm.h>% e( N+ ~/ K- x* U% C
  34. #include <linux/dma-mapping.h>
    & P+ \! d+ \9 Y, Z4 i1 f1 a8 V* F

  35. / w8 k3 W. q6 l9 T
  36. #include <mach/memory.h>' J9 v! \/ F/ i- y0 N2 {
  37. #include <mach/hardware.h>
    ! H/ m7 N% B) n
  38. #include <mach/irqs.h>
    2 r+ @. W) j$ [3 q; k; V
  39. #include <asm/hardware/edma.h>7 Y1 F7 V" i: ~; h) p$ T
  40. 2 H- s7 T$ y$ F. ?5 z8 a& U# J
  41. #undef EDMA3_DEBUG' j7 l# ?/ z7 g0 p0 m3 ~
  42. /*#define EDMA3_DEBUG*/
    ; \$ m' Q8 }% R

  43. ' U7 K) H2 Y$ D" o6 c* q, [/ i
  44. #ifdef EDMA3_DEBUG7 o0 [% I6 g7 `0 a! S4 W# ^, W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + h$ P5 t5 @3 a0 ^# U( ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& t8 r/ b# |5 \6 U6 H' N7 [; ~% E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + I+ g+ E3 p9 I0 c7 m! N" R
  48. #else$ E+ e0 g0 q3 B
  49. #define DMA_PRINTK( x... )! {: M8 q& @+ O- q4 u1 ^. l
  50. #define DMA_FN_IN2 s4 |4 q+ T5 h( {& ~  W) S0 J9 K
  51. #define DMA_FN_OUT* N1 x( U& \7 ]  x5 L2 f) J
  52. #endif: d" I8 g% B* B+ B" a8 P8 c
  53.   _" ]. G' z# R  b0 N, r0 q' s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      a5 G8 H) b) L  c; S$ T
  55. #define STATIC_SHIFT                34 T. u" N. |0 i6 C: M. {
  56. #define TCINTEN_SHIFT               20
    7 S, o( v# j7 J3 D
  57. #define ITCINTEN_SHIFT              21
    9 ^8 O7 m( i4 z* A2 y
  58. #define TCCHEN_SHIFT                22
    0 z7 Z. c/ Q' f' b( e4 d, M
  59. #define ITCCHEN_SHIFT               23
    3 z: r: u* u7 _4 s9 G

  60. " z3 q* N* G  t, R
  61. static volatile int irqraised1 = 0;
    9 w, M( Q+ ^8 R) w1 `( K" P' }4 p
  62. static volatile int irqraised2 = 0;$ I0 ~6 l0 M9 ~7 V; l

  63. / A% c7 S$ |9 `0 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / J) d9 b4 H' G( ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( e! K' [! D) U2 ^1 F3 Y: n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; E8 I4 }* w8 M0 X

  67. + m; |! E$ G  R
  68. dma_addr_t dmaphyssrc1 = 0;
    0 Y: I- ~$ N; C/ ?' V. Y
  69. dma_addr_t dmaphyssrc2 = 0;
    2 u: f" ?1 T4 r6 H
  70. dma_addr_t dmaphysdest1 = 0;2 s2 \( {& H6 O6 a2 c# l
  71. dma_addr_t dmaphysdest2 = 0;( ^, C3 a. ~4 s& J8 C
  72. 3 x( a1 a1 }4 x1 D) H2 h
  73. char *dmabufsrc1 = NULL;4 R# m3 G4 f* J; J& r1 u% r% m; v
  74. char *dmabufsrc2 = NULL;5 k5 G9 N+ C8 [; _. V
  75. char *dmabufdest1 = NULL;7 U: I6 f# j6 S: ?2 B
  76. char *dmabufdest2 = NULL;" h- H8 N- U, n+ F6 T" {
  77. 4 w1 l6 d$ d( h( g7 r; C) W/ d
  78. static int acnt = 512;, o& c" ]5 l) L0 ], r
  79. static int bcnt = 8;
    6 j- \  c8 f9 y7 ^/ @
  80. static int ccnt = 8;) e+ i: F& h3 g# X1 I5 k

  81. ) u. ]- x. T. @
  82. module_param(acnt, int, S_IRUGO);" s2 i& c& K' u. c9 o2 T6 V" X
  83. module_param(bcnt, int, S_IRUGO);
    5 [6 K; x, q# U: K5 L' r: {: o# p$ }6 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- R8 p6 W% @9 T- M& Y4 R3 Z3 v
+ h: X5 H* O4 p* p' D, h( H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 G  d4 P& L5 `0 y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& u7 I  `" n, i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# |7 y- I3 U5 U) @! R8 B6 c
& @9 m6 q3 I3 l  H% X
% t; U  [" I5 R/ q. l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-8 17:10 , Processed in 0.069410 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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