OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % u& A. d) v* x/ b9 x
  1. [code]EDMA sample test application
    7 n1 t% f3 Y6 [
  2. /*
    * c  Z! L3 Z7 m: Q* K
  3. * edma_test.c. B; S: Q+ q# r/ ?7 G
  4. *9 \/ w1 S& a: A/ g$ y
  5. * brief  EDMA3 Test Application* @/ k5 w* Q+ n" Z# r3 n; l- A
  6. *
    ) w6 G- J" \6 v% y
  7. *   This file contains EDMA3 Test code." p: X2 ?2 H. `! U& b% u6 x$ H
  8. *$ ?5 g6 i9 z4 G9 c* f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 m, ?: i2 q9 ^( g5 I5 |: o9 c* m& @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 G4 Z: ?0 H2 F: O1 U
  11. *         TO CHANGE.' Z5 l+ a3 B$ c5 \
  12. *- s* {0 T4 y7 d9 _+ h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 B& d1 i" A: g6 G
  14. *  v. E0 `. f* l, ~
  15. * This program is free software; you can redistribute it and/or5 t0 r. M9 l" c  D* X8 j( e
  16. * modify it under the terms of the GNU General Public License as
    ! w5 V6 h% z# \5 C6 k9 g# U- y
  17. * published by the Free Software Foundation version 2.4 j: D9 x" D$ [1 t% @- d) `
  18. *
    6 {$ F6 d+ X/ q! S- H6 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# E) }5 C$ h8 U  K* m$ d
  20. * kind, whether express or implied; without even the implied warranty
    ! Q; y( _, p% Y3 o& I- {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 [# n2 x, z' ?4 g: E# ]1 ]
  22. * GNU General Public License for more details.
    - @, V, r2 X  g1 J* m
  23. */
    7 l/ D* T4 L/ |$ O: l
  24. # @4 h  q1 s% C2 L! K
  25. #include <linux/module.h>' T2 N# x# k1 ?! K0 U% X
  26. #include <linux/init.h>
    9 N8 y2 `6 D% H# V
  27. #include <linux/errno.h>$ f+ g- I; K, a* {
  28. #include <linux/types.h>
    - r6 t4 R  G# k# G; j) P- S
  29. #include <linux/interrupt.h>
    " H% x" p( c  ~. r. X% i2 M& M
  30. #include <asm/io.h>
    ' z0 M2 O# r2 Q! ^* W
  31. #include <linux/moduleparam.h>
    # b# g. f: w  V1 I; B0 R
  32. #include <linux/sysctl.h>' p% m9 x$ @5 g8 l. Y
  33. #include <linux/mm.h>- R9 g! E5 ?3 u8 Z" F2 L6 n; p% ]
  34. #include <linux/dma-mapping.h>
    - \+ ?* E* K: j  B1 [

  35. 7 V: H* D7 s7 V3 y! J+ ?1 ]
  36. #include <mach/memory.h>
    , ]8 O3 {, l5 Z9 T6 z
  37. #include <mach/hardware.h>
    0 u1 ~# O) ]. F$ x& }0 t
  38. #include <mach/irqs.h>
    , l% G$ K7 S3 a8 l' O- [
  39. #include <asm/hardware/edma.h>% I" `7 ]6 ]. `$ f8 E- w

  40. # [% q! i! w) _& K% A
  41. #undef EDMA3_DEBUG
    7 @' o0 {# a" g2 J5 {0 g
  42. /*#define EDMA3_DEBUG*/% _4 X! R/ H+ ?5 `9 O4 k

  43. 8 i& g' M6 \$ E, ~
  44. #ifdef EDMA3_DEBUG# u5 d* a- G) y' [& N+ T; k! U0 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % [$ ^: x9 [( N% ?. B, @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ d2 G( v( ~* a. x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 V* y0 a) ^! S$ u% l
  48. #else2 o/ X, e6 v4 ?! K& I
  49. #define DMA_PRINTK( x... )
    * {, C  A, P$ s( K+ ^* V
  50. #define DMA_FN_IN8 e8 n3 x; \" d. p3 t
  51. #define DMA_FN_OUT5 O: |4 B$ J0 ~1 n! k
  52. #endif4 r$ b# o: d- N9 x8 W  K5 r% @

  53. ( C( m1 X* T# {  @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 j5 m) C0 ]$ Y4 \' _
  55. #define STATIC_SHIFT                3! i' {/ W7 s6 O. w2 V
  56. #define TCINTEN_SHIFT               20
    $ W" }$ B% b$ p# K# I! ^' t- p" A
  57. #define ITCINTEN_SHIFT              21
    $ l7 }/ f7 E" _
  58. #define TCCHEN_SHIFT                22& x! W7 F& L. i# e% i
  59. #define ITCCHEN_SHIFT               23; S9 V: r* w. o+ l" `
  60. ) c) j2 B& D% V3 k
  61. static volatile int irqraised1 = 0;
    ( r8 }* R; F, ?. v, ], {% z
  62. static volatile int irqraised2 = 0;
    - w- G; |9 f& I. }+ [$ B, m' C
  63. 0 {( G( ]# Y! T  }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : b/ u% J4 K7 h. q* w# [" p" v/ s1 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q7 E1 F0 b; Z6 J$ K9 i, W7 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * e! \. S0 d3 O: s1 u* b
  67. " O( J) o5 `8 e) ]! k4 }! @' K( T% w
  68. dma_addr_t dmaphyssrc1 = 0;# d% D8 Z. q) Y
  69. dma_addr_t dmaphyssrc2 = 0;
    0 T& b5 O5 U/ L
  70. dma_addr_t dmaphysdest1 = 0;- T8 w2 Z; c- M! i( _  S8 U  ^2 L! U
  71. dma_addr_t dmaphysdest2 = 0;+ v! B# M8 l+ ~& m9 P. z

  72. ( o% @' k+ X& z, h- ^# l' Z, ^% w
  73. char *dmabufsrc1 = NULL;
    ' M7 ?" N* Y+ Y, A% b
  74. char *dmabufsrc2 = NULL;/ G8 k/ b1 g3 p1 ^& E
  75. char *dmabufdest1 = NULL;/ _0 Q5 C! g8 z# q
  76. char *dmabufdest2 = NULL;
    : _3 p7 z" b2 Y
  77. ' L; N9 {9 P9 B
  78. static int acnt = 512;
      ?  f$ _( j* y
  79. static int bcnt = 8;
    7 ?- Z" V* @# Z* A- y, D( n0 ^
  80. static int ccnt = 8;1 d5 z/ r0 V$ k
  81. / W* Z9 d4 m3 V" l. d/ b# Q
  82. module_param(acnt, int, S_IRUGO);1 f6 C* a0 \& N1 L" c
  83. module_param(bcnt, int, S_IRUGO);
    5 t3 }' S0 u5 P7 L" \4 t8 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& g' C( z7 M. d$ O! K5 K% p5 {; R" k0 s3 X7 o7 A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' s0 G2 n% v; G" warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# w1 v  b) N7 H# I$ \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 g9 `$ W7 u5 ]* N* j: @
' x5 \* @9 b% v1 ]* z+ B. ]
0 N& {2 K; s+ L3 j* T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 09:39 , Processed in 0.041253 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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