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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 t. [4 c5 A4 _* x- {0 G: x1 j4 V
  1. [code]EDMA sample test application& s$ q( @6 k0 Y. B
  2. /*1 m! y9 B) [2 @, x1 q+ y
  3. * edma_test.c5 x& H# V) C& [" n1 [! W5 Y
  4. *0 u8 t3 {' g/ v2 w" i% c
  5. * brief  EDMA3 Test Application
      ^* d6 c2 e# C3 a+ m
  6. *
      @4 X4 ?4 g9 c1 ?& W. M- }
  7. *   This file contains EDMA3 Test code.
    $ R7 I+ d) X4 Q( e% v) \
  8. *, d/ q1 y; p2 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( g; ?$ H/ Y( r9 O7 f8 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ^9 V9 I2 E% P2 R9 v1 g$ ?2 p
  11. *         TO CHANGE.
    # d. A* ]7 ~& w: j5 `4 a
  12. *
    2 W* y% t% ^" P& W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 R3 R. ~$ K, t* i2 I% [) T
  14. *0 @/ R8 [$ g$ K9 g  r; D# Q
  15. * This program is free software; you can redistribute it and/or
    ( u. l4 a8 H) n9 _+ I
  16. * modify it under the terms of the GNU General Public License as
    . |0 K4 I; r( f( V3 w5 g
  17. * published by the Free Software Foundation version 2.& L# V& [: c& D+ X* f& ~' p
  18. *& S2 }6 s  s- b2 L/ N) |9 {7 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 e" [* ~: M6 J* T8 u8 P0 [; g2 G
  20. * kind, whether express or implied; without even the implied warranty
    ) ]- G; l6 `6 X1 k) L* Y, i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. E/ o% W# {" P+ X* T5 }2 s* _9 e
  22. * GNU General Public License for more details.6 n7 F% a9 R/ u3 i9 }
  23. */) @/ A8 J1 a! c8 E6 B& G
  24. 4 C( K, @1 \0 U4 e* Q
  25. #include <linux/module.h>
    % M6 v+ @( r7 \4 s5 T+ v0 s8 \
  26. #include <linux/init.h>' w8 C4 \; T- P7 k& F; |' O) w5 v- _
  27. #include <linux/errno.h>
    ( G: T* @0 n$ R9 d- b, Z8 t( @
  28. #include <linux/types.h>
    6 p# k$ j6 w, T# z) n7 g
  29. #include <linux/interrupt.h>
    / \  j2 w* F* j7 o- Z( Y; _/ H
  30. #include <asm/io.h>
    " E/ @  _2 Z6 W7 Q2 E
  31. #include <linux/moduleparam.h>
    8 s) {  b- o8 k1 ?: A& }
  32. #include <linux/sysctl.h>
    + J: ~- E# P. h% z6 e
  33. #include <linux/mm.h>
    2 G& d! E1 ^/ ?0 V2 T( N
  34. #include <linux/dma-mapping.h>( _  m, R: a. H- x1 W. f

  35. & A- _5 I. u" F6 O. j: S
  36. #include <mach/memory.h>
    : `* |/ `0 `" [' t# }+ x' E, a
  37. #include <mach/hardware.h>- d( g( D6 h* p* N4 Q5 t# {2 m
  38. #include <mach/irqs.h>
    # B- i. a2 P7 K8 ?7 Z  l, R' q/ W
  39. #include <asm/hardware/edma.h>
    4 ]  a! {/ L1 Y5 n- l$ B8 u& D. T7 {0 Y

  40. 6 \' U# `! }0 V
  41. #undef EDMA3_DEBUG
    7 M7 f4 h* L1 w6 L3 i6 d' O/ ?
  42. /*#define EDMA3_DEBUG*/
    ! d' P& ^  T& q( Z2 [
  43. $ F7 }+ {& {2 I
  44. #ifdef EDMA3_DEBUG3 o- V- ?; `+ f3 E9 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) K' ?, j/ ^" k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), W9 \* Y( D' F; L8 Q: ~! P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" e% o7 S8 `5 W4 b
  48. #else
    6 U# q8 r! p% T
  49. #define DMA_PRINTK( x... )
    / R  Q, \( p3 S# F0 ]$ v
  50. #define DMA_FN_IN
    6 O7 D: ^( ^  H/ _% s3 w( s: R  D
  51. #define DMA_FN_OUT1 P7 B2 Q; P" o
  52. #endif5 @, s0 n+ _# E& N2 `; [
  53. " J" W+ j9 H/ N. ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " E7 [. n) q# N1 M
  55. #define STATIC_SHIFT                3
    * P- e3 f: B4 }
  56. #define TCINTEN_SHIFT               205 t+ E. z6 @2 G* Y- }$ R
  57. #define ITCINTEN_SHIFT              21: G, x4 {2 Y! b' j5 G* a5 E
  58. #define TCCHEN_SHIFT                22
    ; ~3 u' Y; b9 y  u
  59. #define ITCCHEN_SHIFT               23
    ' Y* }4 @, I# Q% C
  60. , L+ _1 V' f( y" A
  61. static volatile int irqraised1 = 0;
    5 G2 P$ B* s9 J% l
  62. static volatile int irqraised2 = 0;7 ~) r- p" i; ]* E' T- b
  63. 3 y8 x% _, F) [# @) m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . V% ?: q% E8 M+ W8 p/ _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% o3 \' O3 v/ I) d$ D) O8 {( K: g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, k! J# P; g- P: }( B
  67. 1 G1 Q& |% |+ s9 A
  68. dma_addr_t dmaphyssrc1 = 0;" t, s: E( t1 c
  69. dma_addr_t dmaphyssrc2 = 0;' k" ~- _" i1 j
  70. dma_addr_t dmaphysdest1 = 0;
    8 F- u4 `& q+ @7 j2 f
  71. dma_addr_t dmaphysdest2 = 0;4 E  V' c' a) W  [8 j+ O

  72. 1 g2 d/ k& N9 e) b* r
  73. char *dmabufsrc1 = NULL;
    ; ?6 b( H# ^+ c
  74. char *dmabufsrc2 = NULL;
    7 O! R$ S: Z0 O- P/ n& }5 Z' I7 I0 `3 {
  75. char *dmabufdest1 = NULL;
      }$ X% X0 D3 @6 G3 w! E4 u/ {
  76. char *dmabufdest2 = NULL;
    * q  C# @: B* P! R. R0 K  I: h
  77. # ?! y0 I2 [2 I6 ^4 z* L
  78. static int acnt = 512;' |" A$ k, @- ~- Q: _
  79. static int bcnt = 8;
    4 }1 Z( ?. L* B: `; C/ F
  80. static int ccnt = 8;- B* W5 A5 [( n0 D

  81. : ^1 [* [" J2 e9 {& O& ], G
  82. module_param(acnt, int, S_IRUGO);3 Q$ Z: P' x$ g! `" |9 f
  83. module_param(bcnt, int, S_IRUGO);
    0 g' ?; L" M. e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) |( {) m0 p0 A4 A1 L

( k: S1 x1 Q2 f! E) s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' I9 h5 N; w2 Z5 H  ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" {& G6 B8 O" ]$ f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 u+ \- E* o; T7 C1 ?0 D+ L0 f( g6 s, N' v) B8 l

% T3 x# [2 q- ?  d- H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 05:04 , Processed in 0.044927 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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