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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 Z  d. s. n( [
  1. [code]EDMA sample test application
    1 D# g. L$ u* F/ T+ v
  2. /*
    5 x$ j% H2 }8 t5 g
  3. * edma_test.c  D5 r9 X1 d9 h2 G( y4 |
  4. *5 D& p; J* G" F6 s# `
  5. * brief  EDMA3 Test Application
    $ x6 q/ A% `, h6 Z- R0 D: r, @5 N
  6. *4 R4 I8 d6 G* d$ p4 ], j7 B
  7. *   This file contains EDMA3 Test code.
    - D- L' Y  c! M& B- u6 J
  8. *
    1 F, z$ {& t) w: Z. h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # q' {: n4 j8 v1 P% O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) ]* P* w3 T: g: v
  11. *         TO CHANGE.
    % f# i+ `: o4 f) c& A! U
  12. *$ s- [$ f2 P" i9 ?/ I/ A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 ^! r" T9 q4 B& z" y
  14. *
    2 _% ]9 i7 a& b) U' ?
  15. * This program is free software; you can redistribute it and/or  q4 W6 D) b  i( v* F
  16. * modify it under the terms of the GNU General Public License as
    6 |% [1 H, c* j/ r2 s
  17. * published by the Free Software Foundation version 2.2 H" D8 k  H+ {/ u
  18. *$ m: X* `' d6 o, y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 R$ e% P2 o% Y" F# C" O* H
  20. * kind, whether express or implied; without even the implied warranty
    ) c% F& t* W6 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) y& `* G: u1 N/ C# `3 B7 b/ C  U
  22. * GNU General Public License for more details.% t3 _$ Y1 ?1 f+ _2 j- w% ]- U
  23. */
    . o5 N) g) r% a3 k7 K

  24. - P6 T) ]  x6 ~+ a9 H4 L
  25. #include <linux/module.h>
    9 U( v; k( k: D5 j# Q, f  U) E0 j+ c
  26. #include <linux/init.h>
    * R1 r7 n7 C9 h- f$ t1 _
  27. #include <linux/errno.h>
    + o. S) O% w1 Z3 b, _" f1 \8 q
  28. #include <linux/types.h>
    # m5 r7 ?, F0 R0 Y3 [
  29. #include <linux/interrupt.h>
    * E. z5 H) K, ?' R7 @: Z
  30. #include <asm/io.h>- l" }- Y! d! Z
  31. #include <linux/moduleparam.h>
    3 Z! I+ q* [2 L; ~" F, H4 `
  32. #include <linux/sysctl.h>9 b  V$ @" P, f: {
  33. #include <linux/mm.h>
    * D1 ~5 r7 p5 G/ w% [5 ]" D
  34. #include <linux/dma-mapping.h>% M) g; X7 d# m+ X% c3 R+ m  i
  35. 6 a; u# f- q- G* X  e. X
  36. #include <mach/memory.h>. J' t, Q& w6 z5 h- ?
  37. #include <mach/hardware.h>
    . [9 h* M& h7 h( i6 x+ s+ i- z! z5 }
  38. #include <mach/irqs.h>7 d6 F( i" p$ `$ O4 ?
  39. #include <asm/hardware/edma.h>' o. t* l9 F; f, p) D3 o' A
  40. 6 r! B% h# M& \) o: v
  41. #undef EDMA3_DEBUG
    5 p$ h6 O( p) J
  42. /*#define EDMA3_DEBUG*/4 W9 z% B2 a9 _3 N
  43. + J) Z6 _7 C7 ~9 S& `& C: v/ R8 Q$ d
  44. #ifdef EDMA3_DEBUG, v1 \- b4 F) S3 e& R# @  Y$ }' l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 D! Q8 u. ^/ G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! Z0 R, C  `3 Q& I/ e) o* L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 @) C. a; J/ d' Q; j1 ^( R# B
  48. #else" i' K6 {! i/ E: |+ u8 A  b
  49. #define DMA_PRINTK( x... )
    $ N7 L2 I7 c5 p( y) \
  50. #define DMA_FN_IN
    ' |  b& t3 G# C: s' y! e
  51. #define DMA_FN_OUT1 f" F& D( e1 o6 p5 c/ d# I: Q" j4 _
  52. #endif
    ! W' @4 Y# |, o9 P

  53. ( y2 c/ l  e: T. b, c' S6 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ i/ }; D9 U" m7 L
  55. #define STATIC_SHIFT                3
    5 U- J$ j# a/ R5 d& F* s4 E3 H+ \
  56. #define TCINTEN_SHIFT               20
    . M$ C  V  d% V2 j! X% M$ D3 L- R5 I8 X
  57. #define ITCINTEN_SHIFT              216 p8 \$ Y8 V; q' l8 E
  58. #define TCCHEN_SHIFT                22
    8 D  |9 |5 K2 [( q& O
  59. #define ITCCHEN_SHIFT               23/ ~! K  g$ L8 v
  60. : s# k& n% t2 s% e* F
  61. static volatile int irqraised1 = 0;
    ; D+ ^! }  q5 h; m8 Z5 j" O8 d
  62. static volatile int irqraised2 = 0;# z8 J6 s8 p1 o9 Z7 p% }; t

  63. + z' \# k  S5 \% {. d& H! i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 S$ Z+ S2 b: `* z& C, M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # B/ I- `2 Y: y' R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# t- m! w( Z, X( Z' E- \
  67. 5 u: W, c; O2 G$ V* X
  68. dma_addr_t dmaphyssrc1 = 0;
    3 A) I% P. `6 k1 G# x
  69. dma_addr_t dmaphyssrc2 = 0;- N/ q0 m# g! O6 b7 M' W: L
  70. dma_addr_t dmaphysdest1 = 0;
    ' z7 Y! r- T7 `
  71. dma_addr_t dmaphysdest2 = 0;. ?! b" F9 s5 P. h7 G

  72. 4 K- u' L: D; X" I1 _' v
  73. char *dmabufsrc1 = NULL;
    * O* _9 n% {+ [3 i/ p
  74. char *dmabufsrc2 = NULL;4 i/ S. F( m$ i9 F' p9 F6 H4 J
  75. char *dmabufdest1 = NULL;
    4 s( C4 `2 }: L4 ]
  76. char *dmabufdest2 = NULL;
    # B6 }* r5 g8 G: ^. [8 ^+ ~& a
  77. 1 p, `1 \$ p& M' n( M) c
  78. static int acnt = 512;% g$ n" ?, u6 ~
  79. static int bcnt = 8;
    . r8 ?/ u% _# B; |3 t: ^
  80. static int ccnt = 8;" z; M% r$ ?1 h5 \) g

  81. 1 M) D" T( [3 r5 \. A
  82. module_param(acnt, int, S_IRUGO);  g( b0 T$ r, p% ?2 t
  83. module_param(bcnt, int, S_IRUGO);/ ]; u9 {& V2 R- X3 ~) ~# T6 H+ M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 ~. u+ l' H  Q/ V
' \9 s" E8 b% M' ^2 C1 B8 H, n; }3 R8 r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 ]8 d' N8 \/ x- B+ B! E/ A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* n- V7 z2 k; t8 N6 B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* p5 ?9 |8 d6 f, i
5 Z+ A# |& X; H  H# E

& p; B6 A6 w2 Q; ?$ j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 04:29 , Processed in 0.040945 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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