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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) H: V4 \# g; w3 o6 q! \
  1. [code]EDMA sample test application
    % L1 ]3 P# O9 y& u$ Q
  2. /*) N% C5 ?0 X1 ], d) O$ u9 \- c, @/ i  n
  3. * edma_test.c$ R7 S, Q: r$ b, w  Q: E5 L. e
  4. *% i1 b" n" i. ~& I4 h6 K
  5. * brief  EDMA3 Test Application) U+ l- o7 c  o9 c% G7 X
  6. *
    " ?% u; [; a* M" ?, r6 A1 ^
  7. *   This file contains EDMA3 Test code.6 o- b" z0 o8 a* {2 Z2 [
  8. *: E- O$ y' k. r! F  f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : j2 c+ M. d0 S! i: y. g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" {0 J& L5 n, L/ [- @3 `& p
  11. *         TO CHANGE.  H% }5 E* c' D) q) Z$ r
  12. *$ `2 w1 |$ I/ e( X% p6 Q: j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- X' |2 N5 f+ A% D
  14. *
    / H% F; D3 c4 @! F- D3 s) |0 r
  15. * This program is free software; you can redistribute it and/or
    ' s0 r) }. ^2 K" s# I) f  b3 \
  16. * modify it under the terms of the GNU General Public License as. x! R9 f+ |" g+ W4 Z
  17. * published by the Free Software Foundation version 2.$ y1 j3 ?& ~" J
  18. *. h" d4 ~7 i& D0 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. m& R$ \( ?5 T7 `) ~# D2 I
  20. * kind, whether express or implied; without even the implied warranty
    9 j6 |/ b- K1 K2 W2 E+ _% d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : k& X9 v% O+ p
  22. * GNU General Public License for more details.# i1 `7 u2 H" i2 \4 l/ A2 t7 V/ w
  23. */! d* d3 T# P% t5 Z8 |+ y5 j
  24. : }0 k! d/ _7 U, x
  25. #include <linux/module.h>
    3 ]# k6 a1 A8 _8 _* b4 B6 A- T
  26. #include <linux/init.h>
    , q4 I1 p% H7 _% z+ q  i
  27. #include <linux/errno.h>
    0 t) Q2 r: o  w' f6 f9 B+ P
  28. #include <linux/types.h>* C* O+ y- j. B1 J/ c
  29. #include <linux/interrupt.h>
    0 @$ `2 Y5 x; M5 u0 _6 p
  30. #include <asm/io.h>
    ( D9 {8 P6 p$ G; ^9 ?" B! p
  31. #include <linux/moduleparam.h>/ P. E3 h, n8 A: m( e! B
  32. #include <linux/sysctl.h>
    ( B, L+ i0 P; A! u& k7 C
  33. #include <linux/mm.h>
    # b, r8 @7 V6 ~& m" E3 Y8 w
  34. #include <linux/dma-mapping.h>) T/ h! E4 y7 z% F( g) b
  35. 9 C* j' U1 e/ p$ y2 E  _
  36. #include <mach/memory.h>+ C/ m3 N. `. M8 g! v! C4 @* c
  37. #include <mach/hardware.h>; [  `6 H6 f4 N; d  L1 G0 L$ J
  38. #include <mach/irqs.h>
    % l/ x: d0 E+ H* O1 D2 h
  39. #include <asm/hardware/edma.h>
    6 O$ p, U$ `6 }# S

  40.   T/ ~& B/ h- {4 G  @
  41. #undef EDMA3_DEBUG+ j4 p# B% D, A+ [, ~; E& j% o
  42. /*#define EDMA3_DEBUG*/0 w1 ^& O1 h7 M& x! b
  43. . _- r4 ?4 v: N
  44. #ifdef EDMA3_DEBUG
    $ W0 O0 \: e5 j# Q5 n5 Q( `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# w9 X6 L* z( [; d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* k4 C5 x' i6 T1 d. R* d4 B4 e  X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) E; Z0 `2 T: I
  48. #else
    . V* f6 \" y9 {4 H! o
  49. #define DMA_PRINTK( x... )
    ( i2 n$ V! p  H  x
  50. #define DMA_FN_IN7 V9 B# Y+ Z" Z5 m: D+ G
  51. #define DMA_FN_OUT% S0 V# ~0 F4 _8 {7 w6 L
  52. #endif% N4 n5 ~3 z7 J3 @/ N
  53. 2 i( q( W7 ?, ]: S4 H8 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 ?, p. @! C% d6 m2 \" }
  55. #define STATIC_SHIFT                37 V0 Q0 x8 D* `
  56. #define TCINTEN_SHIFT               20- t1 F" }! q/ S" s& N
  57. #define ITCINTEN_SHIFT              21' A: m# T! r, X5 |
  58. #define TCCHEN_SHIFT                22: Z  |2 f, s5 {; x# X+ @+ ]0 t  @
  59. #define ITCCHEN_SHIFT               23
    ! X; S( S+ l9 a$ L9 f) z1 E: C0 t
  60. ; I' O2 v/ [7 d% l6 I' W
  61. static volatile int irqraised1 = 0;: Q  K$ `; m. G! G
  62. static volatile int irqraised2 = 0;, J: p" K) \! \0 ^
  63. % e, W" |6 F! v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 b6 A. G" E) e1 c$ B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u* A, q* j; m7 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( I7 ], i5 T1 w$ D
  67. " p6 V* Z8 \7 V& L' c+ h
  68. dma_addr_t dmaphyssrc1 = 0;6 H8 ^1 n: n- N8 I" T
  69. dma_addr_t dmaphyssrc2 = 0;
    + N! _7 v7 T3 |6 Z6 O
  70. dma_addr_t dmaphysdest1 = 0;; k! y: h' B! [/ r
  71. dma_addr_t dmaphysdest2 = 0;
    ( H6 ?6 j4 ]/ t( w
  72. 3 ?+ U% a8 ]" x. b* T1 `5 e
  73. char *dmabufsrc1 = NULL;) U) ^$ z, D+ {  n- Z
  74. char *dmabufsrc2 = NULL;0 I) C! _3 }0 p5 Y
  75. char *dmabufdest1 = NULL;
    $ O' g; B* g# m- l& M* _
  76. char *dmabufdest2 = NULL;
    - C  I' |! F9 Q1 a' w6 r$ A

  77. 2 D2 r- q8 z' O. t0 ?0 v5 f$ w
  78. static int acnt = 512;
    : P$ J" Y+ k3 p
  79. static int bcnt = 8;
    + T  b. n$ z0 @4 E2 b# e/ _; R. d
  80. static int ccnt = 8;
    - J# {" S+ \2 d9 M$ [$ e

  81. ; o6 p0 H6 ~& p6 H! Z1 k
  82. module_param(acnt, int, S_IRUGO);
    7 |8 {0 Z% L8 f' i
  83. module_param(bcnt, int, S_IRUGO);# B- M: T1 a5 e3 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 K* g4 l/ ^7 \6 m& ]. p
- U" A3 [9 m" @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) a& x9 M! u2 W9 L& U" U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' ]' `$ g3 S8 Y! H4 ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, }4 X+ t' K! b

8 W* v( B9 N& i9 V2 Y, _; R! N. K& ~4 z% m% J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 02:31 , Processed in 0.040229 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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