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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 E  i; k/ e6 p! w0 i
  1. [code]EDMA sample test application* x% T9 g8 Y( f2 q
  2. /*
    5 Y1 F/ L6 v$ x
  3. * edma_test.c- L! H8 ]9 t9 c5 L
  4. *
    % {- ?, u% G! J
  5. * brief  EDMA3 Test Application6 Q$ g; [) V+ w
  6. *- m4 o: P* m0 R; u
  7. *   This file contains EDMA3 Test code.
    ; [0 J! }* R) g( a' A0 s
  8. *- A" f7 c+ C3 ?2 v, I! i1 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 N" Q. Q8 C0 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 \; B# J1 Y# q  L! D, H- O0 I- y
  11. *         TO CHANGE.$ n3 Q7 G& ?$ t( q0 X( i# m
  12. *$ v& v! H" Q2 i3 ^, r3 m7 R5 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 X  b: U6 g6 c' o
  14. *1 ^7 t" Z; c" W  F1 d8 P! `
  15. * This program is free software; you can redistribute it and/or
    7 ]3 A! ~5 q1 c- a& Z( |# R
  16. * modify it under the terms of the GNU General Public License as
    - D  M" h, D) G( U
  17. * published by the Free Software Foundation version 2./ T+ h3 F1 E4 o$ e5 `
  18. *
    0 D4 b8 j" o3 W! t' f+ N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 K, ~) d7 i0 T# C, ^5 o
  20. * kind, whether express or implied; without even the implied warranty4 X4 B7 n+ D: B7 ?2 f5 I# l' ]% h5 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( v% Q. P8 ]  n  E4 R
  22. * GNU General Public License for more details.# }) D% `7 g' d9 D
  23. */
    9 ]3 u2 ?; ^0 c

  24. ( d4 }3 O% A5 C' X7 {, ^
  25. #include <linux/module.h>1 K$ X7 t! T/ V2 _
  26. #include <linux/init.h>5 s8 C' M/ {/ u/ f% o
  27. #include <linux/errno.h>
    . M" M' n- R% }  D) Y
  28. #include <linux/types.h>
    , T$ k% l; Y8 `0 e, R
  29. #include <linux/interrupt.h>( M6 j6 ~6 D  |" O
  30. #include <asm/io.h>9 o; O, g( v3 @& Y6 z
  31. #include <linux/moduleparam.h>
    : C* R% G  m- o' l6 S
  32. #include <linux/sysctl.h>2 b1 ]+ F# k* Q) E0 B6 x6 g
  33. #include <linux/mm.h>
    : h! W) v  `- w3 K$ c3 `+ Y) @. e
  34. #include <linux/dma-mapping.h>
    ! t& N+ v' s8 v7 v$ y  P1 y
  35. 9 R9 `8 s- y4 N/ f! f/ g; ^2 h
  36. #include <mach/memory.h>
    7 [3 l. a. z* U
  37. #include <mach/hardware.h>$ I5 A0 i) b2 ^' I1 g7 w
  38. #include <mach/irqs.h>
    . C2 M: i% p: R* i/ g
  39. #include <asm/hardware/edma.h>. b" i5 M( i9 v* ~5 k; j' l: t

  40. , w5 f7 a5 h& y
  41. #undef EDMA3_DEBUG' C3 r% y+ h3 }: f- S( X
  42. /*#define EDMA3_DEBUG*/
    , A1 T+ l) R$ ?. p. P* z! t; h

  43. ! T- M# Q2 t- Y9 S: K
  44. #ifdef EDMA3_DEBUG
    . }" o3 T( V$ V9 A6 }/ D! ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- F6 Q' r1 S1 O1 n7 k7 [( a8 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % X+ g9 ~# O7 n- e! `7 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 T" y3 }2 @$ O; p* F& e9 w
  48. #else
    7 W+ v6 d3 y; {1 g
  49. #define DMA_PRINTK( x... )9 e  k5 ^! o5 y. V3 `9 |
  50. #define DMA_FN_IN
    ) |: V, v6 e9 j& L% ?; F7 k
  51. #define DMA_FN_OUT0 E! Q3 Q  X, E, H
  52. #endif) R# [3 a) G% \) V1 |" h

  53. & K0 p7 A4 V  \- v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 f/ S* [5 b+ k( S$ J0 `5 Y9 ?$ P& l; _
  55. #define STATIC_SHIFT                3) ]: R& y& J+ ~0 x2 @+ b
  56. #define TCINTEN_SHIFT               20; v) }: k3 Y9 [/ b, \
  57. #define ITCINTEN_SHIFT              213 P8 n( o+ Y& m' R
  58. #define TCCHEN_SHIFT                22: Q- y5 H" D1 L, s' s8 S+ S6 i* }3 e" T. A
  59. #define ITCCHEN_SHIFT               23! \. `" D& h4 Z6 [$ }# H8 Z- E7 p9 E
  60. / N% U" j  T3 z! F4 w
  61. static volatile int irqraised1 = 0;
    5 N6 s* b1 o6 I5 a$ L" F
  62. static volatile int irqraised2 = 0;
    , O% L; L) P# e0 u9 m
  63. 7 Z" r: G: s8 H. y/ B. S/ F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ \3 Z1 E: m, V/ M! v" ]9 H' o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      U8 O; {/ ^4 H" D: c4 W8 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / o* p) ?2 K/ U- o( g1 r
  67. : W7 c+ J" {5 {
  68. dma_addr_t dmaphyssrc1 = 0;
    ! Q( s6 |0 [3 O% Y
  69. dma_addr_t dmaphyssrc2 = 0;* Z; S2 t3 \4 a3 j% t- \
  70. dma_addr_t dmaphysdest1 = 0;2 A7 G% X) K- F2 \" F, V; R
  71. dma_addr_t dmaphysdest2 = 0;% W) D1 C" B4 p' q3 g' M, w' |
  72.   V& z! G6 Y! Y
  73. char *dmabufsrc1 = NULL;5 Y8 x4 P& ]+ r* c2 R
  74. char *dmabufsrc2 = NULL;  e, [& C9 ]" p, i
  75. char *dmabufdest1 = NULL;
    0 m% A$ a$ d) E* U# N7 s$ V3 [
  76. char *dmabufdest2 = NULL;
    - p* h7 `% ]& j: o5 x
  77. : A1 N7 E- |$ z4 \! R9 o
  78. static int acnt = 512;
    2 k3 w- I1 B7 s' _
  79. static int bcnt = 8;" s2 Z7 v6 e' u1 n
  80. static int ccnt = 8;
    ) l; z( m1 i( |+ R& z

  81. , c: [& _3 b6 H
  82. module_param(acnt, int, S_IRUGO);
    9 V; w' ?* G" t1 d, |! M
  83. module_param(bcnt, int, S_IRUGO);
    & E& [- z' d9 _  w) {$ j6 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- A- T* G& G/ B  W
3 c0 p& v5 h" @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. }+ P* k! Q6 {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ g& F, e( h* v9 y. w: K* Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% p. W$ \- u; i  b1 |  e

' g3 \  o6 b) Q3 E$ A$ f
' j$ P( a- V* V3 X7 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 13:02 , Processed in 0.038274 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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