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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* U! b" {& s5 |' C, U; X  Y1 F
  1. [code]EDMA sample test application; ?- j7 p( D9 G8 A. c
  2. /*
    % `, w2 e) y' o9 M. F
  3. * edma_test.c
    - `" U7 K( z* T' a( l
  4. *  t* [+ r% k* e# u( x; p/ u+ d
  5. * brief  EDMA3 Test Application1 z) e( V! x+ p. a* g- |
  6. *
    " e/ s8 y+ o  o
  7. *   This file contains EDMA3 Test code.6 T$ k2 `; e; `9 {% k* }
  8. *
    : C2 B, [5 C7 l- d1 ?: G: v7 i2 S8 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 }0 i- g! \( y+ n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 A6 I- G1 D! q, A" I4 H; K  I
  11. *         TO CHANGE.9 [/ O! Y. J" ^7 l* B, |7 R
  12. *
    - t+ B3 z; p1 E% C! m# `, a/ j& h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ k3 a" @) w3 z: _+ J
  14. *+ n/ C5 c% A: H9 j/ k2 Y9 L( i8 `0 q
  15. * This program is free software; you can redistribute it and/or
      S) X7 o( \7 P1 D5 F/ L
  16. * modify it under the terms of the GNU General Public License as
    ; r, ^% i6 G5 }, _- u$ A
  17. * published by the Free Software Foundation version 2.3 g1 R7 b  W5 G* @0 r; S
  18. *8 D+ Q' t5 t7 U, P+ `) Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 ?# m5 A$ N! G2 s' _
  20. * kind, whether express or implied; without even the implied warranty. S6 G: X8 `* m& a  U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 K# ?  \; A7 h. C
  22. * GNU General Public License for more details.
    1 J+ M) _! j" Q0 Z6 c
  23. */% i) h5 w9 |6 g) M* V8 L
  24. 3 X/ k* ]* ~& W6 W- L3 y
  25. #include <linux/module.h>, U  e; d. i. ^' m2 K/ T! \
  26. #include <linux/init.h>! e% ^, k7 w1 U3 I6 d
  27. #include <linux/errno.h>
    7 ^  O' F5 x+ S4 u4 j  y) E
  28. #include <linux/types.h>* t. u/ _! s/ ?7 }; u5 F
  29. #include <linux/interrupt.h>
    ! c9 G/ ~- P  ^' x) e, U; B
  30. #include <asm/io.h>  E" k  J7 f9 C
  31. #include <linux/moduleparam.h>
      Q3 Z& D7 A/ v
  32. #include <linux/sysctl.h>
    & |4 ?$ `" x+ J: }8 O
  33. #include <linux/mm.h>
    * {; k  G: W/ ^6 ]
  34. #include <linux/dma-mapping.h>
    0 \: v) B" N% r- m2 T4 c  j- R: |
  35. 3 N1 c; m1 a$ ]& L* D4 w1 q
  36. #include <mach/memory.h>* E& A3 e1 C& y3 p# H; J; w
  37. #include <mach/hardware.h>* I" ]. m/ o7 Z. L
  38. #include <mach/irqs.h>
    3 s9 S" V" I4 f' @+ i) N3 p9 L
  39. #include <asm/hardware/edma.h>
    ; [/ o- P; z- K% {) a

  40. / \8 X5 P8 j$ G* a  q4 \; i9 Y
  41. #undef EDMA3_DEBUG1 E' M/ z$ s6 ~+ b% f
  42. /*#define EDMA3_DEBUG*/
    , e0 a. \. W. j# S0 H
  43. 7 s5 x) x3 q" I% P
  44. #ifdef EDMA3_DEBUG
    : a# F  V( m9 h1 X8 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& Z( E1 o: }$ a) I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) J3 i* r- G1 b3 R8 L/ Y& ?1 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! {2 c' N* j7 r6 [, s( M
  48. #else5 c& \. c9 C7 J, E
  49. #define DMA_PRINTK( x... )
    9 Z& q2 C/ L5 }  P( n& w6 t- |2 c
  50. #define DMA_FN_IN
    3 C1 N/ i% V% F: ?& X
  51. #define DMA_FN_OUT
    : P& @& p+ u5 c) X5 l) H$ J
  52. #endif
    . d3 v0 }: m% t
  53. $ v. w' f/ }  R+ X6 }8 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * N1 H" H# n0 {
  55. #define STATIC_SHIFT                3# Q8 U3 l8 s- c3 ~$ W$ I; H( u
  56. #define TCINTEN_SHIFT               20
    ; k8 ]# y2 n* ^; j
  57. #define ITCINTEN_SHIFT              21
    . T- F7 U3 }3 j0 d7 R1 x9 y
  58. #define TCCHEN_SHIFT                22
    , |0 |2 T, t$ a
  59. #define ITCCHEN_SHIFT               230 r+ h! w2 O# s( ?1 X, L# X! k
  60. / B$ Z( {0 U- T7 v2 T
  61. static volatile int irqraised1 = 0;) t0 \& Y2 `) i% [6 x
  62. static volatile int irqraised2 = 0;* v7 r  g- D1 X) i/ P% M  Z
  63. ( k* F! |  R3 V( i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # F7 U- r7 _2 s- w+ \5 t1 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' u/ j, F0 H2 I, [3 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 d1 i! n  H" b0 l" Y

  67. ' n% L8 `$ i* \) Y, v: F9 a
  68. dma_addr_t dmaphyssrc1 = 0;& O4 S6 L' t2 `$ a6 z
  69. dma_addr_t dmaphyssrc2 = 0;) F" U: ~' X/ O9 h. I
  70. dma_addr_t dmaphysdest1 = 0;
    % y5 V) B2 H/ Y* c3 x) _0 i
  71. dma_addr_t dmaphysdest2 = 0;9 Y# H- u4 x  |( L( F' v
  72. ; R& U* \1 \/ a7 d2 a0 ]8 w
  73. char *dmabufsrc1 = NULL;
    / q- Z% s0 ^( v- y, i) p: p. {
  74. char *dmabufsrc2 = NULL;9 Q9 y+ K# f& B5 P6 [# j3 a
  75. char *dmabufdest1 = NULL;
    - B7 m0 M9 ]0 w8 v9 Y
  76. char *dmabufdest2 = NULL;+ b8 M$ }1 ]. f5 v

  77. 9 q/ d+ C6 D8 U1 d
  78. static int acnt = 512;
    - @0 L2 i& p7 e. O7 o. I5 N
  79. static int bcnt = 8;
    / r0 V+ v+ u* u8 ~3 j: b
  80. static int ccnt = 8;
    1 }7 V: r0 E3 I5 o
  81. 2 \! Q! m; p( x6 s' {
  82. module_param(acnt, int, S_IRUGO);
    5 h# K0 ?8 W3 W
  83. module_param(bcnt, int, S_IRUGO);
    & s3 o$ [0 t9 ?2 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  N$ n" u  Q* c9 ]2 V; i2 N
; U! Y  @7 q4 K1 [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  Q7 @0 }2 s7 ~$ iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* g: _* W) y0 V+ G2 z( a% r, f/ }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- U3 \. O; @( y* d& Q( |7 ~6 C$ D' @, [1 Q/ x# U2 h

5 P: F" y) T. F- ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 12:23 , Processed in 0.039485 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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