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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 K- ~0 X/ F7 s- C0 a5 R! B! J
  1. [code]EDMA sample test application
    ) U8 R! a5 z. n/ y7 `7 @6 ]
  2. /*
    , Y9 S$ K6 K) @
  3. * edma_test.c0 ~( X3 t3 c9 u/ _2 p( ~
  4. *
    * _" n2 ~3 B% N  \. @
  5. * brief  EDMA3 Test Application
    1 P6 s! X% D+ R( f: [4 Z( p5 N
  6. *
    6 ~* b% a& J% \+ _+ \
  7. *   This file contains EDMA3 Test code.0 l' j$ u" v1 B% Q; \5 j- o
  8. *
    : |. J6 n; {/ m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) O6 W" y1 }. H% g$ [1 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 g& t# R. I* W. q7 @: X. _+ N) x
  11. *         TO CHANGE.+ `  S" {% H* S' {1 e' \9 Q8 C: S
  12. *8 |4 l1 r. i3 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! ?" h+ X7 s4 Z3 s, f. i0 _5 ~1 m
  14. *) O: s; {) v  v: j2 `/ _
  15. * This program is free software; you can redistribute it and/or! T  o- F3 d6 Y" C% ~1 J
  16. * modify it under the terms of the GNU General Public License as
    ; ]$ _; H0 |2 Y4 A
  17. * published by the Free Software Foundation version 2.
    * ]! c' [- O8 y- `, F
  18. *
    % _; k# t4 d4 s3 P2 |% Y+ U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# R  k  w2 @3 t' K
  20. * kind, whether express or implied; without even the implied warranty
    : A' N. a) j1 `, A  T; m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - h/ ^- S( Q, z) M5 u
  22. * GNU General Public License for more details.4 q+ O: f1 E( D3 P$ D
  23. */0 z# i& W: v0 G2 `% e0 @

  24. : I% K3 u  Q* j- @3 D
  25. #include <linux/module.h>
    $ t/ M2 V: b- t, a( C$ q; m
  26. #include <linux/init.h>
    9 N* C2 y! U! p1 j+ r- N4 r7 h
  27. #include <linux/errno.h>
    : c! \8 _- q7 Q$ |% c% _$ X5 f# S
  28. #include <linux/types.h>- S% v# i/ _3 A4 A- z* M9 C5 V
  29. #include <linux/interrupt.h>
    - i. e% h6 P5 Q! X2 E/ x7 }
  30. #include <asm/io.h>
    $ l; J- _- e9 ]
  31. #include <linux/moduleparam.h>7 q2 e6 ?+ }" O5 u+ b9 G
  32. #include <linux/sysctl.h>) ]; U) W) t6 C
  33. #include <linux/mm.h>9 d$ f# O0 ]  f. R" Q; `8 X
  34. #include <linux/dma-mapping.h>
    ' i! Z( {6 ~) B- o# U" {+ E; ~
  35. - @+ q! `& a: S" G, g
  36. #include <mach/memory.h>
    : K3 L( H5 H/ G3 f0 }2 z
  37. #include <mach/hardware.h>) ]+ T, @$ m6 v
  38. #include <mach/irqs.h>
    / R8 S# R1 r! O) T/ E' ?  x
  39. #include <asm/hardware/edma.h>
    & |4 O' C  u+ k% j1 r6 d

  40. ) x$ N# [2 |  n& y; G( T. r
  41. #undef EDMA3_DEBUG( g. M" i$ G9 R  L' t% K' _' z
  42. /*#define EDMA3_DEBUG*/
    , A* T3 m- q- ^" r
  43. 8 ^6 w& m+ a4 e: I: j
  44. #ifdef EDMA3_DEBUG
    & P0 o( r5 h! ]8 ?. N8 v# o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* p: C+ r4 h  T. W- j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# a7 z1 ?. f+ _8 d  I9 j+ G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * R- H% w! _' Q  s  N9 a% H
  48. #else* S" \1 Z& O; }$ e; r# `
  49. #define DMA_PRINTK( x... )! j2 J, C1 D/ @
  50. #define DMA_FN_IN. R$ x9 E2 d1 c7 R9 d
  51. #define DMA_FN_OUT2 B, A4 F3 M2 }) j0 j4 i
  52. #endif5 s- y" R% G# Y7 j! R" U5 n
  53. & `& _& W. ]% }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 v0 F, d. ^% S. l2 s
  55. #define STATIC_SHIFT                3; h+ @( C1 W+ p( `. d( Y
  56. #define TCINTEN_SHIFT               20
    ; F' a9 L  U5 }. ]# c% F2 N; _
  57. #define ITCINTEN_SHIFT              21
    9 v( C8 f( f5 [' I3 E
  58. #define TCCHEN_SHIFT                22' H: S9 H; \8 B6 F
  59. #define ITCCHEN_SHIFT               23
    & |; u& M! A0 I/ P0 y

  60. - {. `* U: C! P3 p
  61. static volatile int irqraised1 = 0;+ l7 B( D5 G9 [& y
  62. static volatile int irqraised2 = 0;% f* e0 G0 _; n' L- O6 V
  63. % T* ~  O% O3 J' r$ d" S. E$ W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 r' A; G: }# N8 F, S- v% u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 g' V  S9 X& D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* J' Y8 o2 c, ]

  67. - x8 o+ Y6 q* K. ^. |
  68. dma_addr_t dmaphyssrc1 = 0;( ~: K) s" X& K: H$ Y
  69. dma_addr_t dmaphyssrc2 = 0;6 R8 G0 A; T4 s' ]) i0 z: g  j0 Y
  70. dma_addr_t dmaphysdest1 = 0;
      B$ @! i+ P* V4 ?. [$ Z' m
  71. dma_addr_t dmaphysdest2 = 0;
    , k$ M5 J7 F! K/ p5 Y9 n- z

  72. - E. F1 C: c1 V( p' c0 ]0 _
  73. char *dmabufsrc1 = NULL;
    8 y0 w5 I" o. N! w
  74. char *dmabufsrc2 = NULL;8 r- _7 g: }3 {% f- S
  75. char *dmabufdest1 = NULL;2 l, [" A7 s" P9 q: b" C
  76. char *dmabufdest2 = NULL;/ y% Y' L9 s' e5 M' v

  77. + f) P5 e5 g- G, C3 Y' n, f
  78. static int acnt = 512;
    + o; b. u1 `6 ~# Y5 B# S/ n& K
  79. static int bcnt = 8;$ s7 L, n! r; E$ \
  80. static int ccnt = 8;1 f+ ~3 u4 M6 A# E1 K

  81. ! F3 X$ r# U) B; ]% X
  82. module_param(acnt, int, S_IRUGO);3 X' J! J: B+ r' W- g; G
  83. module_param(bcnt, int, S_IRUGO);
    . h) f* k' C- d5 w5 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. x7 E/ s/ D4 ~2 F0 I
4 W8 B7 I; G, N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( z0 ^$ h$ _  P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% |: A7 w; Z- s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 g9 x( k9 d( n* k, T

1 x  L/ b/ O# p8 B, a3 L5 Z+ k8 A9 ^) x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 12:35 , Processed in 0.045233 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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