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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 ~; d" _" l( V$ _0 W5 S2 d
  1. [code]EDMA sample test application
    # C, e/ x, A1 U2 J. u; [
  2. /*5 ^, y# ]0 Z* M2 i! U6 ?' U7 a
  3. * edma_test.c4 u5 j- F& k, x5 K6 I+ D
  4. *7 q" R* t* l* h
  5. * brief  EDMA3 Test Application
    & P5 x# ^# h' O  y6 O$ X" P8 ~5 ^; G
  6. *
    / R( @9 I1 a/ B
  7. *   This file contains EDMA3 Test code./ ^: k0 Y' _# P
  8. *
    * }. `0 S; R& c  i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ V9 ^7 |2 q2 E. t0 z2 G$ _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( t9 q# C0 ]8 \
  11. *         TO CHANGE.: _$ I, m- Z" A+ E3 \1 X
  12. *2 I1 m8 B( e+ J( M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 z1 I1 p: o& [' z7 X  r
  14. *3 E- K) D# F, n7 z
  15. * This program is free software; you can redistribute it and/or
    0 i  Y5 F8 b* k/ p- W  N; ~* P
  16. * modify it under the terms of the GNU General Public License as
    5 _  C# m5 y( t. y
  17. * published by the Free Software Foundation version 2.- q1 h! B$ h1 |/ A1 P
  18. *' G9 O* k2 a0 N1 M' F. T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, w) f7 e: i8 n8 G# J
  20. * kind, whether express or implied; without even the implied warranty6 t* p7 |1 i+ r2 N. K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ h+ B+ X- c( _& b1 G! g$ c% W: M
  22. * GNU General Public License for more details.) a7 C, v' k# b7 ~! s1 K. e
  23. */7 L& J  \8 v; n& t% K- c% T8 h

  24. " m& r% f, X8 ^
  25. #include <linux/module.h>
    * P' `0 c* w& P: \; l
  26. #include <linux/init.h>9 x8 p3 V9 K* R) D0 [6 G% N4 ^
  27. #include <linux/errno.h>
    1 T1 G1 t2 G. w& i! }. ^. j
  28. #include <linux/types.h>
    $ p" a; i# h  L' `" D0 R/ x3 U( B
  29. #include <linux/interrupt.h>+ Q6 Q# @" ]9 f# f5 g0 n
  30. #include <asm/io.h>6 b' X9 o$ a+ i5 g
  31. #include <linux/moduleparam.h>% P, x+ D" r4 }+ F3 O
  32. #include <linux/sysctl.h>$ F' J3 K- a% m+ B, p1 a# d7 Y
  33. #include <linux/mm.h>
    0 i5 a6 j, M3 G8 h
  34. #include <linux/dma-mapping.h>
    5 n3 p: Q0 \$ m1 i: E
  35. 6 M" u  h, y2 j1 M7 e
  36. #include <mach/memory.h>& D5 f3 ?+ [9 I
  37. #include <mach/hardware.h>
    ; F4 C0 v1 t. Y, s! d; ]
  38. #include <mach/irqs.h>6 [: s, I$ R% Z& z
  39. #include <asm/hardware/edma.h>' G; ?  D  p3 B* f( |
  40.   K/ ^" W2 ~5 J1 y
  41. #undef EDMA3_DEBUG
    ) H% C9 S( I) x
  42. /*#define EDMA3_DEBUG*/
    5 A% q- a: p9 m7 G! ~

  43.   R" L$ M3 }9 d% q! I
  44. #ifdef EDMA3_DEBUG
    6 f7 x- }' Z" A1 G6 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), B8 }2 t  ]7 T5 ^" V4 q. o; U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& a- q5 L) O& V/ R( P  Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- k1 l! d: }+ K+ ?! g; G  E
  48. #else9 S+ D8 f$ U( R8 ^# H
  49. #define DMA_PRINTK( x... )
    ; \2 w$ G3 f% b( z  K# x" C# |
  50. #define DMA_FN_IN2 G2 F- a: b. |  S  Q) \
  51. #define DMA_FN_OUT5 }% Z, K& ^5 l! S
  52. #endif' R# D1 B* ^( Z" j' @

  53. ' n9 S; b, }2 d! o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # }% \. X! {3 J3 r1 ]5 a( I6 N
  55. #define STATIC_SHIFT                3
    % z) O# I" k1 j8 E/ b
  56. #define TCINTEN_SHIFT               20$ n# t* O4 g' H. v- S7 p. s+ S
  57. #define ITCINTEN_SHIFT              21
    - s6 z8 s0 F+ [. ~
  58. #define TCCHEN_SHIFT                227 t# K( O5 o$ s+ o) \1 K! h
  59. #define ITCCHEN_SHIFT               23  n4 M3 D8 v& [  c$ E

  60.   H# a- Q# [  y" j7 |+ m, m' C
  61. static volatile int irqraised1 = 0;
    ( r: P' N0 E( R- C
  62. static volatile int irqraised2 = 0;
    % D2 n+ a, Q5 Z% M" g. N

  63.   i7 U' ?, y% z. h8 p( P! j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# s1 ^# D4 E6 {8 u, u6 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 a4 V" E( `) a% `! x5 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Q3 o/ B+ p! b. i" L

  67. 7 M$ P( n. [1 F2 P
  68. dma_addr_t dmaphyssrc1 = 0;7 `5 f# e7 G# D9 K1 G
  69. dma_addr_t dmaphyssrc2 = 0;
    0 s$ t: _. Q1 q2 k3 T) m% p
  70. dma_addr_t dmaphysdest1 = 0;
    % K7 k1 f3 |* |) `
  71. dma_addr_t dmaphysdest2 = 0;
    8 A6 C6 u& `) g4 y

  72. " a7 ]( X0 n' c8 ?1 m% C+ b
  73. char *dmabufsrc1 = NULL;/ T$ z/ Q+ ~; X0 m; o) J/ O6 [
  74. char *dmabufsrc2 = NULL;
    & a+ V  k: G+ m& S( I" {
  75. char *dmabufdest1 = NULL;
    & [6 }% `& C( k8 z3 t$ x5 |
  76. char *dmabufdest2 = NULL;
    $ i. b; L1 p+ @% A
  77. 6 Z+ [, l/ o7 f( i5 I
  78. static int acnt = 512;& c& p5 C- {5 ?! E, B& h2 w, N6 U, e
  79. static int bcnt = 8;
    : n3 O" U8 S! `9 \
  80. static int ccnt = 8;8 c  p+ Z: @4 G9 H8 v2 q: J8 _
  81. 4 H: a7 B3 B! b# r% K
  82. module_param(acnt, int, S_IRUGO);7 B* O& ?7 \# }, e4 ^- E, D
  83. module_param(bcnt, int, S_IRUGO);
      m! d9 B' M9 Z% J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& A# `: d6 c0 ^; v9 G
0 V9 H# ~7 ?0 e8 A  f- q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ ~( m0 W+ M$ [1 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, Y/ i9 U& B: V$ x' U2 Y+ d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 e, \6 o7 J+ c$ Z$ b7 F9 u; J
# i! `% d, T  n( A: L( P$ w5 Z. r  ~1 Z  ~  s( f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 20:10 , Processed in 0.043065 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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