OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ Y) D; i) h4 [$ K. ~# J
  1. [code]EDMA sample test application
    # t2 d8 w) c3 }2 X- J0 ^" e2 X0 Y
  2. /*
    5 U! `) o2 G! T2 {
  3. * edma_test.c  E: \% ?+ m4 G3 C
  4. *3 O" h8 t, @% D; M. A
  5. * brief  EDMA3 Test Application
    1 j! t0 [& V2 |& A$ P8 h
  6. *( n2 ?' q3 s: q( p  ~+ u' C' d5 _
  7. *   This file contains EDMA3 Test code.
    ! ]; G, K$ M- p- w( _6 ?( v
  8. *
    3 \1 v0 W7 g4 L: o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # ?6 F% d+ c* z+ h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & A2 M( h" W& T& n
  11. *         TO CHANGE.
    . c. {) ]9 o/ s/ c
  12. *6 _+ S) {, [7 T) T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + F9 v( E! R0 ?& x# Q6 f  M0 E) @
  14. *1 w9 [9 `$ l! [5 b2 G
  15. * This program is free software; you can redistribute it and/or
    2 K5 r6 ?. A4 W+ G1 |6 e: a3 W
  16. * modify it under the terms of the GNU General Public License as& }1 \) U9 N( |7 ]% z' U) y
  17. * published by the Free Software Foundation version 2.
    % [% g) {+ U- J8 c# \
  18. *! @5 n% r: g& H5 ^9 Y+ v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, i# b  e  D5 r! z( r
  20. * kind, whether express or implied; without even the implied warranty4 G8 ?# y* O$ z. W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, B: w2 f8 s8 T: v
  22. * GNU General Public License for more details./ B6 P7 H! ~  w9 m& g/ h
  23. */8 ^- P; r2 @8 H/ h" P& N: O

  24. 3 }# W: k9 e7 G6 M7 z9 @' n, J3 `
  25. #include <linux/module.h>
    * x- p/ U( I4 L! x0 L
  26. #include <linux/init.h>  p* g# J! i* i% F
  27. #include <linux/errno.h>7 F6 B# i8 f" Q6 u
  28. #include <linux/types.h>9 E) q% g) I2 |
  29. #include <linux/interrupt.h>
    : M! z% J* J0 K0 k( g9 c/ _
  30. #include <asm/io.h>
    6 C: C7 q, \$ C8 `' |% `; J8 |
  31. #include <linux/moduleparam.h>
    ! m7 Q+ D" g$ g9 m6 H2 d
  32. #include <linux/sysctl.h>  ]5 Y8 W4 F- ]' ~1 h9 Z" h% Y
  33. #include <linux/mm.h>; e0 ~; `9 x, w5 k
  34. #include <linux/dma-mapping.h>* n4 o' ]' {  D& H" W* J) d) t
  35. * i2 x4 O, l: d$ S' O: ~! ]" ?
  36. #include <mach/memory.h>
    # B! U0 t* q9 H7 r7 G8 u2 `9 p5 Y$ |
  37. #include <mach/hardware.h>
    4 J& ^% ?0 }, Z3 F0 q! z
  38. #include <mach/irqs.h>9 j* J  L- C5 @6 q! Q  x! S3 e
  39. #include <asm/hardware/edma.h>
    ( k  g2 g8 m* [/ @5 `  j5 }
  40. + e# A8 C1 w8 S9 S2 i7 \  c
  41. #undef EDMA3_DEBUG
    ( b  @% |. w5 g+ l
  42. /*#define EDMA3_DEBUG*/
    : Q1 f# j* L1 G- ^

  43. ( |  m5 g; x* Y! D+ n2 \0 G
  44. #ifdef EDMA3_DEBUG
    0 B! ?# \. E5 s" s; y& c* M( V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      f1 K8 _- Q. Q7 G" R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ K: h+ q, |! w2 M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' y0 F6 _, |4 |3 ^- `
  48. #else# e) }3 H9 A. A* H  S: U
  49. #define DMA_PRINTK( x... ). n% o6 }* n! f6 Y  ]! M7 y
  50. #define DMA_FN_IN
    8 Y1 a  s9 w( B( Y& h# d3 \7 T
  51. #define DMA_FN_OUT
    2 E$ p! p: Z7 U$ q
  52. #endif3 l0 E! `7 T* Z9 Q2 L& d

  53. / }9 V" V& e" j, F+ E6 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 z; L. T9 m5 N
  55. #define STATIC_SHIFT                3! B& ]; i) I  u0 l
  56. #define TCINTEN_SHIFT               20
    ( ]. ^  Y$ ~" }9 ?. S' u/ h9 {  G
  57. #define ITCINTEN_SHIFT              21
    ( |% H9 g$ q) N. y: y
  58. #define TCCHEN_SHIFT                22; K+ D0 ?8 r6 D. {
  59. #define ITCCHEN_SHIFT               23' y3 q/ Z9 A. R0 Y7 h4 A$ e

  60. 2 v3 H2 ]5 T$ I8 {
  61. static volatile int irqraised1 = 0;# L3 R; e- T  \7 w
  62. static volatile int irqraised2 = 0;
    6 `, f- ?  Z; K  S+ N
  63. ) z6 W% I% x* h7 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& |% V. c& h5 }/ t' k! G* v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      Z* h6 K+ E4 w3 Z' M  M4 ]2 D+ m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 z! y/ r$ q6 b9 q5 D
  67. . o$ @4 o: E  b
  68. dma_addr_t dmaphyssrc1 = 0;7 U- c) z: m1 w3 T4 L+ t( n
  69. dma_addr_t dmaphyssrc2 = 0;& S1 _" h. a& o" N* |
  70. dma_addr_t dmaphysdest1 = 0;
    1 K/ M! \  ?% d3 K% K
  71. dma_addr_t dmaphysdest2 = 0;
    2 G- e5 d  o0 x2 Q% D# [
  72. * a( U: o( `. D  O
  73. char *dmabufsrc1 = NULL;5 t/ V9 Q# o+ |) `6 ^) K
  74. char *dmabufsrc2 = NULL;& _+ l3 e3 R; C8 D, ~; g7 l
  75. char *dmabufdest1 = NULL;
    1 l; E6 O& P, j% U  N5 {
  76. char *dmabufdest2 = NULL;
    3 N% ^, M. y, {( Y! H

  77. * @9 L+ z3 _4 x
  78. static int acnt = 512;
    & q: L) v1 R. M
  79. static int bcnt = 8;
    0 G. P& g& [2 ?8 {3 _8 X
  80. static int ccnt = 8;6 n( P7 o( S4 @5 c7 h
  81. 3 ?7 o; W# C: ?% X
  82. module_param(acnt, int, S_IRUGO);  I! |! i- a$ g% Y
  83. module_param(bcnt, int, S_IRUGO);' R/ E% {" Z/ @) A4 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 N8 L4 p7 \$ L) g
3 @4 i( c, Y( Y# Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ D4 K$ O& E9 A( c- V; P. Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 {& d* n- @+ t' H8 {/ b" K/ Z# x3 g; Z" Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# o( G0 G; U. K0 C& e* i; ~' A/ l* L) _) X

  x, F/ U& P% t5 M- F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-13 06:52 , Processed in 0.041001 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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