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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # r( B% }, `9 C9 x* Z( D
  1. [code]EDMA sample test application
    8 L: d* U6 X) O( A1 R2 o& ~) Y& S9 E
  2. /*
    ( F/ B, u1 v( h* G
  3. * edma_test.c
    ' c" O  K/ v! d/ T3 r
  4. ** {0 k) Q% K* q% f
  5. * brief  EDMA3 Test Application  l" A/ ?' V" Y$ w
  6. *- }% Q  Y/ b% ]1 b: ?& ?1 ^3 y" q* q, R
  7. *   This file contains EDMA3 Test code.4 E6 J7 b, R3 D% F9 b
  8. *
    5 H1 S' T; W5 E: H+ B# w5 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  Z( t6 H5 S: r. x( H1 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 B& V% a% ?  C# }4 l/ |6 t2 O
  11. *         TO CHANGE.
    6 t! E" ~5 m$ v
  12. *
    " f0 Q9 r4 r& P0 s: H/ z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; u, a) K: J' h! n
  14. *
    ( x# d) N' |, a
  15. * This program is free software; you can redistribute it and/or0 g7 Z3 K# P+ ?+ j, \
  16. * modify it under the terms of the GNU General Public License as* ^0 G* i" m7 M
  17. * published by the Free Software Foundation version 2.
    9 Y: l: E) ?8 s' \0 \8 g( u
  18. *
    + F+ f- R2 D' e/ x- p& d. X- |6 v$ {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  I- l( t0 z1 |# W
  20. * kind, whether express or implied; without even the implied warranty
    7 L) W0 v7 ]; b: s# v4 M2 B7 K) x! _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 c- I1 i; E( o* ?
  22. * GNU General Public License for more details.2 S- z" e  {4 O+ @
  23. */
    0 Q: ]3 u$ a: \) m* X2 S
  24. ) [5 I8 q) u1 @
  25. #include <linux/module.h>0 i2 {2 ~1 W# ?" i- }
  26. #include <linux/init.h>. p; [+ u0 V8 H$ f$ i% t$ J8 g
  27. #include <linux/errno.h>9 n& k2 \; T! E5 w9 W
  28. #include <linux/types.h>
    $ ?. k" m- l* Y5 L, W9 D
  29. #include <linux/interrupt.h>
    % c$ N! Q) F, B
  30. #include <asm/io.h>5 Y% W" H* v2 y8 `" m! ]9 {
  31. #include <linux/moduleparam.h>
    " r/ P5 i3 p9 G- _" Y
  32. #include <linux/sysctl.h>
    4 |9 l: g1 O3 x
  33. #include <linux/mm.h>4 w& g- H4 Q' r6 b
  34. #include <linux/dma-mapping.h>
    # O/ M( N" q$ _' [' N- o
  35. 8 y2 X* I8 M" V) a6 S% I- \
  36. #include <mach/memory.h>$ o. h5 ?% n8 `# d
  37. #include <mach/hardware.h>
    # @9 L9 K* m# Q& K6 w
  38. #include <mach/irqs.h>
    " v, C. ^  _: Q0 f- {: \; B, j
  39. #include <asm/hardware/edma.h>) `& h) Z+ \6 S  S4 W

  40. / n' E4 @; f3 v  }) I' V: Q7 b
  41. #undef EDMA3_DEBUG
    * T- r, h$ J4 D; q: W
  42. /*#define EDMA3_DEBUG*/+ s7 {3 s: d# l) d
  43. ) Q8 X. z0 }4 p* J
  44. #ifdef EDMA3_DEBUG6 T; H! V9 ]; v! ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 ?; L+ r% W' U( j" F; w, a7 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 f" w* |& E! h  F5 I3 ~7 ?. m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 h4 K, W: z. F% l" r8 X& e
  48. #else6 R$ ^+ X& A# V8 k
  49. #define DMA_PRINTK( x... )
    & q, M+ j/ V, @8 E; t( K
  50. #define DMA_FN_IN8 C4 x; h1 L2 C$ T% ^2 k" |, i0 w6 B
  51. #define DMA_FN_OUT2 k+ V6 D* b3 G* Z; Y
  52. #endif: u$ u% E  C5 p% M9 J' ^9 Y2 ^
  53. 4 q- m, G  \% W* q5 e/ m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / c. v( T: j8 ]5 A. Q7 _7 m& s
  55. #define STATIC_SHIFT                36 \, C# S" f/ s, z) j
  56. #define TCINTEN_SHIFT               20
    ( k  B! |" H: P$ B
  57. #define ITCINTEN_SHIFT              21: O9 f. C: x9 l& H* t+ c) J
  58. #define TCCHEN_SHIFT                22# h9 d9 o# G9 r  e. ?. W. z
  59. #define ITCCHEN_SHIFT               23
    , f: R( [8 n# r+ k( U

  60. # O/ r  }& W  R' U. V  r, u
  61. static volatile int irqraised1 = 0;7 L* M1 v" W: m. }6 a& Z
  62. static volatile int irqraised2 = 0;  p' j+ }/ @2 g
  63. 2 Z; l! J+ H( h1 u$ ~% |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 S$ D4 Y  ?5 [; B* I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , U8 F' u: o3 V1 i; T3 l( x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 z/ F/ N4 X- e  P5 q
  67. ( f: E# d7 P, m( y" P* i0 L( g& J
  68. dma_addr_t dmaphyssrc1 = 0;
    . ]4 y/ U' h) `
  69. dma_addr_t dmaphyssrc2 = 0;# }+ K  u- K5 l" `2 k
  70. dma_addr_t dmaphysdest1 = 0;
    + T# A8 {9 \# [  B; Z# t% V( o( @
  71. dma_addr_t dmaphysdest2 = 0;
    ' ?+ l+ t. H" h  ^
  72. * O: ~4 U) |$ `- h' Q/ c
  73. char *dmabufsrc1 = NULL;
    7 T& e$ @" K3 ]/ c( D
  74. char *dmabufsrc2 = NULL;
    ! Q: t; Q- ], R5 J" e: A) H
  75. char *dmabufdest1 = NULL;" C4 B9 s8 K( L, g1 W$ c6 G
  76. char *dmabufdest2 = NULL;. o: t  O, h- U4 m% ^

  77. : ], W* V) @# _8 ~7 I4 Z$ y, A
  78. static int acnt = 512;; e$ }; I4 {, ^2 X$ I5 p5 X7 G! Z
  79. static int bcnt = 8;% s5 M) N( c/ T' w' o
  80. static int ccnt = 8;4 E6 ~) |7 E! G' M1 d" V
  81. 0 l3 T" B5 S- w
  82. module_param(acnt, int, S_IRUGO);
    - R* c% F' z6 l" H0 N" @# q
  83. module_param(bcnt, int, S_IRUGO);# _6 h& t. ?6 @$ Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 Q# s) V' T* c, J0 l% d7 p8 v4 p
; i! S% H2 E8 [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- w5 j0 J. m9 F3 A0 E! S" Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' \- N/ r5 X: M( ~$ x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 T  |3 |5 `0 C6 C% i/ }! W& }; E3 d2 ^5 |! K+ \% v/ {
. f1 D- _) o3 [' r: a# L+ Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 23:16 , Processed in 0.038987 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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