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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 N: J- L: c* L! b4 {2 b7 {/ w
  1. [code]EDMA sample test application2 r3 U$ ~% V# h. B
  2. /*, F. r  `% }( t. a% H
  3. * edma_test.c2 k9 v6 m% j" u/ t( A
  4. *
    ; H3 Q" O* L2 N1 V' x9 \( E" [
  5. * brief  EDMA3 Test Application+ l- T# l6 ~+ |$ Q, r8 i
  6. *
    + N1 m+ B, v( h* |3 K
  7. *   This file contains EDMA3 Test code.
    $ x- }! Y; M9 @6 p1 c* g
  8. *
    7 @0 d: G2 h5 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * O& K0 \8 M4 t4 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " ]# H4 a  t2 p8 `7 o
  11. *         TO CHANGE.
    9 r$ g9 i* s8 u8 f$ Q" K
  12. *
    7 h  C$ M! u6 J; ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! C! r9 G/ z* J+ V
  14. *& d  i6 ]! b' f; i5 i1 a
  15. * This program is free software; you can redistribute it and/or
    5 F) _1 O# n, S1 |2 @* _
  16. * modify it under the terms of the GNU General Public License as
    $ a& n7 [5 c+ c( {7 X
  17. * published by the Free Software Foundation version 2.3 Z: P( `+ f2 h2 u
  18. ** c6 W5 o) n9 F1 n4 c9 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ k* w+ n7 E6 g3 t; ?( O! e
  20. * kind, whether express or implied; without even the implied warranty
    ( R* |8 R2 B7 z' D* A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 p3 y) f% h, D, L
  22. * GNU General Public License for more details." w  _' a3 q, _' r
  23. */
    , m: _& U  y# o) E* r& Y

  24. 7 n0 S# d5 B2 Y+ p. N/ \  \- C
  25. #include <linux/module.h>2 ^) G2 k8 e; V% W
  26. #include <linux/init.h>
    % H6 W3 v! R6 F2 `
  27. #include <linux/errno.h>( }: |2 v" [" f
  28. #include <linux/types.h># c0 {" X$ J, ?/ i/ N1 D9 K6 D
  29. #include <linux/interrupt.h>& {! V: k# i9 ~6 R% H, l
  30. #include <asm/io.h>& o4 m) J' `$ m4 c
  31. #include <linux/moduleparam.h>
    & T# i9 v# t9 M  y
  32. #include <linux/sysctl.h>
    " Y1 s8 v& s3 ?. p; A
  33. #include <linux/mm.h>
    & Z# ?' K5 `$ m& c3 Z
  34. #include <linux/dma-mapping.h>. p; g$ ]/ t% A
  35. 5 X- T' T# G) u& B$ Q  e* N2 g
  36. #include <mach/memory.h>
    " N0 `* o* Q# a/ l. X
  37. #include <mach/hardware.h>, {) a& b9 w: B$ U) n1 S
  38. #include <mach/irqs.h>, o( X7 D+ ]$ _
  39. #include <asm/hardware/edma.h>. v  Z! U. L" V

  40. 6 H( z3 O  C8 |& m! W- i* _
  41. #undef EDMA3_DEBUG& C/ e1 k# O. U3 }; I
  42. /*#define EDMA3_DEBUG*/
    2 _( R- j2 ]2 B4 F
  43. ) Q6 A: K4 D) |% m* v
  44. #ifdef EDMA3_DEBUG
    ' M, g0 T! T9 ]$ N" `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & A# k" ^9 m' f( s# p1 F/ P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# \/ [& ]/ S, x/ P6 m8 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + n( R5 g% o2 C
  48. #else
    & x" }9 y) z0 K
  49. #define DMA_PRINTK( x... ): n+ a1 j: c" K$ |" T0 p
  50. #define DMA_FN_IN
    0 v% X  \& t# B; r
  51. #define DMA_FN_OUT! k5 G5 h# |+ e0 j0 l. M
  52. #endif( j! R% d( Q' c
  53. 2 b: F  r0 C6 S0 s/ I1 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - b" j! \+ R2 O8 w" @4 `
  55. #define STATIC_SHIFT                3
    4 ?! R3 c' N8 G
  56. #define TCINTEN_SHIFT               20. T/ {$ L; B! V# O% L2 }2 J
  57. #define ITCINTEN_SHIFT              21: p- C& U  m# K" R: L! r
  58. #define TCCHEN_SHIFT                22; Q8 O9 n( w+ Q( A% i+ G4 U5 l" ~
  59. #define ITCCHEN_SHIFT               23& k! f  K3 Y- }6 n7 h! x

  60. 8 o: t' X0 N: g& w
  61. static volatile int irqraised1 = 0;
    / n. ~* y9 M; r2 j% _
  62. static volatile int irqraised2 = 0;8 c3 @3 X5 K0 M$ e$ B6 b; x5 V

  63.   w$ D/ Z7 X" h) P: J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : E2 A  w; ?+ m) `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " K$ U' V7 Q5 T3 V' [& Q3 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 d0 ~. @  Q$ O/ N$ i
  67. 4 f# @' {4 q" i! k, ^1 Y7 _
  68. dma_addr_t dmaphyssrc1 = 0;5 t* s) G$ O9 R$ T3 ~) w
  69. dma_addr_t dmaphyssrc2 = 0;
    # M; s: V- b% I3 j4 X7 ]" R
  70. dma_addr_t dmaphysdest1 = 0;+ n, f6 D6 [0 j& P' f  Q6 G' {
  71. dma_addr_t dmaphysdest2 = 0;% v1 R, m' [. t8 A3 }1 f

  72. 8 P+ q3 k$ {% Z/ M- C5 G
  73. char *dmabufsrc1 = NULL;" b: c1 |% m; m5 \& }
  74. char *dmabufsrc2 = NULL;+ \, a8 @/ `8 c+ g1 x. A! {
  75. char *dmabufdest1 = NULL;9 c9 ^$ u+ ]* Q
  76. char *dmabufdest2 = NULL;
    1 v- @( Q7 Z/ c3 n% J7 \

  77. 8 |. W  K$ A4 p4 @5 G: F
  78. static int acnt = 512;& m# Y1 x8 ^6 y/ q' ?
  79. static int bcnt = 8;
    2 H) T1 z8 d1 r& s0 f' r9 c
  80. static int ccnt = 8;' @; E. [2 {5 T4 M8 n- _

  81. 6 u8 L% w  i2 h3 ]
  82. module_param(acnt, int, S_IRUGO);2 `- u6 s7 N  ~5 }( J
  83. module_param(bcnt, int, S_IRUGO);" V9 a5 L* K( ?2 |) a7 l9 i/ U" C1 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" i# N$ o4 F+ I- p% V4 e. z! z5 h( D' l( }% i2 P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; \0 R& q" @$ f8 {5 T+ }- d1 n( ?" ^3 ~; D! O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! _, A( P, _7 \9 ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; n+ M6 h* i5 N! X- f1 q

% \7 V; K3 i) f% r' l& N8 A9 r' M5 w9 {' @* _7 F* p" o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 13:14 , Processed in 0.053876 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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