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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; k5 @9 z7 W( p0 Y# D4 Q% Q/ d
  1. [code]EDMA sample test application
    0 l, b7 i! i$ y
  2. /*
    9 M0 s% M, X) c& \
  3. * edma_test.c
    + B. ?% w# y+ {9 b
  4. *
    # n4 _0 f0 x: E. |9 K
  5. * brief  EDMA3 Test Application( ^% R' j1 J- C( k, t' I
  6. *
    . Z$ k1 ]1 a; Y7 R4 _/ q
  7. *   This file contains EDMA3 Test code.
    + `3 Z4 x7 ^, j
  8. *
    + U; v( @3 B" r5 ~4 V6 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 V5 q& C" @7 v+ \/ b7 L0 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 L0 K% l8 B: n. s
  11. *         TO CHANGE.
    % ~1 W6 e9 o$ M/ r) l
  12. *
    2 E& Z- {/ b' p( n  `% T6 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' \- h6 p; U( m
  14. *
    ( U) ~& r/ e/ G& R
  15. * This program is free software; you can redistribute it and/or
    2 L5 V- x5 x8 k
  16. * modify it under the terms of the GNU General Public License as/ @* L- e$ u4 A
  17. * published by the Free Software Foundation version 2.  x  i! a# [6 u
  18. *8 ^3 m- `# b: A/ r& \" v, u! m% k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / P2 @5 i( s* ~3 x# j0 I3 \
  20. * kind, whether express or implied; without even the implied warranty
    $ }% w1 p1 m  o! |6 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; i( ]4 H% B% I* q% o' _. m
  22. * GNU General Public License for more details.- ~" r0 r; z$ Y, D( ]$ t  O$ ]: K5 Q
  23. */
    4 s0 F5 D* z" m+ p6 m, w

  24. 2 ?- v# t& n: Q7 ]3 _
  25. #include <linux/module.h>
    + `7 I" n7 V! O' _* G
  26. #include <linux/init.h>) d% X7 |) o2 A! ]. g! p
  27. #include <linux/errno.h>
    + ~: @/ m" U4 L! `4 S  [
  28. #include <linux/types.h>
    ! y% F1 R% H' J3 C
  29. #include <linux/interrupt.h>; K& Q0 ~8 x5 O. Z: H# H
  30. #include <asm/io.h>
    + A" V6 x6 u/ `* ]" h
  31. #include <linux/moduleparam.h>
    5 r4 D6 d6 V3 ~  C
  32. #include <linux/sysctl.h>
    ! u% s4 Y( E/ V) P/ p( U
  33. #include <linux/mm.h>
    / b1 z% y7 W2 Y: z
  34. #include <linux/dma-mapping.h>9 G% q6 a, s# N
  35. ( }# `7 J1 s+ P: D3 J
  36. #include <mach/memory.h>5 C! j( X9 ~  v) W' r/ b# X
  37. #include <mach/hardware.h>
    % n( E! d4 J5 z1 k- v, W# o
  38. #include <mach/irqs.h>' ?( v1 d/ f# r2 I, L  f
  39. #include <asm/hardware/edma.h>% a5 [$ C6 F4 k7 p
  40. 7 s7 R4 n+ @+ i! b6 `/ x
  41. #undef EDMA3_DEBUG: w9 l& L, D2 O1 d3 v7 T$ ^/ N0 e9 a
  42. /*#define EDMA3_DEBUG*/8 n- m$ }& V. N1 h( I, f
  43. 9 h+ \% z8 k3 D+ C( b+ e
  44. #ifdef EDMA3_DEBUG
    * ?3 J8 z1 X- z3 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% V% M& M% r1 P, |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 W* s7 z' X3 R6 O+ @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 w7 i, u: i/ u9 ~
  48. #else
    ' V, t0 U5 Y1 N( h( A# b; e
  49. #define DMA_PRINTK( x... )
    , T- X3 |# b+ h- u
  50. #define DMA_FN_IN
    + ?, n: U0 L5 K% G$ Y, W9 E4 P* l8 X
  51. #define DMA_FN_OUT: @/ b! t2 u" S* p" {; X
  52. #endif
    / v0 b# Y* w0 `9 ]$ Z
  53. $ P3 y: d. L0 f7 E, c- E/ |. X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( a2 L) q5 `- K) z- T0 L
  55. #define STATIC_SHIFT                3
    4 J7 f! f9 e* z
  56. #define TCINTEN_SHIFT               20
      x) G) s# R/ j
  57. #define ITCINTEN_SHIFT              215 t0 C9 E/ n) M* p: h1 f$ L
  58. #define TCCHEN_SHIFT                22: K, l! Q- C- g' @7 p
  59. #define ITCCHEN_SHIFT               23
    0 B' |0 K3 F! X! E/ a; x

  60. & t6 s" I+ s5 M% `4 c9 H! S# K' j% |
  61. static volatile int irqraised1 = 0;
    5 I. x- n  A0 K# i* T, l1 a
  62. static volatile int irqraised2 = 0;  @& O/ |  G6 E$ P, r

  63. . l- }/ ]! _; ]6 i0 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " R5 d7 \3 [8 P9 n" b; X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* X3 `! y( ~0 e9 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ?9 T- |' f5 x5 a3 ~4 [# Z

  67. # C  n, ^9 \0 r' P
  68. dma_addr_t dmaphyssrc1 = 0;
    3 o, V7 {5 o% l. ?6 G$ ~: b5 Q
  69. dma_addr_t dmaphyssrc2 = 0;
    ; A6 p0 e, w4 ?( A
  70. dma_addr_t dmaphysdest1 = 0;) X7 H, T5 r* w# R5 L
  71. dma_addr_t dmaphysdest2 = 0;
    , k1 T/ R( d: t, p7 E- G
  72. / t0 a8 T' s: m5 F5 Z
  73. char *dmabufsrc1 = NULL;
    ' U9 h- N9 @' _5 P& p& A2 h6 a: x
  74. char *dmabufsrc2 = NULL;9 b9 E. m! }: b, P
  75. char *dmabufdest1 = NULL;) N6 E) Z3 a# ^0 z3 E3 n% S
  76. char *dmabufdest2 = NULL;
    $ E& k0 \7 B% ^. `* C- [$ E

  77. " q2 i6 v5 @+ v) R% ]
  78. static int acnt = 512;6 I) u2 {5 L7 c
  79. static int bcnt = 8;3 \9 r8 h  B7 \9 w7 H! V! B- i7 w
  80. static int ccnt = 8;
    / u8 _) A$ E" A( x3 t

  81. $ C8 C& ^# E% _% h- A" V9 f6 F
  82. module_param(acnt, int, S_IRUGO);! e6 h* Z+ ~, F: K9 o% m
  83. module_param(bcnt, int, S_IRUGO);
    ; M5 v1 J$ l$ W5 N9 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ E9 S- t; Z/ N3 K4 X$ w

2 r! }- U5 F# o) v- f3 b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 z4 i9 P' l/ qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( J9 U5 v/ B+ |" }" n( x- h2 y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 e' Z- `4 ]: H. }1 v! }8 d2 D+ B4 R) m( d" b( X' d

3 p8 j0 f5 g7 e  r# C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 22:14 , Processed in 0.044219 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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