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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% |# F+ X6 @/ r% h
  1. [code]EDMA sample test application
    ; s# r5 B2 w: \5 z- ~
  2. /*
    $ n6 w5 O0 J5 x
  3. * edma_test.c- ~% _# c( T4 X9 z7 Q9 N7 {% ]
  4. *6 K7 t, S- b  i  Q" z
  5. * brief  EDMA3 Test Application
    2 P) C% Q7 I1 L; e, x* y
  6. *
    9 {8 W9 G, ~' w9 L+ K  E
  7. *   This file contains EDMA3 Test code.
    1 E  m) o7 ]5 m0 s
  8. */ @$ C' f* a6 m8 n8 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, X; Y/ |; K- i$ u" z# _7 P3 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. O$ p# ~& H& |" e) S4 j3 j- |" `2 w
  11. *         TO CHANGE.# o& N; J% i8 g' W
  12. *
    ! c9 C! H& o& G1 I1 U/ |" K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  x' x  U/ I* m% W) O
  14. *+ M6 J4 e( k/ i5 c
  15. * This program is free software; you can redistribute it and/or
    , q$ K4 {7 K+ {. S
  16. * modify it under the terms of the GNU General Public License as
    * e8 h. D& i1 p! i! @2 a
  17. * published by the Free Software Foundation version 2.0 u3 @4 b/ M' |2 o' a1 n
  18. *- s& i- c3 O  ]$ c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* `/ q, b: T% l4 V
  20. * kind, whether express or implied; without even the implied warranty
    ! i; e0 \  M' h  B7 I" v* g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 I( {7 P. @/ \" E9 G
  22. * GNU General Public License for more details.) H6 G$ X9 c1 k
  23. */
    % s: r! l! b  }

  24. . [, n" D' V1 \- g  W. F
  25. #include <linux/module.h>
    0 ?5 G( C9 h4 T) b
  26. #include <linux/init.h>& r2 W4 ^2 ]# A+ c
  27. #include <linux/errno.h>/ @+ F* P+ t- }. w: `
  28. #include <linux/types.h>
    . F, z! o% w0 _/ ^% U: [3 w
  29. #include <linux/interrupt.h>
    " j( R* _1 ?) L+ d7 b9 t& T
  30. #include <asm/io.h>  c6 H  K0 g$ X, _2 x% D
  31. #include <linux/moduleparam.h>
    - h" O# `4 k# Y6 p$ K4 \" [
  32. #include <linux/sysctl.h>  ?# m2 s7 C5 D
  33. #include <linux/mm.h>
    " n0 B# q# u6 H. @/ x! S5 B
  34. #include <linux/dma-mapping.h>" H$ Q; [& W4 T  o' F
  35. / K8 f3 [- R0 k2 P% W6 s' N$ w' o
  36. #include <mach/memory.h>! \2 |0 Q' ?+ C2 A# l9 c
  37. #include <mach/hardware.h>
    9 ^. a& e# n2 Q" W8 b
  38. #include <mach/irqs.h>
    0 D2 q* M0 Y( d
  39. #include <asm/hardware/edma.h>
    8 G# q( I, g1 `9 ]) P+ g$ c8 Y

  40. ) v4 r2 X4 s1 Y/ q
  41. #undef EDMA3_DEBUG( A! E0 b9 c& v) {% E$ b3 J
  42. /*#define EDMA3_DEBUG*/* ?% e& r0 U; v5 l

  43. 3 Z0 \$ T8 B1 X$ l4 W7 ^
  44. #ifdef EDMA3_DEBUG! X1 a+ Z/ I: M+ y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 k2 q$ P. e; N! \( K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). M! s' M8 V) C" X  Q$ [7 O3 O8 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 `2 e; Q3 [; [! P8 W
  48. #else
    ( _# L. _+ X$ j
  49. #define DMA_PRINTK( x... )( P( e4 B5 E  J; m
  50. #define DMA_FN_IN' `  R2 P! J4 A. ]
  51. #define DMA_FN_OUT
    3 K7 Q8 M) s: Z; B0 }
  52. #endif. K. D% K- ]7 _

  53. ' Q$ j( X$ q8 K7 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 ~# C9 T" d5 R
  55. #define STATIC_SHIFT                3
    ) i. ~' v# P0 Q. X
  56. #define TCINTEN_SHIFT               20
    / P+ H- p* |7 B
  57. #define ITCINTEN_SHIFT              21
    ' ~- K: d2 Q( ]0 {
  58. #define TCCHEN_SHIFT                221 H( Y! c. D) K: R, i
  59. #define ITCCHEN_SHIFT               239 ^7 u, k) z+ @9 J( ~9 w0 C8 [) O; q3 ^
  60. . j, {* h0 D" Z& U( ~
  61. static volatile int irqraised1 = 0;) G8 n9 a/ P$ I5 t0 C9 @: ^
  62. static volatile int irqraised2 = 0;
    ) r( d6 v: L3 g% Z# n
  63. ) V7 |( c: b( {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * r$ s# R0 o+ q& h6 `3 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 z: _* I8 t  B& s1 k1 m% {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 l& L5 _2 U, \5 a$ z7 s

  67. 0 T* j5 e9 y" K+ g, _+ i/ C2 Q
  68. dma_addr_t dmaphyssrc1 = 0;
    # @  n* ~9 M- h( m
  69. dma_addr_t dmaphyssrc2 = 0;
    ) f. k* L' s& ^  u7 ?
  70. dma_addr_t dmaphysdest1 = 0;  H: U6 M0 s0 W8 n, V# G) D  q
  71. dma_addr_t dmaphysdest2 = 0;
    ( N/ J; v7 t6 r

  72. * o, a. ], i& a2 ?* f
  73. char *dmabufsrc1 = NULL;
    ; f; D9 }$ o0 p( U/ T
  74. char *dmabufsrc2 = NULL;3 ]" L8 l  p/ L1 Z5 j( x
  75. char *dmabufdest1 = NULL;) L$ D- W) P/ y6 w6 J9 ?% b
  76. char *dmabufdest2 = NULL;
    # p( h8 j+ S& T$ \

  77. ! Y" b" {8 ]# y" H- j& ?8 Q
  78. static int acnt = 512;
    , s: n3 Q3 L3 i% k# v$ \" w" `
  79. static int bcnt = 8;) }8 l% w" j4 Q! S
  80. static int ccnt = 8;+ ]! M. M4 s6 ]; b9 a5 f

  81. + Q' u( k( N$ U; y) x
  82. module_param(acnt, int, S_IRUGO);
    8 t8 I2 x0 N- g5 j
  83. module_param(bcnt, int, S_IRUGO);
    ( Z" w7 J2 W- f8 H/ H: E8 q( y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ G& y; L+ X# K# q0 c" r- E6 Q
7 o& e/ r# N% j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 W) ^$ R. r3 W8 M5 G2 y+ sarm-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 |2 O: M8 X" X$ z2 {' p9 {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( a; k) ~5 N; [4 Q" W
8 l" W  w* f/ J+ X

. D* W0 ~0 o$ c! u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 20:20 , Processed in 0.039013 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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