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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " y$ i6 w9 C6 J! U
  1. [code]EDMA sample test application
    8 a: G8 v* R9 [9 S( `2 }
  2. /*( h# F! I% V; X
  3. * edma_test.c
    & A, K% k1 n! _
  4. *' N9 X  s- Q; g8 b# ~! h9 y" G
  5. * brief  EDMA3 Test Application
    % [0 T. L! q) e! o, W# a
  6. *
    : y) C+ ?, }2 z5 k+ D. p* p
  7. *   This file contains EDMA3 Test code.
    ; J+ p' U; a7 n+ z
  8. *
    8 d+ O, M- y) y  H, u( l0 u7 g6 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ ?; }9 f: t8 G4 n% x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 i8 ~* Q9 C$ Q
  11. *         TO CHANGE.
    - r, b6 c4 U% f
  12. *
    2 ^* ~/ U( E& K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% s6 y8 ^  y1 K* }. m
  14. *4 l9 |) w' T0 m
  15. * This program is free software; you can redistribute it and/or' }/ w) @& t. R8 N4 d0 |' u* b
  16. * modify it under the terms of the GNU General Public License as1 J4 f% F4 {- I* H( f/ L6 C3 Y
  17. * published by the Free Software Foundation version 2.
    3 N! D7 {( N- M9 A
  18. *
    * Y6 P. l4 Q6 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 v& E9 C6 L- }0 }6 a$ R* x4 ^
  20. * kind, whether express or implied; without even the implied warranty2 P- S1 u. q9 ?! D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) o$ _; `% a0 E/ z
  22. * GNU General Public License for more details.
    ( ~$ t3 c- Z" _% Z
  23. */7 I# m, x0 R; J# v' I9 K" @
  24. & F* P& s7 c& ~8 w; k5 Q; f. [
  25. #include <linux/module.h>1 {5 S( w# M3 o& }  S0 u4 G. \% ~
  26. #include <linux/init.h>1 l) T: P# ^, x! V
  27. #include <linux/errno.h>+ _1 a2 G" C0 V5 j: T
  28. #include <linux/types.h>
    & ~$ Q9 s# p! F7 O- ^% ^8 P( t
  29. #include <linux/interrupt.h>  f7 M" z2 F4 |4 s* F
  30. #include <asm/io.h>
    2 L1 t2 d- }& K$ m4 Z) u7 f( j% Q) I
  31. #include <linux/moduleparam.h>2 z7 Y& L! w( q9 i% w" w
  32. #include <linux/sysctl.h>$ O1 b' q8 A/ L4 `  s
  33. #include <linux/mm.h>
    * z' }* U6 G! {. p# e
  34. #include <linux/dma-mapping.h>
    ( x: ~$ r3 `2 `
  35.   P5 r8 T$ ^0 r
  36. #include <mach/memory.h># C/ N3 h1 C8 D: Z
  37. #include <mach/hardware.h>/ q: J$ x: g2 K4 j
  38. #include <mach/irqs.h>: D$ U+ s0 U: O2 P+ a- ^7 I7 ^
  39. #include <asm/hardware/edma.h>
    * ], n! C& O3 @) C9 C4 R0 b

  40. 0 k* u9 {& W" H! z
  41. #undef EDMA3_DEBUG
    $ s# D; d6 z* B; L' L
  42. /*#define EDMA3_DEBUG*// j5 u' b. q+ }5 ~
  43. # _# y3 L. ~* T, @1 T+ J, O
  44. #ifdef EDMA3_DEBUG- ]9 C& `8 [; L/ N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 t9 o  I$ x  Q" w" A" [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 n/ H! E" j" x: _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + P$ B; C3 {* R2 l
  48. #else- |0 g7 K% M) Q8 J
  49. #define DMA_PRINTK( x... )1 f/ B! R! H* f
  50. #define DMA_FN_IN
    0 h" |: q* x/ p' U8 _9 h
  51. #define DMA_FN_OUT7 o/ B! \- v6 p4 @- [+ _- ?( _
  52. #endif
    " ~0 w& O6 T/ M, F. q
  53. * l' b  }- ?6 U  s6 i. W& U2 m$ F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; m0 U) z  Q" B3 k0 Y
  55. #define STATIC_SHIFT                3. p7 o, r' A8 H
  56. #define TCINTEN_SHIFT               208 Q) M2 K3 W/ w1 s1 J  W
  57. #define ITCINTEN_SHIFT              213 \# ]' T; B' N. }! A* f2 N6 X$ |
  58. #define TCCHEN_SHIFT                22# c/ K9 k6 Y0 P9 F8 o
  59. #define ITCCHEN_SHIFT               233 {+ c5 |: H) b, z# t7 u! S
  60. " Z# [3 l' S! J% E$ d
  61. static volatile int irqraised1 = 0;
    8 N, S) s7 ^' q; W; E
  62. static volatile int irqraised2 = 0;! J7 l/ t5 q3 f2 i: L5 L8 z
  63. ' N% F' l% d( @8 H0 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 v8 p0 d, g2 n1 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" M% x6 P- p" I$ H! k* H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 o' b7 ]7 |! `3 U6 K( x% \
  67. 1 }( j+ q8 l0 X
  68. dma_addr_t dmaphyssrc1 = 0;2 |; B8 t! r8 p( H: u2 y0 v
  69. dma_addr_t dmaphyssrc2 = 0;' ?0 d% }, o' V
  70. dma_addr_t dmaphysdest1 = 0;
    , ~: x$ g( m; y
  71. dma_addr_t dmaphysdest2 = 0;8 X& D3 s9 I3 ?) u& S4 p
  72. # ?* C  e( I/ P
  73. char *dmabufsrc1 = NULL;
    0 [: E5 Q  N; i% H& j
  74. char *dmabufsrc2 = NULL;
    / P8 J  F0 V. w
  75. char *dmabufdest1 = NULL;! y% h; t1 B0 g$ ~
  76. char *dmabufdest2 = NULL;, k2 w; N/ C0 h

  77. % c2 ]& \% w& G  |* e; }. T
  78. static int acnt = 512;3 D+ O0 ^9 r5 ]" |# h
  79. static int bcnt = 8;
    # C3 A9 ?7 U6 G7 F. K* D
  80. static int ccnt = 8;
    & H# n* x; q  ^) F" A

  81. 8 s& n! N9 v( k8 g( |
  82. module_param(acnt, int, S_IRUGO);' B2 e0 v4 c7 l" A2 F( N
  83. module_param(bcnt, int, S_IRUGO);" l; A; ~8 h. J( }4 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 \& U5 T! n) \9 j0 o  t6 j
/ Q1 {( U% f1 r6 e3 J; N& u& x( n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. k$ f) F; f/ R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( W& t; a! k+ f9 n+ d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ D% z3 q8 M& h  N: I3 }' {1 ^+ }- v! t0 C3 o2 i% m/ I1 ?) U
$ f; C* K. R+ Q' a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 10:04 , Processed in 0.040508 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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