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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' C& P5 [% s9 k" Q+ c5 S$ q) p0 h# f' x
  1. [code]EDMA sample test application
    - p7 c/ x& g# ~- o: d6 s
  2. /*
    ; V$ ?4 B7 K; E7 C
  3. * edma_test.c
    7 |- X+ d. Z8 }% z  U# s% F8 u
  4. *
      w7 A. u3 \: C1 R9 M
  5. * brief  EDMA3 Test Application
    2 w5 M1 I$ Y1 E" Y$ u/ j
  6. *
    " Q0 R0 R6 h8 Z( W) z7 K  m
  7. *   This file contains EDMA3 Test code.0 V- t" C& h" |3 X8 |
  8. *
    + B$ O/ t; f5 c3 c# T4 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( K7 }  ~8 _$ U  W1 F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 b9 r2 T4 A! h
  11. *         TO CHANGE.
    0 R" z9 N) J1 H5 }- z6 e6 n4 ?% n
  12. *$ c( _' `# i( _1 n8 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 Q9 @& [! E' c* P8 x
  14. *
    1 p- h. D3 F5 u
  15. * This program is free software; you can redistribute it and/or
    # D6 d/ h6 w5 K6 g) T1 t6 \
  16. * modify it under the terms of the GNU General Public License as
      K, W- P+ ]& w2 f/ W
  17. * published by the Free Software Foundation version 2.; E7 K* [/ `3 O& x
  18. *5 D  p6 c1 a! s# n5 t" v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( E9 V' G7 `) Y  F: p
  20. * kind, whether express or implied; without even the implied warranty
    2 q% V; w! Y) k; V! C: G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" b# ~; I* `1 L# F# i8 u3 ?. `
  22. * GNU General Public License for more details.# Q! N3 O  D! M8 f; n
  23. */. w" S( [# S$ t  p
  24. 5 \/ Q( h- X/ a7 c
  25. #include <linux/module.h>- T8 E  d8 N- F% I. a) u
  26. #include <linux/init.h>
      q* y' x; _# J3 T0 ?! q
  27. #include <linux/errno.h>5 `' C! e) M5 E. u
  28. #include <linux/types.h>
    7 y$ C( ^) v: x" Y* W+ \4 F
  29. #include <linux/interrupt.h>
    3 \4 a$ b- ~2 N
  30. #include <asm/io.h>
    + J: S' }! d, r' y$ |1 N9 e9 \9 V
  31. #include <linux/moduleparam.h>
    & g  A  \8 L* o& j/ U
  32. #include <linux/sysctl.h>
    4 ~: K$ a/ S2 M/ v2 M, w6 A
  33. #include <linux/mm.h>
    3 [) _: X: e* }3 h
  34. #include <linux/dma-mapping.h>
    : ]% x$ w9 X$ z4 }" `" f
  35. 2 X( f9 e8 A3 r3 U" I
  36. #include <mach/memory.h>
    # ~8 M) t- F6 B
  37. #include <mach/hardware.h>! N8 m6 r  j' B& G* I- ^9 T* n
  38. #include <mach/irqs.h>
    . }7 x3 o. K& b
  39. #include <asm/hardware/edma.h>
    ( \/ Q! t! K6 H, O
  40. . V4 O4 ]2 \0 [7 E
  41. #undef EDMA3_DEBUG: o' `! _% p. H
  42. /*#define EDMA3_DEBUG*/
    6 |9 l) G' G5 S4 |+ l9 Z* z, b
  43. 4 C( E7 W8 B; K, H8 n( k5 O
  44. #ifdef EDMA3_DEBUG
    ! `7 z5 N$ f) I7 _: M0 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 U& M! _: i% a  h6 b7 o% {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* L4 O4 e! f& y. ]7 A6 p0 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 A  b; l3 \* c& Q
  48. #else
    6 J; q4 X$ {* |( I% M" d
  49. #define DMA_PRINTK( x... )% c& @4 a' R+ {$ r$ N% @
  50. #define DMA_FN_IN. j6 o- s: F4 q
  51. #define DMA_FN_OUT5 T0 w5 j. m2 D6 f. _9 S! ?
  52. #endif/ Y# x! [4 ~7 f
  53. - X. G7 ?7 T( |2 ~3 b( O- i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & C, t+ F+ g3 C; Q4 A) A# l
  55. #define STATIC_SHIFT                3  a5 J( s$ a' T2 S- L1 D$ Z
  56. #define TCINTEN_SHIFT               20/ w2 u2 q" T. i$ Z3 X
  57. #define ITCINTEN_SHIFT              21  R& B6 d. ?2 p! \& T+ R' [1 N1 @
  58. #define TCCHEN_SHIFT                22: \1 K" |! B' D1 a( W# X
  59. #define ITCCHEN_SHIFT               23! A. Q! D4 g% v7 D! d) R
  60. ! [5 W/ S7 `+ W9 g7 j
  61. static volatile int irqraised1 = 0;4 T4 E+ f# D; @
  62. static volatile int irqraised2 = 0;
    - l. |3 @. T  o7 {0 B0 m. S
  63. 3 B0 U5 z/ y* T" ^$ d" D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # R' T4 H, [4 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ U# X! Z! j% C, P7 N0 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- d. {2 n; _" T& ^
  67. 3 j/ K+ u0 R2 q% j. f
  68. dma_addr_t dmaphyssrc1 = 0;- V- n/ n6 \2 z
  69. dma_addr_t dmaphyssrc2 = 0;; a6 a0 r6 L. ^- B
  70. dma_addr_t dmaphysdest1 = 0;) D  }3 E# _( N6 \1 ]6 I
  71. dma_addr_t dmaphysdest2 = 0;3 C5 D" G, t3 m
  72. 3 o* I3 @  w* ^6 K7 N. o( C: T
  73. char *dmabufsrc1 = NULL;. U7 Y' q5 z5 t; R) R8 r; W' s, a+ D
  74. char *dmabufsrc2 = NULL;
    6 c; Y& ^1 |( }6 K1 m
  75. char *dmabufdest1 = NULL;3 A: D: f  n( G& x  o4 j
  76. char *dmabufdest2 = NULL;7 G* r) m2 `& Z
  77. 6 w8 D; {: b: a
  78. static int acnt = 512;
    ) v- k% A  X  _  c3 m
  79. static int bcnt = 8;
    $ Z+ I) d/ r' g, S! |
  80. static int ccnt = 8;
    ( w7 r; W# t( a# u. P; X
  81. 6 i# Q9 J+ ^! Y: o& B
  82. module_param(acnt, int, S_IRUGO);$ d! W  q% b% ^
  83. module_param(bcnt, int, S_IRUGO);
    3 d& f) v3 F6 ?5 w) s+ X" [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# O. n: r9 O) N/ E6 o8 O+ N( {( K+ u  F& n, b$ `! Y! C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# U) A# x- |3 {- o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; F- t! \/ D" p/ Q5 q1 K* k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 |: x0 l. p, o: @* f6 s
) W3 ?! N* X2 p$ V4 y0 m; q
( t0 _+ w/ Y" e& S( u+ L" X6 X% `& u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 00:42 , Processed in 0.044608 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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