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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; I1 {! h; R8 c: {; M
  1. [code]EDMA sample test application% p0 k/ U+ d# }- T' f
  2. /*
    ; h6 B0 V+ |: o0 ^0 Q
  3. * edma_test.c
    6 K! v7 p1 e& O
  4. *( |# O  A' |6 q$ @& ]: H
  5. * brief  EDMA3 Test Application
    5 Q* i5 D% K8 I8 p4 `
  6. *+ O6 _6 V& j5 T  A
  7. *   This file contains EDMA3 Test code.
    # M# Q0 l0 d* h, @( a3 ?
  8. *' [" [% A8 n. \! g; M; r: i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % y& o$ r( j$ I1 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      |: y4 C, j: H0 |7 C1 w
  11. *         TO CHANGE.: v, M$ _, ?; I! I
  12. *8 ?- t  k) C  T3 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 v/ f0 K5 q9 h  Y# |+ ]  \
  14. *; I" ^' C  V  U4 A8 B
  15. * This program is free software; you can redistribute it and/or
    + D+ E* j: b2 R; L- t
  16. * modify it under the terms of the GNU General Public License as
    ; q$ t/ `9 [" T  ?" a- A1 d0 p
  17. * published by the Free Software Foundation version 2.
    $ E/ u$ u+ u0 I8 Y6 R; m
  18. *: [/ [( d* j, p; n$ t# t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 q8 E. b: e9 h
  20. * kind, whether express or implied; without even the implied warranty
    1 v6 G8 o3 l. c* g3 m  b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 H, x! G& t( [2 n! w8 m% e- v  F
  22. * GNU General Public License for more details., ?7 D4 ]& s7 _' I
  23. */9 M/ M* D$ g, k0 h/ C
  24. 5 |+ _. ^- L" L7 t: `9 X9 f% k
  25. #include <linux/module.h>9 F# [7 c5 C0 k
  26. #include <linux/init.h>2 ]0 z9 G6 @& [4 E: l- ^, l
  27. #include <linux/errno.h>
    $ H4 u( }) u5 \  `
  28. #include <linux/types.h>
    ' R3 w; L9 H) M
  29. #include <linux/interrupt.h>& r, ?/ g& n* P" y' n
  30. #include <asm/io.h>' h5 N) d7 D; Q- W7 Q9 ]. ~+ J
  31. #include <linux/moduleparam.h>
    , [" C# ~; c3 V$ v( W; i! H' @
  32. #include <linux/sysctl.h>0 c! E* v* l- l( |. h+ g
  33. #include <linux/mm.h>7 z! W$ r+ e7 X$ q4 a/ z
  34. #include <linux/dma-mapping.h>+ u) u. ~5 s$ |

  35. , `# B) z1 W/ T! P
  36. #include <mach/memory.h>( t1 u. F3 q$ i( ^6 s+ X+ J9 G
  37. #include <mach/hardware.h>2 ]# g: X. P/ J
  38. #include <mach/irqs.h>
    - E  ?2 M, {5 l* C( x6 b, k, ~9 U
  39. #include <asm/hardware/edma.h>  e/ W  S4 t( }- i& K

  40. - ^" _$ }7 x( T8 z6 [6 z$ U' F" C
  41. #undef EDMA3_DEBUG
    8 ?( ]! @% |# P2 W4 Q
  42. /*#define EDMA3_DEBUG*/
    1 N" K$ f0 ~( r2 g6 [0 G
  43. 9 j6 b/ M& Y+ Q" ?' S
  44. #ifdef EDMA3_DEBUG
    . o! S) x8 L7 Z8 T6 ?4 G( c6 ?1 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ U$ a, z/ j9 n3 F8 P! [" w1 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 u( T  J; T* {, e3 T+ L; \/ }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) ]+ [6 o5 w/ E0 a3 ?5 C7 U, W
  48. #else
    3 ~8 V8 o$ |% a# B
  49. #define DMA_PRINTK( x... ); ?% @; Y8 d. @  {. P( W' C
  50. #define DMA_FN_IN# x  a# C: U6 O1 G" V7 \  `; k
  51. #define DMA_FN_OUT8 R$ w9 i* m# d5 m# K: n6 `
  52. #endif
    1 j7 ~0 D! U. ]! o9 T

  53. 5 }8 K* a/ Q  \3 l& p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); ^" b$ L  C7 x: P, b' K4 A
  55. #define STATIC_SHIFT                3: J( k/ s) A- H0 W
  56. #define TCINTEN_SHIFT               20
    & L/ x$ c  C5 ~& s  p# a
  57. #define ITCINTEN_SHIFT              21
    5 s$ U4 a% Y+ `9 P& C9 _$ d
  58. #define TCCHEN_SHIFT                22
    ! f# O9 l( U7 n; y
  59. #define ITCCHEN_SHIFT               23+ z$ `$ q1 T5 I+ }% z

  60. % N3 k) Z+ [- {! M  e
  61. static volatile int irqraised1 = 0;/ _  x- W1 t7 t( O9 S
  62. static volatile int irqraised2 = 0;' E3 x1 t; O8 z" I3 V& B: O* W
  63. . F, i6 `7 _" z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 G8 [7 Z1 v- P8 r  Y9 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - V+ ?+ K- H1 n, s" R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 c% O' _! ?% J4 |5 P6 v
  67. 8 E' `" D: C8 D' y
  68. dma_addr_t dmaphyssrc1 = 0;- x; t! d  l1 b3 |# v+ {& V
  69. dma_addr_t dmaphyssrc2 = 0;8 N2 g% {5 t* t+ |
  70. dma_addr_t dmaphysdest1 = 0;
    6 Z2 u+ x5 g" \8 s1 j, y3 ?
  71. dma_addr_t dmaphysdest2 = 0;0 T; ^" b3 B8 S6 O
  72. , o, V, [* T6 F+ F# ~
  73. char *dmabufsrc1 = NULL;$ {. ]% n4 k: ?
  74. char *dmabufsrc2 = NULL;
    . F' `+ i; Q7 R! S. f
  75. char *dmabufdest1 = NULL;8 r. r2 Z4 x- @, Q0 |% c3 t
  76. char *dmabufdest2 = NULL;: _$ V5 t7 U# ?  D1 S

  77. * U; [! g3 J( U
  78. static int acnt = 512;
    - W' K: j9 l$ o$ U3 T+ o
  79. static int bcnt = 8;' H) o4 _( |$ W7 l- S& d
  80. static int ccnt = 8;  G8 ^# k( O( n2 E* X' W  Y

  81. , i$ Z. z% j: w
  82. module_param(acnt, int, S_IRUGO);
    $ p9 |5 B9 n; l% z+ l3 s0 D9 k
  83. module_param(bcnt, int, S_IRUGO);* K' J( O. x( i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 m9 G) F0 K$ P+ u

( I. O+ s4 g# g6 C0 T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ B! j, l/ m& h9 w* d) y: X$ jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  p) y$ W9 `, U" _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& W8 v, w7 {5 J; ~. O1 u# ]% ~3 L$ T% \
# Z' H4 o1 E+ j' [$ T8 t. M5 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 15:16 , Processed in 0.039688 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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