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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 t  |: z; _6 F' N' w. }" L1 _
  1. [code]EDMA sample test application! w7 ]( e  B) J+ S
  2. /*3 G. G: H4 b( ?1 l' z
  3. * edma_test.c
    & @- A3 @3 Y& ?* x  L  j: |4 O
  4. *
    5 Z& `0 S: R9 l& p! s3 ?. s" x, T/ L
  5. * brief  EDMA3 Test Application: s  o" x- ~+ M
  6. *, p# m1 }3 U' ~1 t2 ~/ O) F# u+ ]( z
  7. *   This file contains EDMA3 Test code.! D% [3 ~. c) a( p" u
  8. *
    . e! M; u1 \( v1 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . N  b- F, {9 Q% ^6 T, r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! ]) u( M8 z' z9 u" T. Y
  11. *         TO CHANGE.
    ' Y- J, n' x/ D
  12. *
    ' o( \) k% N( ~) c9 v3 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- i7 N' r0 I0 |5 t( m8 C
  14. *
    : U8 [8 O+ B4 P! {* b* Q2 Z- K- b* X% W, `
  15. * This program is free software; you can redistribute it and/or, }% J4 J2 }+ N5 x
  16. * modify it under the terms of the GNU General Public License as
    8 Z% n/ }: H, g7 V+ s
  17. * published by the Free Software Foundation version 2.
    + h: i  d( A9 F; ?& _3 l
  18. *
    0 r& E9 [6 e1 Y% L+ u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 }+ J$ k3 s! d% u' Z, x. W
  20. * kind, whether express or implied; without even the implied warranty
    * ^# L  T9 o# u; \2 o( k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' F! b8 ?& ^9 w+ h' V6 B! a
  22. * GNU General Public License for more details.
    * H/ [7 F9 O  e4 t
  23. */6 e$ H$ `- K9 ]3 Z, O% \
  24. " t' u% p: F0 I! M! a
  25. #include <linux/module.h>$ |' {2 \' L; t. ^
  26. #include <linux/init.h>0 H  n- I; Z( X
  27. #include <linux/errno.h>7 u. a8 R) `% C
  28. #include <linux/types.h>
    6 h# ~9 E; G; A4 }8 f+ H0 n
  29. #include <linux/interrupt.h>
    . |7 r% d- F5 z0 f' W
  30. #include <asm/io.h>9 w+ R* ~( F$ }
  31. #include <linux/moduleparam.h>
    5 I) T% x& q6 w& e' W' e$ q1 a/ P
  32. #include <linux/sysctl.h>
    - z7 P6 F' }! _5 c/ g2 N- `
  33. #include <linux/mm.h>
    ' X' \) n; O$ e7 [+ o# R  w4 f
  34. #include <linux/dma-mapping.h>8 M" ]; K) k  a  b0 Q& R
  35. : F; L4 r: T+ Y- f( u6 j+ I8 F
  36. #include <mach/memory.h>
    9 ]1 P1 c; J8 O7 b5 J8 s
  37. #include <mach/hardware.h>0 Z  y8 b, {# M" L
  38. #include <mach/irqs.h>
    1 g! I. ~7 n) p- ~1 `0 S
  39. #include <asm/hardware/edma.h>
    8 n2 q9 {" ]2 G" ?
  40. 8 Y( I/ u! C1 I8 O% ?
  41. #undef EDMA3_DEBUG% ]3 K* b" J+ m1 K9 J) B
  42. /*#define EDMA3_DEBUG*/
    ! b' U+ {$ a" Q2 z) s

  43. , d) L/ G( B3 `& p* K" G- k8 V
  44. #ifdef EDMA3_DEBUG
    ( p# P0 ]8 Q  k$ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 ]5 g2 F. ^/ J$ O6 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! e1 ^' ?- B- C" M4 b3 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) j; N! l! s& W! d- x+ n+ |( C1 |
  48. #else
    ; l- E7 k, S$ Z, x# S
  49. #define DMA_PRINTK( x... )! V& S3 u6 Z0 J' B' T4 X
  50. #define DMA_FN_IN
    6 O$ ^  p  I& `2 j
  51. #define DMA_FN_OUT+ w- j/ t1 v2 j. C, t! G) ?# U2 R! Q/ [5 a
  52. #endif) v% i5 f3 J# k4 G+ q* [5 P$ y
  53. ' w4 U0 \6 L5 }0 i$ y$ V* ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / H0 W! T0 o. q
  55. #define STATIC_SHIFT                3
    % \$ U- e, W+ }$ y8 y1 q$ y
  56. #define TCINTEN_SHIFT               20
    ; j1 Z$ d1 E. W1 q
  57. #define ITCINTEN_SHIFT              21
    1 m7 i) L3 Z4 y& G  X, m/ F
  58. #define TCCHEN_SHIFT                22. P- R. X& ]0 b# {% J% b0 i) x4 Z
  59. #define ITCCHEN_SHIFT               235 z9 B. F, U, y3 g" G, ?
  60. 4 N+ o' P/ A7 T3 m
  61. static volatile int irqraised1 = 0;
    % l% `# W; T* j2 K7 z
  62. static volatile int irqraised2 = 0;; a6 X9 m& _# d) u: {

  63.   p  q8 ~/ _) y2 C8 ~3 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% \7 O9 L2 w( g5 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( W; A- _9 {1 {0 O3 Z6 u5 H  _5 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % t3 c0 t8 L! ^; h
  67. 8 c8 _$ I% O/ D% P7 P+ y
  68. dma_addr_t dmaphyssrc1 = 0;6 l  {0 J' T/ }
  69. dma_addr_t dmaphyssrc2 = 0;
    & ]! G) Q3 O- `4 K
  70. dma_addr_t dmaphysdest1 = 0;0 e8 L+ q4 ?+ o, J' h# P
  71. dma_addr_t dmaphysdest2 = 0;
    ) a- h! r. O( D1 f
  72. 6 a  T7 i& v: c/ p
  73. char *dmabufsrc1 = NULL;% s$ I. {( W4 p. ?* u
  74. char *dmabufsrc2 = NULL;5 T6 r6 k# V$ E' P: G- t0 ~" Q
  75. char *dmabufdest1 = NULL;' e( J4 K7 l8 q. D: P; N
  76. char *dmabufdest2 = NULL;
    1 U$ G! M- [$ F

  77. 2 O+ W, A7 A' P
  78. static int acnt = 512;6 \6 ?6 U; ^  r+ h* v( m( _6 U
  79. static int bcnt = 8;
    4 D9 b+ t$ h+ F' m% A
  80. static int ccnt = 8;; @) Q' }, K" h2 ?  ?
  81. % L% c, R2 L5 t. L/ ?# I! h
  82. module_param(acnt, int, S_IRUGO);
    4 T6 s2 T3 z# u$ z; [8 u2 S+ D* B
  83. module_param(bcnt, int, S_IRUGO);5 X9 M1 P3 l; b! B7 t. S: j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; m( [7 e, B+ u( r: x7 ?* O; X/ i$ L4 k. k' a' e( t2 H& K* q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! Z) ~9 @9 c* v1 S7 G" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' e3 @! A) Q" _8 _; h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 |! ?& Z8 ?) l3 W$ T& M

, }8 T0 s; ?& g. C  M% T8 _# G& V1 V4 \, z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-19 13:39 , Processed in 0.038918 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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