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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 |2 `$ a$ x' I: X
  1. [code]EDMA sample test application( j$ [' Q* |) l2 H
  2. /*( c; j$ u( t$ w8 D
  3. * edma_test.c3 R9 @# H! L2 y! ?- b+ v1 ]
  4. *
    * F$ U4 B' \( F. |' R( \
  5. * brief  EDMA3 Test Application( U- h7 E) X: V: m; r
  6. *$ J6 x1 J2 m+ V% y; w
  7. *   This file contains EDMA3 Test code./ U. W, z+ ]! ~. {6 t; O
  8. *' m9 }1 d& Z* [) g& p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 D1 ~) S5 s6 R5 p( C8 @# c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' I# M: l$ T+ `) d  e
  11. *         TO CHANGE.6 d) `5 c$ h* `: [. F5 @* T
  12. *
    4 b2 [" d5 r" P: I) p' X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 C1 N6 O- X) ~8 |/ P3 N
  14. *! g5 h1 Z: z! J: V' c2 O8 P6 `
  15. * This program is free software; you can redistribute it and/or
    + y3 X( D5 v& G# @) S" q( G
  16. * modify it under the terms of the GNU General Public License as1 k  N2 G; g- ?2 M
  17. * published by the Free Software Foundation version 2.
    . Q* O! C% }% U5 K
  18. *
    9 r; L" ?; [; f/ x: ]3 a/ _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 G: s3 @$ F# q3 O
  20. * kind, whether express or implied; without even the implied warranty
    * j6 Z9 k: g  k8 ]: v# L1 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & s! P0 L% S& G' p% {  f
  22. * GNU General Public License for more details.1 A, X, Z. M( ~) X
  23. */8 [4 X3 y: n) s: j' g% h% H

  24. # R& t. R) s% R* @7 R. Q1 _8 f
  25. #include <linux/module.h>9 S; G4 J, ?- g$ |
  26. #include <linux/init.h>5 Y& m7 z5 Q. X
  27. #include <linux/errno.h>
    % Y/ m. _  D' d( i( e8 n
  28. #include <linux/types.h>
    & a5 X' S/ v/ O5 }" |9 E% K9 w: a
  29. #include <linux/interrupt.h>2 _/ ?. Q( o# z5 x# W, o
  30. #include <asm/io.h>
    8 X' h0 T1 H5 P& ^$ c4 `9 a8 `5 |2 w
  31. #include <linux/moduleparam.h>
    % k- w% A. h& o/ S) a0 o8 Q
  32. #include <linux/sysctl.h>& O# U. u* p; Q1 G6 Z9 D
  33. #include <linux/mm.h>
    . {4 t: j: T0 q2 Z1 L) ~
  34. #include <linux/dma-mapping.h>
    9 S2 f4 X7 |3 k

  35. 3 D* [* n0 z: |; }! S
  36. #include <mach/memory.h>- V- c6 ^5 _9 }! d4 s. f
  37. #include <mach/hardware.h>
    ( L3 m$ t/ u! ^; x' v8 {$ t; T
  38. #include <mach/irqs.h>" t( W: r# ?) D3 X! s" r
  39. #include <asm/hardware/edma.h>" m5 G. ~  f3 c2 i& g) f. @- ~
  40. / K- H9 y! {% `2 D( E
  41. #undef EDMA3_DEBUG
    2 [' h/ ?% F# E; Y8 H2 S8 U8 i
  42. /*#define EDMA3_DEBUG*/
    ; W: F, @/ a5 t0 r- O1 Q# ^2 n
  43. : M) |4 {$ ]  `
  44. #ifdef EDMA3_DEBUG
    8 m0 d* M; y7 A+ b! u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , K2 c! Y" W9 O& b$ g' C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 {/ t" r8 _2 O4 w. o7 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . h. m: p; m/ O
  48. #else
    ' @/ r  W; L) c7 N5 f
  49. #define DMA_PRINTK( x... )
    ' R% E8 q! a( ?3 c4 c2 T
  50. #define DMA_FN_IN
    9 N  g0 }  t5 t6 X8 P+ p, Q
  51. #define DMA_FN_OUT) O6 g2 J# {# _% Y
  52. #endif
    6 v/ B( r) q, v- `' Y1 F1 Q. V+ [: Q# |. i

  53. % Q" ]! Z  E# E2 F8 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " s& i$ N- q  g
  55. #define STATIC_SHIFT                38 @4 P5 j, o& r8 b& A* R1 _0 |
  56. #define TCINTEN_SHIFT               202 Y& \! A  M. h! X8 q$ d! N
  57. #define ITCINTEN_SHIFT              213 r' B& P- m) R0 X
  58. #define TCCHEN_SHIFT                22. H  }0 G! `8 y) {" l" C1 H
  59. #define ITCCHEN_SHIFT               235 V/ K: K" Z! ^' p$ X1 \
  60. * x  ?4 Y) ^1 B; t1 ?
  61. static volatile int irqraised1 = 0;4 F/ s* L4 {; I! m
  62. static volatile int irqraised2 = 0;
    6 d  W, ]& T+ R% J7 v

  63. 8 X5 Z. l! R1 S9 b2 _- n( x3 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ r" C# B- `4 ~7 W2 ]- [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 V* ~  R0 G; J0 b; U* D( e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ]) [# u6 h! [  R- i, V7 n+ Z& e
  67. " W0 K  z, }' g
  68. dma_addr_t dmaphyssrc1 = 0;& k& K3 P1 K  q% b6 X; v- I
  69. dma_addr_t dmaphyssrc2 = 0;
      `, |" M' j2 h: a5 |2 N/ d) R! Q
  70. dma_addr_t dmaphysdest1 = 0;' D" n+ M8 k! ~; }
  71. dma_addr_t dmaphysdest2 = 0;0 [/ [" I7 V) _- o

  72. 0 p/ c" j% D$ d% |0 i
  73. char *dmabufsrc1 = NULL;
    & S" h$ o7 g- B8 W+ H* g
  74. char *dmabufsrc2 = NULL;
    $ q. {. p4 U' M2 d7 b1 B
  75. char *dmabufdest1 = NULL;; `$ a/ {3 i3 {) U& F- p- H. C
  76. char *dmabufdest2 = NULL;
      V$ P1 p# d1 c. q, D. ?

  77. 4 B: w2 f7 o1 v
  78. static int acnt = 512;
    # M" I! i8 V5 y& l
  79. static int bcnt = 8;# J8 G$ l5 k# d- J/ W# A6 `, y
  80. static int ccnt = 8;
    1 y, `* {1 P% T/ L2 _: N
  81. 1 ~1 D0 f, {, A% R% L( @
  82. module_param(acnt, int, S_IRUGO);
    5 g! w( m1 j! k: j! j
  83. module_param(bcnt, int, S_IRUGO);5 j: c4 `! c! c; i$ s, A0 C5 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 t( r+ r( ^: V# K1 @  L/ u0 |0 ~2 j$ t1 B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" s9 X) M6 ~& T5 A3 Z& Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: x- z, g" B( B0 i' K, e+ H0 `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 d/ y# g! }) q7 M$ K7 T& |% O0 s
5 P( _1 M* c1 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 05:46 , Processed in 0.037168 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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