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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 B: F2 v0 I$ U$ [) T! X
  1. [code]EDMA sample test application
    9 B* e6 |& i5 `3 B9 W3 A3 n6 L
  2. /*" Q7 d' ^- Y9 q  L/ b
  3. * edma_test.c9 ]* p* g! `' Q4 G  ]
  4. *. S5 Z! W1 _" Z
  5. * brief  EDMA3 Test Application
      Y% F' h) j: o) l2 K
  6. *  j/ \7 u& P1 e6 k, ]
  7. *   This file contains EDMA3 Test code./ W3 y5 v4 Q. m" {: X4 b+ {
  8. *
    6 n: b4 p0 o7 n6 d$ V* J) V* U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 D4 i& E( O# ]) ]# `0 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) w1 _0 y% M: u2 [
  11. *         TO CHANGE.; v, ]6 e1 d% \! w, ^# J
  12. *) S  H6 X4 ?) f6 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: V/ R" E8 b  T" N, ]4 U
  14. *
    1 K4 E: P, ]* ^8 j/ [
  15. * This program is free software; you can redistribute it and/or
    4 `2 h5 j6 l3 I' S, B
  16. * modify it under the terms of the GNU General Public License as
    ! K* C+ [/ e9 Y7 _) F: N
  17. * published by the Free Software Foundation version 2.
    3 w4 {# A: {8 y& s7 W/ C/ U
  18. *
    - k, z. P  Z# @1 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, @5 C  L; a' [
  20. * kind, whether express or implied; without even the implied warranty
    ) D+ ?' L, a. ~8 j9 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! K/ Z" ^& `2 `1 a( \6 X" t
  22. * GNU General Public License for more details.
    9 `! _# X/ B' V( ]. M+ g: Y4 r5 {
  23. */
    7 \; Z. I- F) H5 s

  24. . Q  s  J$ G1 W' g- N+ J+ X
  25. #include <linux/module.h>
    & i& `6 i7 Q! B* T9 F/ q
  26. #include <linux/init.h>- A5 C1 u. q9 y" P
  27. #include <linux/errno.h>
    ( a3 ^& Y% @9 l; C4 c
  28. #include <linux/types.h>
    - }, K/ r2 W5 F4 B
  29. #include <linux/interrupt.h>
    2 j3 r4 A7 I, s( m+ X
  30. #include <asm/io.h># A1 Q: ]& K+ j1 D3 u& i% C
  31. #include <linux/moduleparam.h>
    7 y4 T! N) A( p
  32. #include <linux/sysctl.h>
    $ n6 W. F' Y, L3 D
  33. #include <linux/mm.h>
    7 [# C  x4 A5 m  H
  34. #include <linux/dma-mapping.h>
    # m; |4 K, y: w# N9 U  u: Q
  35. , G: o! B: k4 {
  36. #include <mach/memory.h>
    / i% u& L8 _& H
  37. #include <mach/hardware.h>
    , d' b* \' T2 f8 l& C  ]( K# L
  38. #include <mach/irqs.h>
    6 D3 p1 W6 V- K$ t: \
  39. #include <asm/hardware/edma.h>) [% N; z+ u* B  r- e2 v6 h5 A2 F! y

  40. " D3 m/ @. @, T+ y$ X
  41. #undef EDMA3_DEBUG$ N& w3 c+ D6 N+ w
  42. /*#define EDMA3_DEBUG*/
    + H. Q) ^/ E, i: p

  43. & ?4 F" F: D" l- j6 }4 V
  44. #ifdef EDMA3_DEBUG$ r) u3 c- P' e' K9 P- M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ A3 l# r! y1 ^0 I; t+ H3 r9 ]$ ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / [+ U# U/ _$ H* i# m! }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ O1 f+ o5 V0 f( T
  48. #else
    & i% L% e  O, H9 X3 D
  49. #define DMA_PRINTK( x... )
    " d5 T6 h' C9 G5 u/ |
  50. #define DMA_FN_IN% S. L* H2 e- y
  51. #define DMA_FN_OUT' k: a4 E( @7 @* e9 o4 N
  52. #endif4 u. U$ Q6 ~# a. b  x! c

  53. ; l" S2 {! D& Z; h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" [% a% E6 ]1 {) p$ j
  55. #define STATIC_SHIFT                3
    6 g- l9 x% C) M8 k6 U
  56. #define TCINTEN_SHIFT               20
    1 j+ I# E2 S+ A% M5 d
  57. #define ITCINTEN_SHIFT              21# N( b/ d8 r" ]1 ]0 o9 M8 z0 y
  58. #define TCCHEN_SHIFT                22
    ' L" C3 {3 f7 |' r2 ^7 @
  59. #define ITCCHEN_SHIFT               23
    $ }0 z  f; |% g$ ?/ q
  60. 5 d, `1 n4 m4 S! z+ q
  61. static volatile int irqraised1 = 0;8 X& k9 @2 B# E5 d  V. O
  62. static volatile int irqraised2 = 0;# [" j- o7 e" y% E: v

  63. ' U2 C$ D+ b# @0 y1 ], C7 M; R8 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 r, y0 p/ V0 [; T2 w+ `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. n  C7 M. _4 |/ H. ~: n) {' E! |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 r& c8 `3 d$ ~& {+ j4 P

  67. ! O2 E: B4 O9 x: X
  68. dma_addr_t dmaphyssrc1 = 0;
    + Y- t1 Y4 b9 d9 u
  69. dma_addr_t dmaphyssrc2 = 0;
    , w: n- L- \8 X% w
  70. dma_addr_t dmaphysdest1 = 0;) C. }' F& W$ k; W6 U/ V, P$ a
  71. dma_addr_t dmaphysdest2 = 0;( \: N% I* r9 Q' h$ J

  72. 5 W, N$ E* U" n% l( R7 O! X5 K
  73. char *dmabufsrc1 = NULL;
    7 s2 P0 J& \3 b. J. |
  74. char *dmabufsrc2 = NULL;6 J4 `9 M0 }, e+ q2 t" R$ _
  75. char *dmabufdest1 = NULL;
    ; U; f' `: \' y# p/ {
  76. char *dmabufdest2 = NULL;1 Z; X6 h9 Q' ^0 W1 p% ]2 `  s

  77. ( d3 s  W/ V; A
  78. static int acnt = 512;- ?$ |( ?* I0 N9 ^- r) p; _8 N
  79. static int bcnt = 8;; p; G4 X1 @$ v& U7 G
  80. static int ccnt = 8;, T6 @4 I+ P" N

  81. 6 C4 L; v- l$ U" z; W# H
  82. module_param(acnt, int, S_IRUGO);5 a& n  a3 _4 ~* O7 q+ r
  83. module_param(bcnt, int, S_IRUGO);
    2 p$ e  h% Z+ d; B& G5 C6 N' b2 v6 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 m- M& U1 k# ~: T: \% m: p
' e5 u% M7 N. J' M0 f: ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& C9 z8 n% w! A/ A' i# V1 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ q( G8 A, m3 _: P% m! @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ v1 b/ E) M8 F0 s( D
9 u. ?3 {. l& p& A# E) k% Q5 Z' E% ?) C
9 {: i5 `. |5 W9 `" s" t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-17 02:54 , Processed in 0.037762 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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