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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; J1 P6 B  k0 E; n$ }# p+ y
  1. [code]EDMA sample test application
    3 g' s3 U+ U7 G: \3 u
  2. /*
    ; p+ {* z$ M% L
  3. * edma_test.c
    # J% W, T6 @' l" W" N) g4 z
  4. *$ D( Y* n0 v  ?/ S6 d
  5. * brief  EDMA3 Test Application
    4 G3 S; W" b9 `+ y2 ~( j; S$ U
  6. *
    ) H: r. h  [' i3 i5 Q
  7. *   This file contains EDMA3 Test code.3 _7 V* u) k8 e- x5 f: @
  8. *
    $ y% Y+ Y. b! Q$ _0 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) A2 K$ C9 o* E( A& a6 x# m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( ?  [: r! ~; z6 C; c6 N! j$ L
  11. *         TO CHANGE.
    0 I7 ~. e% y3 Z0 ^3 p; S- x
  12. *
    4 U+ [+ v3 ?7 w# J# y6 p( F& q$ q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 w# t: s7 T! q2 \; |
  14. ** C) t! ]. U6 `- j* @
  15. * This program is free software; you can redistribute it and/or8 u! _! H: U; y/ p, U+ x, _' a
  16. * modify it under the terms of the GNU General Public License as
    # N7 j( c0 P* [8 T0 a$ X* O
  17. * published by the Free Software Foundation version 2.
    3 b, E8 F, i. O& [6 j7 d5 r
  18. *! }" \% E+ H+ l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 p8 D) h1 Y( [% ?: }
  20. * kind, whether express or implied; without even the implied warranty. H6 f; t, S, G7 |7 n/ o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 S! f: Z$ C) _% y, P5 [
  22. * GNU General Public License for more details.
    ! s, X0 O- {* [# K) H
  23. */# w5 U; t; Q7 }' L3 v* M

  24. 5 P" a. w+ E& k/ @7 W% ^: p
  25. #include <linux/module.h>+ Q6 g! f( m7 n  d  v
  26. #include <linux/init.h>
    8 e' r* b2 Q' @. N+ h
  27. #include <linux/errno.h>: M- z/ r& [3 H& b) W& Z
  28. #include <linux/types.h>
    / |/ Z3 ]5 D! g% ?3 c- `' D
  29. #include <linux/interrupt.h>
    " ~& H5 v( J7 W
  30. #include <asm/io.h>& C$ `5 ]/ L3 s" i8 o
  31. #include <linux/moduleparam.h>. F- p6 X. k% N* X+ R5 ^
  32. #include <linux/sysctl.h>& x6 d4 n+ A' }# R0 h9 b
  33. #include <linux/mm.h>& z: P( x5 U3 B! Z! W+ k
  34. #include <linux/dma-mapping.h>
    5 v# `1 O: G2 w: a7 m2 [8 `8 _
  35. $ n  e) t) e- @7 t* [" G$ L4 K* f
  36. #include <mach/memory.h>  M8 z( r7 y  J+ {' [0 p1 W
  37. #include <mach/hardware.h>
      \3 H/ ]6 V) u1 L; {
  38. #include <mach/irqs.h>1 _+ E* @$ Y2 y$ |7 Y) M0 L. [
  39. #include <asm/hardware/edma.h>
    ; k+ h1 q. }6 n) L7 G

  40. 2 g7 w. l7 u6 [0 P
  41. #undef EDMA3_DEBUG+ y0 D: J  B2 k, y( m* W( j4 r' z
  42. /*#define EDMA3_DEBUG*/8 n  M; }/ O+ l  ?2 N

  43. & H+ \8 T- m& |. ^% |7 C, s" u
  44. #ifdef EDMA3_DEBUG! K2 o. |" [3 t0 a1 i3 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) ~5 O& c4 B0 K! H" n" Q, u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 ?7 T+ w. ~. y7 Q! @4 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 j, N/ p1 v3 I4 J; b5 H
  48. #else
    + q& w( ]* O5 ?% a  ?9 _9 v9 f" h
  49. #define DMA_PRINTK( x... )  u: Z9 w9 v4 j: J& ?! ^
  50. #define DMA_FN_IN
    ( p3 X" I, P* E0 L- b& q" U
  51. #define DMA_FN_OUT; _3 X5 W* T, v2 n- |1 u6 b
  52. #endif+ c6 Z! X! L3 {/ [- ]$ t; e8 \
  53. * D* c* ]5 }/ q' G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 X( ~9 d7 R. d; ~6 e& \: {# W7 _! x* H' r
  55. #define STATIC_SHIFT                3
    8 l, d7 s4 v3 `9 y3 ~
  56. #define TCINTEN_SHIFT               20) }. r8 j/ |" {+ S8 d
  57. #define ITCINTEN_SHIFT              21( E4 ^; z' e& W2 i7 H+ ?, ?
  58. #define TCCHEN_SHIFT                22  F% {" I' X9 Y2 W8 y
  59. #define ITCCHEN_SHIFT               23
    6 X9 |; S* G: U% J. |6 x
  60. 8 E8 \; C4 x- J/ R
  61. static volatile int irqraised1 = 0;
    ( U' f. v1 _4 ~9 x
  62. static volatile int irqraised2 = 0;2 m2 P& U: E( {% e( W2 T1 [
  63. 5 }# X" `5 H* |* S  {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  j+ k0 q- i5 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 f4 n" W6 R$ p7 l  J! {; Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . T* L5 o- Y; n' g9 E

  67. / ?" j2 {1 `9 R" X# x
  68. dma_addr_t dmaphyssrc1 = 0;: T( b: Y/ w1 O. a* a8 ]& `
  69. dma_addr_t dmaphyssrc2 = 0;
    0 m/ r5 y, t9 \; U% v+ l: w
  70. dma_addr_t dmaphysdest1 = 0;& V; e! X3 R  h6 e" B
  71. dma_addr_t dmaphysdest2 = 0;
    4 L5 K3 Z- `" |
  72. # N8 M5 c6 x( p2 Z" r9 h7 `/ p
  73. char *dmabufsrc1 = NULL;
    3 ?" j& {1 F& F& E- c) A
  74. char *dmabufsrc2 = NULL;. D# k; S9 P$ H, e
  75. char *dmabufdest1 = NULL;# r8 O+ v0 l9 R2 R  g
  76. char *dmabufdest2 = NULL;% [. A& G* d. ^) C+ [7 _# `1 K
  77. 2 D  _$ j5 q; c# w
  78. static int acnt = 512;
    8 K2 F9 x6 l* v" R3 M1 z: _( I/ f
  79. static int bcnt = 8;
    3 B$ H( A* |6 J: E6 W( E
  80. static int ccnt = 8;
    ' h' |1 Z+ X1 t, }- d* p# d' i

  81. ) w1 f# _$ ]$ T6 z, @
  82. module_param(acnt, int, S_IRUGO);
    2 W! g  ~3 a: B7 u; R' l  N2 o6 q6 |, w
  83. module_param(bcnt, int, S_IRUGO);
    ! T( K! J9 T6 h1 f* G, B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( C' T0 I+ K( x9 R
1 u7 D9 Y5 N# u& K* j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ D3 f$ _$ m8 F# x% ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  ^2 S( v/ X% X- x0 ^$ I6 ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- U# V2 L: F+ X0 q' g; N) F
4 S. [4 n/ b, W+ w7 Z

& ~' q) n( J0 s7 O  r) I& I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 13:12 , Processed in 0.039953 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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