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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 h6 @9 R4 I/ J
  1. [code]EDMA sample test application
    3 c6 u6 J. v- P" M3 z, i. f
  2. /*) f& o6 {/ d( j- x8 i
  3. * edma_test.c
    ' R* z# E( t# V5 k' L' |# @
  4. *$ ~0 v+ u; V5 w7 i
  5. * brief  EDMA3 Test Application; q2 o( |  J- z' ~
  6. *
    * T* Q6 p1 R9 }- i9 L
  7. *   This file contains EDMA3 Test code.
    " b) ^) S- f( \4 V$ p; f
  8. *2 K$ j/ y7 w/ @) n) k: B) R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- L$ \+ N, K1 Y- y5 l4 E, u6 k3 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 s# l6 o+ @0 r
  11. *         TO CHANGE." p% `! x3 z8 h" @
  12. *
    / N3 u0 U! X% n' p7 _: Q1 l4 S9 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! M: E' u+ p, B/ V
  14. *
    / p' n! ?: D7 _5 T
  15. * This program is free software; you can redistribute it and/or
    ; R: E! O/ r/ A6 p: A# b6 W9 q
  16. * modify it under the terms of the GNU General Public License as
    " ]8 y3 B  }9 E  ^3 {
  17. * published by the Free Software Foundation version 2.1 K, W% E7 L3 U( v
  18. *
    / Z1 v  N! G3 r' G) D# i0 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: X% r; f( B7 S( A: U: K8 V
  20. * kind, whether express or implied; without even the implied warranty* p/ |) Q% \2 L3 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . t2 w. a# [% h+ q5 `/ L3 U: ]
  22. * GNU General Public License for more details.0 m- P  b% Z; I7 n- e
  23. */
    4 ?! e* T! f! C) |* z

  24. - Y, Z, q/ k! o0 p9 S( k1 @; v0 e
  25. #include <linux/module.h>8 l  `  B- O( R2 t8 G1 P' F! c% C
  26. #include <linux/init.h>
    ( S& r2 N3 n' ^8 x* Z  w
  27. #include <linux/errno.h>6 y( G' C& C7 U6 v! I
  28. #include <linux/types.h>
    . o. c( ?  n8 F. t
  29. #include <linux/interrupt.h>4 D3 T0 E9 i) w6 a- k* }. L
  30. #include <asm/io.h>
    " W+ y7 t. }5 \+ a
  31. #include <linux/moduleparam.h>
    9 L7 ~. P- a2 r9 Q6 V0 H
  32. #include <linux/sysctl.h>
    $ c6 v# ]$ ^9 k4 B
  33. #include <linux/mm.h>% U; A& Z# `9 @8 @
  34. #include <linux/dma-mapping.h>5 l- Q) d6 v  O
  35. " d0 O6 T# q$ H
  36. #include <mach/memory.h># b! L3 A8 U8 B. D; X0 r
  37. #include <mach/hardware.h>% E! x, @9 }* u) h3 p
  38. #include <mach/irqs.h>, \- t. D9 m$ X1 S" Y
  39. #include <asm/hardware/edma.h>2 G+ g+ {1 c6 o( ?& A  |

  40. / h% \9 Y" ~# r5 ~0 m9 W/ m) b* ~
  41. #undef EDMA3_DEBUG$ o& Z! Q7 P5 u( W4 o- u
  42. /*#define EDMA3_DEBUG*/
    7 X6 H/ o0 N7 _! _

  43. 1 }. z8 t3 f* Q/ ~: T4 [
  44. #ifdef EDMA3_DEBUG
    ( G' T, U9 o( j/ L. O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / v. a5 ^& d2 R! Z/ _. V# n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & P7 w! w2 F/ n- D$ ?2 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # `0 i' o$ \4 n* x+ @" w4 e  o
  48. #else4 Z  }6 K( g( t1 p; d; b
  49. #define DMA_PRINTK( x... ), k5 c# y* A+ z) K  p' e2 h
  50. #define DMA_FN_IN
    6 }1 D/ @2 V- d2 E
  51. #define DMA_FN_OUT
    * [3 e3 @# i/ i) t, S
  52. #endif0 ?7 `5 I/ \4 A. T/ h6 R' J# }9 E

  53. % W4 i) K4 _8 s# d- q6 k( D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ _& t: c# H' L$ }* G5 T, ~
  55. #define STATIC_SHIFT                3
    5 p! D$ q" E$ N) P
  56. #define TCINTEN_SHIFT               20
    ( r% \6 H$ r2 K0 s; H( E
  57. #define ITCINTEN_SHIFT              213 f& R+ R+ T+ k6 k, F1 l6 q
  58. #define TCCHEN_SHIFT                22* E! O/ w9 Z! p3 D
  59. #define ITCCHEN_SHIFT               23; ~% U3 E+ I: N4 g3 [! Q2 z5 y
  60. / M5 m# h+ e, f- m' z
  61. static volatile int irqraised1 = 0;
    & `* G  d: D1 u0 P! _7 b, D( b" a# M# T
  62. static volatile int irqraised2 = 0;
    ! x- a# q1 F& R1 G4 }

  63. ! S: k  }; S, f2 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( W* v# a1 |. Z  k, |4 j9 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  O, I& \- N: B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 `4 H8 V" L" v5 ~

  67. " h4 w$ g' \6 E" z& P$ K$ d0 v
  68. dma_addr_t dmaphyssrc1 = 0;; t6 i9 e7 l1 C( k9 j! t; {! z
  69. dma_addr_t dmaphyssrc2 = 0;
    $ B5 r* f, l. k0 m# }! j& l
  70. dma_addr_t dmaphysdest1 = 0;& W7 v) Z" F$ k- L) D/ j7 \
  71. dma_addr_t dmaphysdest2 = 0;
    & l7 Z- j& L3 p; B* A3 p  N9 w3 j

  72. 1 D5 Z$ }, e3 _) F
  73. char *dmabufsrc1 = NULL;2 U* \) d! T/ ?, l( _, ?. S% M
  74. char *dmabufsrc2 = NULL;( ]; y. Z; _3 y4 q5 Z+ T& A
  75. char *dmabufdest1 = NULL;
    , d5 A- j/ |. ]/ F- _& U3 L6 P
  76. char *dmabufdest2 = NULL;
      O  s: l" T  v: T

  77. 9 A! s( O) C) f
  78. static int acnt = 512;6 z2 ~, V6 P) H( U1 |6 u
  79. static int bcnt = 8;6 P( \9 C! S6 y  S3 t0 [
  80. static int ccnt = 8;
      O& {  N2 w. c& `
  81. % H; U8 y; Y  P6 u
  82. module_param(acnt, int, S_IRUGO);
    : s5 n0 j* M* W& `
  83. module_param(bcnt, int, S_IRUGO);
    2 q3 }$ H& n; k: U) `$ ?# r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# i& a- I" u9 n9 q; a
- g3 |& B) p# X$ |/ |: h' U) d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 p( j1 ]: N" O2 n+ D/ barm-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 C0 q9 ^1 v, Z: c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, r$ M8 H2 }' O2 ?4 x

) c+ f, G( L5 i6 _' \% j1 Q$ M: C6 h* P! C9 c# r5 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-23 21:49 , Processed in 0.039483 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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