OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- p# E! ?8 o- T  @, S0 Z* M  V
  1. [code]EDMA sample test application7 T' [0 h5 Q. e& n: R- w2 `
  2. /*& S7 O* C' Y, C: b  L% T( P" U
  3. * edma_test.c+ f* z8 t3 f* O7 Y2 q
  4. *2 c0 x0 L$ C2 X6 q  `1 `
  5. * brief  EDMA3 Test Application% r0 }+ o' I  _2 v: i# S
  6. *& y3 w, n! V' a! k& k4 G# ?* b
  7. *   This file contains EDMA3 Test code.
    & P* K3 a0 Z2 M+ J7 Y. T' m
  8. *
    ( b' b/ L! X: R" r0 l9 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ L  @; c4 D' l8 F  L  }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 O% C0 G& M3 a* p
  11. *         TO CHANGE.1 x& ]7 D+ R; T7 G
  12. *
    ) w2 v: r6 C6 u/ v8 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      S4 t0 q! S5 t' d7 D7 Z2 V
  14. *8 d2 i7 C1 G+ c* }! E, e2 Q. K
  15. * This program is free software; you can redistribute it and/or
    # b1 k$ r; t. z! [" y5 {8 c
  16. * modify it under the terms of the GNU General Public License as, B' A2 I3 }$ z- N( N
  17. * published by the Free Software Foundation version 2.
    $ @! n( M- J' U; ?. a
  18. *
      Q) i3 P% v- A, e! o# O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' F) t, m. }& L. V2 J+ C1 W
  20. * kind, whether express or implied; without even the implied warranty
    1 M" L. L' q& @% e+ D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 u5 j8 m0 W* {/ x1 P+ v
  22. * GNU General Public License for more details., E. ?$ n. h: C9 d8 g8 Y# R
  23. */) C$ ~$ V7 a$ T: A4 d

  24. . D8 W) e# I. i8 Y
  25. #include <linux/module.h>0 T* S/ ?5 M7 D3 e1 f
  26. #include <linux/init.h>6 R( E) v  }4 P5 w
  27. #include <linux/errno.h>
    " Z- u8 G& U- n' J6 T. `
  28. #include <linux/types.h>- D  b2 e5 j: v/ {
  29. #include <linux/interrupt.h>
    : s7 C8 f4 ~% [) [8 M" J
  30. #include <asm/io.h>
    1 F% H7 ~% L0 X1 y4 l
  31. #include <linux/moduleparam.h>
    1 P  e6 t+ S. y  q: j
  32. #include <linux/sysctl.h>) N; [1 j) @4 u4 w( |
  33. #include <linux/mm.h>2 m8 i. s5 X# r) Y# i
  34. #include <linux/dma-mapping.h>
    7 i& s  J, W4 _9 e& q
  35. ' J' U& I& p8 n$ e$ U3 f1 ^
  36. #include <mach/memory.h>
    # D; e" R4 M9 a" s  @8 R
  37. #include <mach/hardware.h>
    + z. M# k4 w# y. \( A
  38. #include <mach/irqs.h>/ a% S' R( _  k" _6 w: i2 _
  39. #include <asm/hardware/edma.h>
    % |; z* i4 @- o
  40. % K8 I3 \5 o9 H* j5 K. H0 D  y
  41. #undef EDMA3_DEBUG
    , {/ W! F2 Z- H5 A; }1 V1 B
  42. /*#define EDMA3_DEBUG*/5 z/ L% K2 L2 j' }

  43. 6 [0 J. o" Y6 L
  44. #ifdef EDMA3_DEBUG2 ?6 H% X( W2 l! j' F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% m7 H: v2 B, c1 l( S& F: c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). I6 l  E# u) a6 R: @  V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 ^% P0 l0 K5 `4 I. U7 z- @
  48. #else+ W- a7 b5 m* t1 w( ^& K& f+ M
  49. #define DMA_PRINTK( x... )
    5 ~% R8 {5 c+ z( D1 B6 e/ s
  50. #define DMA_FN_IN. E/ w3 {2 o' d( N  N
  51. #define DMA_FN_OUT
    2 B0 O. J! b/ q* K7 {
  52. #endif
    ) v" i7 ]  N; o6 W9 y

  53. 3 t1 V8 `* X% ~3 @  E0 A: {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% K4 }; s& e; ~+ ]$ M1 D
  55. #define STATIC_SHIFT                35 t1 g, |& J. q- w! G( z
  56. #define TCINTEN_SHIFT               20
    ) z: R$ p, g/ O9 a0 r- y" n$ b& q
  57. #define ITCINTEN_SHIFT              21% @. Y! @8 c* E3 E
  58. #define TCCHEN_SHIFT                22
    : x0 A0 F3 K2 ^( u
  59. #define ITCCHEN_SHIFT               23
    ) R7 R3 U( e( x2 I

  60. 3 w  U! n0 |, i) x# \: p/ q5 q6 V
  61. static volatile int irqraised1 = 0;2 |# N+ b9 {* |# `! E9 r
  62. static volatile int irqraised2 = 0;
    $ e. Y, g" Y; q$ W# v: A
  63. 6 \, n3 T2 ]1 [9 L# w5 ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J) D% y/ Y* [* E, r2 q7 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      `3 S( l! a+ ?  b1 X$ p: ^* Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & p" \4 S! b' H

  67. ! u8 v! r9 }9 Q4 |8 y6 d% w
  68. dma_addr_t dmaphyssrc1 = 0;6 Q8 K; E+ e, r4 v, @! Z
  69. dma_addr_t dmaphyssrc2 = 0;2 e, i4 X* F* K: ^
  70. dma_addr_t dmaphysdest1 = 0;
    # F' Z& a+ X( g! p3 {( d7 v
  71. dma_addr_t dmaphysdest2 = 0;" u/ d% g5 H. ~) w0 @( {

  72. ( T; p, f% }# y7 _% I
  73. char *dmabufsrc1 = NULL;
    # q0 X4 V7 G' }& ~1 w
  74. char *dmabufsrc2 = NULL;; [5 [* A) g! W
  75. char *dmabufdest1 = NULL;- G/ u  Y; A/ \& J
  76. char *dmabufdest2 = NULL;. E! f+ n6 Q1 |
  77. 7 d7 @2 T' r& p* @, U* o; [- V% Z
  78. static int acnt = 512;
    " r4 Y* y+ V  j2 a! l
  79. static int bcnt = 8;  B) C4 t7 j* H- a5 a9 r/ h
  80. static int ccnt = 8;
    - \% |6 A) A4 R3 P

  81. 0 m, V0 Z4 S  Y) Q8 g) t! L+ Q/ r* q
  82. module_param(acnt, int, S_IRUGO);0 K! i! v$ d( C; ?2 h4 J, C5 H
  83. module_param(bcnt, int, S_IRUGO);
    6 w# _6 o* N0 ^0 E; u! Q; }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 i4 _+ E9 P5 Z, f# p9 y1 D) P

7 q  F# G% d7 h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 ~! g0 R' R& t; y1 c$ a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ A" R' M/ s9 v( [0 C2 V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  L4 k7 h) S5 s, S: f3 k
  V& U* ?& F/ E8 Q- h: F  k5 r# x2 Y. j: O$ x4 ~4 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 14:56 , Processed in 0.039419 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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