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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: Y  `0 R/ K8 Q5 q& c9 I# a/ z
  1. [code]EDMA sample test application
    4 |8 N& A' A$ u9 ]4 `# A+ t  D
  2. /*5 z$ i% R! Y$ L
  3. * edma_test.c
    2 e# I7 w" H# j$ q: O
  4. *4 s3 J% D3 I" P7 Q3 }6 K- |
  5. * brief  EDMA3 Test Application
    0 w7 Y" K7 h' C2 V
  6. *  |$ |6 d; i/ H& c5 S+ M* V, @2 e
  7. *   This file contains EDMA3 Test code.
    2 n7 y; s# b  Y. |' ~: n5 r
  8. *" R  H- `2 U  p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( v0 q- `' c6 V! y5 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, e& B0 c  C: N7 G/ f6 |/ |
  11. *         TO CHANGE.
    ! B) R4 K" P' N1 O2 N0 t
  12. *# |( c" |- }3 I( I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# a+ D* }( w# x* u/ M, L$ v  E
  14. ** v% J0 l  ^, ^
  15. * This program is free software; you can redistribute it and/or
    4 Z# Q" T# t. V1 g$ W
  16. * modify it under the terms of the GNU General Public License as; ]$ w8 y6 n' K* Z  E
  17. * published by the Free Software Foundation version 2.# O) d7 J: ~1 Z+ ?$ `4 a
  18. *
    ) y" I8 k+ N- l, U- n3 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + i1 u" n5 B9 n- R4 o
  20. * kind, whether express or implied; without even the implied warranty
    5 T1 s+ f. C& u4 E6 n( R$ k) G! c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& l% M* w% K" @& r! h
  22. * GNU General Public License for more details.
    ( [3 @9 q) ~  q3 R  R1 w4 `' `
  23. */
    . Z: G' |- e4 X6 V0 B& h

  24. 3 [4 N+ y$ f3 c( a8 H
  25. #include <linux/module.h>* Y3 Z0 s" y6 t, j  f, y) L
  26. #include <linux/init.h>
    * S2 e# e( @3 U' a+ m) T  b/ B
  27. #include <linux/errno.h>
    , ]' _/ G; _! y: h6 I
  28. #include <linux/types.h>
    3 _' }7 p  h; \* J+ u3 b
  29. #include <linux/interrupt.h>  T' z1 z4 U$ Z/ p
  30. #include <asm/io.h>! [4 V) p) `5 h, \& x& t
  31. #include <linux/moduleparam.h>* Q. s* q" Y5 Q1 _' U
  32. #include <linux/sysctl.h># w4 t/ B/ o% c: a: e2 j/ o
  33. #include <linux/mm.h>& @6 c* R  e( ?6 @5 @
  34. #include <linux/dma-mapping.h>
    ! O. \( [$ D3 d

  35. ) \; A. K, @, P3 a
  36. #include <mach/memory.h>+ t* M/ E$ l# L5 [
  37. #include <mach/hardware.h>
    / ]" ]3 I) D, s. _# G: R% @
  38. #include <mach/irqs.h>
    4 y" q7 F( O& W* m8 E3 r
  39. #include <asm/hardware/edma.h>
      c: \3 v* n3 Q) d& k

  40. - H% s" v' |; g
  41. #undef EDMA3_DEBUG
    ( J& `3 K4 c% N  e
  42. /*#define EDMA3_DEBUG*/
    # g# \% x/ l* n' `8 ^0 H

  43. ( q+ H8 J# E# x* `6 s
  44. #ifdef EDMA3_DEBUG
    - z0 x& {3 N/ n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 _' l# q% t- t& P; i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 e9 E0 n* k* z: a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' L3 C/ N, ~' U3 f0 U
  48. #else
      f2 D* ?4 B1 V- j+ v6 P/ D6 f
  49. #define DMA_PRINTK( x... )8 i8 }( e% Q, E$ R0 k' j  y) a% ~
  50. #define DMA_FN_IN
    9 |# |* W# T2 C0 d7 L
  51. #define DMA_FN_OUT
    6 y8 D. o! W' |+ k
  52. #endif3 T0 I1 J( R# M' W4 x% x5 ~
  53. # c, W8 V1 A1 U+ A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; G5 `6 z! J& h1 g
  55. #define STATIC_SHIFT                3
    $ ~) O5 N8 l5 _9 x/ E1 l
  56. #define TCINTEN_SHIFT               20
    , H$ ^! P, M. g) k+ J6 Y- \
  57. #define ITCINTEN_SHIFT              21
    1 D$ P7 G: w! R! ]+ C
  58. #define TCCHEN_SHIFT                229 J4 t( x( L9 t* p' ?, x8 m
  59. #define ITCCHEN_SHIFT               23
    8 N. \1 Z0 V$ l
  60. + ~2 t+ @' D0 \0 B  q" a
  61. static volatile int irqraised1 = 0;7 i4 w  I) E6 ?6 z; w5 j8 ~
  62. static volatile int irqraised2 = 0;
    % Y4 Z- k3 Y! {6 W. o
  63. 0 L7 J0 r+ g$ k, h! N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + i: G2 n0 A; W3 {+ J8 U9 r, f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      n. r7 y" L! b+ e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ h: O9 T$ C) r, {
  67. " D8 k0 F' t0 c
  68. dma_addr_t dmaphyssrc1 = 0;2 j* x2 }: K) m7 n  p
  69. dma_addr_t dmaphyssrc2 = 0;- T' x  u( A! t6 J
  70. dma_addr_t dmaphysdest1 = 0;. k$ v5 \. N( I4 Z% H1 X( q
  71. dma_addr_t dmaphysdest2 = 0;, K( c5 K8 r; Z& m# j+ C: G+ E
  72. 3 i/ ~$ r+ a# @( ?
  73. char *dmabufsrc1 = NULL;- U0 S5 j1 Z4 F, @& u0 M
  74. char *dmabufsrc2 = NULL;1 u& x+ z% M) d  F- t
  75. char *dmabufdest1 = NULL;5 v2 m2 ^" d. U3 l& }
  76. char *dmabufdest2 = NULL;/ x) k) ]) X6 K: `2 u* r4 F" {, ^/ {

  77. 1 S# j& o) Z  o% X1 p& B
  78. static int acnt = 512;
      K, R5 h5 C" M* ~# M: D# Q, `
  79. static int bcnt = 8;
    2 c5 P0 \; X1 Q6 w- [
  80. static int ccnt = 8;
    + g; p- u; _5 D
  81. & `- ]; S' V% O/ D: k/ q- i, X( }
  82. module_param(acnt, int, S_IRUGO);. S3 A; m0 g. S4 ]% g
  83. module_param(bcnt, int, S_IRUGO);
    % d* M6 l+ E2 i  x6 C7 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 N$ h* v) n. n% v7 K- E% `
+ ]" J' [, I: y' p. i& |0 W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) Z$ y: Y7 y& w8 C- H4 w- Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% t4 b# p% n: v# a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  c$ h3 y. v( q, E  o( ~) b; \8 n

3 V+ D, T# I8 C' Z& {7 A9 ], @. Z( _* V. g& r% w5 i6 I# @( s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 15:46 , Processed in 0.039363 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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