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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 w8 f2 K$ P1 |1 R+ i6 Z* }
  1. [code]EDMA sample test application$ `9 t# x. G1 D. l
  2. /*
    6 y$ m6 o) g: F6 T  h8 O
  3. * edma_test.c
    + d; K, J+ H  @! x; H, h9 a
  4. *
    ' X  j( g) F# V' n
  5. * brief  EDMA3 Test Application0 I. a- u! E( g3 z+ ?2 G. v
  6. *: Y7 r% ^$ X$ c. P
  7. *   This file contains EDMA3 Test code.
    ( L+ T0 {; c# k7 ~3 \) r
  8. *. m! I! J7 S) U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( o, e2 G; Q/ V& `  Z3 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) ^! Z3 E, A' O  @
  11. *         TO CHANGE.
    & ]+ [8 D  o& s$ R$ P; G  t* @9 i8 u
  12. *4 ?* ^7 `) s+ ~7 {- \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) R9 `) O" Q7 q! S
  14. *
    / x! s' S  O$ @2 r9 j, V- h
  15. * This program is free software; you can redistribute it and/or1 {4 k/ I. s+ H! Y+ J$ X4 h& i
  16. * modify it under the terms of the GNU General Public License as
      Q: Q0 s# j, \
  17. * published by the Free Software Foundation version 2.4 c" J# o+ n- F
  18. *
    - h# M" D2 V5 I; L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 A- ]9 U0 a! u! D0 q( M$ q/ r# B0 p% y! t
  20. * kind, whether express or implied; without even the implied warranty
    / I0 m/ G& v% m8 X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . W' {+ p' I( \/ z% R
  22. * GNU General Public License for more details.
    6 {  h# w# W0 q# o7 c
  23. */
    2 W2 \% P+ a1 g+ [& ]! X
  24. " p, @8 Q; s/ a$ g: v' i# X7 e. N
  25. #include <linux/module.h>
    . s+ M* m/ Q8 E. l: w& a
  26. #include <linux/init.h>
    0 e/ s! b1 v) T3 Z- x2 ?
  27. #include <linux/errno.h>4 r0 x. f5 c9 _+ y: W& i
  28. #include <linux/types.h>% T# Z3 l" e8 @5 h( N
  29. #include <linux/interrupt.h>
    % E$ {; @+ _! A$ p( S* v6 v% l
  30. #include <asm/io.h>
    0 O  N: g. j5 h
  31. #include <linux/moduleparam.h>: c/ B. m: P) W1 u3 @/ {
  32. #include <linux/sysctl.h>
    8 u9 n, j8 @% ~" i9 U- G1 L
  33. #include <linux/mm.h>$ H+ D. V2 ?9 K4 H# R" e
  34. #include <linux/dma-mapping.h>/ B# W6 f5 V8 d

  35. 3 @2 Y* w, K3 O* ~
  36. #include <mach/memory.h>8 @$ n+ U$ V: k- r7 Y' E
  37. #include <mach/hardware.h>
    ! Q" R" k' h9 e4 d. y
  38. #include <mach/irqs.h>% h/ C- o) }/ k; {
  39. #include <asm/hardware/edma.h>
    4 c$ z9 ^0 i. D; e7 Z

  40. 5 i$ W9 U* b: R+ d
  41. #undef EDMA3_DEBUG. d6 `  p( X$ y  @
  42. /*#define EDMA3_DEBUG*/# ~& d; E) l9 p( @( L0 `

  43. 0 Z- ~+ y9 ~5 w2 s7 ]% e
  44. #ifdef EDMA3_DEBUG1 w! k% a  ]( q+ O$ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 W" N5 K% N2 L6 o; E# R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 Q; P% ?! d+ x! |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), ?/ n) v5 H+ G& X2 E
  48. #else
    . o$ n7 W( E3 ?2 g/ C. U1 A
  49. #define DMA_PRINTK( x... )9 ]* c# K3 t! i% O4 O
  50. #define DMA_FN_IN
    " u/ W, {8 Q# S( y
  51. #define DMA_FN_OUT
    5 e4 C, f2 S) I: u
  52. #endif
    & e- R: }4 |% ^$ f5 A/ m; Q3 y

  53. $ c! [5 Q+ N% U  u; W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 W7 \% x8 t& S
  55. #define STATIC_SHIFT                3
    ( l6 p* H+ Q1 |8 p, k% c1 d. ?0 `
  56. #define TCINTEN_SHIFT               20( p+ Q, q( [, _- v' I4 a& i
  57. #define ITCINTEN_SHIFT              21' x9 A9 A8 _' q  ?$ Q' l- w
  58. #define TCCHEN_SHIFT                22
    , ~9 m0 L8 q8 ^) Q/ V. z
  59. #define ITCCHEN_SHIFT               23
    + i/ Q* _; G8 ~

  60. & ?( @, `) E8 m
  61. static volatile int irqraised1 = 0;
    ; m- y7 m. e1 ^! u4 W# A
  62. static volatile int irqraised2 = 0;* e, a/ P% [1 Z$ l4 x. S5 e
  63. 2 j& P7 B5 J5 ?/ A# o$ x. J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& y  w& y8 i: m: V9 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! O2 b( F' E" h1 V# E& T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 J" G& `6 a' T0 ^. v

  67. 7 `8 }6 E/ ~8 C
  68. dma_addr_t dmaphyssrc1 = 0;! |# e% I" q9 e" y
  69. dma_addr_t dmaphyssrc2 = 0;9 _! E" I" Q; G1 ~5 ?6 ^4 G
  70. dma_addr_t dmaphysdest1 = 0;- I; N% Z1 @; s0 U( Y+ F4 J8 I
  71. dma_addr_t dmaphysdest2 = 0;
    5 ?# r/ N$ [7 a% e. d& r; a

  72. , ?' R+ P7 \1 A
  73. char *dmabufsrc1 = NULL;; l5 s7 N9 N# A3 D9 V; m
  74. char *dmabufsrc2 = NULL;% w2 P- K2 x# H! L+ O
  75. char *dmabufdest1 = NULL;% Z1 F% J$ J+ C  X) |+ A, Y
  76. char *dmabufdest2 = NULL;
    & z, p- _* m' _$ v$ q

  77. / ~+ j1 M  I/ ?, u/ v
  78. static int acnt = 512;" r9 C2 B& Y) Y% K& m
  79. static int bcnt = 8;
    : V- s5 d  u. y. A' [
  80. static int ccnt = 8;, n9 {0 e& I9 \7 L) `) Z
  81. $ g9 t: L4 D( V- D
  82. module_param(acnt, int, S_IRUGO);! E8 ]. P" W! ?: H+ E$ i: G/ `
  83. module_param(bcnt, int, S_IRUGO);
    , u- u; @* ?' h( ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 Z5 h& O/ O7 D! i" `! d) u+ B! M4 q- u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; W& ^. l. @. @* ]/ F) x9 J% Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ G) k3 ^# C. T$ o% d* e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 t/ i9 G, f. r& U, b+ p
" X$ @: l4 }5 W; Z3 V9 K; T2 t" j3 c, C8 n7 y, ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-10 06:49 , Processed in 0.045445 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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