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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( z9 E  }( O) Z- h& b. ?8 p  i
  1. [code]EDMA sample test application
    . x* @4 ^* X+ [/ Z
  2. /*
    3 B; \6 h4 C1 W
  3. * edma_test.c
    ' L9 V$ ^6 n% L
  4. *
    + o! d, C# S) C2 J  g
  5. * brief  EDMA3 Test Application- K* N9 U5 R# C$ ?: U& q
  6. *
    % M- m9 m; a9 M" r3 o
  7. *   This file contains EDMA3 Test code.; }2 b3 s9 A6 ~2 x
  8. *
    - j$ F2 Z, S7 p, x- w6 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % g0 A; \+ F! _3 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " s" C0 U- O6 T+ @! t3 A7 \3 ^8 j
  11. *         TO CHANGE.
    3 ?3 ?0 k" D) h" d- ^
  12. *
    ' ?9 m7 d: k# l' u4 U" E: q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) R- V( y) m! Z. W& U- \
  14. *, \0 X5 `" x* m; x: x
  15. * This program is free software; you can redistribute it and/or
    2 {; p$ j- n) J* z
  16. * modify it under the terms of the GNU General Public License as
    ' ~$ N, [4 I6 u# Q( ?% U+ b
  17. * published by the Free Software Foundation version 2.* E4 f+ Y- Y' Y7 \4 j6 d7 ^
  18. *& B3 T! V  h& ]+ h& ?& Y: o/ `; L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - g6 O) _2 Z4 ^4 u
  20. * kind, whether express or implied; without even the implied warranty
    8 b4 K. v. Z3 h. K% C: ?" w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 I$ p7 R3 V1 N7 E( I4 E) M
  22. * GNU General Public License for more details.% @  O4 a/ V9 E" F% n+ L
  23. */0 @2 |+ U* ?6 e) v6 o1 y
  24. % i) [8 @8 }, Y7 i
  25. #include <linux/module.h>6 E0 u" g9 G1 U4 l3 w
  26. #include <linux/init.h>; G- O2 E& V: r" \
  27. #include <linux/errno.h>
    ) M: V. @; c4 Q, _
  28. #include <linux/types.h>
      v1 V  b9 |% u
  29. #include <linux/interrupt.h>$ p) O2 L; V2 F0 I& N
  30. #include <asm/io.h>' P! h' z2 E) p  z* F) m% O7 k# v) [
  31. #include <linux/moduleparam.h>
      _: Y8 }0 b3 ~* k! o
  32. #include <linux/sysctl.h>
    0 u9 A1 P. a. G$ C
  33. #include <linux/mm.h>, a( S! y! G: m; Y' n* ?0 M
  34. #include <linux/dma-mapping.h>
    1 H0 C% O# r) V
  35. ' F' Z0 I+ i$ h. J. x* h
  36. #include <mach/memory.h>
      y1 ~" Q8 ~, R$ f* E8 i
  37. #include <mach/hardware.h>6 g& p0 W; W; I5 \5 n( ~
  38. #include <mach/irqs.h>" p$ y/ O1 o3 v# \, \1 z3 _
  39. #include <asm/hardware/edma.h>
      @0 e$ `0 f/ N( ?+ Q+ w
  40.   V" V% ?' w- l: h0 i
  41. #undef EDMA3_DEBUG
    : `  _! c: M3 j- i4 g2 b" w3 D
  42. /*#define EDMA3_DEBUG*/
    5 D$ n2 Q7 G' u, g' K7 l4 s% q

  43. 7 C3 q: x" \3 j6 l* O. z( d, E
  44. #ifdef EDMA3_DEBUG
    , j! {* N2 v; I( W! Q# i$ v. c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - f1 s" X# o% N( ?1 Q3 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , j/ e' j0 p9 ^0 D$ n  m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' t# _% X" U5 I) Z+ f
  48. #else
    3 I; q) d6 R/ g% @
  49. #define DMA_PRINTK( x... )$ I2 I/ F9 O. t' Q5 J& L
  50. #define DMA_FN_IN/ W: K& G  U) O4 z
  51. #define DMA_FN_OUT
    ; L) ?$ P, a' Y  R+ d7 S0 |
  52. #endif6 T- P8 B0 k, T/ y' S! A

  53. - ?2 \: Y3 q, Y, `0 b- q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). }5 k8 ?. @% N! e( t
  55. #define STATIC_SHIFT                3- v$ }) ^4 o+ R' x
  56. #define TCINTEN_SHIFT               20( O( k5 V0 Q5 E/ {  A
  57. #define ITCINTEN_SHIFT              21
    + g3 |, \2 l- M! m! T$ _, H0 y( s" D
  58. #define TCCHEN_SHIFT                227 N# K- ]. x: m8 o
  59. #define ITCCHEN_SHIFT               234 O) R/ r$ K' D4 J
  60. ) e# s# R1 p4 {4 D% _9 [
  61. static volatile int irqraised1 = 0;& b9 m  L0 k2 ]
  62. static volatile int irqraised2 = 0;
    3 k) y# A0 t% L8 N: T7 y
  63. 9 I- K% H  Y4 I# v, p* t% g3 p0 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% g6 J5 R5 p- a, l$ ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 _$ n  K& p  S; _( f0 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ?( ^2 X. X+ M5 \5 T2 Q

  67. ) w' H, z! }9 N  ^" _& s0 x
  68. dma_addr_t dmaphyssrc1 = 0;
    + g9 X; h! }: D. _6 R
  69. dma_addr_t dmaphyssrc2 = 0;
    + F! p* E$ Z. `
  70. dma_addr_t dmaphysdest1 = 0;+ ~3 r2 ^! p2 o3 t* @0 I
  71. dma_addr_t dmaphysdest2 = 0;" H' _! w& N" L/ Q0 R- F

  72. , X* G0 q; h  M; `
  73. char *dmabufsrc1 = NULL;
    3 C. [' k# j! {
  74. char *dmabufsrc2 = NULL;! d1 k5 ?: y, y
  75. char *dmabufdest1 = NULL;5 y; j! u. t; J, B# P# n
  76. char *dmabufdest2 = NULL;
    % t2 s7 s( U$ A& M
  77. $ m' w$ q( D$ v: o3 v6 Q3 y
  78. static int acnt = 512;
    4 _" d( v" `- v6 V1 r6 i5 r) k
  79. static int bcnt = 8;
    + L  z. H# W, x( p% `
  80. static int ccnt = 8;$ ^* {/ F) e. }

  81. / ]! k6 g  F0 h( h
  82. module_param(acnt, int, S_IRUGO);, U7 d6 v' J1 j
  83. module_param(bcnt, int, S_IRUGO);
    0 d) M+ B6 `2 _" r$ Y5 q  [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 D  z- [4 M1 @+ H) O" b# m
7 E0 Q; d, v, p" d* z# e  B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 q# A6 Y! i+ w9 @1 V0 ^
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 u+ H& u. G# J1 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& H! W9 e7 N# {7 i( m/ W
% e1 V2 g8 o5 H# a" {
3 Y! A: W; E- Q: b2 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 17:19 , Processed in 0.038879 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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