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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , a3 n! u& W. Z$ H
  1. [code]EDMA sample test application$ [2 ?0 k; C* j8 p& w& D3 I
  2. /*
    ! u" P) \4 w* |6 O# q$ Z8 Z/ n
  3. * edma_test.c
    , c( P  C( K% K2 C2 Y7 O# E; f
  4. *
    2 X+ x0 U; K3 o7 c( ?
  5. * brief  EDMA3 Test Application
    / X% y1 C/ B* B9 Q5 |2 A* @
  6. *9 m$ z: Y  T3 s) t$ _# C( ^; R
  7. *   This file contains EDMA3 Test code.& |, [. l: s$ {8 I, x
  8. *
    ; S' i; s; I2 M! p/ G; P" \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      c. J* ?- P3 R- R2 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* h: H  v: o3 J4 r& c
  11. *         TO CHANGE.
    ! D& ?8 {! Y. n; ?+ C" o- Q8 Y
  12. *  h3 _! ]) c5 W( ~5 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% L' T% P. h6 k; F" B9 W
  14. *
    1 ]6 U4 ~) ?) h" d! ~6 t
  15. * This program is free software; you can redistribute it and/or/ m0 n. ^; [7 b# p1 w9 |& ?4 @0 W
  16. * modify it under the terms of the GNU General Public License as
    - F6 f5 Y1 ^! F( a' d
  17. * published by the Free Software Foundation version 2.
    * @6 S0 o6 U  O+ L
  18. *
    5 m) J- p# V: ^3 \( T8 S+ L/ ~! s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, g' _+ d9 l3 N$ u" ~
  20. * kind, whether express or implied; without even the implied warranty1 Q' P3 n- A: b- P5 b; ?% q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* e' X3 X" ]8 `$ r- g4 B8 s. E* Q) N
  22. * GNU General Public License for more details.
    . i0 n9 t1 h) B+ j
  23. */
    5 ]& V7 w/ N6 w6 {: m& ^
  24. ' h- C: `8 f' \% @/ s4 B+ h+ L7 n- Q
  25. #include <linux/module.h>$ {8 @7 }2 k9 g
  26. #include <linux/init.h>+ h# R! Z8 Q( k7 G  z
  27. #include <linux/errno.h>3 d# f% N3 s6 y+ Q) G) j7 _
  28. #include <linux/types.h>: e6 c0 F! |; Y! r( n9 [( {+ H
  29. #include <linux/interrupt.h>8 w, o- K# S2 G6 f2 l. @9 ]# Q
  30. #include <asm/io.h>
    ' `3 |" X6 l; K0 I
  31. #include <linux/moduleparam.h>
    ( l( W: Q. e) u  a, A( o3 ~) O: Y8 x
  32. #include <linux/sysctl.h>
      Y9 O9 I2 `# E- ?
  33. #include <linux/mm.h>' I1 c4 a3 G( Q& ^5 s5 O
  34. #include <linux/dma-mapping.h>
    $ `- n, y7 _4 f9 [4 g/ S' A
  35. ' m$ y4 L3 p4 T- u# L% p
  36. #include <mach/memory.h>
    " X+ X3 ]! \5 T
  37. #include <mach/hardware.h>
    / F, I" F2 j) s; C
  38. #include <mach/irqs.h>+ Y! A1 n9 }* o+ `9 ]; I6 E
  39. #include <asm/hardware/edma.h>' p' d3 H1 P/ V& |" Q$ Y, k' i

  40. # L7 x+ b1 j6 B
  41. #undef EDMA3_DEBUG$ W$ a6 z1 P4 g
  42. /*#define EDMA3_DEBUG*/, D, X3 z; P  L7 E0 g

  43. : L. V$ h% m7 H9 V& V/ L" R
  44. #ifdef EDMA3_DEBUG
    / b; a% P( ]/ R+ d4 q# x4 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' `) Y, h* O( T  T7 v5 n, E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# Y: W9 l2 T; {6 N% X7 `& E$ S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 v' t9 X, r7 `) z# \" F- T
  48. #else+ i0 V1 ^5 i/ x# _) A, b
  49. #define DMA_PRINTK( x... )
    , o" C" B$ R; J* N1 B! z$ S/ z
  50. #define DMA_FN_IN
    . Z% W, l/ |" y* ?3 H. t! Y
  51. #define DMA_FN_OUT
    ) C. w1 o+ x0 S$ M
  52. #endif
    + v& ~) i! s8 i. {) N. A9 a5 |

  53. " d. u+ N6 _6 w7 `  `# [4 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): J8 K, ]1 U; |  N6 c6 G
  55. #define STATIC_SHIFT                3; n! a: Y7 p( l; S2 |6 f" w
  56. #define TCINTEN_SHIFT               20
    4 `: J* }* H! n1 a
  57. #define ITCINTEN_SHIFT              21
    ( ]4 _3 v5 X8 `
  58. #define TCCHEN_SHIFT                22
    # z$ l+ b, @0 R  l8 \
  59. #define ITCCHEN_SHIFT               23( \. w4 t" B- m2 C  J, }6 `

  60. . h: `  ^0 Y" _- R, v! _+ G
  61. static volatile int irqraised1 = 0;
    : {2 h+ B% t/ I9 W& R) ]% D* e
  62. static volatile int irqraised2 = 0;
    6 O: A0 f9 i! z

  63. 8 y: H* G' |/ S9 K) l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 \% m3 q8 E; M3 q4 k/ F0 i! v4 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; m9 x9 n* x8 G% I% Y6 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; w  D6 ^7 c. e! p# a. D
  67. * ?& m' {3 ?( `9 M8 h3 w
  68. dma_addr_t dmaphyssrc1 = 0;
    4 b( U; _/ U' a, {+ Y
  69. dma_addr_t dmaphyssrc2 = 0;  B# W- Z6 ]8 \/ H1 Q
  70. dma_addr_t dmaphysdest1 = 0;
    * L7 ~" A0 s. L+ ?1 R
  71. dma_addr_t dmaphysdest2 = 0;+ x! E- f0 `: V; q+ x# F
  72. ) Q( G2 O$ n  L+ F% _5 Y+ y
  73. char *dmabufsrc1 = NULL;+ b9 s! D$ n% S7 k/ F  }3 K
  74. char *dmabufsrc2 = NULL;: V" v, c% I; a7 [8 m  k1 {
  75. char *dmabufdest1 = NULL;
    1 @5 K+ W0 G6 Y6 J9 E
  76. char *dmabufdest2 = NULL;/ l8 A1 z5 r) M8 J1 e

  77. / M: {: L! n7 l2 J5 q
  78. static int acnt = 512;
    , D9 b# b* B+ O' J" W
  79. static int bcnt = 8;
    ; z& L. \8 I; f) M% r/ C. R0 o
  80. static int ccnt = 8;$ Q8 B: s4 ~' r

  81. 0 t, _" ?  p0 h* }; a- n1 j1 Q4 Z( p
  82. module_param(acnt, int, S_IRUGO);
    ! M2 J  |& ~0 d' J% N, N
  83. module_param(bcnt, int, S_IRUGO);
    ; h$ k4 j: I* l% Y% n6 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 X" W- z$ h6 B8 i) D
% n1 |6 S# h) l& [7 v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# b9 Y+ G" g8 g9 i; c- b3 t/ F) earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- d' s0 ]% z1 S' g& Q6 D: [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- d6 n1 K, J. h; H% H7 a
( L) j9 K9 M. M2 {' y+ _1 }' O
/ [! q" s, \7 R' U; l  I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 16:03 , Processed in 0.040587 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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