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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : o3 e/ I, E+ D* w( I
  1. [code]EDMA sample test application
    8 Q1 _9 Z- U/ V- l( t7 h) g
  2. /*
    ' x8 z5 i. [& D1 M# v: {/ I
  3. * edma_test.c& W) w9 E  H/ H8 d
  4. *0 [4 N5 \$ H  ^+ @
  5. * brief  EDMA3 Test Application7 ?( {  _8 D" ]7 w# w
  6. *" O& v! Y6 Y6 J4 @
  7. *   This file contains EDMA3 Test code.
    / j- s  ?& c2 j& _3 @
  8. *9 l" N& n0 r2 d* u$ p4 p9 H! Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( ~' Y3 l4 S8 q# v' r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* ?4 I7 K+ E2 V. @: v
  11. *         TO CHANGE.0 n( w9 T7 w& y% @
  12. *
    ) V) Y# X, n" X5 m5 k1 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 v1 `9 W! X% Z) k( i
  14. *! F5 M5 c5 A8 N
  15. * This program is free software; you can redistribute it and/or
    9 t$ e5 Z. i' d3 D4 F
  16. * modify it under the terms of the GNU General Public License as3 p0 E. g) [+ b& i4 w' x% [
  17. * published by the Free Software Foundation version 2.
    7 K/ _$ S# m$ S! t
  18. *5 G/ U0 Q1 ^! y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ U" b0 ~- q) M4 B: M4 Q
  20. * kind, whether express or implied; without even the implied warranty
    % [" Q3 C1 d5 s2 |+ T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# Y' i. r3 f7 a0 H2 m3 q3 t
  22. * GNU General Public License for more details.- @/ h4 t1 [% B
  23. */
    % F* T2 T* `) O+ M/ Q) h8 j1 @" e
  24. 9 |* A: i5 j1 q! _- u7 F+ i! z
  25. #include <linux/module.h>
    . E: z1 C. @! m) {
  26. #include <linux/init.h>
    0 `/ x7 x' M8 K; j6 [% t
  27. #include <linux/errno.h>
    ) z" k& S3 v/ F. b, X( m
  28. #include <linux/types.h>3 W) \9 `( A; c+ N( K) v- a; g
  29. #include <linux/interrupt.h>
    8 R) E' z; B8 W2 ~
  30. #include <asm/io.h>
    : o3 N- N* ~2 K2 Y7 J, l
  31. #include <linux/moduleparam.h>
    & `8 i" }1 h, P
  32. #include <linux/sysctl.h>8 c% F$ o% p3 C3 g1 o; ^
  33. #include <linux/mm.h>
    * Z6 T/ _% j% J
  34. #include <linux/dma-mapping.h>
    ) D( C4 d' b, F! A

  35. / u: w6 k& y8 ^  p1 f7 e) \
  36. #include <mach/memory.h>
    6 M( v, V+ g9 K2 {/ o5 c$ b$ v) e
  37. #include <mach/hardware.h>
    * U# i- `6 H/ O. t, y% [2 L/ r
  38. #include <mach/irqs.h>1 o8 K. X+ Z. ~' A7 ^3 F5 a/ D3 k
  39. #include <asm/hardware/edma.h>7 ~, p  Z/ p3 ]; h

  40. ) I. I! u* v5 m
  41. #undef EDMA3_DEBUG, w: k9 n8 @" R
  42. /*#define EDMA3_DEBUG*/
    $ b- H1 U0 D! Y( E$ N! u
  43. $ @5 o" e% z6 s/ t
  44. #ifdef EDMA3_DEBUG
    1 Z& v( k; N# n8 x6 `& f- i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , A& q  T: B+ r0 w" J. B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 `9 b1 T2 Q" S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 q1 {9 K; I8 s2 a
  48. #else
    0 A* ^8 h9 m4 a7 @
  49. #define DMA_PRINTK( x... )5 f! w6 V& H" v5 B' I
  50. #define DMA_FN_IN
    7 T) Y# K& L5 n! |1 Q. p
  51. #define DMA_FN_OUT
    : v8 ?! X4 w% w" C" c
  52. #endif& r; P/ D1 _2 Q2 @: m8 h

  53. ; H9 X7 b  ^3 B6 u* O% G8 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " _8 L3 s5 z6 g6 t
  55. #define STATIC_SHIFT                3* ?) W/ Q) j# L. f0 z
  56. #define TCINTEN_SHIFT               201 @* T. C1 g( a5 o( @8 T7 N, c/ `1 F
  57. #define ITCINTEN_SHIFT              21
    ( h' M2 U4 h( w# N" j
  58. #define TCCHEN_SHIFT                22
    # j: Q0 i, v7 o& I7 ]& m" Q
  59. #define ITCCHEN_SHIFT               234 G) W& k! v9 H) R5 z+ q

  60. & c/ m/ h  E0 W+ C1 U, \
  61. static volatile int irqraised1 = 0;
    ! ]; W' ^; }% B& Y9 }
  62. static volatile int irqraised2 = 0;. X$ B) g7 |+ f  {' I9 P3 F
  63. $ Q& Q& ^$ w* i2 v( }% k/ Q. s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 M& e7 F# T! @8 y6 `* [" ?: c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- S: E$ r3 \1 m; H6 D+ [3 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 x, q7 A; }! v. \+ u* H
  67. " {% Y2 W$ l( E8 ^% [& G7 {
  68. dma_addr_t dmaphyssrc1 = 0;$ d6 T& |% j( A( ?
  69. dma_addr_t dmaphyssrc2 = 0;& s7 s3 D4 |0 }7 {8 A7 q' }/ D: g
  70. dma_addr_t dmaphysdest1 = 0;
    - y) H* T( W# D8 \. e
  71. dma_addr_t dmaphysdest2 = 0;& z- z2 T# H7 N/ w' u+ W

  72. 1 n9 [. t6 o; {! ~
  73. char *dmabufsrc1 = NULL;- L9 l- w$ l0 c" @: |% q) m$ R
  74. char *dmabufsrc2 = NULL;
    0 ]- C# G& ?% m
  75. char *dmabufdest1 = NULL;
    / @. B4 V0 N% \
  76. char *dmabufdest2 = NULL;2 L2 t. X8 N( _& |$ N

  77. 3 B7 t$ Q) C6 V/ s
  78. static int acnt = 512;, E0 C# ]7 y: \/ z7 t
  79. static int bcnt = 8;% J+ V" Z8 X- V  K, F' n
  80. static int ccnt = 8;
    9 f3 s! M0 C4 a7 {. Z& R

  81. ; ~5 v" n, N/ [0 e1 b
  82. module_param(acnt, int, S_IRUGO);
    * g; e9 ]- {, r. i
  83. module_param(bcnt, int, S_IRUGO);
    ) F$ o; ?+ y) A6 v" h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 l3 b1 t( z" a& e

  v* V# g, i% Z, B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ]& _  c% P* Z: L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 _3 _, |" N5 q2 `. p3 I4 b7 p: `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) i. C1 K  H1 b( O1 _& r1 l# f* f! i

5 [* Y: V- ^( u3 W$ u# ?, o1 r" C+ C- ?1 O; a9 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 21:39 , Processed in 0.039695 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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