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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ N1 }4 ~" f& l4 \0 C
  1. [code]EDMA sample test application. [- m, a- X2 ?! e) Z- P
  2. /*
    / ~3 v, d6 t# h8 W" q5 f
  3. * edma_test.c5 e+ |$ {5 F0 T0 N3 u; Z
  4. *
    $ T; ]8 m/ R3 b( K2 P# C) ~
  5. * brief  EDMA3 Test Application
    - G+ w4 M  f1 c- l, \+ f% A
  6. *8 O1 i3 j* K: R! L" R$ Y8 T9 V* [
  7. *   This file contains EDMA3 Test code.$ c) a4 B5 V3 O# G! S
  8. *# j* X7 a, P& j( h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  c! S9 J4 U+ o! u7 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ |& t2 p3 |% j: F& \
  11. *         TO CHANGE.
    + L1 ?2 x9 I& r* N) T/ O" {5 O
  12. */ Z: d1 I! G4 ?. V2 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& d  A0 ^5 L4 ?% L
  14. *
    4 F7 [, S& N; \, I
  15. * This program is free software; you can redistribute it and/or4 K1 k5 p' V- [: A6 I7 e8 z" i* g9 t
  16. * modify it under the terms of the GNU General Public License as3 O" V, J0 c& |+ _) w) w" Y* f3 `
  17. * published by the Free Software Foundation version 2.
    ' L  ]. S. E8 q
  18. *0 [/ y3 m7 d) z2 i- U8 A# ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 M8 b( ?, l6 r/ Y$ [+ S
  20. * kind, whether express or implied; without even the implied warranty
    6 h0 q' R3 n. N- i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 g" q2 M- y4 S$ I, n+ y5 a" z
  22. * GNU General Public License for more details.
    + I! n1 ~8 B5 G# Q/ {, K
  23. */
    ) t. Z3 a+ f) K

  24.   m" l! _+ W" O+ x' x* F- b
  25. #include <linux/module.h>) s" I/ H/ R* T
  26. #include <linux/init.h>
    ( D- k+ n+ S' y
  27. #include <linux/errno.h>
    0 A# p- H6 y' i
  28. #include <linux/types.h>; l5 S( Y, n7 W7 v$ j9 a* u: r
  29. #include <linux/interrupt.h>
    ; ^3 _2 K0 S- D
  30. #include <asm/io.h>" e8 W, `# F" L8 y  l' t  t4 P( M3 K
  31. #include <linux/moduleparam.h>& F( w* u3 f$ }5 K9 `1 x3 n
  32. #include <linux/sysctl.h>
    9 ^3 Z7 X2 [5 g0 O+ |3 [6 |
  33. #include <linux/mm.h>5 S, b! [4 Y* B! R+ q0 _% e; E
  34. #include <linux/dma-mapping.h>
    7 i& z& I5 n" n5 P
  35. % L% D0 z3 J+ a
  36. #include <mach/memory.h>
    5 I! ?  p6 |# Y  i, B
  37. #include <mach/hardware.h>$ `+ ?  {  D- T# [2 m# Q
  38. #include <mach/irqs.h>
    # P3 E8 I5 @- l, w* p+ F; g
  39. #include <asm/hardware/edma.h>0 F/ l3 K! w7 T' o2 |! d

  40. 2 _6 [  Z- f$ E+ s* f8 F
  41. #undef EDMA3_DEBUG
    0 _, _6 \2 b$ y  v5 C; \9 i" u/ [
  42. /*#define EDMA3_DEBUG*/
    4 y) Q0 Y# I$ f
  43. $ q$ n! m( ~; q1 ^/ l/ ]
  44. #ifdef EDMA3_DEBUG
    2 D; l9 g; Y* ?3 f& v4 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : w# ]) h4 g1 d3 ^) [9 p. P9 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( o$ M7 v/ C6 h0 Y$ S* n6 r2 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 P, }$ T/ N8 G
  48. #else" ^$ \& T% @& F7 x
  49. #define DMA_PRINTK( x... )
    & l- {) c& o" s: u$ I4 S1 A
  50. #define DMA_FN_IN
    6 V# O# T2 D1 l7 w3 V
  51. #define DMA_FN_OUT
    , I/ v9 u9 J4 E: d- K
  52. #endif
    5 E0 V; o' Q% f* T! [( R! @1 V9 [

  53. 0 k% \/ y, H- p; l8 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % |1 `& k8 o' g+ q! M
  55. #define STATIC_SHIFT                39 J' q% F2 y3 g) K0 t
  56. #define TCINTEN_SHIFT               20
    ( ^0 J+ N& w, L$ d! c
  57. #define ITCINTEN_SHIFT              21* G- m. Q9 U# l" |
  58. #define TCCHEN_SHIFT                22
    4 f, r- u2 B% U* t& h# s
  59. #define ITCCHEN_SHIFT               23
    1 u" Q& t9 v7 S9 q
  60. 6 G/ j3 U* }$ n
  61. static volatile int irqraised1 = 0;  D5 E( T+ n* M
  62. static volatile int irqraised2 = 0;) A( w& s8 I# ^$ Q4 R
  63. . Z. o$ c/ }' m' X* P& }, A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 w  f/ o8 Z- m! p- T8 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 T* ?# n5 @* K" y1 }4 I: g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, e9 W, L: g( p
  67. 6 N# U/ m% @! Z  Z9 V+ \! J
  68. dma_addr_t dmaphyssrc1 = 0;
    % u' o9 `  x- y
  69. dma_addr_t dmaphyssrc2 = 0;4 T' a: k' w  N9 j% |" G/ s1 ~
  70. dma_addr_t dmaphysdest1 = 0;
    7 _+ }' h& n0 k
  71. dma_addr_t dmaphysdest2 = 0;
      z- O- f0 e1 Z  T
  72. , o0 Y, T, P+ q2 Y7 `! k2 B
  73. char *dmabufsrc1 = NULL;
    9 @( r/ S8 B. y/ q0 O
  74. char *dmabufsrc2 = NULL;+ C  \# a4 K" q" y, m
  75. char *dmabufdest1 = NULL;1 N: w. a- Z+ ?" ~& ^
  76. char *dmabufdest2 = NULL;- [9 r  ?# h* P
  77. ) x& B6 S* N4 O0 B! i
  78. static int acnt = 512;
    + M  z' q8 V0 @2 L
  79. static int bcnt = 8;0 Z( m% t0 `9 Q  ~5 D+ G
  80. static int ccnt = 8;' D. m! R+ x! `" d7 X

  81. 9 C7 i6 A# c" f' k% x
  82. module_param(acnt, int, S_IRUGO);
    2 y8 i6 M# q; B- J. q1 a- e
  83. module_param(bcnt, int, S_IRUGO);
    ) R% R4 {* Y2 s! ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 J  }9 s  G: M# `1 ^, N, F' D) p( x- x& t- w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 B" ~' v6 u# W1 G/ N4 D3 P; V, marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 a1 L4 Y* }* [8 o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, z, B7 j, ^' H1 \
8 l4 B& ?( y8 u. H1 y) \
, G0 @" w- r+ G- G4 O: X5 g2 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 00:40 , Processed in 0.041922 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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