OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 W& b( ^" A( I% x" S2 z" i
  1. [code]EDMA sample test application- ?6 `8 v# H+ ~! j: A+ g4 M% I
  2. /*
    $ E% v* Q- f- e7 i* b' B
  3. * edma_test.c
    5 N6 X% P5 s6 U
  4. *; O  j/ k8 O* I8 W, E5 P
  5. * brief  EDMA3 Test Application7 l0 {! b( C7 f( S  J
  6. *
    , ?; Q$ s8 i) P3 Y+ v1 N; r
  7. *   This file contains EDMA3 Test code.
    + J' \. m1 V/ O9 N+ ?
  8. *. z. [+ r! n3 N: ]! \3 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 W, a( k5 o+ J/ s0 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( [8 N( S- V+ [) A* {/ o
  11. *         TO CHANGE.
    # i& K, c- L; @0 B9 f+ d" O, X" {
  12. *: a; [1 e$ A; m& G' s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 _4 l1 s0 i4 a! n
  14. *5 Q. {+ @$ g' Z* c) @! H
  15. * This program is free software; you can redistribute it and/or
    " q" I# Z+ v$ V+ V" s: S
  16. * modify it under the terms of the GNU General Public License as
    1 {* B# @. p) \9 {5 S; n0 A. e1 _
  17. * published by the Free Software Foundation version 2.
    , G) G3 }! J& b3 n- I
  18. *
    , T) T8 j; ]0 g, ]: G5 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' B5 j: p; w' I- q8 k
  20. * kind, whether express or implied; without even the implied warranty, A: U8 g4 d* F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' K0 i- j: Q" T$ |
  22. * GNU General Public License for more details.
    5 Y* U! a. g! B) a
  23. */7 F! Z% ?' }: s# y
  24. " v% S( C& p" h( |0 }
  25. #include <linux/module.h>9 F  B) o1 Y4 L+ S1 z
  26. #include <linux/init.h>
    3 m2 i' I, [; i( ]" ~- a6 \) E  ]3 u
  27. #include <linux/errno.h>
    ( J. t; q4 Q- z
  28. #include <linux/types.h>: I0 E3 Y7 j7 U7 _  M9 S' v
  29. #include <linux/interrupt.h>% D8 t% l4 D- n2 [
  30. #include <asm/io.h>
    % [' P- ?' M' N8 T$ b" y/ F/ _; [
  31. #include <linux/moduleparam.h>
    ( R" T' Z8 C7 d6 A
  32. #include <linux/sysctl.h>
    * l. ~% [0 M1 P3 |9 c- P
  33. #include <linux/mm.h>6 ]+ s  G/ f( }. a. l% p$ ?
  34. #include <linux/dma-mapping.h>: b* m5 X; O1 y3 ]) o
  35. . R- }. I  ^/ I8 R2 M5 |" t7 @% `3 ^
  36. #include <mach/memory.h>8 @! l, _' h& T8 x0 h3 a
  37. #include <mach/hardware.h>
      a5 J& G: k' {$ F
  38. #include <mach/irqs.h>8 ^5 ]' f6 T/ y' ?' P6 O
  39. #include <asm/hardware/edma.h>
    0 ?/ L+ P1 \# f. g2 _" U

  40. : n& B8 E6 M+ d+ f  R
  41. #undef EDMA3_DEBUG5 o/ D' D6 T& c
  42. /*#define EDMA3_DEBUG*/% J2 }) v- j9 O4 \! h

  43. ! `# @7 b% k, ^, G* @
  44. #ifdef EDMA3_DEBUG4 \+ u# j; G& c( x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' |/ z8 a6 {. m, |* Q7 ^& [, z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* F" N% l1 J6 B" n6 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 u$ h6 }1 ?2 |, z
  48. #else5 S3 e" S3 d' r$ w. C8 Q
  49. #define DMA_PRINTK( x... )
      X" F: L4 V* ~4 f& M0 p
  50. #define DMA_FN_IN/ y6 v( y7 p: j7 i  }+ s
  51. #define DMA_FN_OUT
    7 c3 m- y/ Q( {
  52. #endif
    3 I- n! Z+ ?6 ^* w3 O
  53.   \: U, t, p+ ?/ r0 g+ |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 i. O# m; R" A, ]3 m
  55. #define STATIC_SHIFT                3
    " j+ c3 ]5 H0 }% a5 |6 h
  56. #define TCINTEN_SHIFT               206 w8 C( ~& o/ C, T- K, Q; R
  57. #define ITCINTEN_SHIFT              21, n: O" @" ~" ^  @' I8 c
  58. #define TCCHEN_SHIFT                22
    . V' c! A+ ^$ A& D; s& h! I
  59. #define ITCCHEN_SHIFT               23( x: z( E9 E- R9 F: s
  60. " Q8 M" m6 t0 k, Y4 B0 B
  61. static volatile int irqraised1 = 0;$ K9 Z1 A; J) h  F: \
  62. static volatile int irqraised2 = 0;
      |' f) D! W9 j8 M5 p
  63. 7 r/ D: S, W0 J4 \* d6 R% s7 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 q( y" v( }. s1 e' C1 N2 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 f: E1 X5 k4 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % v3 z5 ?2 S; n, e8 {+ o

  67. ' w; i/ X# X" i7 m
  68. dma_addr_t dmaphyssrc1 = 0;
      g) q0 D. X! n4 [6 z$ Q
  69. dma_addr_t dmaphyssrc2 = 0;( {, L4 w$ y5 \$ L1 F0 i
  70. dma_addr_t dmaphysdest1 = 0;& p: d1 I$ e" b% q- A% D4 c& ^
  71. dma_addr_t dmaphysdest2 = 0;+ j5 y# C: u: X  L4 k

  72.   E- l4 ]! y( ~- a
  73. char *dmabufsrc1 = NULL;
    5 j$ f* A& t7 e4 z
  74. char *dmabufsrc2 = NULL;; D9 U9 v; A& i6 i0 n- O
  75. char *dmabufdest1 = NULL;2 ~$ X$ o7 l. Z4 f8 B4 f
  76. char *dmabufdest2 = NULL;
    ( E9 n6 q% E# e+ _) T# W

  77. 5 J  Z5 i4 x2 ?. l) M. r" l7 @" s
  78. static int acnt = 512;
    ) y, D  P# n3 V
  79. static int bcnt = 8;( R) v) G/ w2 G) ?! \
  80. static int ccnt = 8;- f6 r3 i3 y2 P  p! F& z- V9 H% ?" J
  81. 3 J; e' o1 @( h9 w: T* p6 O/ w
  82. module_param(acnt, int, S_IRUGO);
    , b$ D. J) J- b1 u
  83. module_param(bcnt, int, S_IRUGO);# P+ S) B; u( T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 g7 P, S# H6 X, R
+ b3 ^( F" O4 b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* L* A1 k+ @4 H, t- ~/ ]( Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 W1 j8 p- I4 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" D- j- V! t5 H: J( b. [9 C7 v) O! ]+ G4 X$ `5 g
3 b* Q) Z/ u0 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 04:56 , Processed in 0.043314 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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