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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : `" h* h4 ], F5 t9 }7 J4 k
  1. [code]EDMA sample test application
    1 E" X5 _2 j2 ~: Y5 P
  2. /*6 S8 {/ A4 K3 ^, N
  3. * edma_test.c# B# z- U& G. [/ R
  4. *3 o; h0 T* t- G, {7 ^4 r
  5. * brief  EDMA3 Test Application
    $ m; I. M4 @, e
  6. *8 h2 j, \( o5 u8 Z
  7. *   This file contains EDMA3 Test code.3 n* j; q( m2 ]( a1 j
  8. *
    $ _6 E  L, C" z! d) A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: S7 D/ Q4 w7 B; L' f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ ?+ U; y, l6 V. \
  11. *         TO CHANGE.
    7 A/ E# W+ d/ k
  12. ** v) m0 {  v: t+ j" s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , v( b" m1 w6 w7 B5 K7 l8 k4 {6 F
  14. *
    1 j% H% }1 R4 C' a
  15. * This program is free software; you can redistribute it and/or
    : V& l0 A& P5 T% I7 N) P
  16. * modify it under the terms of the GNU General Public License as
    ( r" }: h5 @% |0 r7 g
  17. * published by the Free Software Foundation version 2.' R( c0 M9 _: ?: |' S
  18. *9 Z' U& s4 w8 w  t( U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ B( X' T  E7 x% C  U) Y$ Y9 c: e
  20. * kind, whether express or implied; without even the implied warranty: z* D2 [7 D( j6 @& A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , s  Z" p$ L, n! ?
  22. * GNU General Public License for more details.
    % s; i8 S2 f3 K1 b7 n6 [/ g* X7 {
  23. */
    3 c; M0 |: _0 G: E/ u: ]  [

  24. $ _7 t$ P- R) l& K) D- c2 A
  25. #include <linux/module.h>* p2 d. |  U. T
  26. #include <linux/init.h>
    4 @/ m( y/ h, H
  27. #include <linux/errno.h>6 X# E0 e. @5 ]+ v6 Q
  28. #include <linux/types.h>, i8 J2 f( E. r9 z5 o
  29. #include <linux/interrupt.h>7 J3 k9 R, F' w. c
  30. #include <asm/io.h>
    ) ^7 r: @: A3 i* O; Z, ]0 X- l
  31. #include <linux/moduleparam.h>
    ! f3 C7 I1 _0 g0 G. @
  32. #include <linux/sysctl.h>, i1 P# b* o9 ]4 }+ |1 S
  33. #include <linux/mm.h>
    9 A* ]2 n9 R/ R; m: j
  34. #include <linux/dma-mapping.h>
    3 M. w+ s2 y8 h) F) G/ g
  35. - u8 \7 b2 M6 v1 V2 A
  36. #include <mach/memory.h>
    : J" V  l/ n4 ^% n
  37. #include <mach/hardware.h>
    - L9 _" z) ]4 [# X& ~* ]
  38. #include <mach/irqs.h>' s. M) _& W- u! d5 R# E4 ?; A0 x
  39. #include <asm/hardware/edma.h>( v" k, c$ ]0 o& C! d. u; B2 G, x

  40. + D9 c/ K! e1 b: _6 m/ H
  41. #undef EDMA3_DEBUG
    ( O: u- J  t5 v( b8 k, F
  42. /*#define EDMA3_DEBUG*/) \0 v# A; X. E. A

  43. 8 @. D( ]1 D& S+ L+ y. z. \# k
  44. #ifdef EDMA3_DEBUG
    9 h7 R0 y; r7 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + W3 q6 V6 E; C' ~. K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ |2 M6 G. v8 _7 J* @' p% d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; T" g9 ]3 L+ `% G6 P7 n
  48. #else
    4 [: v  m) P$ Z' e% S6 n& ?
  49. #define DMA_PRINTK( x... )
    ; V/ G1 h7 v& g& u
  50. #define DMA_FN_IN
    " F' s0 {8 h! ^0 S
  51. #define DMA_FN_OUT$ `4 x- N$ ^. S1 R+ e4 x0 |
  52. #endif
    * I' i/ k: }3 V

  53. ' t! y+ i- h- j$ K; y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 L: y6 M' ~7 ^, ~- s2 G- n
  55. #define STATIC_SHIFT                3
    9 H: d6 v, H3 G- E, v2 w; Y
  56. #define TCINTEN_SHIFT               20
    : _3 P* q* y1 x6 T' ]* y" E; U
  57. #define ITCINTEN_SHIFT              21
    8 q: @( y5 y' z$ V9 L
  58. #define TCCHEN_SHIFT                22
    6 }7 W! T+ a9 g. D
  59. #define ITCCHEN_SHIFT               23$ W! E1 O0 r3 |+ Y+ _% I7 z5 ?
  60. 7 h8 F* A' X* E% Y+ c" s
  61. static volatile int irqraised1 = 0;& [  o* Z% G6 Y5 o9 h
  62. static volatile int irqraised2 = 0;( A1 |: _0 Z: Y8 P0 @# b$ z3 c( s- v

  63. 1 m' G1 p* K- I, K% y6 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 M9 @0 e: u3 k6 y+ B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ~5 h+ X0 v& ]* B: X" P0 l* z+ n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 e4 R. h  c6 X$ O# O
  67. 6 N: f: N5 L' ~4 M* ^
  68. dma_addr_t dmaphyssrc1 = 0;: F$ Z  S0 {! c' j# v: S
  69. dma_addr_t dmaphyssrc2 = 0;# `9 ~+ b6 V3 {# b
  70. dma_addr_t dmaphysdest1 = 0;
    . K2 z5 ]' ?) G% `
  71. dma_addr_t dmaphysdest2 = 0;: k  r* B, R% S
  72. : j! C: D# l& f& g
  73. char *dmabufsrc1 = NULL;
    0 v, W7 p* ?! g
  74. char *dmabufsrc2 = NULL;
    9 O4 N! W4 n) Y$ D& Q
  75. char *dmabufdest1 = NULL;
    + l* ^  Z! P& @
  76. char *dmabufdest2 = NULL;- `: }$ S# \) Y0 {0 o# ^

  77. 2 f! [7 a& _" ]8 `- a; n6 t
  78. static int acnt = 512;/ M% l" f2 K; S) {: [4 B& b: y
  79. static int bcnt = 8;3 @4 w* }6 N" B
  80. static int ccnt = 8;
    6 ]/ {% v) H# W0 m# v  k
  81. ) ^4 k  n" s% q: ]7 |( x
  82. module_param(acnt, int, S_IRUGO);
    9 m. ]' }( ]0 Y% S* P# v- w
  83. module_param(bcnt, int, S_IRUGO);
    3 S" C7 h! ]# }# S" C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' V" q/ r5 C7 o* H4 w

# R% Q4 p0 R& A# Q% L% }- ^" `, W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" j$ j  I2 n& a# x0 j! oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) Q' X# h. Q8 f; H9 z1 U5 {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 A; L  a% x, a  y$ T0 z
- p: }) ~2 ?: G/ W9 L
& g$ l5 {$ j- F* d5 E, e, `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-16 12:57 , Processed in 0.038350 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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