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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, {$ z; }$ f6 z$ I+ g0 F. a5 u6 S. b
  1. [code]EDMA sample test application5 n  W1 I8 x8 R0 G7 W
  2. /*
    ; {& Y% |# D9 v
  3. * edma_test.c4 \1 Q4 D8 @( `. P
  4. *0 D( C3 |) x' G) x
  5. * brief  EDMA3 Test Application) ?# i% Q; [8 y( b
  6. *
    . _4 J6 t* K, o2 [! E
  7. *   This file contains EDMA3 Test code.( j8 j; N3 F0 B# X
  8. *. J& S" y- Y/ m+ e& m! m( p! F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' J  O& {( F% L5 m# ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 B  J' f& B; N7 I* t1 M8 Y
  11. *         TO CHANGE.  S& I) s9 ~; C$ n9 M
  12. *" m7 ], i5 V( G, ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 m7 z; O# \( R+ J/ `
  14. *& n/ L8 {0 Y2 x
  15. * This program is free software; you can redistribute it and/or
    . U9 h6 R2 t+ [, z/ F
  16. * modify it under the terms of the GNU General Public License as
    9 o% L$ ~( \3 w5 Y: y; b
  17. * published by the Free Software Foundation version 2.  |/ S1 X0 o! A* ]
  18. *
      X0 r' H& n% ^% u, k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 @# o2 n! V, y  w
  20. * kind, whether express or implied; without even the implied warranty
    % I" h% c! V+ ^. u4 _& p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 G2 \& q6 @/ [! B1 Y( Q+ f
  22. * GNU General Public License for more details.
    ) n9 Q5 y3 R% H5 s  B6 H/ X
  23. */
    ( Q) V, A% a  [0 @% u9 ~
  24. 2 k' X: X! I# G. k
  25. #include <linux/module.h>! n. j& ?4 v2 \
  26. #include <linux/init.h>- s, [4 W  l1 f" Z& b: \4 x
  27. #include <linux/errno.h>
    5 l5 E# `8 m, d, J6 @
  28. #include <linux/types.h>& k" ^% k! X" k8 Z) R, J
  29. #include <linux/interrupt.h>
    8 [0 t- g) P: E& X
  30. #include <asm/io.h>: B& r# h* {7 k+ N+ U; I$ [
  31. #include <linux/moduleparam.h>6 L( l% D, q4 E
  32. #include <linux/sysctl.h>$ g0 v( t7 B, Q2 K% h1 P
  33. #include <linux/mm.h>8 [0 w4 I4 f, k9 j3 q$ F! s6 K4 O
  34. #include <linux/dma-mapping.h>
    3 ?( r7 L" x4 V; M9 C0 c

  35. 5 Z  v4 |# }2 B% Y
  36. #include <mach/memory.h>3 t& {( N3 y& y$ B
  37. #include <mach/hardware.h>
    ( x; c* |' I; G
  38. #include <mach/irqs.h>
    1 b0 R+ d' f* a9 p/ u" S* @: M1 S
  39. #include <asm/hardware/edma.h>' x/ H. X8 a- g. p$ G/ T

  40. 6 r0 m$ T' m2 H* K# ?
  41. #undef EDMA3_DEBUG
    0 T; k  Q- d4 t6 L$ M
  42. /*#define EDMA3_DEBUG*/! s( B7 x5 d4 w4 O% b& m
  43. 4 K6 k" [* x8 V* z" v8 ~
  44. #ifdef EDMA3_DEBUG% ^0 K2 _4 v! U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % T# {4 u6 [3 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + G% b' H- c$ t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 [7 }% u$ c* e* r
  48. #else
    * n. c7 N( f# ]& A1 |0 w
  49. #define DMA_PRINTK( x... )+ z6 N  p6 }0 l% B
  50. #define DMA_FN_IN8 Z7 H# s4 o0 r, i2 |% [7 C; Y8 ~
  51. #define DMA_FN_OUT% d% Y& e( ?4 M7 V4 k
  52. #endif- h3 Y7 T5 s; l. x

  53. . I: q' ]( x& ~0 }; I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 G" z2 y' M3 m7 S4 a6 v4 t- I
  55. #define STATIC_SHIFT                3
    1 w3 k: C8 D; J* v
  56. #define TCINTEN_SHIFT               204 }; m( U% y0 _4 Z2 U
  57. #define ITCINTEN_SHIFT              21
    % A/ t# ]# o* G! N: z5 u
  58. #define TCCHEN_SHIFT                22+ p0 Y) r. t# K  d; ^; P+ U' h
  59. #define ITCCHEN_SHIFT               231 r  C9 x2 y1 i5 H

  60. : a0 K" L2 w5 _" ]
  61. static volatile int irqraised1 = 0;
    ; P6 U' r; k. h* W3 [' F1 Y
  62. static volatile int irqraised2 = 0;+ o+ X! T- E1 K/ i" ~9 X8 G

  63. - N$ E0 E1 B7 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 A8 M4 M6 }) Y5 x! E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , [, J# n3 [; p+ `- D( K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" I0 k! [: Q/ a# X" h' R

  67. * X, I3 Q7 P9 ^% @8 p, o
  68. dma_addr_t dmaphyssrc1 = 0;
    6 G0 ^1 Y6 \1 X- [0 I4 }4 ]0 Y
  69. dma_addr_t dmaphyssrc2 = 0;- g0 S% u  s, V8 c' F2 @; z
  70. dma_addr_t dmaphysdest1 = 0;
    7 \4 i$ x8 m  F/ Q5 P8 v2 \
  71. dma_addr_t dmaphysdest2 = 0;8 O8 n% D4 \' J
  72. 2 P' f& J8 m5 O
  73. char *dmabufsrc1 = NULL;
    9 G( f( q) m0 n
  74. char *dmabufsrc2 = NULL;( |' c- ~2 {" m0 M- Y2 `1 A
  75. char *dmabufdest1 = NULL;
    ; R5 S6 l3 q) u" W7 e
  76. char *dmabufdest2 = NULL;* l; ?) B5 C1 q9 Z$ w( ]9 h% A: {

  77. * _5 t8 j2 x" o" ]3 a* V1 f
  78. static int acnt = 512;2 M" u3 C, o+ y: z" c  h7 b1 Y
  79. static int bcnt = 8;
    . E3 v5 o1 }/ Y) d5 E
  80. static int ccnt = 8;7 K/ u) U+ ?! S$ x7 H; @. S
  81. 7 |) j2 J/ w, |) R/ g  T" O
  82. module_param(acnt, int, S_IRUGO);
    " d' }  w" G7 t3 d
  83. module_param(bcnt, int, S_IRUGO);2 c0 d/ w2 Z! Y! M7 v+ @, B  J# N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" k4 U) ]. T/ v& r" V1 G7 E5 W6 f* D1 G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& c  R  V- V# J( `1 L) varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 G& r# w/ c, p0 Y, I6 x9 |8 p6 n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 l, y& }- A$ m& C4 s* v6 p, R. ~8 ^
6 G& K- a' w7 f- r8 `% q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 08:28 , Processed in 0.040423 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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