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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : G1 _, A+ j6 S4 M: k
  1. [code]EDMA sample test application
    $ J' x! |$ m, |% t
  2. /*
    $ d8 E9 A6 p. f2 k
  3. * edma_test.c* h' e8 p9 p( D+ Q
  4. *" v# t/ {4 l8 C" G  o2 w. ]2 }
  5. * brief  EDMA3 Test Application
    4 W8 z0 {" p# `6 V7 n
  6. *
    7 ?5 Y4 C4 P  r* o8 J' ]
  7. *   This file contains EDMA3 Test code.
    % _+ I* Z* i) i7 b2 F; F
  8. *7 a; ~; e* Z0 K# H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' ^5 J; C. M7 n4 `, C/ U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* K; ^: S3 ^1 N
  11. *         TO CHANGE.
    - O4 K) L7 _9 a! c
  12. *
    ! e. P2 r# B0 d* M$ y* G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 R: W0 {+ u5 o' D6 e. ^# k& ?
  14. *2 x# H# @7 P5 M, Z, v& f0 R2 P
  15. * This program is free software; you can redistribute it and/or- D) }7 r% W0 R
  16. * modify it under the terms of the GNU General Public License as7 M2 |  v- g- O% a" A3 K
  17. * published by the Free Software Foundation version 2.
    . n; e, w% u4 e, K. v( a" V
  18. *5 v# ]  U$ }9 b5 l6 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' ~2 f$ x+ E; k& H
  20. * kind, whether express or implied; without even the implied warranty
    - v9 p9 O: ^6 e5 E3 S5 a+ o2 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # c2 n" i& H1 t  w- f0 Y
  22. * GNU General Public License for more details.
    ' G1 e7 ^/ f/ d- N: O8 d" X
  23. *// G% x+ F( U) s; g- y

  24. 7 }9 |" ~! A# T0 O4 K$ u
  25. #include <linux/module.h>
    4 G5 K, I, O' ^
  26. #include <linux/init.h>( `2 f1 T% P/ v8 F" j
  27. #include <linux/errno.h>7 |9 [3 Z. ~2 I; R2 \% @: V/ W% C% a
  28. #include <linux/types.h>; w2 L* w8 h2 j2 J3 Q# z
  29. #include <linux/interrupt.h>9 ]+ }: r: {+ X, H, H( r
  30. #include <asm/io.h>6 `3 J1 c5 q+ p- S% `+ D
  31. #include <linux/moduleparam.h>
    5 h4 l" G; C* q5 k  N: l
  32. #include <linux/sysctl.h>4 }; \1 E- F2 Q. D. E
  33. #include <linux/mm.h>
    0 |# ~7 f, M1 X; a; x8 [0 U" y
  34. #include <linux/dma-mapping.h>
    7 E1 R7 b, u' I  C" p# ]

  35. 1 X2 n( R- A* v% ~' x) v/ y
  36. #include <mach/memory.h>
    : Q/ d9 y  J3 i+ D
  37. #include <mach/hardware.h>
    ; a7 ^3 G( d8 q, J6 B9 c
  38. #include <mach/irqs.h>
    , [) [1 _, d; L6 s/ A( D& u6 x: P( ~
  39. #include <asm/hardware/edma.h>4 j; n6 K3 R* T, a
  40. 4 D% F* U7 v# R* l7 M, i
  41. #undef EDMA3_DEBUG
    , j0 ^; b2 P+ f+ t1 Z2 q
  42. /*#define EDMA3_DEBUG*/
    " D7 g- \, m$ z( C- |! D! N

  43. / o- M( Q- m5 {& x& D
  44. #ifdef EDMA3_DEBUG
    - \& }! R# x# q) B8 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 n& a4 N8 U2 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( j, z6 e' ?3 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 c) Z4 |7 x" Y4 X8 r
  48. #else
    8 b" X+ H( Y( X
  49. #define DMA_PRINTK( x... )
    , u; J; K* U7 x$ s5 g: w
  50. #define DMA_FN_IN
    , `  G& Q7 r; Y* O3 l9 K
  51. #define DMA_FN_OUT
    " U0 Y. W9 L5 c* Z: k
  52. #endif
    ! w0 G3 Z: R2 @

  53. ' s7 C1 ?  U/ _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). k) l9 L" }4 F5 i
  55. #define STATIC_SHIFT                3
    5 D% T$ V2 [; i3 z: b( R
  56. #define TCINTEN_SHIFT               20
    % p' e2 [. }7 v$ h8 w
  57. #define ITCINTEN_SHIFT              21
    , d; {9 @! e) L% W6 f
  58. #define TCCHEN_SHIFT                220 w: ~: C+ @6 t/ K& X6 z
  59. #define ITCCHEN_SHIFT               23
    ' K7 Q/ E  C# e  {$ d
  60. + X9 |# V, H9 V: {2 x+ f
  61. static volatile int irqraised1 = 0;
    7 l' l; V' l2 G9 ^$ ~# b
  62. static volatile int irqraised2 = 0;+ E, n1 I, @! r! j! H

  63. - |- t! B4 N, R7 K/ l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' R" J4 |0 i) i. w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 y  |: `4 \" v9 D. G" K1 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . r# l: m! n+ G5 b9 O( B

  67. : }, D' I, Z$ E% V
  68. dma_addr_t dmaphyssrc1 = 0;
    ; c# Z4 ^% t* `- p( B! F# a
  69. dma_addr_t dmaphyssrc2 = 0;4 G% P1 `, F5 n0 D3 d" n# {
  70. dma_addr_t dmaphysdest1 = 0;
    5 c( {# O$ s! w% z2 d6 ^; v' }
  71. dma_addr_t dmaphysdest2 = 0;
    + n# X! ?# ^) ]9 Z* G; E, I! X

  72. , p' E# U* L& I( [+ z
  73. char *dmabufsrc1 = NULL;
    : o4 \$ f3 v8 W/ D1 T$ R
  74. char *dmabufsrc2 = NULL;  E; @/ C2 q4 i
  75. char *dmabufdest1 = NULL;1 a" }) T1 R2 |9 m
  76. char *dmabufdest2 = NULL;+ N3 K" j, b" W7 ?" {

  77. 2 U9 _2 D/ d' J. X$ S8 i
  78. static int acnt = 512;# r; W" ]$ }' \, k, \4 I4 ^# K
  79. static int bcnt = 8;
    9 I. v' k1 F1 ~
  80. static int ccnt = 8;
    1 ~# J- D% [8 r$ L/ B  b1 c3 S0 X

  81. 0 M1 T' [& i. w; v/ a
  82. module_param(acnt, int, S_IRUGO);$ K9 e. Y* u% n+ _+ P4 T* B6 C+ \
  83. module_param(bcnt, int, S_IRUGO);
    . v) ~, S  L7 P! I; v, u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# X. Z; N  }6 ^# R* R
  a9 p* c6 J1 c4 N4 k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# `0 v4 \: ?$ k* t* Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& k1 [% u0 x" c+ z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! f- i6 {) f4 L! t% ~' c5 ^7 K5 i

. l" Q$ k. v& R& n+ ?9 h3 s7 \. I
" l. q- H( A2 W& ?- H! s1 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 22:30 , Processed in 0.040208 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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