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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ T: V& \! V" h& v* j/ p$ _) d  H5 P
  1. [code]EDMA sample test application
    . b0 i5 {* }) f+ x$ S
  2. /*0 r' `& o' w- t+ K
  3. * edma_test.c
    1 W; J, {5 L: \$ o% t7 i; O
  4. *3 {$ H) z0 C4 d9 O  n4 G2 L
  5. * brief  EDMA3 Test Application
    2 s8 ]8 R; m3 A5 x& p% ?
  6. *
    1 W( g% M* [7 x( }4 K
  7. *   This file contains EDMA3 Test code., m4 R) U! Z  T6 i
  8. *
    $ G! b! c; q) m* F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 u3 L2 k2 m8 [+ }: K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + i5 T' n% Y+ K7 q& X3 B
  11. *         TO CHANGE.6 F* S7 F/ y1 l0 G3 x6 E
  12. *
    " l" H% A7 i' C1 N2 X1 \; M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 A2 F- X# t  q# R3 ?5 K, n8 j- g; X
  14. *
    ' |2 }6 Q  d3 \# r6 L- X$ H
  15. * This program is free software; you can redistribute it and/or
    3 S1 X1 B- {5 B
  16. * modify it under the terms of the GNU General Public License as
    8 d2 L+ B1 {1 i' T# U
  17. * published by the Free Software Foundation version 2.0 f- Y# ?/ d7 S" k
  18. *
    5 q/ ?; l0 \! P8 D$ A9 L9 X* {7 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      }- X3 P; s: D6 b7 ^% \  b( T" w
  20. * kind, whether express or implied; without even the implied warranty
    $ E/ C, R. \: a2 t. W; B' P2 L# t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 A  F$ m2 l  T5 R; e8 P3 Y
  22. * GNU General Public License for more details.
    ( F/ p' ^( g, w0 C) H
  23. */
    ' l+ r" E" q8 P9 U* T8 ~% C  l) W
  24. 7 Z; w* l6 v7 X8 a4 h
  25. #include <linux/module.h>
    / G# W% g  P, p  T/ |2 W
  26. #include <linux/init.h>
    # B9 V& V5 k, v  ^
  27. #include <linux/errno.h>* m; N( C8 {5 W, Z5 o
  28. #include <linux/types.h>
    ) S' Q  d# Z4 Z
  29. #include <linux/interrupt.h>
    ( }$ \4 G9 C! C" Q
  30. #include <asm/io.h>
    $ A6 ~; Y; c/ N5 a# R9 d/ N& x- g
  31. #include <linux/moduleparam.h>
    ' l3 D$ g2 j3 }  ?7 Q
  32. #include <linux/sysctl.h>
    + P/ Y% e6 M3 j4 F
  33. #include <linux/mm.h>
    / H' G) O7 m3 ?2 E6 z
  34. #include <linux/dma-mapping.h>
    # Q. x4 u9 p+ \# l. K/ @

  35. $ K8 \! g9 J3 r: E9 P/ B- L2 K
  36. #include <mach/memory.h>( r% q0 A% O% ]7 O* j
  37. #include <mach/hardware.h>1 I& X4 c9 f1 P+ I" {
  38. #include <mach/irqs.h>; l+ v' o' E, y) ~6 @
  39. #include <asm/hardware/edma.h>$ M2 a) q3 v7 c
  40. 8 a3 z) d# g# Q1 u
  41. #undef EDMA3_DEBUG5 \" H0 g$ I3 z) p" O6 i+ M
  42. /*#define EDMA3_DEBUG*/3 U) z  R4 M2 R, C

  43. 0 k# b% w' p3 t/ `9 c
  44. #ifdef EDMA3_DEBUG) j# k9 x1 k$ ?* Z: n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ m' y# T8 q) p4 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 I5 I* z7 X& l! i8 B( G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - V; d" A- x; B( s: ?0 a
  48. #else
    - Z) ^8 G- D% @# g* o
  49. #define DMA_PRINTK( x... )  ^8 C, n: L; o
  50. #define DMA_FN_IN
    2 z. W( O& {+ ^, C
  51. #define DMA_FN_OUT
      s" U4 F$ n% P1 o  f
  52. #endif* B7 E9 N3 T) \
  53. 4 h# Y3 _% w* N5 b, z' L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). W; h1 C5 {2 i, g! o/ T! _5 E+ I0 ]9 Q
  55. #define STATIC_SHIFT                3. t  ?, J! e  Q- h! t- R. `
  56. #define TCINTEN_SHIFT               20
    % I" [, y# a( U
  57. #define ITCINTEN_SHIFT              21
    " \1 l% b# B/ O5 X
  58. #define TCCHEN_SHIFT                22
    9 }6 {/ ~; }  ~9 U& ^# O" S2 B/ H
  59. #define ITCCHEN_SHIFT               23
    & D) l: O0 N3 }, E2 s, O  K

  60. 5 F. r! s; x* d
  61. static volatile int irqraised1 = 0;/ d& j) Q5 h8 ~1 C
  62. static volatile int irqraised2 = 0;
    ! F2 [$ e! s  f

  63. 0 h! k' Z3 P7 j4 Y+ R* x8 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 f5 y* \, g# `/ e8 {+ }) ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  Y) l: M& k% s0 ^3 O& w0 h/ @7 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 m2 t* W) g2 h. S) }& u
  67. ! m; A: `+ J% q3 Z  ]
  68. dma_addr_t dmaphyssrc1 = 0;, ?% T6 W7 ^  @2 I" _3 X2 ~
  69. dma_addr_t dmaphyssrc2 = 0;
    9 e' E! P% T) b3 M# X
  70. dma_addr_t dmaphysdest1 = 0;1 C' C) y+ f7 \$ L8 p( G
  71. dma_addr_t dmaphysdest2 = 0;
    $ r) }6 q! i. y: F) c
  72. , M6 o  B$ f1 [; V. O
  73. char *dmabufsrc1 = NULL;
    ! [4 [( I2 P/ ^& H4 m
  74. char *dmabufsrc2 = NULL;8 j! p6 B; W+ ^. ~
  75. char *dmabufdest1 = NULL;
    7 k: T8 T# @8 X% M: r$ F) h
  76. char *dmabufdest2 = NULL;$ s' ^" t+ |4 w

  77. 1 e! W5 O& Y' k9 O5 h2 c
  78. static int acnt = 512;/ ]/ b9 Q( N; {1 E9 v$ [
  79. static int bcnt = 8;
    5 S' T+ F9 j$ ^: K/ U8 ^9 n. Q
  80. static int ccnt = 8;
    - g% H$ M& }7 h- A6 N- |! q2 G9 ]9 F
  81. $ M/ P5 Y% _4 J8 M, L
  82. module_param(acnt, int, S_IRUGO);
    ; {% N" ^8 [' s6 Y: i
  83. module_param(bcnt, int, S_IRUGO);& d) v& E9 W2 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 E4 H5 g6 D$ o) }% ^

7 s8 u" Z7 v9 h; C" ~$ ^7 Z/ _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# s% {- @, `, B4 d- m% K3 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 }5 t8 q0 w, K) T/ U7 T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 R; T& J6 `& h# \
/ d8 S* @8 T; `# Q' m5 D& U

7 l) d# [" o/ b0 c9 ^* I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-16 04:31 , Processed in 0.038867 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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