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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 _" `. O: S2 V8 _: m) c1 q
  1. [code]EDMA sample test application/ U) t$ m( R3 l9 a
  2. /*5 C6 E1 }6 q' l: s; t% T0 B% R
  3. * edma_test.c1 u9 q9 c% L& E7 O8 s. S8 F7 L
  4. *, R7 g- z; D, z: E
  5. * brief  EDMA3 Test Application
    4 p- A6 X1 J' p+ d
  6. ** r+ w5 n# N; M3 l
  7. *   This file contains EDMA3 Test code.& ~( L& {* y! \% p& f& d8 E
  8. *1 D; y3 V2 \2 d( f8 L/ Z# i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 e% H7 e) J3 J. @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - j& D6 |( q8 M6 x% ?# E" k& f
  11. *         TO CHANGE." i* H2 K" e* ~  }9 |
  12. *
    ) v, X, m# J2 j0 J  g  Z4 `( |+ k! r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 X4 [: `6 w: l" P$ Q  }6 v
  14. *' T: t6 j+ A+ X0 O; @* @6 n& B
  15. * This program is free software; you can redistribute it and/or
    7 K& O" F/ ~- \% @1 p2 H
  16. * modify it under the terms of the GNU General Public License as7 s/ [' e" P) ^. Y3 ~) R
  17. * published by the Free Software Foundation version 2.
    0 J8 j2 c( o! E+ i1 T
  18. *# D  }  Y4 y* u9 x5 }' L; a0 n9 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! X2 k/ I. P4 b5 s  n( o7 h
  20. * kind, whether express or implied; without even the implied warranty
    7 B' P! Y6 _3 P& @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " E( {1 k0 \1 [) L/ z; c- i+ {8 m
  22. * GNU General Public License for more details.
    $ G- u/ F" Z. r  U- M/ ]4 i
  23. */
    $ M0 k) f' ^7 z; Y5 ~7 l, O1 c

  24. $ z: i1 Y& c6 |4 P/ }
  25. #include <linux/module.h>) k1 J6 Y. q# s5 F& k
  26. #include <linux/init.h>. {, m0 o6 M- }) s1 T( R
  27. #include <linux/errno.h>$ e) f% B* U/ Z! ~2 w
  28. #include <linux/types.h>
    : }: x4 g) J, _6 g( i
  29. #include <linux/interrupt.h>
    9 }  C& R( L0 j! _# d
  30. #include <asm/io.h>
      M0 H, L7 ]- J: o! N
  31. #include <linux/moduleparam.h># k/ ]+ `2 E' C: Y/ W$ j
  32. #include <linux/sysctl.h>+ P7 r; l$ k9 ]! b/ y, S- V; n4 n/ {
  33. #include <linux/mm.h>" u4 U# `& I. C3 z  m& R
  34. #include <linux/dma-mapping.h>
    ) P% x% s0 A  N% Y; z

  35. 6 F7 w& v! f4 M$ ~( F# a
  36. #include <mach/memory.h>
    ' ^1 l1 m! Q/ f: _( R  t$ x
  37. #include <mach/hardware.h>/ s- P1 I! _1 k  _2 r5 h/ b. t
  38. #include <mach/irqs.h>
    / P# {" q5 [/ i+ Q
  39. #include <asm/hardware/edma.h>( M3 n4 o5 X. h9 ]- B8 |: x
  40. 4 q8 N$ R  S3 F/ ]6 E( L0 h2 U
  41. #undef EDMA3_DEBUG
    / E9 c8 Z9 H/ w2 F1 X  [3 g- j* b
  42. /*#define EDMA3_DEBUG*/( e' s5 @8 }/ \4 C. D" _+ g! v

  43. # M. }& N/ G( Y
  44. #ifdef EDMA3_DEBUG
    6 n3 O0 S8 g4 _# n4 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); v; N, D1 _. @3 |5 L9 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 Y4 u9 u0 c# O; @0 p! x! q9 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# Y8 z- i/ {8 S. F0 e( C
  48. #else
    6 n; V. m/ j% }0 W! T  K+ e
  49. #define DMA_PRINTK( x... )* G+ u8 ~. {/ Q2 j/ |" R
  50. #define DMA_FN_IN
    8 _7 _* i& {3 X9 I( e5 B% I9 j' [* T7 k
  51. #define DMA_FN_OUT" |6 P0 H) I8 W
  52. #endif
    # ^5 C* U2 t' A0 {2 @7 m! w

  53. * P/ c! V: _: @6 f' M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 j1 W1 n  [5 M5 b7 R) J; z( Y1 m
  55. #define STATIC_SHIFT                3& a1 V) B6 ?, ?+ P
  56. #define TCINTEN_SHIFT               20
    ! ?: n: u3 F3 y. U& z
  57. #define ITCINTEN_SHIFT              21( N& e; x  _& [& |: ]1 p9 U1 A
  58. #define TCCHEN_SHIFT                22
    4 _" _. Q! p# }' d& @3 `% M3 g
  59. #define ITCCHEN_SHIFT               235 ?6 j' U  C$ X, H' V! b

  60. 9 ?0 o* P/ p* U" \* g9 X( G) K, a- f
  61. static volatile int irqraised1 = 0;+ [* _$ Q; N& |0 o$ S
  62. static volatile int irqraised2 = 0;- v- l6 R7 F' M. I" S( r
  63. % {* h: h) f5 X* u( q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % o7 d. `' d1 E8 G+ l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ^2 O. d% e0 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 d- s7 F; [1 h& q9 Y

  67. 1 G* I, n+ ^) e1 Q/ f- N
  68. dma_addr_t dmaphyssrc1 = 0;
    ! }, `7 t( ~$ Z
  69. dma_addr_t dmaphyssrc2 = 0;
    ' n: G% E  B$ L" L* a1 ~' ]0 T- x1 Z
  70. dma_addr_t dmaphysdest1 = 0;5 e' W0 A, e% K3 I9 k5 F8 P
  71. dma_addr_t dmaphysdest2 = 0;! X! D& P: @0 Q+ c/ r
  72. 8 p) q4 s7 P  r) q& R9 \1 C
  73. char *dmabufsrc1 = NULL;* O4 n& T: V$ {7 c* A- U0 f
  74. char *dmabufsrc2 = NULL;& ~5 ^) w) [: `* R9 W
  75. char *dmabufdest1 = NULL;7 k( K+ G- m! j4 k  U
  76. char *dmabufdest2 = NULL;# S; F/ [5 B2 T# H( l0 ]. J
  77. 7 b) W, g6 m0 U, T4 I
  78. static int acnt = 512;3 o" l6 \8 N" ~9 l2 K5 G0 C
  79. static int bcnt = 8;
    + A$ g) r: ], y9 k, y; d* }
  80. static int ccnt = 8;
    2 ^6 w: z8 |1 s

  81. 7 o8 P" {1 d% p' h5 c& g/ X; h
  82. module_param(acnt, int, S_IRUGO);6 j* @. c7 f! h8 W2 X
  83. module_param(bcnt, int, S_IRUGO);2 L9 S9 n8 g: h% J* z. a4 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 J8 t; i4 |* @" g- J1 q  J! S
; U8 |) x2 E" i# p- g% v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  Z: P* S& u7 F% k: ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) }4 C" L5 x5 Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 f/ r; q) L! R5 \. V
# H; W0 t$ D8 _1 E
; n; l2 f# j) H0 O, B( E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-21 11:42 , Processed in 0.040574 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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