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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 @; \0 ?4 [. l7 h1 B
  1. [code]EDMA sample test application
    / A; R5 g9 ]+ ~, f0 v& l2 ~
  2. /*
    : K, _- s6 c2 K4 W! W  e
  3. * edma_test.c
    & W* a# A& D: O& [; m$ z
  4. *
    3 K8 I4 e! x5 r" f1 J; G, q* b5 w
  5. * brief  EDMA3 Test Application
    / v2 c4 ]0 m# n
  6. *
    0 K4 w- ]5 U: u. i' e
  7. *   This file contains EDMA3 Test code.
    + g1 a! a+ }: D, t  i  X+ W
  8. *
    1 k  \7 ~* I+ m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 j9 b3 O2 x* T. ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 P, K  Z* s7 f: r
  11. *         TO CHANGE.
    5 V: z9 H4 c! `( T! G; Y
  12. *
    * s" s5 G8 p9 C7 J) I6 F9 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 O9 J7 e' s) ]! l1 y
  14. *
    " s. \; K( w7 I2 j) z* k6 q
  15. * This program is free software; you can redistribute it and/or' ]3 b1 d. ]/ o1 H
  16. * modify it under the terms of the GNU General Public License as3 k4 N2 ~4 `2 X# t/ U9 a6 _) C' x0 ~
  17. * published by the Free Software Foundation version 2.
    ' Z/ c( X: [6 ^+ ?) W4 K
  18. *
    : g" F7 C# p3 x1 \4 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & Y; S# z0 Z$ q4 J, k; _) \% D
  20. * kind, whether express or implied; without even the implied warranty
    ( n5 `& W) W0 l: j9 }7 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / ?# l4 ~. l+ G, w4 g$ F4 U3 r
  22. * GNU General Public License for more details.
    ) C" j$ K8 H8 l. b& S3 T
  23. */
    ; B; j1 A8 l2 G. P4 \
  24. 4 A; k* S* N6 A% C5 ~4 ]* `8 A* P/ c
  25. #include <linux/module.h>
    / ]" @8 I3 x0 F  w  F4 \
  26. #include <linux/init.h>
    3 v# X3 [8 O+ t! Z8 E
  27. #include <linux/errno.h>0 J+ |( V! s1 B: e4 Q
  28. #include <linux/types.h>
    # u7 S0 @# n% d" l, g9 ~
  29. #include <linux/interrupt.h>" D" y9 f8 B, l) {% k- s. _
  30. #include <asm/io.h>" l" Y5 A" V4 D
  31. #include <linux/moduleparam.h>
    5 y. ?4 E5 A3 `: I9 R
  32. #include <linux/sysctl.h>/ k! E; R/ R# K4 Z+ @  l5 ]
  33. #include <linux/mm.h>
    " L& m+ d( j5 w2 N# S
  34. #include <linux/dma-mapping.h>1 z: p* I; I  g# i" C; \* s
  35. ! J8 V# Q; e& p) M$ y6 H3 W
  36. #include <mach/memory.h>
    8 u- A" F" K0 B( b' E; ~- A4 S& B4 N
  37. #include <mach/hardware.h>! M$ V+ `- d, f8 V! b
  38. #include <mach/irqs.h>
    1 k& X* ^" i! }: D
  39. #include <asm/hardware/edma.h>' w: f& V0 `( [# d) B

  40. + A; ?+ C( y% ~8 I8 G" M  z
  41. #undef EDMA3_DEBUG
      H3 @! i6 A3 M
  42. /*#define EDMA3_DEBUG*/
    " x. e% n; z( Z, t" Y+ f6 D

  43. / R9 f% Y& B' P0 D7 _' V) l
  44. #ifdef EDMA3_DEBUG
    " ?) T5 n9 o( S1 r5 R# [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * ]2 _* U0 p2 [/ n$ ~$ b' Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). }0 u4 B$ Q' g' _  W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 y& C6 g: K- _  p0 r4 h$ V/ c
  48. #else( U0 k6 M* [8 c0 a
  49. #define DMA_PRINTK( x... )$ q3 E! V2 V2 L+ _. h
  50. #define DMA_FN_IN
    $ I- h4 B9 O  B2 X1 a
  51. #define DMA_FN_OUT
    4 z) [4 {1 n/ N) }
  52. #endif7 |! [) U1 U1 k

  53. # T7 e8 ]8 a7 \# I: _! R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 {+ k1 c, {3 q- M: W
  55. #define STATIC_SHIFT                3
    ; X+ p; v- p0 ~+ F) w
  56. #define TCINTEN_SHIFT               20
    8 z3 j5 H2 Y0 {6 b4 w8 h' P
  57. #define ITCINTEN_SHIFT              216 T: f% m, F, F" Y* c
  58. #define TCCHEN_SHIFT                22% ?1 G# N# H, n
  59. #define ITCCHEN_SHIFT               23
    & {6 h# t, s! K9 e
  60. . w4 A8 ~# L% `  C" C# J  j/ {
  61. static volatile int irqraised1 = 0;
    1 d/ D1 I5 A' |9 G( M6 B/ q
  62. static volatile int irqraised2 = 0;' L! \* K: R7 A+ B, R1 a4 I  p
  63. 4 `! q9 z; D. F% Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - j" @* x: G0 ]; W6 S2 R/ g- m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 ?' T8 {- ^# {9 A" f3 j& \6 d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 C# H3 v' s' l9 @1 X- @1 ]
  67. & A* k5 c& J6 v$ S8 o# V* O
  68. dma_addr_t dmaphyssrc1 = 0;! M/ ?6 W6 G# f; C- o5 G) d
  69. dma_addr_t dmaphyssrc2 = 0;! a4 J* d3 Y% U- i: l. M: e5 ^
  70. dma_addr_t dmaphysdest1 = 0;
    . j9 k, j: L3 i
  71. dma_addr_t dmaphysdest2 = 0;' F% G5 z" H* M7 n6 j+ F$ o

  72. , s. W: N' l) C6 T7 R3 Q
  73. char *dmabufsrc1 = NULL;
    / h9 \/ Y+ k0 F7 g0 k
  74. char *dmabufsrc2 = NULL;
    ; J7 N6 j- L/ t4 b9 N
  75. char *dmabufdest1 = NULL;
    : n) g, N, g0 k+ U! s: R& l8 \
  76. char *dmabufdest2 = NULL;8 A) p- l8 V' V' ^8 q: X

  77. ; e6 C2 N# Q* @" u( S
  78. static int acnt = 512;
    4 \# X- I5 S- R& H4 M: ^
  79. static int bcnt = 8;1 l) G/ y3 u# _
  80. static int ccnt = 8;
    / B3 ^8 Q6 C! i0 z
  81. ' w$ T1 h! \9 b' D/ z* ?
  82. module_param(acnt, int, S_IRUGO);! `6 A) Z7 C8 ]! H. S& }
  83. module_param(bcnt, int, S_IRUGO);
    7 D8 S) t: R; \% G% q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 |$ C8 w! Q8 e- v, A! K

  o8 @6 Y& `- k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ V5 M( z5 q2 uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! x& A6 X) G6 }8 C$ e1 Q( M$ B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 B! D8 L: y; G# T: G
, x8 F' W3 _: l. o1 c! v' G" x
9 I+ Z) g; t$ }4 C5 |4 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-13 23:28 , Processed in 0.042520 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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