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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% f' Y) V: Q3 ?1 I; T
  1. [code]EDMA sample test application
    " w2 y7 y# O; c/ ~4 u2 W
  2. /*" \/ J- Q4 X$ t/ B% [& l! o9 y* u4 m9 a
  3. * edma_test.c" Q7 I0 h0 u& q# S0 ?% i9 v
  4. *) C) V, L& ^1 A) z, N! x
  5. * brief  EDMA3 Test Application) D% `$ X% O' W) |, d
  6. *
    : C! h# n; o8 }5 J$ [' \' a
  7. *   This file contains EDMA3 Test code.! K8 l* t* M. a: M2 M( i7 e! r
  8. *
    5 A- o! T4 m2 f; Q9 C6 w; m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 H! }. k* C  w! _* u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, s6 H1 d7 b4 {+ N) o4 u0 c1 u6 f& b
  11. *         TO CHANGE.1 }/ H, \0 Z. S+ D* z3 G
  12. *
    , ?/ ?8 U! m! ]1 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// ~/ M" n: t9 x9 R/ W
  14. *8 L$ c# k7 U) o5 t8 k, z  N
  15. * This program is free software; you can redistribute it and/or
    9 N, B2 C  b" s8 g* o
  16. * modify it under the terms of the GNU General Public License as( j# z" d& Q( O
  17. * published by the Free Software Foundation version 2.6 d7 b' K& w, t/ ^
  18. *
    7 i  `" c7 C/ F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% m. m$ V6 o; e- Y
  20. * kind, whether express or implied; without even the implied warranty  A6 ]. @  w6 e% t; B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ e8 \# F  ^( }; u% C3 l. a- j3 W6 n
  22. * GNU General Public License for more details.% W" t# H+ c& |
  23. */
      H/ O- o0 e# a, O) O* f' y
  24. 3 |* m+ K2 c% W) i% ]! G* y
  25. #include <linux/module.h>
    ; E2 }  j: h+ g
  26. #include <linux/init.h>* {7 N7 y  [# t* u9 c$ e
  27. #include <linux/errno.h>1 c/ F& J& [4 Y
  28. #include <linux/types.h>
    5 \* p% j4 c/ @
  29. #include <linux/interrupt.h>% @; q0 M4 U. b  i
  30. #include <asm/io.h>
      T/ T5 q9 A* W. d5 {% [
  31. #include <linux/moduleparam.h>
    8 I8 \3 R4 a! X
  32. #include <linux/sysctl.h>
    5 ~% q4 \# v# x& `- l5 r" c! C
  33. #include <linux/mm.h>
    ! k6 d4 z; D+ ]  s: A/ V
  34. #include <linux/dma-mapping.h>6 o8 h# m# {6 ]: K/ p
  35. 6 T( j4 d/ i0 X4 p, h
  36. #include <mach/memory.h>  a+ w- Q* G% ]6 m5 G" h2 |" u1 q% L
  37. #include <mach/hardware.h>; L7 F  s- H" l7 e5 S
  38. #include <mach/irqs.h>
      b9 p' a* F$ ?- U% E
  39. #include <asm/hardware/edma.h>
    . U2 u4 r- ?- I* W; n- P: t% y
  40. 0 G( ?. |# \  T6 z5 @! w
  41. #undef EDMA3_DEBUG7 u" B7 L! M. k6 u; `6 ^: c
  42. /*#define EDMA3_DEBUG*/
    4 m* E! \! o/ K
  43. 7 ]7 M8 r* S, x- c
  44. #ifdef EDMA3_DEBUG
    7 s" s7 g; o* Q/ G: ?% k* ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 _8 |' R4 F, o- d) A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : q5 E2 b/ u* ^# `9 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * N. W8 f1 u8 c
  48. #else
    & V/ F6 k/ h5 F; i. V1 M- i) W9 A! Y
  49. #define DMA_PRINTK( x... )
    ; a, x  ?) Z6 d4 _7 h* r
  50. #define DMA_FN_IN" J3 _. o; G) V
  51. #define DMA_FN_OUT# V) A5 L) ^/ b
  52. #endif
    . G$ F: \) c8 C/ {

  53. - u& _0 G6 M& E* {% D/ \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 d0 S9 V+ ~3 {, _. c
  55. #define STATIC_SHIFT                3* A  i, h) q( W1 k
  56. #define TCINTEN_SHIFT               201 `  H; ^7 R6 N  `. S- \% Y, Q
  57. #define ITCINTEN_SHIFT              21
    0 T7 A* r4 o2 l5 q
  58. #define TCCHEN_SHIFT                22# T/ P, u" ?/ R
  59. #define ITCCHEN_SHIFT               23
    ; H* q0 n# [; A; f8 r

  60. - [# s8 P7 K0 J: d
  61. static volatile int irqraised1 = 0;) d3 B, \* W* P; l
  62. static volatile int irqraised2 = 0;4 k6 B4 U. T0 r2 ?  t

  63. 2 N% g. Q* |+ A: W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + T, ~* ~6 r+ r7 m* H% V# Q' ^0 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 Q& i  p( x5 H0 o- A7 }2 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      d+ m3 c  P( n5 y- Z0 B
  67. 1 w6 N" A  j% o
  68. dma_addr_t dmaphyssrc1 = 0;" D# D  K& N1 H6 D& q
  69. dma_addr_t dmaphyssrc2 = 0;
    " ^* J, X' l: B
  70. dma_addr_t dmaphysdest1 = 0;
    ) e; @8 l* E6 g: s- z% R- B0 U% S
  71. dma_addr_t dmaphysdest2 = 0;
    / p. p  N  y9 I( f6 b0 l

  72. 2 p' C% A  \2 B0 n3 |
  73. char *dmabufsrc1 = NULL;, _7 V9 A$ d) e8 g& q4 M
  74. char *dmabufsrc2 = NULL;
    + A7 e$ W/ _; R: [' u6 _3 q
  75. char *dmabufdest1 = NULL;& \$ h" c: \$ g2 ], t
  76. char *dmabufdest2 = NULL;4 o5 j8 m1 ~# K( K! V% Y

  77. + D% S9 G- G" W$ u" K- t. t5 Y
  78. static int acnt = 512;
    + T0 O7 f! L4 j8 d  Q
  79. static int bcnt = 8;
    ! }$ n  I; n; F
  80. static int ccnt = 8;; l+ w8 R6 t7 O0 x7 o$ t
  81. 3 h$ e8 s, l% g3 [! [
  82. module_param(acnt, int, S_IRUGO);
    " B$ `; d0 H; h, i
  83. module_param(bcnt, int, S_IRUGO);
    " Z' G; f; ]3 x; B7 B; J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* h4 ?; j- j8 ^( b, o
, u# ?) E6 y: U9 G5 s1 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 H2 @+ O0 u! Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 ]1 p$ Y1 a) x' k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 @4 U2 {* h& s7 \. b9 e
! w2 h: a; A7 A# z7 d4 f2 @

6 r5 a9 A! M( U3 a) D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 22:19 , Processed in 0.038855 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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