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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; {1 H2 o: T- h/ k+ o; |
  1. [code]EDMA sample test application3 J: u! m/ A$ ?$ i( h
  2. /*
    5 D! D  i( L; L* A/ ]  X
  3. * edma_test.c
    ! T5 M: G! r. J" N' F/ c, l! C9 h
  4. *
    . P( K4 f" e7 [/ S/ @7 t4 F. U! n
  5. * brief  EDMA3 Test Application$ A# D+ c4 V8 B# |9 M
  6. *8 t: n$ o. l( C! T
  7. *   This file contains EDMA3 Test code.
    ; e  n* ~5 g2 I0 b2 P! @4 h" m# @5 ^) t
  8. *& E2 A7 `. _% o1 |, `+ n# G2 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! P6 k: P, }9 `9 G: U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 [* m3 l+ t  D) m6 S2 X: ]
  11. *         TO CHANGE.* j2 g& l* q5 _( _" ~1 }% L
  12. *
    ' F5 t2 q+ f' o) `3 ~* z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 Z1 U! v+ P! i( Q
  14. *# B3 y, {( {8 i! T
  15. * This program is free software; you can redistribute it and/or
    / d! E+ |4 i' Y
  16. * modify it under the terms of the GNU General Public License as
    9 ^! m4 h; C( ^
  17. * published by the Free Software Foundation version 2./ _8 I# j3 S4 e# x* p& J9 l
  18. *8 z( L5 [- a, F, O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # y6 B& L! _- r: f# Y; M/ V( P6 D
  20. * kind, whether express or implied; without even the implied warranty
    + X2 |  e" ^4 [2 u0 P$ k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 z1 i$ e0 Y! f! x9 ~4 d
  22. * GNU General Public License for more details.
    + G% B- Y$ c- d) C# y3 X' d8 l
  23. */
    7 M  T3 K& I( T* e; N" Z

  24. 6 ^( U$ r* }) V4 X7 \* u# q, G. a
  25. #include <linux/module.h>% W/ t8 h, T2 ^+ U
  26. #include <linux/init.h>  l( i( F7 O# m& k* `) r; Q
  27. #include <linux/errno.h>9 d, u: Q  H% m+ B! \! r
  28. #include <linux/types.h>
    ' V( m# z' C/ L
  29. #include <linux/interrupt.h>* d& N! Y9 `7 w6 }4 c) @
  30. #include <asm/io.h>
    9 w- Q9 V2 X2 g. h  D2 _6 A; z
  31. #include <linux/moduleparam.h>2 @  I7 a1 f7 ^) z$ g
  32. #include <linux/sysctl.h>
    & I, v3 w. A! ^5 a) [: z
  33. #include <linux/mm.h>
    $ V0 E, I- A) Z! A% x" U5 F' f9 O
  34. #include <linux/dma-mapping.h>
    6 R- K5 k3 e3 I8 D6 Y. Z

  35. . k9 o) h5 Z* y; H% i/ q
  36. #include <mach/memory.h>! v' N3 W+ c: D) G$ `! W
  37. #include <mach/hardware.h>4 _. c" g+ V2 ^9 o6 G) r1 j0 v- A& t
  38. #include <mach/irqs.h>
    & |; G" u- c, O: R2 l5 O
  39. #include <asm/hardware/edma.h>
    " s  p' a  `; `6 W

  40. % q$ P0 k: r  v( X" y
  41. #undef EDMA3_DEBUG
    5 f+ F2 ^' O9 \" S* a0 F6 m
  42. /*#define EDMA3_DEBUG*/% ^) I( i8 @# P0 p0 |6 o5 ~

  43. . D; z$ l. h# g: T" T% w. l" |
  44. #ifdef EDMA3_DEBUG
    4 S/ P, h" Q, m* `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- z# ^  W5 l( U* g3 c) j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ a" J! H  T+ U1 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 Q1 M. H/ \, q  p% u
  48. #else
    , e+ M% X  U7 i: {; g# l. j
  49. #define DMA_PRINTK( x... )0 K6 S/ E) o& M" h$ P
  50. #define DMA_FN_IN$ v9 n) j8 q0 q/ V
  51. #define DMA_FN_OUT8 V. G; _1 G& f8 ^- m
  52. #endif; l! ?7 |- j# O9 h6 m# V
  53. ( S% s) V  ~" a) F3 A5 [2 g9 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' O4 R) ~9 G1 G, c* Z* Y: k" g
  55. #define STATIC_SHIFT                38 t- _# s; c+ n: m" q
  56. #define TCINTEN_SHIFT               202 Q! ^4 e. p" x) ^; ]; ^
  57. #define ITCINTEN_SHIFT              210 a& R$ J4 Y6 ]7 c+ N' T
  58. #define TCCHEN_SHIFT                22" e0 J5 ]: Z: a8 O+ U+ S
  59. #define ITCCHEN_SHIFT               23
    $ t# f+ J0 c& S9 O9 q) W7 Z

  60. 6 c+ S$ L1 ?3 _2 g
  61. static volatile int irqraised1 = 0;0 {. H3 U* z* l) ?1 C
  62. static volatile int irqraised2 = 0;
    ' D6 [. {) k6 @4 @9 C& M& ^1 F
  63. . [- k0 K  }  X7 N( d3 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ Q: K& p% w1 q; }8 d# _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! M# ^" H, j: q' `! y# P  l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " l8 D2 Y! p) y

  67. * E5 \$ n+ G# j+ a0 Y1 ]. L9 j
  68. dma_addr_t dmaphyssrc1 = 0;6 p" o+ e% V. [6 P2 v
  69. dma_addr_t dmaphyssrc2 = 0;# f4 Y8 u1 e& v; m
  70. dma_addr_t dmaphysdest1 = 0;' A/ B3 F/ h8 `9 E. p" u* K
  71. dma_addr_t dmaphysdest2 = 0;
    + k/ P7 s9 r' {6 R5 ^/ G" ^. ?
  72. 6 m  V7 i5 @8 v$ a7 V' G. Y
  73. char *dmabufsrc1 = NULL;
    4 M& ^" @7 ?1 N2 N. @
  74. char *dmabufsrc2 = NULL;- k) f1 R$ a8 i  H3 e
  75. char *dmabufdest1 = NULL;& P. {: a3 E0 B
  76. char *dmabufdest2 = NULL;
    ( c5 H+ r& |: u) @+ [! D

  77. * Y" b4 w+ `7 E1 J8 t" Z
  78. static int acnt = 512;- T  b3 e, N# N* {# \2 p8 q. [/ T
  79. static int bcnt = 8;
    " n. f; @7 }5 R# e* B2 y& S6 ?% d+ V
  80. static int ccnt = 8;& w$ Y! X$ d1 J/ c$ h0 ]. ?& Y
  81. : {/ x: X4 W  H. h; W4 p
  82. module_param(acnt, int, S_IRUGO);
    % Y- F) n( S+ ]) m$ t( V- ?5 @5 A
  83. module_param(bcnt, int, S_IRUGO);5 p) P' B; e% e4 f9 e7 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# {9 @& Z( r/ x3 _# m( Z
3 X: x, Y: b! B  w6 j! l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& P3 U2 a9 c. K7 Narm-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/ p% ~9 d! P( ^) t0 i2 [+ L* F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" ^* E3 W+ m4 G' t

. W- e- C# t2 C' H2 k% Y7 r  e' u. u6 z8 S6 E! L  p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 20:11 , Processed in 0.042827 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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