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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   @$ c5 q7 B! Y# m
  1. [code]EDMA sample test application: L" g4 o: v7 B* r) q
  2. /*7 a3 u/ E( u( U3 C+ D
  3. * edma_test.c( K+ n4 y8 W: _" \( c3 [  G' F5 J  J
  4. *
    ; D* S1 K. y' Q
  5. * brief  EDMA3 Test Application% W: ~8 J3 f+ N" W5 |5 o/ E
  6. ** o& j, |8 d; f, l7 y3 [
  7. *   This file contains EDMA3 Test code.
      y2 e# f8 q, G) n. n& @7 Z
  8. *
    1 i( p, a# P; X' Z0 b) E+ w) M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - v& y& l* V- q$ L: }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 B" ?: t& e* Y' Q; c2 {% f2 j( S4 z
  11. *         TO CHANGE.& P5 s$ L$ C5 g. l3 U7 A
  12. *0 ]: o8 L( w7 i' Z) u1 j2 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' U& q3 Q7 p$ L
  14. *
    + s9 v/ c8 K- J3 C$ y+ Q, T( l
  15. * This program is free software; you can redistribute it and/or
      R) `( A% C% w: ]8 Q
  16. * modify it under the terms of the GNU General Public License as+ J2 r" p8 M) U) Z' k" V& j
  17. * published by the Free Software Foundation version 2.
    % u  R1 m2 ^2 V7 n: ~' D& G
  18. *
      W0 c# m' N! }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) T1 l* Y" n; L1 H; _- G+ O
  20. * kind, whether express or implied; without even the implied warranty  n5 I0 L/ G& D5 ]. q% U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 B' i4 n# S# ^) N: t' z
  22. * GNU General Public License for more details.
    ( s* ^+ A, E$ e3 z
  23. */
    % f9 S" G! @5 p$ s, G

  24. , x( w4 n7 J, _0 h- g; U
  25. #include <linux/module.h>
    5 W' ]( u7 V% P; h' B0 ^
  26. #include <linux/init.h>
    ( O' k! _* m: j
  27. #include <linux/errno.h>
    9 s8 b7 d. N/ y8 k2 x& D5 f$ t0 Y' y
  28. #include <linux/types.h>  d6 u; n  s" i( s0 Z5 c
  29. #include <linux/interrupt.h>% S5 `; z/ b8 `
  30. #include <asm/io.h>
    ; Q* q* }5 |( D; v5 ?8 R
  31. #include <linux/moduleparam.h>
    ; r- X) @; W* \0 c- u6 u% ~/ [
  32. #include <linux/sysctl.h>5 e: M2 ~% n1 z  A! K1 O+ B
  33. #include <linux/mm.h>7 j9 z6 `9 v. ?6 \0 h0 k+ i' [
  34. #include <linux/dma-mapping.h>
    / }# }2 [- J" |5 W9 R9 f0 _
  35. ) S9 `" s# }9 [
  36. #include <mach/memory.h>
    . P  F; H) b4 x( k0 `1 y. F6 o
  37. #include <mach/hardware.h>$ {3 E; {, Z2 q7 g  V
  38. #include <mach/irqs.h>: b: j1 R) {/ g2 q" A' v
  39. #include <asm/hardware/edma.h>
    ( f$ b1 j0 T! H5 |) O" v$ b! }' l: b# l

  40. * w! g: b% J) i8 o( g
  41. #undef EDMA3_DEBUG
    $ t5 Q! p+ z5 i  x8 {
  42. /*#define EDMA3_DEBUG*/
    - z5 ?' n+ k, R& _+ I
  43. + ^' w" I- a6 {1 u
  44. #ifdef EDMA3_DEBUG
    ! P  @" `( {$ W; X9 v! {& U% f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( N4 g( v2 a! T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" _8 L; ~' z- p; d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 f$ z9 k$ b1 H" h% q% U# D5 I
  48. #else
    1 k, ^" R/ _, }" W
  49. #define DMA_PRINTK( x... )) t) e* ?4 i( K& R" ]- [
  50. #define DMA_FN_IN" s0 y, O+ Q) V$ e8 ^, I. y
  51. #define DMA_FN_OUT7 `+ u- j/ U) @6 t: u
  52. #endif, i  ]! Y' B' _& Q$ f: C
  53. ' O& n+ a) {3 q$ u) O) ]* Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 |8 T4 S6 j; D6 i' s( T
  55. #define STATIC_SHIFT                3
    % @5 A- d, {3 r) S/ C' W
  56. #define TCINTEN_SHIFT               20
    + ~8 k+ o1 L1 X( R: E1 n  |
  57. #define ITCINTEN_SHIFT              21
    8 m9 l* S5 G7 C' P; ]9 K3 e
  58. #define TCCHEN_SHIFT                22
    ( D7 y% \  @) g0 w2 @+ r
  59. #define ITCCHEN_SHIFT               23
    3 [" L+ ^0 s. H! D. J, h
  60. 6 w( P+ ?, Z2 w( a2 K
  61. static volatile int irqraised1 = 0;# w  \; U$ l* G1 X& \' ]
  62. static volatile int irqraised2 = 0;
    6 g2 l8 Y# E: o8 K

  63. 0 o  a) W3 W3 M6 j+ X$ @6 o2 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 [' U% a5 {% t) x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) F3 ?/ w% f7 l; p' ?9 f  t$ l8 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 ?- w2 ]9 L% O8 M

  67. 9 ]; p6 N; G/ I* a; r
  68. dma_addr_t dmaphyssrc1 = 0;
    / r$ @9 K  X# n; J3 _
  69. dma_addr_t dmaphyssrc2 = 0;
    2 X1 H4 }) p& u7 m& _: ]% @5 W
  70. dma_addr_t dmaphysdest1 = 0;# T  ]) i6 \4 e# }( j2 Z
  71. dma_addr_t dmaphysdest2 = 0;
    ! a  O; v6 W7 m

  72. 9 C& w: o4 G1 S' p% i$ e
  73. char *dmabufsrc1 = NULL;% R: {: x5 f) M8 ^
  74. char *dmabufsrc2 = NULL;: e: _0 k# n1 ^  W4 c! J: g
  75. char *dmabufdest1 = NULL;8 z* E; F3 P4 k9 a+ ~
  76. char *dmabufdest2 = NULL;. g7 L  x: }1 r9 [8 `0 ]# i1 P# ?
  77. ! m( _& @& F* n7 q1 ~+ A' H
  78. static int acnt = 512;: n" [, c2 Q9 }0 }2 e
  79. static int bcnt = 8;
    4 |1 H4 C! b4 A7 J9 N+ i# V! q
  80. static int ccnt = 8;
    # O" q7 M9 n7 |- ~, P7 B
  81. % {1 @3 Q  S3 w( F) h3 D* I
  82. module_param(acnt, int, S_IRUGO);
    $ X2 S) L) ~  v4 ]
  83. module_param(bcnt, int, S_IRUGO);5 i- k- P! V8 D0 V' v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& Y% D3 A# z% X, n& X& y* ]

6 d! }/ Q2 j8 y8 V; [0 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 D4 c/ {6 F& T. K% X8 m, q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 i  @' }! S% R8 F, G5 z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 A9 e1 t; ~/ K$ ]: E
4 J. L4 Z4 i! n# Q. z. Y  j9 _) b2 O9 B6 L6 _; `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 23:17 , Processed in 0.040793 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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