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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ ]5 E6 w% p2 U
  1. [code]EDMA sample test application
    : `( t/ o( y! n/ Y" B( G
  2. /*
    % S3 [& U6 o% c0 h& O, \2 X
  3. * edma_test.c
    * [9 J9 m( t$ G) ?
  4. *. b: n; d6 E( ]' n% d4 Q4 T
  5. * brief  EDMA3 Test Application) C, ]0 l! Q$ H
  6. *, o% k9 X$ O* }4 _! W8 i2 P+ U. y. q
  7. *   This file contains EDMA3 Test code.. z2 ?' V2 h8 \* j2 v
  8. *
    + n! v  r' B! `5 C# X) _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ m9 l6 J8 \1 J6 h; V9 W; C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " E/ C- z. p  D0 Q3 O
  11. *         TO CHANGE.- I/ w9 A9 f8 q* x; r
  12. *
    + ~/ t! O  v& p; ?' `7 J0 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! c/ s" M* I0 Y- |* |* k
  14. *
    $ e2 \9 |% J4 I
  15. * This program is free software; you can redistribute it and/or6 a$ e" V$ M4 X( d" {  ?4 I' a
  16. * modify it under the terms of the GNU General Public License as
    ! [$ G) [5 X& K7 b
  17. * published by the Free Software Foundation version 2.
    ; O5 k- k0 ?4 |, _" x' T' e$ g/ P. e
  18. *: m9 o' H! M/ X* q' Y1 \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 z" z" g- n" b4 E& X
  20. * kind, whether express or implied; without even the implied warranty( [7 t+ K2 Y; J0 g/ `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 d" t3 Y0 J( B' c8 R' C$ K1 V2 H1 |
  22. * GNU General Public License for more details.
    - U, e6 l, L' \0 z$ y% j
  23. */
    - @& }/ s# D# T
  24. 1 u0 \. d! D/ F! a& ]
  25. #include <linux/module.h>
    : {. F( h( l7 R" _
  26. #include <linux/init.h>% E7 Q; N4 ~! h4 c; J( i" E
  27. #include <linux/errno.h>. V; O- b* T) Z7 h% I% Y
  28. #include <linux/types.h>
    % U3 L; Y2 u2 v0 [. w
  29. #include <linux/interrupt.h>
      k# ]. z0 _0 k/ j( o4 s
  30. #include <asm/io.h>
    4 U9 L3 t7 d$ k2 g% k) O6 ?+ R
  31. #include <linux/moduleparam.h>! m- @$ P  \$ V- n& {# F2 X+ n0 A. |
  32. #include <linux/sysctl.h>) i# ^" [# G  D7 T9 s8 L0 A
  33. #include <linux/mm.h>" B3 S/ w" G- f) _3 d
  34. #include <linux/dma-mapping.h># w: P' K: Y* X
  35. ) b1 W: k6 B9 D4 f, h
  36. #include <mach/memory.h>
    : B9 f7 ]8 k( N1 `& X6 f
  37. #include <mach/hardware.h>
      r& M* h, X: Y/ }$ n  M* s
  38. #include <mach/irqs.h>5 V1 f  ?' T3 ]# w6 O* U
  39. #include <asm/hardware/edma.h>
    , J. Y3 V2 l1 u, C+ \

  40. . n( {7 \2 z! O) d
  41. #undef EDMA3_DEBUG8 _: r. E$ c$ G8 I4 u/ J; q
  42. /*#define EDMA3_DEBUG*/$ O2 ~9 \% x% i9 P& g! n1 O
  43. & ~! z3 u4 x* X9 T, @
  44. #ifdef EDMA3_DEBUG  i; T% N6 B0 q1 i# U% p' W2 Q& l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . O' h; k  u  O0 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; N. A' g; |5 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 K9 M9 D, p0 J/ j6 s& V# D. ?" Y
  48. #else+ U3 N( P( q! n
  49. #define DMA_PRINTK( x... )# @! l( {! r$ ?. f- c: A
  50. #define DMA_FN_IN. d) ~, ]' \7 H9 [' V9 E
  51. #define DMA_FN_OUT
    * y$ O! I) b2 b
  52. #endif
    5 n& i& G  g* `) T$ n5 Z# }: e
  53. 3 q' n6 B2 F, g2 U1 u' U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ M; f# I' i9 n/ x
  55. #define STATIC_SHIFT                3
    , z" t5 `$ ?! d$ P7 l4 v
  56. #define TCINTEN_SHIFT               20+ Z* d  w. u8 g' h* d
  57. #define ITCINTEN_SHIFT              21
    " S" G: h6 s. b+ Y& @! y( `0 y
  58. #define TCCHEN_SHIFT                229 b# ?, v4 r6 v$ C6 L) j3 t
  59. #define ITCCHEN_SHIFT               23
    : @% Y9 b& J3 u) M
  60. $ @5 K, }% O; C6 j3 h
  61. static volatile int irqraised1 = 0;
    ) H9 o* e. E* e. D, G- V4 C
  62. static volatile int irqraised2 = 0;
    8 o% c% y$ z& s$ ]
  63. ; w3 @  r: t: ?' v/ \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) l5 _8 o% Y$ W1 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ?5 X* o  M- _+ I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' T0 P: |/ W$ x0 W8 R: d
  67. 3 H7 a% Z7 K# \( h6 Z6 ~! K1 ^
  68. dma_addr_t dmaphyssrc1 = 0;
    4 \. e. O" ]4 v1 t# Z  B9 m  M
  69. dma_addr_t dmaphyssrc2 = 0;
    : I1 P1 S, I  g1 j0 i
  70. dma_addr_t dmaphysdest1 = 0;7 `. O* Z% s4 ]" s5 W5 M. `7 ]
  71. dma_addr_t dmaphysdest2 = 0;
    1 ^! j3 k1 q( e4 U" ^1 J* O* ~# U

  72. 0 J) W6 B% B7 X. ]
  73. char *dmabufsrc1 = NULL;5 y2 x0 M+ G! ^/ s8 @5 g& L6 t& |
  74. char *dmabufsrc2 = NULL;5 X, U# m/ m' {4 N. H
  75. char *dmabufdest1 = NULL;+ B7 ~" n" J8 }' e2 J# {1 h
  76. char *dmabufdest2 = NULL;5 z5 L! G) P8 j( g+ C: N0 Q

  77. $ a  a& a/ Y" M
  78. static int acnt = 512;' U2 Q. k. b- U; U& \
  79. static int bcnt = 8;7 A+ [8 j+ e7 o
  80. static int ccnt = 8;* Q& y( a: Y! G

  81. 0 N  a2 I2 Y& \- N
  82. module_param(acnt, int, S_IRUGO);
    9 w2 `/ S1 `1 y/ N5 K9 _/ n" D
  83. module_param(bcnt, int, S_IRUGO);
    9 J! r) k9 Z7 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% [* \+ p- p5 ]! e, e& V. `( ~

3 m- ?4 c6 a* ]& D1 {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; T8 Z* J2 G2 l# Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 Y; C! O" U  r( |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) w8 z" n3 n1 ]3 U3 y: p
; o% d+ V: P2 ~0 S* \) i3 p* K
7 t1 ]8 ], L  k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 20:59 , Processed in 0.040748 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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