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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( L1 L3 g& N3 k( {
  1. [code]EDMA sample test application& F( w- F  B  e9 w4 E; \
  2. /*
    $ F: E: A8 H1 v! Y) P4 X9 I5 }
  3. * edma_test.c: y0 _$ Y& `0 ?0 E0 Q
  4. *7 G0 H2 B. o& _! N
  5. * brief  EDMA3 Test Application
    7 U" q5 U% H' N2 V* L. B9 Z: H7 O
  6. *$ B( p0 n, K' {# f( r7 h# [
  7. *   This file contains EDMA3 Test code.3 C4 P& ]  y9 R( K9 k/ O
  8. *4 O2 P' @2 v3 R& y% r) c! A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! q' c9 ~# C( R$ d+ F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 g$ `$ @) W! P2 y8 ~) a( p
  11. *         TO CHANGE.# @& F  ~2 {; c6 J8 w
  12. *. Y3 ^' U3 M' I7 p6 G3 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 f2 C; _2 C1 c$ g/ @/ c' s2 c4 f+ F/ p' }( B
  14. ** U% I3 h$ [- q, H3 L
  15. * This program is free software; you can redistribute it and/or
    ; C. }* d  Y) c8 L5 O
  16. * modify it under the terms of the GNU General Public License as
    ; f5 {) v7 s% O9 L1 e: |6 k
  17. * published by the Free Software Foundation version 2./ B( V: @9 |8 D' M
  18. */ T! x, M2 `7 J, {% h! {; ]* M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! q! h2 }* P; f6 J4 T( w
  20. * kind, whether express or implied; without even the implied warranty
    - [* N- q7 _: H) b5 O! F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 t! C3 Q: U  V1 G
  22. * GNU General Public License for more details.7 [. P! |5 ?: d7 T7 V
  23. */
    $ l1 |7 T( h# D5 B& _0 m- I

  24. 8 s" P6 V; M1 s9 L, ~
  25. #include <linux/module.h>
    * [- L' ]; `. j& {
  26. #include <linux/init.h>
    1 n$ E* z5 a3 C; s+ n# `8 z# d  N
  27. #include <linux/errno.h>
    ( X) q1 B- ?" J2 v4 @
  28. #include <linux/types.h>6 S5 i  L) L- k; j
  29. #include <linux/interrupt.h>
    - B/ C) I/ D2 j6 U
  30. #include <asm/io.h>
    $ M7 a3 K- n$ `9 j7 I
  31. #include <linux/moduleparam.h>7 M* m& z' p/ x& g8 Y- q
  32. #include <linux/sysctl.h>
    8 \3 _8 R) g8 A& [- J2 ]1 }0 j
  33. #include <linux/mm.h>& P: y4 O" ?8 ~3 }0 W  @
  34. #include <linux/dma-mapping.h>3 S( O4 L3 ]9 n

  35. 6 C. ?- g' i; X) H/ ^5 r
  36. #include <mach/memory.h>* z2 I, S+ R3 n4 s& Q8 C0 c
  37. #include <mach/hardware.h>. E$ h6 K  \2 D
  38. #include <mach/irqs.h>/ A7 |, l; O4 ~8 W" S
  39. #include <asm/hardware/edma.h>
    + [5 i1 }  n2 P  ~5 o, |

  40. ; R) z5 X; X/ e) m- a1 c* E
  41. #undef EDMA3_DEBUG+ |2 s9 R2 K7 r. [
  42. /*#define EDMA3_DEBUG*/# J: o" D/ [6 y6 {- p

  43. ( E7 O. l2 ]6 Q
  44. #ifdef EDMA3_DEBUG: T9 Q( t# J* ?" O0 `/ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 \5 ]5 ^: T7 ~6 `, }* `  u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 R% P  r5 o9 W; i6 z, [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 I9 e8 ~' M# D* P* w6 K$ P
  48. #else
    . e" ^/ j) O6 m! O! D
  49. #define DMA_PRINTK( x... )9 j2 n# B/ Q/ {8 R0 c; Q
  50. #define DMA_FN_IN
    9 Y& l3 ~: k+ e* A7 g4 P, A
  51. #define DMA_FN_OUT
    + U0 K% T0 N) n) c, w
  52. #endif5 j/ y' m% @6 g. y5 ]6 E( H
  53. 5 Y  F  G$ j6 U5 G8 Q& B) M1 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 ~0 `1 V# s4 E1 L) N
  55. #define STATIC_SHIFT                3
    * |8 \- M$ _/ A' y- H
  56. #define TCINTEN_SHIFT               20
    2 I8 g& V9 Q! g9 O
  57. #define ITCINTEN_SHIFT              21$ l0 y1 n5 e: B( c& f' ^4 s, Y
  58. #define TCCHEN_SHIFT                22
    * G8 [- \5 V+ ~2 p5 T  Q" U
  59. #define ITCCHEN_SHIFT               239 E) W" A; ^, w' W) a0 I# \0 ?

  60. 1 C4 V$ g6 x& }, \
  61. static volatile int irqraised1 = 0;& O- z  F7 P: g, M7 v" n) ]
  62. static volatile int irqraised2 = 0;
    # G+ Z: y2 y, n3 F/ Q6 e

  63. ) T  J# Q7 h8 \8 p1 o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " z$ z6 V0 O5 {5 `6 d# U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* d! K4 u8 m% H4 `+ ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % n7 Y* Y5 ^" o0 k9 y. r1 c) F2 Q
  67. ( r9 Y, P0 D0 J3 ^# M3 e5 i
  68. dma_addr_t dmaphyssrc1 = 0;% l# T! Q5 H5 J% |
  69. dma_addr_t dmaphyssrc2 = 0;
    2 B; j: e( \" I/ o
  70. dma_addr_t dmaphysdest1 = 0;& }1 a# r" F) ]
  71. dma_addr_t dmaphysdest2 = 0;% p: W+ d# e$ `# K5 j5 E4 Q1 H

  72. : Q, i4 y. ]6 ?) z- K
  73. char *dmabufsrc1 = NULL;
    0 a/ [- B2 E& ^' G2 h0 A9 t" P
  74. char *dmabufsrc2 = NULL;
      p* `/ O# _, F6 o6 s: e/ x9 \" U" ?
  75. char *dmabufdest1 = NULL;
    - l5 C8 |  \) J. t/ }8 S
  76. char *dmabufdest2 = NULL;% u6 g( S; \- T6 z* J

  77. % K" {5 o4 A" P& f8 R7 w
  78. static int acnt = 512;
    * Z: h) ~& {$ U1 v3 g
  79. static int bcnt = 8;
    $ t" L  X: @% p
  80. static int ccnt = 8;
    5 _# W; A6 u. q5 I, a
  81. ' `4 {: V6 u$ f$ J" r+ f1 B* ^
  82. module_param(acnt, int, S_IRUGO);/ w5 C! T6 B4 J( V
  83. module_param(bcnt, int, S_IRUGO);& z- w  N- q5 K4 x3 s) |) w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' L1 o: c0 t' c) d0 q7 g. i1 t4 Z% S! Y' Y, @2 W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 B9 M7 o* z, K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ ]& z  l$ _# b! Z6 G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* d& c4 @5 W" O; z, I. G! K" j7 Z
" j# z; O/ ?( K. M- Z" F7 q( |2 I0 E
6 O' o- y0 q( @/ B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 01:36 , Processed in 0.040588 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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