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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) o: b. X' g; q; s
  1. [code]EDMA sample test application3 {" z$ r  d0 U$ c0 S
  2. /*
    * ?# K2 N6 a3 A. L, F/ g
  3. * edma_test.c6 O. t+ B. X4 l
  4. *
    ) n% A0 e) k; w' e9 G- @! U
  5. * brief  EDMA3 Test Application$ {8 ^* ]/ ^6 N. |2 m9 T
  6. *4 R8 g: E# {8 _# m
  7. *   This file contains EDMA3 Test code.
    7 H" T7 l! x, X, P  `% C
  8. *1 X, c% \0 ]# v* m' R7 O# P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' L- l/ H6 P8 v# M" K" c: v  H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 r/ E0 \( N9 U; z) c: R
  11. *         TO CHANGE.. Y0 T4 J2 L1 v, D8 }
  12. *  B/ K' j! x9 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) U3 p9 v4 F- L
  14. *
    " o% T- Q5 Q7 r1 R$ D  r# R
  15. * This program is free software; you can redistribute it and/or
    " d3 i+ L" C. g* l8 o
  16. * modify it under the terms of the GNU General Public License as
    : p. ]) E/ h1 D7 K  X( u, R4 L4 Z
  17. * published by the Free Software Foundation version 2.! h# B9 e% z0 b& o: F1 P& E; U
  18. *
    ( G- i& y) e2 ~5 x; P/ F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. D7 P  Z6 [. x+ S' v( L$ ]# Y
  20. * kind, whether express or implied; without even the implied warranty' u8 ]% T0 G. `" u- o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * E/ H0 F/ p/ j: G3 x' T
  22. * GNU General Public License for more details.
    3 P; K5 `( y# b! S$ v3 N
  23. */% r0 Z! o: g4 t2 F, P/ U: v. D
  24. 5 o) {: S$ |& z: \7 x5 V
  25. #include <linux/module.h>
    8 }- t. ~, K% Z) a5 M
  26. #include <linux/init.h>9 f. P$ f4 c, V1 E  A7 Q9 f5 \
  27. #include <linux/errno.h>
    & g2 \  x4 J$ q7 @' @* T
  28. #include <linux/types.h>
    3 u. ]* g7 t4 c- C8 ^. C  f  D
  29. #include <linux/interrupt.h>' q: t. ^# T8 N2 r6 v8 Z
  30. #include <asm/io.h>
    0 E2 `- \# u2 K- _, f8 @: d( `* B
  31. #include <linux/moduleparam.h>5 A" O/ y1 v* T, e
  32. #include <linux/sysctl.h>2 B( {' I+ J3 ]+ q3 @# e5 ^
  33. #include <linux/mm.h>
    ' r/ Y# u; c( Q7 C0 u
  34. #include <linux/dma-mapping.h>
    : Z" r+ {+ S! ]6 {

  35. 9 y8 J  N& k7 B. L+ S+ _5 M* m5 {6 A2 D
  36. #include <mach/memory.h>" ~. w& x6 n" Z' f9 R
  37. #include <mach/hardware.h>9 Z, b0 Q% M$ y8 n  }4 t$ N  E3 |
  38. #include <mach/irqs.h>
    % g" s5 V6 a! K- u* r
  39. #include <asm/hardware/edma.h>
    * z4 c0 C5 L; _$ G

  40. 7 F8 z) K( F0 h5 T, {0 f
  41. #undef EDMA3_DEBUG
    # P* @1 k3 c0 T# B1 ~$ d
  42. /*#define EDMA3_DEBUG*/
    - H" ?) l% q9 A1 T2 M
  43. & n. s4 O  n! T/ g% S4 X
  44. #ifdef EDMA3_DEBUG( D# c7 E' O9 k/ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 ^0 `3 U5 x9 }5 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). ]; a, k  F* @. y: f4 n! A# |1 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* X- v$ ^: w' A' ]' c9 T4 j
  48. #else1 k' M3 ^) K5 X
  49. #define DMA_PRINTK( x... )
    / N9 n' J4 ^) L/ Y/ d  V; q
  50. #define DMA_FN_IN5 l/ S. }6 b7 b0 e+ ]% c
  51. #define DMA_FN_OUT
    1 l& R) i. R" a5 |5 [
  52. #endif
    ; p6 L- H  c5 v3 ~
  53. ; i! m% X3 c9 B/ q+ y0 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% T/ I  Z9 W; V7 d2 l+ @$ M
  55. #define STATIC_SHIFT                3* Y5 _0 P6 j& C
  56. #define TCINTEN_SHIFT               20" ^) d7 G6 u7 P3 Z) Y' a/ ^
  57. #define ITCINTEN_SHIFT              21
    $ B7 B. l! |2 u2 v0 F/ y
  58. #define TCCHEN_SHIFT                220 L. p* D, U' {# _+ ~
  59. #define ITCCHEN_SHIFT               23* Q, C6 Z% N6 i3 H2 |# M' _
  60. 0 }: y( ~( A; D( n' T
  61. static volatile int irqraised1 = 0;
    ! z9 p3 E' T4 B
  62. static volatile int irqraised2 = 0;4 S' r4 R$ N8 C0 [
  63. & h7 c3 |# P' r- l1 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ n2 I; n% ~2 ^8 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ]# Z6 C. d/ q: k5 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 f4 W  B: s/ V

  67. ! A% F' G/ P1 ^, G: @5 t" h. ~
  68. dma_addr_t dmaphyssrc1 = 0;4 j+ U6 b2 \& G. ?% k
  69. dma_addr_t dmaphyssrc2 = 0;
    # i8 t" G1 W! S+ x
  70. dma_addr_t dmaphysdest1 = 0;/ u+ R' ?, Z2 o6 t( }1 o3 |
  71. dma_addr_t dmaphysdest2 = 0;
    * b2 b9 k. H5 c- U% F8 G
  72. + ^) v, s! s# w, d8 t
  73. char *dmabufsrc1 = NULL;
    , D8 o" ^2 s5 x2 g5 `
  74. char *dmabufsrc2 = NULL;
    3 Y2 T! U3 k4 s
  75. char *dmabufdest1 = NULL;
    + b4 J4 ^# z7 ^" D9 y
  76. char *dmabufdest2 = NULL;0 b+ a. d6 f0 h; y
  77. ; ^# u2 h" x6 R0 D' S* x8 k
  78. static int acnt = 512;, ]* |: c0 a* j# t# F+ g
  79. static int bcnt = 8;# z1 k6 H0 M9 m: J. x+ d
  80. static int ccnt = 8;  _9 Q  o3 ~- B, v3 s9 r2 ~
  81. 4 T, m2 ^9 v  l0 {# W3 K, q. \
  82. module_param(acnt, int, S_IRUGO);4 D7 R) N% X2 J6 |: j3 N
  83. module_param(bcnt, int, S_IRUGO);
    # D% H! b7 {6 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( p- U+ T5 _  d$ m' a. v  e
) H) K* M8 I' q5 v! G  X  _4 P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ^5 T' \5 X0 Q5 `" H. {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" \6 K8 {5 \3 \4 M, U) K& t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- g6 g+ K/ q7 P) c
+ s- X% [) i+ g* p/ t8 P% x
. N, f$ X0 R! w- k5 |1 `/ j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 11:24 , Processed in 0.040568 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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