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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 A" S. z( {* e" I! l
  1. [code]EDMA sample test application
    & y& @: O$ w, F+ _' g( E! I
  2. /*$ |* S2 l" H! j2 m/ y3 i, j% x
  3. * edma_test.c
    8 _8 P" b6 K1 s7 E5 v7 J
  4. *: m% V+ {8 [6 Z' m
  5. * brief  EDMA3 Test Application) p  W; a5 r% b5 w  o
  6. *+ M8 K0 N. {) P! I2 [
  7. *   This file contains EDMA3 Test code.2 X" m) G  r6 W4 o# p. }' ]- }# \9 V
  8. *6 R! ]$ Y2 U& w. o$ C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 M" y3 t0 J! Z  E7 t1 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. Z& s  j& {4 U: l. s% O" ]
  11. *         TO CHANGE.4 g& U4 W, w! y; J+ i
  12. *8 I8 I) I4 G) t2 ?: l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 P; D6 q+ j+ n  q8 B! X
  14. *
    ) w8 N$ @4 y; d" [. {- L% j
  15. * This program is free software; you can redistribute it and/or
    + Y+ h; E- ^' ]6 c
  16. * modify it under the terms of the GNU General Public License as
    6 S: K5 t5 r& x; ~
  17. * published by the Free Software Foundation version 2.
    8 y! J+ H( C( a. a2 R: V0 n& j6 d
  18. *! z# K7 F. l" G! {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 c/ A0 B& m/ I
  20. * kind, whether express or implied; without even the implied warranty
    ( S2 O3 u' Z: K0 T) J2 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! {8 @9 s& X$ ~7 }# O  m- s1 f
  22. * GNU General Public License for more details.4 t8 _) f1 e4 x' u# C3 u  l
  23. */
    ; X$ i9 m1 I5 S+ @  g2 Q$ p, g

  24. / K1 d3 d* T  Z8 |! U8 `3 q
  25. #include <linux/module.h>; L; s  b% J; B8 l* K
  26. #include <linux/init.h>- ~% u2 H1 m' ]3 v
  27. #include <linux/errno.h>
    " F0 k" _) v5 S! B7 s
  28. #include <linux/types.h>; |1 }% R2 {" ]
  29. #include <linux/interrupt.h>
    - n6 ?- K! B. v0 P0 o1 D
  30. #include <asm/io.h>
    ' \) m* D0 ~) S0 p  u( A6 g+ [
  31. #include <linux/moduleparam.h>! V  Z9 j$ ^# o  r9 l
  32. #include <linux/sysctl.h>
    2 m  ]/ F! e$ q( ~: @& [
  33. #include <linux/mm.h>  p+ ~" _, O( ]' m" W+ O- \9 ?
  34. #include <linux/dma-mapping.h>) N+ O# h# X0 q2 n, U" _7 W. R; M
  35. 9 I# r- t" B" @9 P4 n: T' o
  36. #include <mach/memory.h>
    , u- H: \! }$ o4 S- m1 N; E$ x% \
  37. #include <mach/hardware.h>
    " M" I& k+ G8 y4 O" X
  38. #include <mach/irqs.h>
    7 ~% {7 t3 d$ x* [4 n. X0 @5 P
  39. #include <asm/hardware/edma.h>
    " f) L& }. b8 e

  40. 2 ?. y  G: Y3 |1 U
  41. #undef EDMA3_DEBUG# l  O6 S2 v' f1 q$ z4 Y1 g, f& s
  42. /*#define EDMA3_DEBUG*/
    , Z+ P6 I7 [" H# n6 _

  43. * B: s% }& ?! W
  44. #ifdef EDMA3_DEBUG) d) U/ U" o: Z( @5 q7 |! x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( y% t3 ^/ C+ Q8 V7 A$ w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 P! l) G/ E) C9 r, H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ]9 W  R8 ]9 {7 _
  48. #else, ~! D# w. D# g# l3 }0 l' {
  49. #define DMA_PRINTK( x... )
    * ]  o; I' j- Q/ [& ~' a, t
  50. #define DMA_FN_IN+ D$ f' ^( ~6 V$ T, L" D
  51. #define DMA_FN_OUT& b: u6 J4 `0 {6 o2 x
  52. #endif% G0 G* P& Q9 L5 m6 e6 |
  53. / N1 I9 J4 C# O6 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + G2 h, T8 ]4 A) t( q5 B2 a: \
  55. #define STATIC_SHIFT                3
    9 U3 O8 B& d# \: I% m
  56. #define TCINTEN_SHIFT               20
    2 w; _" s7 q7 `2 f7 o$ a5 H
  57. #define ITCINTEN_SHIFT              21  u$ B5 G0 W2 Q
  58. #define TCCHEN_SHIFT                22
    / ?! O7 g' G& h) D. `% Q, ?% d6 ?6 M6 {
  59. #define ITCCHEN_SHIFT               23
    * E: d* t  k' ?4 N) h
  60. 1 N$ S) g; l% r  s
  61. static volatile int irqraised1 = 0;8 s3 n- m8 V1 m5 K, K* F
  62. static volatile int irqraised2 = 0;) e" ~# O, D" ^
  63. , s/ C6 p# Z: o2 i  I8 O9 z  G3 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. x, m4 v! `* }- f; R# c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% R4 U6 W' r1 D3 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 u3 i' O% e) `* D! J4 v$ r
  67. , C/ \3 o/ Q4 ]9 P) A4 b
  68. dma_addr_t dmaphyssrc1 = 0;
    , B4 t  p+ W- }3 k
  69. dma_addr_t dmaphyssrc2 = 0;
    4 }5 J- D/ v" g3 ~% Y$ h: P' _
  70. dma_addr_t dmaphysdest1 = 0;; o& c5 \: h( ^. [
  71. dma_addr_t dmaphysdest2 = 0;
    ! q0 x( Y- k" r: R# c  q

  72. 0 _9 Z* {# o, A3 e/ Z1 |- ~' L& F* D
  73. char *dmabufsrc1 = NULL;- E- F8 G) W' H9 K8 Q, Z- R
  74. char *dmabufsrc2 = NULL;( I5 d1 k( f! R8 U( e0 K& e
  75. char *dmabufdest1 = NULL;- {7 r$ ?1 N! b. f
  76. char *dmabufdest2 = NULL;1 P6 @( S. z* L- L
  77. 3 o; I, G5 T) c1 a% h: y
  78. static int acnt = 512;
    % Y! p# i% f" Q$ j) X1 K! v2 k
  79. static int bcnt = 8;
    ( H: T* T2 k. c
  80. static int ccnt = 8;# v* G! K6 I- |, y# q; J

  81. 0 }3 |) A6 K9 Y. o. v" p
  82. module_param(acnt, int, S_IRUGO);+ P( U8 z; b; X7 I% O% M% a
  83. module_param(bcnt, int, S_IRUGO);" J4 l9 A3 A7 q7 G# F0 ?* g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 y* V, v: d% k. o5 r1 m! M
) g0 e3 D; M+ B) v5 L1 x5 k$ U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" w; n( I" |7 L+ j5 W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 [% Z' `% \& e, I) J5 B5 [/ U3 J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ^0 N7 N* }9 U3 o$ M0 X
7 q! F$ E& u/ m
  T, F5 ]  i4 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-22 07:01 , Processed in 0.038006 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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