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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 \. ^/ n, K% v
  1. [code]EDMA sample test application
    & k6 ?) ?/ K0 [- L
  2. /*  p6 p8 o/ |! Z5 q/ }: ~
  3. * edma_test.c
    , V$ n9 w7 w" q6 y" ?9 b% }0 U( B
  4. *4 L! M# m% D& T+ x
  5. * brief  EDMA3 Test Application
    # Y; I: V1 X* u- n+ J7 E+ W
  6. *
    # l! r! n% K& p# a" t: r
  7. *   This file contains EDMA3 Test code.( P; x0 k+ k- D% O4 Y
  8. *
    ) @4 |8 a+ w: g+ M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( {- d1 R7 Z2 a0 X, ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ }4 a- f( n/ G" m/ @
  11. *         TO CHANGE.- g, V7 g$ x( v: c0 J6 v* Z
  12. *4 Y: x6 a! K" p( e( u7 M! \. c  N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 \6 Z$ g/ n0 m$ t& H
  14. *
    9 i/ N3 U2 o, z8 j, i
  15. * This program is free software; you can redistribute it and/or. b# o' k+ T0 i
  16. * modify it under the terms of the GNU General Public License as
    ' T* `- _9 D  l7 ~0 i- m% c$ @
  17. * published by the Free Software Foundation version 2.
    * o9 q$ {. |" m# }
  18. *6 ~7 |- i% ]/ P2 X' ]7 k' N& N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. d3 F2 V& M+ p# o# m# i; X
  20. * kind, whether express or implied; without even the implied warranty
    , [( i1 q# S2 d4 M% d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) m0 B6 u& ~, A$ _# H
  22. * GNU General Public License for more details.
    - l3 O$ b/ T/ y
  23. */' x. D) o9 F$ K  A( d
  24. ) |+ [0 i" h/ r4 Q$ j
  25. #include <linux/module.h>, t  S* ~& c4 V0 t: `
  26. #include <linux/init.h>6 j9 ^- b2 ?2 V* W) s# s  J
  27. #include <linux/errno.h>
    ' {# J% H, \! O. X4 n+ i5 y
  28. #include <linux/types.h>/ F- j& O$ n- m0 q1 P
  29. #include <linux/interrupt.h>- C! `& I( u8 U9 L% X; y
  30. #include <asm/io.h>/ D) b5 {( O% w) k! m% o3 B
  31. #include <linux/moduleparam.h>
    - U5 ~# E4 r6 k4 s
  32. #include <linux/sysctl.h>
    2 C7 q' Z2 e! M+ O7 V% A
  33. #include <linux/mm.h>
    ( T6 W6 a& H7 I6 p
  34. #include <linux/dma-mapping.h>, D6 f' v7 r4 ]- E6 [* I# c

  35. % b- Q, W# N& i/ V
  36. #include <mach/memory.h>
    * o; D* S- T4 k5 g; Z4 S
  37. #include <mach/hardware.h>
    & D6 v4 _; R) U/ P
  38. #include <mach/irqs.h>1 [: D0 E$ e/ E
  39. #include <asm/hardware/edma.h>
    / Z" _  J; k7 f9 \
  40. ' I, Z. d2 ?. ~
  41. #undef EDMA3_DEBUG9 @0 Y+ B( y& D/ a; e8 D
  42. /*#define EDMA3_DEBUG*/) t4 J" d3 N' X6 |% m7 p
  43. 9 c- j+ Q; l! p6 H* m
  44. #ifdef EDMA3_DEBUG
    4 ?# ~0 q6 b: G7 ^6 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % a4 C: n$ m) E) S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); b2 u3 J" c3 a8 D9 L/ n, J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + \5 e" c  \  m  R2 D
  48. #else7 C% t/ L* g1 h8 U& E" I3 C( G
  49. #define DMA_PRINTK( x... )
    3 e9 ~. q6 w# E6 ^/ q0 F
  50. #define DMA_FN_IN
    ! ?6 A# T$ k; w+ J. o: t& [
  51. #define DMA_FN_OUT! G$ x/ u! K) a8 ~& M- Z
  52. #endif' F. W' @( d, @' y3 A5 ]; _
  53. / W) T# f# t; E  `/ d( S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , Y5 {4 j9 T! h1 M; w  m
  55. #define STATIC_SHIFT                3+ Y7 s( `7 V0 w4 K2 g& Q3 ~
  56. #define TCINTEN_SHIFT               20# e1 s# i4 F2 n- a
  57. #define ITCINTEN_SHIFT              211 b+ l4 G/ l" [8 \4 {& ~, n0 t. r
  58. #define TCCHEN_SHIFT                22
    7 c! s' [  ~- w2 o! R
  59. #define ITCCHEN_SHIFT               23
    5 d; ]( ^/ S$ D( ?' j
  60. " Q; D' m0 A* ?! y
  61. static volatile int irqraised1 = 0;
    & t5 T4 R8 }7 Z% x+ m$ Z  }
  62. static volatile int irqraised2 = 0;6 \. W2 V8 m% |
  63. 6 Y! h: A# K0 s: O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: j3 \; J3 B/ v  }2 Z9 H% o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 e* W' k( F8 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, t) k# O' Y* ?4 n
  67. 1 T6 _2 ~: Y% t9 |9 S9 \( H; O: F
  68. dma_addr_t dmaphyssrc1 = 0;; n! `5 J1 Z7 |1 B, M( @( Q
  69. dma_addr_t dmaphyssrc2 = 0;
    0 `2 i  O) U) l! g
  70. dma_addr_t dmaphysdest1 = 0;
    4 X  V1 W9 v# i2 w& ?9 D
  71. dma_addr_t dmaphysdest2 = 0;# O# e7 G* Y6 R" l. k' i% i

  72. 3 J$ t8 K" ^* B0 u  r2 `
  73. char *dmabufsrc1 = NULL;
    ! d& S7 {; j9 F! [# u
  74. char *dmabufsrc2 = NULL;
    # U$ u6 f% G+ F! T4 C% {
  75. char *dmabufdest1 = NULL;
    " ~  J8 Q1 O/ |2 l0 s
  76. char *dmabufdest2 = NULL;9 U1 w( G4 D* w4 x- p4 k$ e
  77. $ `2 D6 [( B( N- Z2 ]3 y
  78. static int acnt = 512;
    0 y0 w1 n" z( R5 a, i
  79. static int bcnt = 8;4 a/ P5 w9 J* ~+ O* f7 B* |7 j
  80. static int ccnt = 8;
    0 ]) P0 b( r- v( |: y3 f* k
  81. 1 z8 _7 d; ~% i7 s* ^; F
  82. module_param(acnt, int, S_IRUGO);$ `) K4 O7 B* q/ ~" r# g+ B
  83. module_param(bcnt, int, S_IRUGO);
    8 c# M3 _- O6 u- J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) ]9 ?  M/ l8 l9 u  J& Y: Q

% \0 P8 G/ ^: ^3 B, [, f5 R" _# I6 y& K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; u9 u# h3 q5 d. W" Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( d9 n3 W' Z, \* E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 b. ~5 n3 C/ o* k& s) K$ n6 e4 l+ a; [" W& K1 d6 i% E- a3 V
/ ~- _4 I' i- {2 m9 s9 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 14:25 , Processed in 0.039487 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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