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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( I% V" U( @' I- Q/ H
  1. [code]EDMA sample test application
    ' Y! X, u/ U0 d1 E" W6 X
  2. /*2 ]2 W. W1 ~3 p/ S% t/ w9 J5 H4 r
  3. * edma_test.c" x2 p+ ~8 T- s( U7 z
  4. *
    9 F( ~  l3 ^" t% i
  5. * brief  EDMA3 Test Application- ?6 n$ E; P  o5 h, J0 U* Y3 S
  6. *
    4 M/ H9 \0 X2 Y7 ^( Q
  7. *   This file contains EDMA3 Test code.
      ?" h9 j* T3 B$ y/ g
  8. *
    ; X0 G5 n/ k# `/ A. i; W9 R2 q6 Y3 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      V# D& ~( G, S8 e5 n) n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ \5 W) D. T' W3 k% `- S
  11. *         TO CHANGE.
    9 v/ l) J( d7 V8 V4 g1 G: g0 z
  12. *# Y3 Z) a' i) z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 Q, r3 t* w2 u" u4 }/ ~" V
  14. *
    2 F# A1 T/ ]7 u, q: D
  15. * This program is free software; you can redistribute it and/or
    3 O% U  ], S+ I: L* k  F
  16. * modify it under the terms of the GNU General Public License as, v% X8 F9 n: a- k) R8 l
  17. * published by the Free Software Foundation version 2.& [6 F2 [) s6 t: a
  18. *
    6 t$ q1 U0 F9 _# J8 S0 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / S1 G9 ~( c9 @$ X# O+ A" j2 z
  20. * kind, whether express or implied; without even the implied warranty2 T: [3 W  n- p3 x7 Y6 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % w2 G9 M2 U+ H6 ]* S8 E
  22. * GNU General Public License for more details.
    . K! W3 V# M) G8 K8 z8 @) a# _
  23. */0 I( w6 K3 ]' ]0 v, b- b) w7 ~

  24. 8 `, d. H+ A9 w7 T! @# _
  25. #include <linux/module.h>
    4 y  y! r. F9 B( U
  26. #include <linux/init.h>
    ; h) c7 @/ _" ~* P9 v; W
  27. #include <linux/errno.h>* N0 R$ Q2 ^' v
  28. #include <linux/types.h>& f5 d  N4 o( A: ]  E
  29. #include <linux/interrupt.h>* n, y# m5 z* g# s4 T9 \. O
  30. #include <asm/io.h>
    $ W! D; B. @! A  d8 c
  31. #include <linux/moduleparam.h>
    3 l1 q( t% O- O. Y8 N1 R1 ~
  32. #include <linux/sysctl.h>
    3 B; q; C. j, k& ?# m
  33. #include <linux/mm.h>) U; o2 g4 B0 N! w; f
  34. #include <linux/dma-mapping.h>
    # z% Q! `6 I  H3 g' K" U  v
  35. * s9 S, l5 I% r0 n; b6 j, q# M
  36. #include <mach/memory.h>% H9 D5 s3 t2 ^0 m' t3 |% Q4 i
  37. #include <mach/hardware.h>1 T* |5 {0 ]2 P3 L7 O' J
  38. #include <mach/irqs.h>
    5 c# ?5 l8 p9 R- D9 s
  39. #include <asm/hardware/edma.h>
    0 M0 {7 @  o$ O# ~
  40. : n1 p/ Z% E# b4 J* Y
  41. #undef EDMA3_DEBUG
    ! T  S% R1 x' w; U$ K  Z
  42. /*#define EDMA3_DEBUG*/
    7 C% k2 V; H$ B2 _  z

  43. ' w$ Q0 Q9 h$ [6 z5 c% g- v
  44. #ifdef EDMA3_DEBUG" }# @8 c- W# Y1 h' X- D. s: `6 B: H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 J0 E2 Q; N/ J) b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ r/ d, S" Z  b% _& j" r7 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 r. n6 O% @) e
  48. #else
    ' s- o1 x1 g* g* N4 J5 I
  49. #define DMA_PRINTK( x... )
    , n/ _. |# W, a+ }, B/ ^" Q
  50. #define DMA_FN_IN
    2 \( P8 y+ g, ]8 X8 F5 \. I  E
  51. #define DMA_FN_OUT
      M% w  R9 L2 w- B: O  d$ q
  52. #endif
    * x+ i9 ^- L1 X1 d  F, m
  53. ' T. r; H& H/ W3 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 s5 u3 ~9 ~; F" W
  55. #define STATIC_SHIFT                3
    # t/ {7 R9 C# |, \) O8 ]4 [5 I
  56. #define TCINTEN_SHIFT               20
      Y7 A$ ~& s( p; W- d4 F  E1 @
  57. #define ITCINTEN_SHIFT              214 C8 x) q" G+ x$ W7 }3 J
  58. #define TCCHEN_SHIFT                22
    7 `) \& J' d8 Q, e2 H
  59. #define ITCCHEN_SHIFT               23* |4 O( ]$ X- }5 g% u1 y+ [

  60. 4 N; ^( X* N8 P/ i- ?9 A
  61. static volatile int irqraised1 = 0;( f$ @/ I" e5 W3 j$ r
  62. static volatile int irqraised2 = 0;- H: ]( I0 X) _8 X" k( p5 P

  63. 0 S. X2 P3 h+ C/ h- m: O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 Z" p' b' l( T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ^$ f- n; z. v! K2 h. h0 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ~5 z! P( Q# T% K5 d( G5 {

  67. / a) A5 Y8 B- F. O- C
  68. dma_addr_t dmaphyssrc1 = 0;
    6 f- t2 C& H0 B9 t) \4 }' d( L) N
  69. dma_addr_t dmaphyssrc2 = 0;, U! d* Q: {6 {1 p% c, l
  70. dma_addr_t dmaphysdest1 = 0;! |1 Z5 \7 O! @4 ]% w8 M, x$ n
  71. dma_addr_t dmaphysdest2 = 0;
    / q9 x* ]( W' Q& l. P$ d
  72. $ r6 R* V: E3 u$ c/ g
  73. char *dmabufsrc1 = NULL;1 s4 D# g' G6 F" d/ `7 b
  74. char *dmabufsrc2 = NULL;5 A  X% E! i, D6 n- |! B
  75. char *dmabufdest1 = NULL;& h) Q* y9 v4 W
  76. char *dmabufdest2 = NULL;
    2 ^" r$ M0 Z/ @0 s: R

  77. 3 i" R3 q8 h7 w0 J! [6 N
  78. static int acnt = 512;8 G# x) M: Q( x3 b' d
  79. static int bcnt = 8;
    $ K6 S1 s" [4 I/ v' p9 N8 B
  80. static int ccnt = 8;
    3 }) Q7 y) o% t
  81. - G& p3 D/ g; I: x
  82. module_param(acnt, int, S_IRUGO);
    ; n0 U, y! F% \1 J% w# T* l
  83. module_param(bcnt, int, S_IRUGO);
    % T" Q1 P7 G) O5 x$ ]. g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  s: x: D1 {% D6 n5 i7 S
# u8 o, Q1 {+ i6 Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 r' L) F5 W+ u$ e! o6 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& p5 Y5 O  v7 j% X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 |! ?; Z1 @' r* u% S/ C; G

" M9 c+ H; y5 B, q, ]. X. G+ y) s( D" S0 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-29 07:31 , Processed in 0.045325 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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