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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 N9 d3 ?/ y. ~) y
  1. [code]EDMA sample test application
    , b# H5 ?' H4 c9 P
  2. /*
    % s" w% a2 `* A4 @
  3. * edma_test.c) n  E. i% c  A# r
  4. *9 T( H- e! W8 s* b3 L, ~
  5. * brief  EDMA3 Test Application( _. C9 l" m1 _) i( N0 X% J
  6. *" u4 A" O) b5 j3 p/ ~2 v
  7. *   This file contains EDMA3 Test code.
    , n: h$ g# [$ I; N  v5 C/ z# ~
  8. *
    % n8 w8 M* f/ f; U$ f  C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, g6 {* }- A6 M) x6 b& C8 O) z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # f8 T% I6 h3 Y% l0 A
  11. *         TO CHANGE.: f% J0 r7 e+ t3 {* {3 b* r
  12. *  B: q. R8 `1 k0 _( ^0 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " B0 j4 t8 |3 q
  14. *! G& z- {6 Q# H1 n
  15. * This program is free software; you can redistribute it and/or
    ' C* m& [- n3 j! t- f- s1 G
  16. * modify it under the terms of the GNU General Public License as
    2 |3 o, f" r" H8 e, M: g
  17. * published by the Free Software Foundation version 2.. l7 j! N# I+ s) x  _
  18. *
    , e' \+ a- ]1 v  |# A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; B) S; e. `/ Y' i  g) [
  20. * kind, whether express or implied; without even the implied warranty
    1 J" @8 {! k4 H! a% d. q$ }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 C! D$ o& p* Y: f! q6 W* h
  22. * GNU General Public License for more details.# g- V! l/ `( l  ^5 u0 j, Z
  23. */; w! F" x6 k) a; K) b6 F# l- s
  24. 2 C+ I6 v! I$ j% O
  25. #include <linux/module.h>6 K; [5 Q8 N/ l; G
  26. #include <linux/init.h>
    8 \$ d! |! @* _2 U
  27. #include <linux/errno.h>$ g2 K% B: @2 E/ o
  28. #include <linux/types.h>& \! K6 q' d# N3 x
  29. #include <linux/interrupt.h>, H6 J; V3 j4 k5 Y$ l3 N
  30. #include <asm/io.h>3 }2 e5 P; B- e& F6 [% f) N
  31. #include <linux/moduleparam.h>( e& {6 |& m6 ~5 s5 k6 {6 E8 L
  32. #include <linux/sysctl.h>
    $ f1 ?: h2 n- d9 E7 x
  33. #include <linux/mm.h>
    & i6 {. V' ~3 g4 q! C2 e/ i
  34. #include <linux/dma-mapping.h># k0 j, A" |$ D

  35. 5 E: X& N, h: `2 S8 g9 B7 a
  36. #include <mach/memory.h>
    8 A  l" \( s2 L
  37. #include <mach/hardware.h>
    + }: ~; B; K% C) X; S* L+ M. G: V1 V
  38. #include <mach/irqs.h>8 [% X( A3 k2 Y) y; W
  39. #include <asm/hardware/edma.h>; V+ Q( r( G; n
  40. % u# y* d" a. V- f% F
  41. #undef EDMA3_DEBUG2 o( M& y/ u% z- q/ E' V
  42. /*#define EDMA3_DEBUG*/; [% W+ c0 F" {( R' H

  43. * X2 C0 a) w8 |; t6 V
  44. #ifdef EDMA3_DEBUG
    ' y( x9 j, E" S: `2 d$ N: a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( A# ]( |5 N4 z: @" z2 _1 X# Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 U' s; `; D$ y& G) @2 _4 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 y$ g  @* K0 u2 O% u4 w
  48. #else
    - [3 f" _: V# f9 Z* b$ x$ {, C
  49. #define DMA_PRINTK( x... ): h5 O# [6 y0 L' d$ s
  50. #define DMA_FN_IN, R  L0 g  }) J( L6 ]
  51. #define DMA_FN_OUT
    7 r9 g+ G& B  k' y) n0 `/ f0 b1 u9 K
  52. #endif+ R8 Q2 M9 |, P5 O; N5 Y  S

  53. & \* Z6 C! v& T+ ^5 y% l8 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; [( ~! }9 l' z1 i% `  c# s6 s1 g/ c; l
  55. #define STATIC_SHIFT                3% U( a. V0 x; z# O; i  j" `% v4 D
  56. #define TCINTEN_SHIFT               20+ N: R( a8 g1 i5 J% Y
  57. #define ITCINTEN_SHIFT              21
    , Q' `. O2 s9 A
  58. #define TCCHEN_SHIFT                22  Q8 T9 k! U- q( f0 i; L# G( d4 Y
  59. #define ITCCHEN_SHIFT               23- u5 z9 Y5 [& k( v
  60. # ^8 B8 V3 p7 H& _
  61. static volatile int irqraised1 = 0;
    7 F! n  F3 ~4 p6 u( x( y3 k! V
  62. static volatile int irqraised2 = 0;9 c( s3 W! G0 \( }

  63. - v" E8 {- H4 z2 b  }/ F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 [* [8 D, r5 T& J- d$ v3 s  A7 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 u: j# U6 Q* b* Q! _* u+ i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ C) ~6 P. t/ Z( z

  67. 0 I, ^% S/ V; w0 C# \- A% y
  68. dma_addr_t dmaphyssrc1 = 0;7 @' M  E$ w- G0 x/ n2 O
  69. dma_addr_t dmaphyssrc2 = 0;
    * G; ]1 x& q' R8 S
  70. dma_addr_t dmaphysdest1 = 0;
    ' x9 F1 h: S5 K( e' \0 a
  71. dma_addr_t dmaphysdest2 = 0;+ y& p6 o- O) y: A
  72. % |- Y# V; W" D
  73. char *dmabufsrc1 = NULL;4 G! T3 @$ Z- q% m2 y1 D$ Z
  74. char *dmabufsrc2 = NULL;( g8 l0 ?5 K& P7 D# r
  75. char *dmabufdest1 = NULL;
    ! |2 O- }! p$ i! H
  76. char *dmabufdest2 = NULL;
    7 Q& @' x4 E8 ^8 p. f8 T2 `( n, [

  77. 2 v# F# C. S' Z" ^. j6 j+ I
  78. static int acnt = 512;/ n0 O% X" }' g! t; `1 o4 \
  79. static int bcnt = 8;! S1 t- ?6 A/ d% n3 b3 T( F6 ^
  80. static int ccnt = 8;3 h) t! Y5 @# l% h1 M7 L7 [" j
  81. 6 Z: \8 T+ I) }+ t( b$ W6 R1 b
  82. module_param(acnt, int, S_IRUGO);' F6 ]  G, R/ X- E: E8 j
  83. module_param(bcnt, int, S_IRUGO);  i/ V1 G) Y2 o4 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 m7 S" z7 b7 @" w1 Z5 q0 k! c( ?1 R6 E' c! L5 G8 F+ K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ r0 U  W0 ]! @' o6 J+ n9 \5 j$ _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 M% b/ z+ H/ P+ V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( z' X- P" s* G9 `0 x  W+ k  V" J% m* s- e6 f# a) i3 T! B& z- z
+ d% l& v- I9 N8 c& ^; Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 01:31 , Processed in 0.048759 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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