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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 j" K  U, ~  l% `: G
  1. [code]EDMA sample test application
    ' V# U& v% K  [& T. h! S6 f/ x
  2. /*
    " ]) p2 {/ d: G$ f" U0 G% w- R
  3. * edma_test.c) [% a, I# G4 |/ @& c4 U
  4. *
    5 m* ]7 @! ^" K" p' s3 Q
  5. * brief  EDMA3 Test Application
    4 H' S  P  L4 W# s* V! }0 ~
  6. *
    3 d2 d2 |- X" f! R
  7. *   This file contains EDMA3 Test code.1 h. I. S1 m7 `
  8. *6 W- _- N* E! a  ~  Z* I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 c; g; h$ k0 `' ]/ Q! J, X1 B5 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- v; G& X, h" ?1 V( J4 q
  11. *         TO CHANGE.
    ; v9 f+ E4 |4 ]8 |& D
  12. *
    ; f+ w# C3 b0 T! M. b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " u2 d  f6 I0 R* P7 ~+ o
  14. *
    3 T4 ]6 r# f' a. b* M
  15. * This program is free software; you can redistribute it and/or
    5 Z& r, E- V+ x/ M2 R3 Q1 Q- X
  16. * modify it under the terms of the GNU General Public License as: L+ D: a- X+ P; i& m9 ?
  17. * published by the Free Software Foundation version 2.
    - v0 y0 g9 o) \: p6 H
  18. *' L1 S9 L2 Z1 }( h9 T' S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 _3 q; S5 W2 o  q! A1 u
  20. * kind, whether express or implied; without even the implied warranty' f- R9 P& x' @' ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , O* S$ A( h1 ?& `  I9 A# @) D
  22. * GNU General Public License for more details.
    0 Z3 N6 f, f5 j6 @& C1 n+ w
  23. */( c, Q) D4 m' ?2 o; l
  24. 2 R$ T9 E. D) S7 z1 [
  25. #include <linux/module.h>5 T4 M# l5 \/ @  E3 t! @
  26. #include <linux/init.h>
    % I' `& ^9 m8 b& M, R. _7 Q3 L
  27. #include <linux/errno.h>
    - Y3 {& j5 x& \
  28. #include <linux/types.h>6 L' b; Y5 y' s0 p! w
  29. #include <linux/interrupt.h>
    * I7 A$ o( P4 m( B
  30. #include <asm/io.h>
    - I) R0 Z+ _$ r5 y
  31. #include <linux/moduleparam.h>
    9 D' {, `' k( \( C
  32. #include <linux/sysctl.h>
    8 L: t" h; Y, E' _' t4 j1 c
  33. #include <linux/mm.h>' `2 v4 {0 p9 d1 i- B2 P
  34. #include <linux/dma-mapping.h>
    ' L  u4 r! k: `& H4 t7 O+ a

  35. - ~! |% }9 P7 W
  36. #include <mach/memory.h>
    8 p2 [# V2 G9 C
  37. #include <mach/hardware.h>. }" E6 B: G' P4 y
  38. #include <mach/irqs.h>: Z% J  r/ T% B5 e" e6 J/ J) e! S
  39. #include <asm/hardware/edma.h>
    2 D! L2 ^  g6 {3 `$ l! ?( {2 L
  40. 5 o, ~- V* l, z0 O, g. F# f5 D& ]6 g5 k
  41. #undef EDMA3_DEBUG( M# N5 s6 o; ^! {( q6 L
  42. /*#define EDMA3_DEBUG*/
    0 S7 k# d- ^5 Y: G+ O
  43. 7 ?2 T7 y& w0 }
  44. #ifdef EDMA3_DEBUG
    # l# t3 @7 I- _% a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 s# `' N5 U. j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ M" {) n9 n. N' s# p" {& v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 p3 {/ ~' J8 e1 E8 z% ~5 h
  48. #else: d* ]9 ^; u* [( f% m5 w$ v
  49. #define DMA_PRINTK( x... )+ P/ @. }! e" |
  50. #define DMA_FN_IN
    % l; y8 G, N/ p  `- [7 u
  51. #define DMA_FN_OUT
    & G6 u& a3 G% y
  52. #endif$ S# i$ j( y" w, o3 A3 s
  53. - v' d+ U) @4 K+ i  i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% Q9 ?8 l/ `; f4 o, x" A9 D
  55. #define STATIC_SHIFT                3" Y5 P- k4 }0 }) R$ d) F* g
  56. #define TCINTEN_SHIFT               20' x( {. U- O0 z
  57. #define ITCINTEN_SHIFT              212 z& X: O- V$ w% Y; [
  58. #define TCCHEN_SHIFT                22
    7 k* q6 V  ^$ D6 M
  59. #define ITCCHEN_SHIFT               23
    , u0 c- A2 q- L/ \9 E# V* [

  60. 4 e% x; [% a0 W; A5 k- i+ e
  61. static volatile int irqraised1 = 0;1 H; C8 M% M% z
  62. static volatile int irqraised2 = 0;6 r5 L3 P# c, h: ~

  63. % Z6 n; ]! a: p/ ?. _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % P% U" a: o% m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( M# W" @: L, j* D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 |" [; i& g  l& Z: v2 E

  67. 9 [1 @4 r2 {- P" t: U. N
  68. dma_addr_t dmaphyssrc1 = 0;
    7 G& `: R: M5 I! y' @$ B6 l: n
  69. dma_addr_t dmaphyssrc2 = 0;
    ; K  i, D4 p2 q6 m% W8 g  o" c9 Y, `
  70. dma_addr_t dmaphysdest1 = 0;6 p! ?/ }/ ]) B: x8 @
  71. dma_addr_t dmaphysdest2 = 0;4 F, ?6 v# {6 G/ J. ?" G
  72. + T( n& V8 r. O( |: {' H5 n- x7 D
  73. char *dmabufsrc1 = NULL;
    . `, v) J5 T) S& `3 X
  74. char *dmabufsrc2 = NULL;
    ) A; E/ p& C2 ]; q
  75. char *dmabufdest1 = NULL;- z4 c! j: i( p5 g/ t9 w# q
  76. char *dmabufdest2 = NULL;0 d, O; l( E) W

  77. 8 y9 [2 B7 A8 C# D! k9 H
  78. static int acnt = 512;# a3 V1 X/ m4 |1 d9 p& v/ o; O  j
  79. static int bcnt = 8;; B0 I" _+ `% ]
  80. static int ccnt = 8;$ d0 \% _& E4 c+ |' i) w9 O$ B

  81. , L. `: d: k( w' \. Q2 }- [" c3 ]
  82. module_param(acnt, int, S_IRUGO);4 f) ^* e' {, t# X3 I) }
  83. module_param(bcnt, int, S_IRUGO);7 k. [" n; X1 M: w1 t6 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 ^" K! z: p, U  \
+ Q$ x! t. n! ~; S. h& v( l' {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 A6 g7 E; @! @3 v6 l" b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 Q* h5 x& h0 w2 R$ ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: h7 e5 ~! o+ [! B$ R7 n( `
4 _" i3 n7 i+ e8 y+ @# p" C8 P
4 z1 I. ^* M- O3 A! w5 m# R# L- }1 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 11:13 , Processed in 0.054675 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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