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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 ?$ M: P' ?9 g+ o
  1. [code]EDMA sample test application
    ! |, y& F* n: @( b2 W
  2. /*
    $ _. @9 z0 J0 ]6 ?3 L8 Q
  3. * edma_test.c+ i% p% S  Q( S7 L
  4. *
    9 B- x) @; I( M! `9 w; M
  5. * brief  EDMA3 Test Application
    : n0 k3 A. y% Q' c" `* p
  6. *: Z1 c$ F! h6 _+ W- z5 N' p4 m
  7. *   This file contains EDMA3 Test code.
    + X4 W  L4 ^' u0 n
  8. *
    1 T2 u8 l8 t9 G0 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' l& {4 ?- O; m2 u) x7 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% }5 B$ |% M. ~9 y! W5 x
  11. *         TO CHANGE.
    5 i6 G7 C7 [3 a( [1 ]- n! M& }+ G
  12. *4 s- u* v: M' E3 ~/ h. ?, Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 U  `: E% [1 f, F+ t' F* g
  14. *. P, f  H7 J+ D9 r) Z- w9 U
  15. * This program is free software; you can redistribute it and/or
    2 _  p0 }4 o; S8 f! X, p1 h1 k
  16. * modify it under the terms of the GNU General Public License as% ~2 \% P2 O! ^$ z
  17. * published by the Free Software Foundation version 2.
    * y' _, g# v2 Y; W
  18. *7 g" e. x; U6 z3 g+ h  b3 S/ }0 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ?. O0 m+ i/ B) T& D* \
  20. * kind, whether express or implied; without even the implied warranty
    , u9 n, B, }" P, H, w+ U* d- [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + t0 Y3 h/ K  J  \
  22. * GNU General Public License for more details.
    0 J: i6 D( c  D' H8 M
  23. */
    0 r; @  H9 g/ H5 g
  24. . g4 x# p$ T8 h
  25. #include <linux/module.h>  I6 G# N7 e2 r2 S" o1 ]- g
  26. #include <linux/init.h>0 \, g5 E2 L6 c, H; k7 l" U
  27. #include <linux/errno.h>
    + |* W- q6 G! R& Y+ F5 u2 R
  28. #include <linux/types.h>. X2 x( ^/ [' w8 ]( @7 q
  29. #include <linux/interrupt.h>% M& t& J6 ?8 h$ n6 L
  30. #include <asm/io.h>, t# P% L8 K& n2 a0 n: R8 b
  31. #include <linux/moduleparam.h>
    4 e6 G6 K9 \2 ^, \) p" x
  32. #include <linux/sysctl.h>& h+ ]! l5 O9 l# Y+ Q0 B$ m
  33. #include <linux/mm.h>. h( X! G5 A; e1 [& x" n% x; G
  34. #include <linux/dma-mapping.h>  ~' F+ i3 P/ K, @- c! j

  35. 2 e, Q$ @3 y& k; i
  36. #include <mach/memory.h>- p; C0 E% x& N
  37. #include <mach/hardware.h>
    # K7 g0 ~* E4 N) |
  38. #include <mach/irqs.h>
    8 ^6 r( }) h  k  h7 ?5 ]; R! U
  39. #include <asm/hardware/edma.h>
    % l  t0 N$ V- p) q8 _
  40. ! U& f: g+ Q0 x; r5 J  ~8 p2 d: t
  41. #undef EDMA3_DEBUG4 ?) _3 Q! n" \% r! a% @
  42. /*#define EDMA3_DEBUG*/6 }7 ^& e8 T" p# H" b
  43. ; \! K# y2 s  y$ ~$ k4 ~9 m& L' c
  44. #ifdef EDMA3_DEBUG! r9 a8 D% t: A8 h$ x' d1 J# |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / k9 ?% r% ~8 ^; o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ o* w+ n4 ^" A3 o% M6 t/ x8 _1 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  N$ h  S9 s9 P5 w2 }
  48. #else
    7 w+ M$ G) I* g4 r9 R
  49. #define DMA_PRINTK( x... )$ P$ d* r4 U# b% f2 A& v$ X
  50. #define DMA_FN_IN& I) c! b! w1 T# L/ P  w) t' ?( c
  51. #define DMA_FN_OUT
    ( z% d, {9 A* G+ p8 g# S$ t
  52. #endif
      |# U# x% b- U+ k7 ^. H4 A

  53. , F) j& L& z) Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) q% q3 I  V! w7 O9 A% T8 w
  55. #define STATIC_SHIFT                3/ T3 w/ e" p+ d8 K" X: y+ L
  56. #define TCINTEN_SHIFT               206 L& C" Y4 z0 Q0 f' x9 L) ^
  57. #define ITCINTEN_SHIFT              21
    4 U5 |$ z, }7 O  G% {0 K
  58. #define TCCHEN_SHIFT                22
    7 z) j* H' M1 }. y2 ]
  59. #define ITCCHEN_SHIFT               23
    ) z3 r+ _! o6 x: F8 U) V

  60. 4 Q) {  u; {) V; x' b
  61. static volatile int irqraised1 = 0;" a- t! d1 l# N- X
  62. static volatile int irqraised2 = 0;
    + P3 u+ d4 @5 z. N& E# N: S

  63. , U& n$ \: }: [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 c7 p: M: x! q+ g* H5 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 u# P6 T3 A5 f6 p: Z% E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 H8 A* E2 w: T' ?
  67. 9 Y0 t8 a% a7 ^7 A% d8 S8 a
  68. dma_addr_t dmaphyssrc1 = 0;( ~5 ?& o; S  K: d0 p
  69. dma_addr_t dmaphyssrc2 = 0;: b1 \, h: A" O7 g& |0 @
  70. dma_addr_t dmaphysdest1 = 0;0 X6 @! x! o& U$ n  f) Z
  71. dma_addr_t dmaphysdest2 = 0;
    $ h5 B' b8 g& T2 C1 D/ J5 U- R
  72. + N3 d1 W# H! p2 d8 ^
  73. char *dmabufsrc1 = NULL;
    % U) j. I% j0 Z" p, l. |" h
  74. char *dmabufsrc2 = NULL;
    / h( b; b; \3 r9 v0 x3 M
  75. char *dmabufdest1 = NULL;
    $ O; B6 C: p4 B% ~
  76. char *dmabufdest2 = NULL;& j6 w, K' G9 c1 {2 U( e
  77.   s; Z! F( X5 L) [- `
  78. static int acnt = 512;4 k0 }  ]  `5 N4 w* m/ b: A
  79. static int bcnt = 8;3 P, p* C6 x& }) {" i  Y
  80. static int ccnt = 8;
    % {- B1 W% q( N5 c& O0 v% T; o

  81. 7 N1 @5 d. E2 }% D
  82. module_param(acnt, int, S_IRUGO);
    ) U7 b: s' [2 W6 A" _) Y
  83. module_param(bcnt, int, S_IRUGO);
    ' ?% O' ~$ z$ A- n' V! R0 x  F  `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' [; s( X* D$ b9 _. \: W9 d

2 u4 H# [, _3 f" k: B5 Q3 w$ f# d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" O) `) i9 \1 O3 w  o+ C% u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) M3 U- W! _4 I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 \9 T# \9 M' @6 Q& h; m1 `& ~  O7 Z0 G! q, u
1 L2 W+ t% y  {0 w" O7 h. e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-6 09:24 , Processed in 0.038925 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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