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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) v' f: v, g: y& q. o# R& _
  1. [code]EDMA sample test application
    / C  X# _7 z: g% A2 }
  2. /*' F* V9 f" M6 @6 Y. H9 i
  3. * edma_test.c; Z$ |1 s' ~% n5 p5 l
  4. *
    ' P! [+ M, X8 d5 T3 D
  5. * brief  EDMA3 Test Application
    7 ^' F+ d0 Y- Q# H% H1 U4 S
  6. *  [# p3 j; _  t5 [+ D0 t* F
  7. *   This file contains EDMA3 Test code.
    ( }: q9 `$ C6 b: [/ @
  8. *
    ) {0 c6 S5 E& }% c* [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 j3 q) [1 a) X1 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      y; A* r! G# H# i8 D
  11. *         TO CHANGE., G; @  b1 R$ \: L6 Z! ]
  12. *' V4 f/ ^% K4 v& }- D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; V8 m/ Y% G* J1 u+ `
  14. *
    * r4 B3 H' P! B) R) S$ D
  15. * This program is free software; you can redistribute it and/or
    * o! J: r, c; b0 E4 ~5 q6 b
  16. * modify it under the terms of the GNU General Public License as9 `$ c' Y9 p4 @
  17. * published by the Free Software Foundation version 2., A# \% e+ ~; P
  18. *
    9 H8 m' l7 u( {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 w. g  j. N1 |1 [% H
  20. * kind, whether express or implied; without even the implied warranty. a  m3 a% R1 M& E1 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ _; `+ }: G! b1 f, ?# A2 k3 n8 z
  22. * GNU General Public License for more details.+ {! V# E& v5 r6 |1 z' l* P* B' }
  23. */
    4 O" F# }/ T# s6 f$ @8 ~: g
  24. " p) q6 v7 J' l
  25. #include <linux/module.h>
    4 B3 [& z! _9 o; R1 d; I4 X
  26. #include <linux/init.h>5 m$ k2 n! s: n/ O
  27. #include <linux/errno.h>
    6 n7 I& E) M" V. }
  28. #include <linux/types.h>
    6 U( x8 X  H; l& w
  29. #include <linux/interrupt.h>6 I  r. ^/ i/ V
  30. #include <asm/io.h>
    5 u$ c9 C, j% Q" a. C- D
  31. #include <linux/moduleparam.h>9 t0 ]% Z4 n( L+ K- G
  32. #include <linux/sysctl.h>) t" l- U) j0 `
  33. #include <linux/mm.h>
    # ^: Y  u5 Z6 k, K( k6 B+ F' U0 A4 i
  34. #include <linux/dma-mapping.h>
      {' i- ?6 i6 h& k* S5 n
  35. 5 l' p  ?% g0 a5 E' j' ?6 t
  36. #include <mach/memory.h>
    7 d" S# `  ~$ i
  37. #include <mach/hardware.h>
    & O9 N4 j" |% R* |" e
  38. #include <mach/irqs.h>% U+ \& C  ^3 j% }& Y/ R" A2 G% F. B
  39. #include <asm/hardware/edma.h>4 [% b; l3 R* A. w# n+ }

  40. % D" D3 V$ u8 I8 i! L5 _
  41. #undef EDMA3_DEBUG
    . q$ S# S2 c# F  t
  42. /*#define EDMA3_DEBUG*/8 c  v0 {$ w  m$ k1 ^! G
  43. % H3 M7 ~0 p' C
  44. #ifdef EDMA3_DEBUG
    ( Y- j" f( ]2 \% S2 z: e# F+ k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . Q% a* b: E1 r9 i! S* q+ P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; Z$ Q6 S5 F8 W+ P8 V! t  ~3 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & z+ T! K. u% `4 l
  48. #else5 T( G8 H; R( E1 _- L
  49. #define DMA_PRINTK( x... )7 H5 }8 `; o1 J2 ?
  50. #define DMA_FN_IN3 ^7 B; @, v+ a  p0 s3 X+ U6 @
  51. #define DMA_FN_OUT: \# D: Q# A- {
  52. #endif
    , s' Y7 i. i0 W9 l1 o( v
  53. ; M' }5 J7 I9 {- ^2 T# R! u. p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 R  P( E/ \0 M) `
  55. #define STATIC_SHIFT                3
    5 G' e  z5 B. A9 w* y  t
  56. #define TCINTEN_SHIFT               209 {1 V* I5 p9 A  Z" G2 X
  57. #define ITCINTEN_SHIFT              21% i5 J* {2 N7 F+ v; ^' N
  58. #define TCCHEN_SHIFT                22$ d0 p$ w& L' F6 N; F8 m/ I
  59. #define ITCCHEN_SHIFT               23
    - C( o1 ?! \6 g( I0 f
  60. 9 i+ X- G5 C; e/ p
  61. static volatile int irqraised1 = 0;
    % A# @  e6 a5 t6 F0 J" t1 Z5 }
  62. static volatile int irqraised2 = 0;
    " a) {. ]% }- {9 u

  63. " n: j" R7 q3 T( \: J; d% r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " U% E  {" \2 o, R8 x% k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! H7 I2 U4 e) M7 m0 c1 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , B- x4 L4 c5 l
  67. . z5 Z8 a3 M7 E( _6 ?1 i, i
  68. dma_addr_t dmaphyssrc1 = 0;0 c8 E8 Q/ c: Z- p7 N& s- v
  69. dma_addr_t dmaphyssrc2 = 0;8 @! l3 h& ?( m8 g( }- ~6 X
  70. dma_addr_t dmaphysdest1 = 0;
    : R/ ^0 z! A0 \/ I% d
  71. dma_addr_t dmaphysdest2 = 0;
    * L( I. O0 }0 r1 C# P" K; K8 ]
  72. * W! z9 g" ]0 d0 c
  73. char *dmabufsrc1 = NULL;7 c$ ?1 F# L* m, `" k2 B
  74. char *dmabufsrc2 = NULL;/ g: ^( P7 I" m2 V* P
  75. char *dmabufdest1 = NULL;
    0 |. T  c; w1 p$ m" @
  76. char *dmabufdest2 = NULL;
    8 M6 F9 P8 o6 ^3 q+ l
  77. 1 v$ M2 p% x' Q
  78. static int acnt = 512;
    # x! S. U8 M8 H; ^6 R0 Z
  79. static int bcnt = 8;! |6 D& @( r$ @( [7 I
  80. static int ccnt = 8;; f) R4 L1 X. w5 ~4 }1 i0 u

  81. . Y$ n6 l9 t! \: E. p3 z- }
  82. module_param(acnt, int, S_IRUGO);
    : A5 i+ \7 }$ S) n  [' E: K3 [
  83. module_param(bcnt, int, S_IRUGO);- t$ p3 G8 R0 t2 l5 V7 d7 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; `' `4 u- M, |6 P! e4 e9 n
) U  ]6 U7 h! v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! Q9 D% E. K  v& d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ P6 b  d8 A- H' A5 ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ i. Q$ i2 O' J' t, @
$ w! q& G2 q/ n# c8 d. C% U
8 ?0 y& v) @7 }/ Y' _' K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 23:51 , Processed in 0.039507 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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