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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 d$ {5 K5 q8 l" o" q
  1. [code]EDMA sample test application
    ) O5 h/ s9 {* T
  2. /*" W8 W; E# m6 _. _3 d
  3. * edma_test.c4 @+ z3 X% a1 k  |
  4. *8 o0 S7 l' C$ A0 h9 D' u9 A
  5. * brief  EDMA3 Test Application
    $ Y  ^; a: ]4 ]1 b+ z8 v* y
  6. *. I; R. F) u: e, ~
  7. *   This file contains EDMA3 Test code.! k7 b( c* p  j/ f* W: H. d
  8. *
    ! c/ b$ \7 y6 _5 }3 H2 N; Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! p* }2 [2 h$ _/ O0 n( V  |8 A2 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( f) J" V  V2 }" H
  11. *         TO CHANGE.' N) o+ P: w4 L6 y; E2 Z" M( `  q1 A" ^
  12. *
    3 _% G( ^" n6 v+ K: g  i3 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ p: A8 x1 R6 m0 ~* s/ L
  14. *
    - i% @6 E  O' i  o3 W
  15. * This program is free software; you can redistribute it and/or
    1 ~- P  s' C$ ~: |6 p# |6 H0 N
  16. * modify it under the terms of the GNU General Public License as
    2 m* m2 V7 l/ V" Q. q
  17. * published by the Free Software Foundation version 2.
    ) g5 |& h; L9 p# q5 F) g
  18. *- B! |8 r0 |1 S' U5 h- k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 r' i: o+ k; I2 q3 m% G
  20. * kind, whether express or implied; without even the implied warranty
    , Q1 ]1 E& p# O8 K5 p4 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - S- l! _" _7 \3 g* M* f
  22. * GNU General Public License for more details.
    6 u! y( l- C+ e0 p$ i* `" u, B
  23. */
    6 z- Y9 t8 M' t

  24. # Y1 W3 H  T/ T' y' o7 p, s
  25. #include <linux/module.h>
    ! G  P5 J# i+ i+ E2 a  L. ?
  26. #include <linux/init.h>8 U0 [$ i$ B( }, ]. M
  27. #include <linux/errno.h>" v: b. c+ c5 c( ~
  28. #include <linux/types.h>9 A; P! E! s9 r. W
  29. #include <linux/interrupt.h>
    & e5 F8 a, G3 N- Y! F3 N
  30. #include <asm/io.h>( X/ z  p  ?* U. V8 T: W! M' s1 H
  31. #include <linux/moduleparam.h>, e( I3 a4 {; D- R# d% _
  32. #include <linux/sysctl.h>
    8 [9 K1 d. k( x  V8 V8 g
  33. #include <linux/mm.h>: e1 r5 e" P4 j# ?. V. D
  34. #include <linux/dma-mapping.h>1 U" K, I5 |% W! \, U

  35. $ _3 k! E1 l* i; j- q
  36. #include <mach/memory.h>5 c4 F9 B. N: k' n4 H3 _
  37. #include <mach/hardware.h>7 d$ S. c# X( r9 U$ M# s: ^/ c: G
  38. #include <mach/irqs.h>
    # Y, i& u' `# L- V% N8 s9 {
  39. #include <asm/hardware/edma.h># e& M8 v. p( t* `
  40. - r- {7 s1 w: h
  41. #undef EDMA3_DEBUG& {" R) ?% S3 F' F1 ?
  42. /*#define EDMA3_DEBUG*/$ w: g; |: s% g9 O! q" ?4 m
  43.   R; [9 x9 u& Y" ]& a
  44. #ifdef EDMA3_DEBUG4 F- f1 ~+ O. T+ u4 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 ^5 n6 @- p& w) j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / t" z. f- j2 ~! |2 n1 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 `0 k9 G" ~) {- {' d4 n, M9 W
  48. #else
    3 c7 @& Z: T+ p' W8 r5 O
  49. #define DMA_PRINTK( x... )
    ; j5 @) M+ I" L) I8 c4 k" {
  50. #define DMA_FN_IN
    . B& _9 u  S+ h3 k* q% E3 k$ _- m
  51. #define DMA_FN_OUT# H) V7 T# E1 C1 c( P
  52. #endif$ b8 J! Y2 b- A, U+ u
  53. ' h2 x" }% [- j& j9 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# `/ G  F2 T, L- W4 m5 N
  55. #define STATIC_SHIFT                3( d' G/ v6 M7 g
  56. #define TCINTEN_SHIFT               200 R5 ^. K2 y- a" L- j, _" u
  57. #define ITCINTEN_SHIFT              21
    & X/ q* f" h" h: c
  58. #define TCCHEN_SHIFT                22
    6 [2 y' m) ]3 K" `! g* K; ]" T* M
  59. #define ITCCHEN_SHIFT               23
    , A/ i  [) E3 c' g$ w: s
  60. 1 m' a; d3 g# m! e# u3 c$ A
  61. static volatile int irqraised1 = 0;& Z# J1 o# [1 I& Z' F' Y
  62. static volatile int irqraised2 = 0;& C; c9 `+ C( n- p

  63. ! @4 I" p( e4 e+ _& w6 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ~, q9 ^! C) S" M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ [1 F5 E. R% `2 k7 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      a( u( k  j# I5 [$ p9 l, T

  67. ) b+ l( N: B* x$ b# V8 K
  68. dma_addr_t dmaphyssrc1 = 0;
    6 @8 y1 `2 S# N; `- ]4 A
  69. dma_addr_t dmaphyssrc2 = 0;6 O9 |4 w3 m/ }. S/ r
  70. dma_addr_t dmaphysdest1 = 0;
    ' C* m: T' c! m& s) ~; v2 P# J) S
  71. dma_addr_t dmaphysdest2 = 0;
    . E$ F1 f" g2 R$ \
  72. & V$ A, u8 L( X
  73. char *dmabufsrc1 = NULL;9 V) S$ K( Y$ Q; E6 @5 v, B$ k7 }
  74. char *dmabufsrc2 = NULL;
    / @6 ^3 I1 T& T4 h% O& {* h! |/ ?
  75. char *dmabufdest1 = NULL;4 n. d3 o( ~6 p: u3 f* j$ x
  76. char *dmabufdest2 = NULL;
    1 N2 b- t8 f3 ?2 c

  77. 0 E! m% C  H' b! ]( o& V
  78. static int acnt = 512;+ o" u+ i4 `* T0 j- U% {
  79. static int bcnt = 8;
    8 P8 f  H, o. h# O
  80. static int ccnt = 8;! c) R! `" ^  w

  81. " Z9 g0 C- T9 [0 ~# R. }
  82. module_param(acnt, int, S_IRUGO);# V+ ^. K8 `" C
  83. module_param(bcnt, int, S_IRUGO);* Q' I, i8 z  }$ P: J( c0 U$ p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ H0 T0 ^4 z+ P' z5 D% o1 l

7 F# o$ S5 Q" P8 h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ Y6 e( r  T% U2 ~# L# }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ~/ A9 @2 M7 g# @5 [2 Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 v% r1 b7 p5 O' a" q" h, d, f
* i) c9 x4 h, _$ n- K+ F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-30 07:29 , Processed in 0.039411 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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