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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 u- Z0 |- e7 W1 K, A
  1. [code]EDMA sample test application
    ' \$ k# d) B& z& h% C4 H
  2. /*
    3 l% R; d+ ~0 [4 y* y: A0 H6 H
  3. * edma_test.c
      t% D" Z9 y' n9 F& K4 B# |
  4. *
    , b  K4 z( [! y' ~8 w. v
  5. * brief  EDMA3 Test Application  y: t' [1 q5 R7 _- q( x
  6. *
    ) h; T3 X8 J. U1 \; {+ [3 t9 J
  7. *   This file contains EDMA3 Test code.
      y+ e8 K5 y3 Z3 [8 v+ k# M! e
  8. *$ g7 z& C6 v' Z5 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) `% ?% z* m9 i! [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 R' f0 |& ^" M  \6 D% ?# B0 W
  11. *         TO CHANGE.3 ~  d& \: b% b
  12. *
    , M- h) X& \/ b6 g+ o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: I$ t6 L3 F7 O& o
  14. *. q+ b5 F# X$ ^! F- ]: C  k2 ]' s
  15. * This program is free software; you can redistribute it and/or# t+ P+ k# f8 Z4 }+ K
  16. * modify it under the terms of the GNU General Public License as6 h+ Z$ X) S" f0 s1 O9 L
  17. * published by the Free Software Foundation version 2.) ^2 f' k, T- M% L& s4 R
  18. *
    ; m) S, ^* T" F2 j: r4 F2 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" }" c) u9 v# m- ~9 t  J. H2 [
  20. * kind, whether express or implied; without even the implied warranty
    7 y2 J( Q- e1 Z% Z% Y  c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 R- C- @* f: `# S2 s! B
  22. * GNU General Public License for more details.
    # f0 K% G7 J% u0 K" c
  23. */# H8 m8 G  o' `7 F# }" b0 q
  24.   X0 r2 ]& b8 {9 p' Y
  25. #include <linux/module.h>
    : u! ?* {) x0 n
  26. #include <linux/init.h>' m8 Y+ C+ T( {9 V5 `6 |3 D
  27. #include <linux/errno.h>2 v$ g+ }5 Q( ~1 D
  28. #include <linux/types.h>& l- l  f6 t- E+ l8 [
  29. #include <linux/interrupt.h>
    + }6 a3 o& \2 L
  30. #include <asm/io.h>
    - w6 `: {% F; n4 o
  31. #include <linux/moduleparam.h>
    2 X' r1 T4 {5 a1 @9 Q- ?5 D
  32. #include <linux/sysctl.h>$ @: O  X. B: S4 p6 Z
  33. #include <linux/mm.h>
    & V, k4 j9 s0 r" K! [% O
  34. #include <linux/dma-mapping.h>5 I* _  p" i$ d1 W; I

  35. ; K8 ]( L/ T# [
  36. #include <mach/memory.h>
    ) b' j( c5 O0 Z, Q  @
  37. #include <mach/hardware.h>. M. E0 E7 |7 Q" N  M
  38. #include <mach/irqs.h>
    : h1 K" {" A/ B9 d  N/ I
  39. #include <asm/hardware/edma.h>  t. X  n  v5 s
  40.   J. G; _) L; D5 G
  41. #undef EDMA3_DEBUG
    ! e# F9 {0 P  K+ t7 @1 M) i+ y9 z
  42. /*#define EDMA3_DEBUG*/
    9 W. W0 q5 [, u  B
  43. + J$ p" Y+ e9 [* q$ C$ @9 E
  44. #ifdef EDMA3_DEBUG
    $ w6 J# x! {, n& H. i6 L& ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 U% @0 ^/ D* k  y( L" b- D& v& G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" c; E1 n/ y9 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' N+ t9 ?4 j! `
  48. #else0 X2 P7 w3 j" z7 J6 O/ d% |
  49. #define DMA_PRINTK( x... ), M# i( j" e2 s2 w( B
  50. #define DMA_FN_IN0 T! `" _; C/ h5 Z& \2 I2 s
  51. #define DMA_FN_OUT
    ' U: D3 i  V$ f! H- R* K+ ^! h; d" ?
  52. #endif
    ; M3 Z4 j& ?, _" Y
  53. 6 r' l" g8 W$ F' s2 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 W9 G5 A" O3 D4 R
  55. #define STATIC_SHIFT                3
      n: [7 f! A% z. b; L3 o
  56. #define TCINTEN_SHIFT               20
    # ]/ @' f  G; ~
  57. #define ITCINTEN_SHIFT              21& B. u1 Y4 b/ c/ G: q- n9 D
  58. #define TCCHEN_SHIFT                22: P$ X( O' S( s* n$ ^
  59. #define ITCCHEN_SHIFT               23
    9 W# F& w5 k* z1 |3 G

  60. ! d% N  P# V: W2 J
  61. static volatile int irqraised1 = 0;
    2 \8 n8 }3 r7 X1 m4 a+ ?
  62. static volatile int irqraised2 = 0;
    8 d3 P3 y1 Y1 `

  63. % j: J' O" l) h1 E/ B8 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Q8 Y9 q1 u; J3 X) m' ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      r& N6 |/ E3 N1 [( S* ?; S7 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : f" }+ I. H5 ~1 y. e; w: {
  67. : \! r2 r: _! j* I+ z( ?
  68. dma_addr_t dmaphyssrc1 = 0;
    ) Q5 X4 t0 x6 y/ m: u
  69. dma_addr_t dmaphyssrc2 = 0;1 Q% D- @/ f" W$ S
  70. dma_addr_t dmaphysdest1 = 0;1 c+ h" n1 W; {* k# P
  71. dma_addr_t dmaphysdest2 = 0;
    8 Q$ w2 ^4 D8 z6 F6 s

  72. ; L* z0 I7 j: n2 t8 |" t, y
  73. char *dmabufsrc1 = NULL;: K& J$ E9 a. j% A9 y
  74. char *dmabufsrc2 = NULL;% V! t1 N4 \6 v" u' N5 j1 p
  75. char *dmabufdest1 = NULL;
    8 G$ y3 X3 x+ a; b5 n6 }
  76. char *dmabufdest2 = NULL;
    " f/ H6 G$ d% F4 }2 c
  77. , E: e8 @  C* ~9 a
  78. static int acnt = 512;4 [' {- B6 [5 E
  79. static int bcnt = 8;
    5 F0 d  B/ i1 ]/ [
  80. static int ccnt = 8;' l+ T  R  Z9 \  h& l

  81. 8 ^' M# w" }  L* Q8 O7 `
  82. module_param(acnt, int, S_IRUGO);
    5 v1 o, }7 d) l+ U7 G3 }/ ?
  83. module_param(bcnt, int, S_IRUGO);: Y( U- f: l. w4 k1 X' w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 q4 A' C1 ]. H) M* w+ R8 g1 B: ]" C6 P, D( v5 @9 ~; I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' C- g9 f. T/ F, ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ~) m6 Y; q* ^; m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 b% n! K' a# L3 M0 b
, a' [# j8 L: ?3 R1 C: S9 q! v& z) G

  x# n! d- N' F4 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-5 12:04 , Processed in 0.045173 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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