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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! I% U( X+ Q; |" F
  1. [code]EDMA sample test application
    % M+ E* P( I& r
  2. /*; E. ]5 x& q5 g! y' x9 \
  3. * edma_test.c
    " B1 P6 U% D2 J% N+ u
  4. *. q% I$ m% G7 M; u$ Z1 S1 R
  5. * brief  EDMA3 Test Application
    ' R2 g/ B/ R. s+ I
  6. *0 S: R( W+ l, d
  7. *   This file contains EDMA3 Test code.' h9 S5 P4 Q6 ^% ?. U9 j6 z
  8. *
    2 m5 {" T( B, G5 W# v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. B9 t" |3 H, L7 I& M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 @: b5 ~* }# m+ \% P8 }0 T( s2 D6 a
  11. *         TO CHANGE./ }0 Y% C7 B9 \, u
  12. *; p* z& r1 n/ D& v, p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + i, X8 z8 M) j0 H, }8 d
  14. *5 D7 _% S" l: E  H8 R
  15. * This program is free software; you can redistribute it and/or0 z+ ^0 S9 b0 L# I1 f4 x
  16. * modify it under the terms of the GNU General Public License as. I% W! S9 L2 [; u1 E5 S
  17. * published by the Free Software Foundation version 2.' U: y0 f0 m) J/ E& R1 u0 P! u5 j
  18. *2 o* Q2 Q3 P9 T3 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 Z3 F3 o- z2 s) ~
  20. * kind, whether express or implied; without even the implied warranty
      w0 w* I* F( ?9 {7 O. n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / c7 }5 E  U5 [2 x
  22. * GNU General Public License for more details.4 K% R  Z4 q( [" L5 t! d. ^
  23. */% Q/ s3 q* ?5 u& ~

  24. ( _' T9 ^# ^8 @4 I% a4 y
  25. #include <linux/module.h>% U: y% Y; {+ n4 a
  26. #include <linux/init.h>
    8 z4 ^; n) u# |$ U/ U; }  y
  27. #include <linux/errno.h>
    # y0 {- G5 {* a* g6 `/ Z2 [* e, s
  28. #include <linux/types.h>
    ) ~) i, N1 ?0 s/ L$ e5 V3 ^( v
  29. #include <linux/interrupt.h>
    ) I. C# q" }; S6 P, o! F$ L
  30. #include <asm/io.h>
    2 m9 W9 v$ \* h) p; J
  31. #include <linux/moduleparam.h>
      h) b3 v. I6 O  n- y/ d
  32. #include <linux/sysctl.h>
    2 r+ C, V$ a% o- o$ J
  33. #include <linux/mm.h>
    9 r3 H  k" A' D
  34. #include <linux/dma-mapping.h>
    / H# [5 d2 X- S; y5 f" \

  35. 0 r6 u5 a8 g  T/ V
  36. #include <mach/memory.h>, e5 Z1 X8 s' B: |1 U
  37. #include <mach/hardware.h>
    % }3 L: e9 Y  R" T% Y, @- G
  38. #include <mach/irqs.h>, f" a7 _; d: r6 `) V+ p
  39. #include <asm/hardware/edma.h>% S# L+ [' V7 _
  40. 6 T$ q7 G1 E7 [3 P- ]) E0 g' U
  41. #undef EDMA3_DEBUG
    ' `3 a3 M$ @( u* P% C5 E
  42. /*#define EDMA3_DEBUG*/( v+ Z! B# X: A- D' d. P" I2 g
  43. . c' I" u) J% v2 u+ |, a" O, J
  44. #ifdef EDMA3_DEBUG
    * [* y+ t1 s( b8 w# m* g. y! S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); O5 f/ A+ A* ], l4 r* H, h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ?9 E% G1 ^( ~# n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % @0 }  n6 K: f; k
  48. #else
    % Z( K4 N( b( d5 v7 c: D5 t' e, F
  49. #define DMA_PRINTK( x... )( A- M, o5 ?' Z. [
  50. #define DMA_FN_IN
    - O0 A4 i/ C; R& U
  51. #define DMA_FN_OUT& t/ A2 O( b' R6 y% |. G
  52. #endif4 f+ p! `# i7 X$ w" N

  53. 1 W4 D& `  H8 \: s9 o. E- D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), C+ x% f7 A- H! R' L
  55. #define STATIC_SHIFT                3  X/ I( ~6 }  L7 Y5 ^( K7 @; Y9 d
  56. #define TCINTEN_SHIFT               202 Y% {9 z1 H3 A4 {
  57. #define ITCINTEN_SHIFT              21
    ! y# C- ]3 A2 Q
  58. #define TCCHEN_SHIFT                22
    . _, R) ^5 n$ U$ F
  59. #define ITCCHEN_SHIFT               231 n, d4 n( V. T  f  l% d% X
  60. " y! J9 r& i; G
  61. static volatile int irqraised1 = 0;
    , v) s& r( x5 m- _+ J
  62. static volatile int irqraised2 = 0;
    # [. I" @) \- s; }
  63. : B# ^0 m+ B  @  E$ L8 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! X4 x% x0 c) j6 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 {) Q( |0 L/ @' f5 d) i( B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' V$ ^) s3 g9 \3 y: m
  67. * r8 k& l! k6 k
  68. dma_addr_t dmaphyssrc1 = 0;  z" y# b( p' C5 K4 K9 ?1 ]
  69. dma_addr_t dmaphyssrc2 = 0;
    4 z) a- A$ p& q- W
  70. dma_addr_t dmaphysdest1 = 0;0 w+ C# j1 U, w) i* \* `2 o$ Z
  71. dma_addr_t dmaphysdest2 = 0;/ N1 @: t1 y; _. E6 |% S5 L

  72. 1 X: A* @" D3 l5 i" p: F
  73. char *dmabufsrc1 = NULL;/ D$ ]& R. Z* T8 t- O3 l: r
  74. char *dmabufsrc2 = NULL;
    . F. |' ?% Q% s, ?
  75. char *dmabufdest1 = NULL;8 W; h; n8 f5 L* d* j, }
  76. char *dmabufdest2 = NULL;
    1 V! ~* D, O) ~0 G9 Z" Q
  77. ! M5 o1 p: h* J3 d
  78. static int acnt = 512;1 i3 K2 v& R1 B1 I
  79. static int bcnt = 8;* H- ^$ ]( E+ ~( q) I/ j! g0 c: ?
  80. static int ccnt = 8;5 \) l: k# D1 n  _! a5 R5 l
  81. * M0 v3 l$ t( b, i7 f5 F/ R
  82. module_param(acnt, int, S_IRUGO);
    ) \$ r2 \6 _0 d% O' m" P
  83. module_param(bcnt, int, S_IRUGO);5 P, F; r6 H0 d% y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: F( P. @" D, x! D! p+ N" {

$ o+ B) G8 f. l% @$ v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 p% R8 x  ^/ B- `- M; b! jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' ~4 [' r; E; I  k* m1 y; G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 c; y$ r) U- N9 ~

1 f4 }/ M' a8 C8 C3 ]% T+ r; n3 L% e4 _4 ~1 w$ \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 03:03 , Processed in 0.039507 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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