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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - Z* ]4 W2 @& s. L  x  N/ O# K! Y
  1. [code]EDMA sample test application
    ! V* |  h0 D7 H* f
  2. /*
    0 ^' u3 s9 h% E+ M( [
  3. * edma_test.c9 m( z1 U2 y: w3 A! e; K2 c
  4. *, D- k& g8 N, l/ A% d+ ^4 j/ [, m
  5. * brief  EDMA3 Test Application* b9 W: Y( C6 c+ D7 a
  6. *
    # B' L$ z$ J- c, t
  7. *   This file contains EDMA3 Test code.- T& v% v' l% ]' V5 f" _* P/ Z
  8. *
    ! v5 T/ F. e$ i5 j( ^/ {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& G+ g8 {3 M" E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, ^0 [+ U3 W  T1 j
  11. *         TO CHANGE.$ u! s; n5 x3 X: ^, h
  12. *( R% `1 r$ ^0 A$ [/ y  g' h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! j* Q+ G6 ?- {, ]( H
  14. *- G7 r* n; O. d! ?; t! c: k" t9 C
  15. * This program is free software; you can redistribute it and/or& A) n- e4 ]1 F; w* u2 C6 A# Y
  16. * modify it under the terms of the GNU General Public License as
    ! ^% S  k" \( }; B- [1 E9 `+ m
  17. * published by the Free Software Foundation version 2." J: i) a. C7 _+ M
  18. *
    & T9 P3 d% y: D5 P+ Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 ?# `/ K3 K% B
  20. * kind, whether express or implied; without even the implied warranty
    " {  j( v4 I8 |9 v% f- Y1 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 r) d$ A" N* S( [) ?
  22. * GNU General Public License for more details.
    1 W  b& a' l$ u2 P5 U) r
  23. */
    0 r7 o4 m/ y/ s3 ^) M

  24. 0 T0 t4 W2 P4 O5 H, e- A- F
  25. #include <linux/module.h>
    ! E1 v! E2 L$ C
  26. #include <linux/init.h>
    * A4 G8 r: G+ }$ f6 A3 [
  27. #include <linux/errno.h>( c& G' N5 o9 ?4 o
  28. #include <linux/types.h>
    " w! J9 C  a, w: R& S; x
  29. #include <linux/interrupt.h># v* F: Q# r% z2 U6 b3 e4 N
  30. #include <asm/io.h>
    $ e- X8 Q3 J; T: v' C
  31. #include <linux/moduleparam.h>4 F' Z) Q) ]& k& R" R  C. ~, z
  32. #include <linux/sysctl.h>
    " y- `4 J0 m  b) b: i
  33. #include <linux/mm.h>  h: w* z8 v/ ~* [3 i6 t
  34. #include <linux/dma-mapping.h>
    7 V; a4 ?  ~. y; c) E: |

  35. ) k( S  Z. T* G! ~
  36. #include <mach/memory.h>
    * |2 J8 t5 C2 O. [
  37. #include <mach/hardware.h>1 X' C$ W2 R' x9 O/ |! s
  38. #include <mach/irqs.h>  E$ a' U. }0 s2 A# d/ N
  39. #include <asm/hardware/edma.h>% q, u$ k* _5 X$ J
  40. 9 f9 W' n3 e3 S0 V
  41. #undef EDMA3_DEBUG
    ; `1 _/ U+ b7 `6 k5 A$ K
  42. /*#define EDMA3_DEBUG*/4 G& f% c, U: A! S; ?
  43. - J! }2 e3 m- R: l3 H
  44. #ifdef EDMA3_DEBUG5 V/ Y( B) i' B2 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " f6 P3 \! L+ C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 _* ?% `3 V3 C9 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& n1 E  `2 U8 G4 v
  48. #else9 v& f" b- h8 o! H  T% X
  49. #define DMA_PRINTK( x... )
    - `, ~. I6 @1 ]% q
  50. #define DMA_FN_IN! D6 ~- v0 a, A1 n
  51. #define DMA_FN_OUT! ^# @, k! C7 D) Z
  52. #endif
    0 [9 ~5 Y: ~/ k( _0 b/ J) H
  53. " H) A9 }: T1 ]0 a& j7 E0 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ W3 E# ]8 M* S, c+ M- Q; U$ p
  55. #define STATIC_SHIFT                35 J) k- u3 B- t/ y9 Y, U
  56. #define TCINTEN_SHIFT               20" N7 ~4 S7 ]/ Y) s/ s3 v# {
  57. #define ITCINTEN_SHIFT              21
    & n, b' M: E4 g
  58. #define TCCHEN_SHIFT                22
    ; d6 P. P5 p, e7 F
  59. #define ITCCHEN_SHIFT               23
    " o( x+ K" M( }) d' d0 z. l$ R( @
  60. 2 @! P7 c+ @( M% e( m/ d: j& ~
  61. static volatile int irqraised1 = 0;" W9 w2 V3 m8 h; j; H
  62. static volatile int irqraised2 = 0;( a9 e5 O5 A/ {% J5 y4 v

  63. " _6 P, u7 r. C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% |: u8 Y! ^' h) T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 o) m+ n/ v1 D5 Q6 R2 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ g  q! n3 o4 F$ U5 Z$ u. f& t9 N
  67. * S3 [9 _' h7 U! r; I! W
  68. dma_addr_t dmaphyssrc1 = 0;
    1 F1 W# u* c+ K) W8 R! O
  69. dma_addr_t dmaphyssrc2 = 0;: c; g3 i* ], {" {9 W! o8 a4 C2 z, y
  70. dma_addr_t dmaphysdest1 = 0;
    ! |9 l, c! s) E" w& t) X
  71. dma_addr_t dmaphysdest2 = 0;
    8 W; N, {8 Y4 V$ ~' o" ?; ?  k& _

  72.   ^+ A( {/ l/ O! |* z' W
  73. char *dmabufsrc1 = NULL;
      f' ^( B. x, ?3 Y
  74. char *dmabufsrc2 = NULL;& F& F$ t2 n2 g
  75. char *dmabufdest1 = NULL;
    # w8 K; m4 _5 [3 v7 q
  76. char *dmabufdest2 = NULL;
    2 h- Z% D0 G: J9 w& G1 e- o

  77. 4 ^2 c5 D9 I) f
  78. static int acnt = 512;
    / j4 H( h& J0 S+ H' x' q5 W  w2 m
  79. static int bcnt = 8;& r4 q7 t5 m4 L: q
  80. static int ccnt = 8;
    1 U0 E6 S, Y: |; s+ f, x
  81. 5 O$ S  H0 Z2 \
  82. module_param(acnt, int, S_IRUGO);9 G4 E( u. v' v' _$ K: F0 h$ I  S
  83. module_param(bcnt, int, S_IRUGO);
    4 j- C! ?; r7 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# e9 Z8 C3 l4 Q* H+ ?  r) R! s9 Z/ k2 X" S+ Q! u' t% d5 M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ C3 F' Y# [/ u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 i" E9 o3 k" h9 Y* J: L9 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- X% B* D  @8 p* [. l& l3 {

& j' a, x' z9 o) e
# y) ?4 p2 v) M2 o% g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-22 10:17 , Processed in 0.041247 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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