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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' k) c/ R3 D% ]2 Y
  1. [code]EDMA sample test application
    2 j- |* X0 H; r* k
  2. /*
    6 P* ~/ K) q" b1 M2 h$ s5 I
  3. * edma_test.c
    . X$ [$ X( j7 d. P7 {9 ?( A" s. K# |
  4. ** |$ A9 S- d& r+ P& B
  5. * brief  EDMA3 Test Application4 H6 ?8 B% n8 H! b& s6 F' Z0 F: W
  6. *' Q/ i5 H1 f8 c2 h! u$ ?+ h
  7. *   This file contains EDMA3 Test code.3 e+ x% m- ^6 y9 E& q. u% N4 i
  8. *
    + v' B8 y, ^9 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 ^$ K3 [: ^. w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . R1 e5 y* j2 v
  11. *         TO CHANGE.. p/ L5 Q! f: n
  12. *
    . b4 j3 x! J* S7 L$ m1 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( q- s) u5 B( z+ n9 y
  14. *
    , }2 u2 S' o6 P1 Y
  15. * This program is free software; you can redistribute it and/or
    : _6 E/ q4 y5 w  o! U
  16. * modify it under the terms of the GNU General Public License as
    ) e1 Q. D; ~. c$ R# Z3 ]: B
  17. * published by the Free Software Foundation version 2.) R) J$ H; O$ u
  18. *2 \" p* T+ |- w% ?" u  @+ g$ }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, a. I4 `9 M1 v( [
  20. * kind, whether express or implied; without even the implied warranty: ]# n9 H5 u# R  ]& C; U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * G( w+ n' H: Y8 S. u2 o6 f9 i) b
  22. * GNU General Public License for more details.; l9 g: a4 x$ v- z0 Y9 _& D- `
  23. */
    ! ~) T, a  ^2 V* h) k& b
  24. # f- u$ j! T3 `$ |4 \
  25. #include <linux/module.h>
    * I% ?* {6 B4 A; {- r
  26. #include <linux/init.h>  N$ K; Y6 {4 |# Y8 f
  27. #include <linux/errno.h>
    4 H0 Z" C# }- X( j0 R% f9 g5 J
  28. #include <linux/types.h>
    4 T- q- a; U7 n9 V: a% L# L
  29. #include <linux/interrupt.h>
    . e8 ~* v* q9 r( i5 c+ v* X
  30. #include <asm/io.h>) ~) J5 k2 C3 W0 B$ r! f4 p. o  k
  31. #include <linux/moduleparam.h>% b/ j$ a( \0 y4 h  ^7 F
  32. #include <linux/sysctl.h>" s% C0 f4 W1 h5 u8 A( w
  33. #include <linux/mm.h>4 P& `- T! L0 W* O; N- F8 R5 {
  34. #include <linux/dma-mapping.h>( }  h: Q% q9 f* M5 m% g8 {/ ~

  35. 7 u2 @" m5 Q& k5 i
  36. #include <mach/memory.h>7 V& D0 O9 M9 S# i: ~
  37. #include <mach/hardware.h>
    ' Z+ m/ i3 |8 ~3 N
  38. #include <mach/irqs.h>
      x# o4 m* B6 Z. d3 c+ I
  39. #include <asm/hardware/edma.h>: K# [2 T5 ]6 g9 S- y

  40. ! b+ `7 f2 [$ O5 J! s# m
  41. #undef EDMA3_DEBUG
    ' C, O% ]2 P* n' R4 Q2 `
  42. /*#define EDMA3_DEBUG*/1 k& h3 L  S8 N% U+ ^

  43. - ]5 |/ y+ H) b& Y/ q
  44. #ifdef EDMA3_DEBUG
    $ M$ I& L+ c) {0 c' ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - ?1 h  y) |+ T( a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ?( v6 c# P* ]' v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ R* L9 D# [8 M0 l
  48. #else
    3 b3 c, }- G% Q
  49. #define DMA_PRINTK( x... )
    * ]. C8 }( b. Y4 g
  50. #define DMA_FN_IN
      w' l% y; v9 @
  51. #define DMA_FN_OUT3 I& ^  k# t$ j$ Y$ x+ }- V
  52. #endif8 {; H, J) o+ N. E& B  l) T
  53. ' {. q4 U+ o) X5 Y) H) P1 F$ L4 x1 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# e8 d& d$ v" p9 C) o; B
  55. #define STATIC_SHIFT                3
    6 L# L6 m. H( v6 `& @; f
  56. #define TCINTEN_SHIFT               203 t8 |$ U* z7 S1 n
  57. #define ITCINTEN_SHIFT              21
    " R- x: ?1 b, U. a3 m5 t! h$ \
  58. #define TCCHEN_SHIFT                22
    : ~7 U* N( f) R/ q. ^
  59. #define ITCCHEN_SHIFT               23+ a! i+ u  K, T1 O2 m
  60. " R" ~1 n) l: J: o
  61. static volatile int irqraised1 = 0;
    : P8 w5 a7 p) z. u9 m$ q  p
  62. static volatile int irqraised2 = 0;3 s" ]! t+ p$ s; K
  63. 3 D; k: O- k" @% o2 m4 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ E/ j+ z! Z& `' ]- y- ^" b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, M5 O" Q8 g9 B. J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% i3 k: ]* g. D& l! H

  67. / g% v5 r; Q0 C
  68. dma_addr_t dmaphyssrc1 = 0;
    % k1 I  V6 M- T1 q5 s$ g
  69. dma_addr_t dmaphyssrc2 = 0;
    * V. k! x5 {8 F" ?1 z
  70. dma_addr_t dmaphysdest1 = 0;: M- V* Q) ~0 y2 R
  71. dma_addr_t dmaphysdest2 = 0;: q2 U$ m# C9 i4 z, M: k0 f7 \$ T: s
  72. " F3 |5 G' y9 g1 X  w
  73. char *dmabufsrc1 = NULL;
    & p% X8 Z5 Z4 j: f' N/ D
  74. char *dmabufsrc2 = NULL;+ L5 |5 U1 }5 |$ c' ]6 x( ?
  75. char *dmabufdest1 = NULL;
    8 o1 ?' r. _% ]3 p9 O$ m5 [
  76. char *dmabufdest2 = NULL;
    9 @/ U5 `; p6 F0 r9 `

  77. 1 P7 @& X  N3 ^. i
  78. static int acnt = 512;- e8 b8 N1 g% g) `$ \
  79. static int bcnt = 8;
    ' S  t0 i/ O5 F1 Q0 ]
  80. static int ccnt = 8;, i+ o3 D4 F3 j- d! V( t

  81. 0 p' Z) p' O7 \  Z; N3 |
  82. module_param(acnt, int, S_IRUGO);
    " Y/ u2 q1 a6 a( d- q; p, N
  83. module_param(bcnt, int, S_IRUGO);9 p3 j1 I2 |$ e4 l8 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 E- Y9 r/ B6 J( d: k/ X' ]
3 f  F% r+ {& w& H" Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ n' w8 `4 Q7 ^. Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 L/ a3 `+ J) X7 y! C1 `6 y1 z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 c  R5 m6 a; d! w4 D

8 D* u6 O9 T: C: d" N. L$ }& S. ]$ G2 u4 S1 a( k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-8 06:58 , Processed in 0.038008 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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