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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 _/ [3 C1 {0 Q- ^# b0 a6 _8 x$ |, P
  1. [code]EDMA sample test application
    ; _. L! I: B/ Q4 X  {) f
  2. /*
    - H* }  ^0 L0 E2 Z% O+ F
  3. * edma_test.c6 Z- O) g6 V  ?) I: }
  4. *
    & @1 h0 P0 ]. P- ]2 i
  5. * brief  EDMA3 Test Application& a6 R; q5 N( w& x* m
  6. *" s& O3 @6 J$ b( y9 z+ c4 A- B
  7. *   This file contains EDMA3 Test code.: s/ G. D1 n- |  I: J
  8. *
    8 f$ g( G) B9 X  K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 s" x2 R3 g0 L6 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ I9 t! v# w4 U" @9 R
  11. *         TO CHANGE., J/ _+ g% P, d
  12. *
    . b) ~' c; t# U$ s7 p; u$ W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . Q7 I: `  p7 N4 l9 T, A8 I
  14. *
    8 @+ j0 ?& F8 V+ i8 [- I2 M
  15. * This program is free software; you can redistribute it and/or! V1 \% ~6 p  i1 t) Z
  16. * modify it under the terms of the GNU General Public License as9 a7 _. e$ i! ^% I+ c( }  |
  17. * published by the Free Software Foundation version 2.6 u% o; K( j5 X$ t. ~& O" B  l
  18. *
    , M4 @. s" v+ \/ N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% Y  R& _- M% C8 V3 r
  20. * kind, whether express or implied; without even the implied warranty% Q2 ~* h9 ^% ?& I2 F( ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ E& `# A  b  m# W- `& @
  22. * GNU General Public License for more details.* {8 d- b( x8 s$ N( I2 e
  23. */! n# T2 M, ^% b" m4 u. k

  24. ' X0 _% P% P3 u
  25. #include <linux/module.h>9 R. ]5 S( @9 g1 i1 U3 H& s
  26. #include <linux/init.h>
    ) n' o4 \) u6 m, X0 ]
  27. #include <linux/errno.h>/ _6 Z; p1 A6 Y* ^1 u3 S- `
  28. #include <linux/types.h>
    + @2 ?. k& [  q& z% |' |$ Q
  29. #include <linux/interrupt.h>: Q4 A4 j+ x' B# A& L' z
  30. #include <asm/io.h>: V" |* ^4 ?) O2 {: ^& X: {6 R# ~
  31. #include <linux/moduleparam.h>
    8 e! I/ r7 [% K* B/ E' Q
  32. #include <linux/sysctl.h>8 `; Z8 A0 i. `1 ^* e
  33. #include <linux/mm.h>
    ( N7 P  L9 w/ X/ [
  34. #include <linux/dma-mapping.h>
    0 z5 S. F" l- P+ ^' E: |+ X. c3 f" A, ?

  35. - f, t- h8 o6 s' i: o& @" [% G
  36. #include <mach/memory.h>8 }2 M( j7 H4 N; f
  37. #include <mach/hardware.h>
    $ R7 z7 W  ?# v9 n- o
  38. #include <mach/irqs.h>0 U- g- [  O2 r0 Y# [
  39. #include <asm/hardware/edma.h>
    & Y, p7 b/ G2 \4 Y7 i

  40. / x8 l) O% R. ~
  41. #undef EDMA3_DEBUG' z# ]! n! f6 F( U
  42. /*#define EDMA3_DEBUG*/2 c2 h8 t' c& \1 E
  43. " i1 s2 e6 J6 k- Q# G
  44. #ifdef EDMA3_DEBUG: C  q3 Q5 R; |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # Y4 ^7 k& D4 Y7 p% T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 u* A( f6 ]* t$ ]7 Y1 y3 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 M- D2 H" @3 H) a3 E# `
  48. #else
    # x$ f7 }" Q- v4 ?  f9 g7 z
  49. #define DMA_PRINTK( x... )
    ) ^0 O* I( t  F2 Z6 @# t
  50. #define DMA_FN_IN
    8 I' H! x2 ]$ R( b4 P
  51. #define DMA_FN_OUT* l7 B: W+ v6 z5 x+ G
  52. #endif
      U2 J# M; F6 K. J$ r/ f
  53. : a  B8 }7 B5 s# ~- Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 M; ?! C; L/ f! B
  55. #define STATIC_SHIFT                3* e* e: o' |! e* ?" a! k$ G
  56. #define TCINTEN_SHIFT               202 e+ z# @9 \7 L' b. L( P; \
  57. #define ITCINTEN_SHIFT              21
      b; z# @8 ~! s/ ^
  58. #define TCCHEN_SHIFT                22: G# O' X) `% _) w
  59. #define ITCCHEN_SHIFT               23
    8 R! t6 i2 ], ], H0 d

  60. 4 O5 p- p5 _4 X9 X
  61. static volatile int irqraised1 = 0;. I6 i- j- P, m% c* g
  62. static volatile int irqraised2 = 0;
    ! m) t; a# R7 }3 ^

  63. # q6 E* B  T9 Z7 I2 D$ ?8 `. T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 V% S& x' ~, M/ Q2 p, M1 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 p# d! S$ G2 u2 P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 L4 x' b6 ^; L' b! `

  67. 3 ]# N5 J, g+ g/ m( Z
  68. dma_addr_t dmaphyssrc1 = 0;
    . _8 t2 Y5 O- a% |
  69. dma_addr_t dmaphyssrc2 = 0;
    ) d- L; G% P5 d6 k; {# ~/ J) a
  70. dma_addr_t dmaphysdest1 = 0;: u; s/ ^) f: V& S8 @
  71. dma_addr_t dmaphysdest2 = 0;
    . V; P( R8 {' g; x. H2 r. l( d+ t+ O

  72. ; f  ~0 D  a, @; K9 E9 F' @+ q
  73. char *dmabufsrc1 = NULL;: q. v4 S7 K& D
  74. char *dmabufsrc2 = NULL;5 E! Q* d+ O1 D4 `# Q. J" w0 @
  75. char *dmabufdest1 = NULL;* s  U+ r$ S! f
  76. char *dmabufdest2 = NULL;
    , s" S+ ^+ M$ x1 D
  77. & W/ e8 {7 o0 R+ b, K( P
  78. static int acnt = 512;+ i) U9 h9 X0 e, @& H8 l
  79. static int bcnt = 8;  B+ }. w" T3 S# ~! S  c
  80. static int ccnt = 8;
    + {5 H, a) b* t  m
  81. / Z$ ^% K" l1 Q- w6 _1 [
  82. module_param(acnt, int, S_IRUGO);
    3 T- u/ ~7 i/ g: V5 U
  83. module_param(bcnt, int, S_IRUGO);. g1 f1 A. K4 Z& P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: f3 i7 U8 I( y+ q1 X6 {( ~; ^3 [+ e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 B& t; a/ z5 A9 V+ u! Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* J' C! g- O8 }9 _( h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 N' \/ [+ a3 D3 u! C2 ]* [: q6 W# S

# Y% ]9 n% Z, m; f8 F* ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 10:11 , Processed in 0.039655 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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