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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  B% l7 k4 y$ P- o
  1. [code]EDMA sample test application
    $ h; x5 z& W) Q
  2. /*
    : m* g& `% q# _( d' Z
  3. * edma_test.c
    . c1 m0 q$ {( K& I3 V9 m
  4. *' C0 a7 s: w* M0 Y) [0 r) L
  5. * brief  EDMA3 Test Application
    $ y3 ]. S3 ?3 a2 `0 g
  6. *' I/ T/ Y9 z3 K4 n6 h
  7. *   This file contains EDMA3 Test code.
    ) j. X. F$ {6 ]" u( a
  8. *4 G3 e1 N" a7 g# v4 n6 V, C( Z! ?! f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / A, f* L1 ^7 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" o  N) s( h' ^) U; V
  11. *         TO CHANGE.
    : P/ i  x( g& o5 f. w# I8 ?
  12. *
    3 V: t: v$ B/ F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : E4 i1 V- y" \) m: _. b& G4 y  z
  14. *1 R/ e8 A1 n  v1 H) w' O& A
  15. * This program is free software; you can redistribute it and/or& F- I6 M6 {/ l6 j2 M
  16. * modify it under the terms of the GNU General Public License as) T9 M. l' P2 W4 ~3 u" d% P" {" |5 }
  17. * published by the Free Software Foundation version 2.
    & o' Y/ K8 z' l, L/ o
  18. *. Q8 i  Y3 s5 M, _* c0 ~3 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - F! p1 l' O% c# Y& z
  20. * kind, whether express or implied; without even the implied warranty: y* n( k) Y/ c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 t9 j& i) j# r7 }; a
  22. * GNU General Public License for more details.
    ! S) q/ \( G; M9 ^' b3 x; g6 n
  23. */8 \$ a* ]! ?7 [2 E5 m

  24.   l' L: K+ @* }3 {! }5 v3 c2 R9 f
  25. #include <linux/module.h>9 k, L' W2 X6 Z1 c3 s
  26. #include <linux/init.h>
    ( n# V+ R% J! x/ v/ W6 i
  27. #include <linux/errno.h>
    ; y  x0 i/ u1 l2 v; ^/ r/ p" v
  28. #include <linux/types.h>0 ^- j+ x. n9 U  G
  29. #include <linux/interrupt.h>  d, D  z' x3 [% r9 h1 o; {. d1 y
  30. #include <asm/io.h>) e9 ]& S) j: t
  31. #include <linux/moduleparam.h>
    ( w2 J* U( t1 ~7 z- p3 ]# ?- a) Y
  32. #include <linux/sysctl.h>
    % j! X; `' i! ~5 {9 i/ k
  33. #include <linux/mm.h>
    - z, N; `" h8 u% p! }
  34. #include <linux/dma-mapping.h>" `, J0 Y* V/ H) l3 J+ V+ P

  35. 0 M, \; F5 J6 @5 H- L( ~
  36. #include <mach/memory.h>
    9 [# T8 ~8 f6 j- ]( g" o
  37. #include <mach/hardware.h># Y- M) G( E$ m& E
  38. #include <mach/irqs.h>9 t# \! M- D1 b' \5 s
  39. #include <asm/hardware/edma.h>8 \# e1 s3 y8 v  O0 a

  40. ( K8 c# m( P0 m! a6 c+ f/ C
  41. #undef EDMA3_DEBUG  z! e* q  R- t: L: @
  42. /*#define EDMA3_DEBUG*/* E! S" f1 ]( |$ R0 @$ f
  43. " M, k& K0 |1 y& ]+ D) L: H, [3 b
  44. #ifdef EDMA3_DEBUG
    7 g5 ?. C4 M5 ]: ]2 k8 l, P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 v$ X# S( c5 \4 w+ \3 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 V/ |. o/ m  t+ \3 ?+ A7 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " ?$ g$ m' ]% ?/ s6 T" P7 E
  48. #else
      ~# r6 T8 O& N5 U7 E( X
  49. #define DMA_PRINTK( x... ): x. e9 s' D8 I0 d8 K3 }
  50. #define DMA_FN_IN
    . A6 Y! I0 X. ^9 C! Z4 u0 S
  51. #define DMA_FN_OUT
    6 l7 s6 M- ^/ C* b# H' |
  52. #endif
    2 C, l( ]9 u  k: ~/ V

  53. 9 ]5 {- N: Z$ v7 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + I$ v5 [/ y4 a5 b5 S* O' I
  55. #define STATIC_SHIFT                3
    ; Q2 G9 b! D3 g4 w
  56. #define TCINTEN_SHIFT               20
    1 v+ B; G- Y8 S& S1 ?3 N) h$ ~
  57. #define ITCINTEN_SHIFT              219 r7 G8 I; @3 U. f( Z# `
  58. #define TCCHEN_SHIFT                22
    1 ^7 w4 t9 m% |) \6 j1 @9 `
  59. #define ITCCHEN_SHIFT               23* i9 _0 f/ T# y+ s" a- i
  60. 7 A. i" D/ |: `
  61. static volatile int irqraised1 = 0;$ A# ~1 U8 {3 M- a- P# T0 A# u9 A& M1 x
  62. static volatile int irqraised2 = 0;- U. K% j9 y" s% t+ o$ k

  63. ; n3 J2 |' Y/ _5 G9 F4 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ]3 W1 K% c# ?- n6 P1 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. r" D6 l8 s/ [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 p9 p$ ]4 E* @+ p6 g9 [8 [

  67. " x8 Q& C3 O2 q0 X) H
  68. dma_addr_t dmaphyssrc1 = 0;7 o1 H  c: b3 U5 _' o
  69. dma_addr_t dmaphyssrc2 = 0;
    . s& r' ~! v1 [' u/ ~0 w
  70. dma_addr_t dmaphysdest1 = 0;: p+ B5 I  B% p, G( g
  71. dma_addr_t dmaphysdest2 = 0;  Q: k3 l2 ^# [: [  t2 y# c

  72. ( B. b; ~7 A1 Y/ I( A3 c3 R9 y
  73. char *dmabufsrc1 = NULL;' D9 ]0 E3 s( J& b
  74. char *dmabufsrc2 = NULL;( M0 o( s6 y- \( [# N8 Y. [1 b
  75. char *dmabufdest1 = NULL;
    $ M! Z, R. \$ m3 i1 \  ?
  76. char *dmabufdest2 = NULL;2 f( i' K+ q$ ?
  77. 2 m: S* U" \. N5 f# {$ ^8 Y
  78. static int acnt = 512;
    4 Y* J& a+ e/ q! k; |' s
  79. static int bcnt = 8;
    9 S+ T, |, \# m1 A
  80. static int ccnt = 8;+ W" _: J; m) O' Y( W# p

  81. # C. r% ^/ i) Z6 m7 c
  82. module_param(acnt, int, S_IRUGO);5 k! }# d3 n% @/ i' I
  83. module_param(bcnt, int, S_IRUGO);3 b& l! b* P2 {/ J% f# O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. w. ]& Q+ C% B* J
5 o" y4 K$ ]. E# j  m1 g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* T6 t: s: O+ `3 K. V5 e3 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; w/ U6 U7 s$ C/ U: K! P3 }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# _  u; Q' g/ s% K8 i3 C

$ L/ y4 M8 Q, [, x3 A- y
) }2 b8 c) b8 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 10:49 , Processed in 0.036847 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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