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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % T- Z' F' P$ i5 ?2 h. g
  1. [code]EDMA sample test application
    ; g' C3 n/ {: g% A- A
  2. /*- G( ?& e1 `$ ?8 S
  3. * edma_test.c
    + U' d* J5 w; U7 ?( W  u: p, v. K
  4. *
    3 w5 a' Y- E5 k
  5. * brief  EDMA3 Test Application: A& W- p9 f- P( k0 V
  6. *
    + w2 s  e1 S4 y% ]; H" {' }
  7. *   This file contains EDMA3 Test code.
    2 u- k* y, W( q# ^. S
  8. *
    7 T3 B  _% t  \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! h+ F3 e- J6 x# ^! |4 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 |4 L" u( @' c
  11. *         TO CHANGE.5 X7 {% ^. Y3 m" H: s& L
  12. *+ h4 U: z! [+ M& i" \; n$ b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 |/ \2 I' S; t( H1 S
  14. *. s( B& _2 a" M% F2 g3 r# b& P' k
  15. * This program is free software; you can redistribute it and/or
    . u! Q" l" t: S& f9 }* i* L' a- K4 M
  16. * modify it under the terms of the GNU General Public License as
    + A4 K4 ~2 `, {
  17. * published by the Free Software Foundation version 2.
    & n6 S" H! F8 W5 C
  18. *4 h: e5 u9 M3 _: v* i2 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! l0 D4 x2 b6 x3 f
  20. * kind, whether express or implied; without even the implied warranty
    0 @9 |8 D" Z" {- p: Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 @4 w5 Q( {& y* Q! {
  22. * GNU General Public License for more details.
    % e$ Q6 H8 d, m
  23. */. i# @( O. {. j' c
  24. - {  R& i/ L. ~2 m9 C8 _
  25. #include <linux/module.h>* @0 s9 ?- F1 k. ^; n6 I
  26. #include <linux/init.h>
    . Q8 Y6 l: l. k
  27. #include <linux/errno.h>) a$ p" E5 t% `4 _3 {; T4 Q4 h
  28. #include <linux/types.h>) D/ l! v1 |8 G- X3 g# C7 r
  29. #include <linux/interrupt.h>
    1 F, ^) d8 C% G$ |
  30. #include <asm/io.h>$ F! m9 z9 Z" {' A1 x7 {9 t. a# }
  31. #include <linux/moduleparam.h>
    $ v2 |( ~! g; X3 O0 F* U4 U
  32. #include <linux/sysctl.h>+ o8 X3 Q9 p+ a
  33. #include <linux/mm.h>2 Y! _1 F* t: w6 ^/ ^
  34. #include <linux/dma-mapping.h>
    6 y! m6 T: T( d

  35. " v2 O0 u$ ~/ w
  36. #include <mach/memory.h>+ }, ]$ p6 I8 R9 q# M2 k& L
  37. #include <mach/hardware.h># V# N. i! g3 Z5 _; T1 X9 _
  38. #include <mach/irqs.h>
    , c" [9 G3 d; k' |1 N0 [
  39. #include <asm/hardware/edma.h>( y' e! W  R4 M4 F8 Y+ j- A

  40. $ S: D: e/ l4 p7 N
  41. #undef EDMA3_DEBUG
    8 D4 m# _" f% W# X$ Z, U4 W
  42. /*#define EDMA3_DEBUG*/
      K  i: _0 o2 [# e) ~: M
  43. , d8 l6 u. ^$ [
  44. #ifdef EDMA3_DEBUG% v5 T# d) w( ~) n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 [2 k  O5 ~- f4 t0 H* S( Z0 ]4 |, ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 H3 j. h. s$ w$ s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ M/ W+ ~8 y& R0 ^6 o
  48. #else3 X; I! ^, Z3 b
  49. #define DMA_PRINTK( x... )+ A& N4 }% V3 w
  50. #define DMA_FN_IN
    ) J4 @0 b) k  K6 X' d+ H1 z
  51. #define DMA_FN_OUT6 k3 D% `" _' V1 }& O9 J/ H- X
  52. #endif/ t: N* D  p, ]% X1 y4 z2 m2 Q1 `2 M

  53. 6 U# U1 t4 N: G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 s) o& t: M9 a- M" l
  55. #define STATIC_SHIFT                3
    ! N  S, E& @2 K
  56. #define TCINTEN_SHIFT               20: C6 K0 \( I; |; k; _
  57. #define ITCINTEN_SHIFT              213 ?; G1 v- d/ \( S% ?
  58. #define TCCHEN_SHIFT                22, U6 B+ h# w/ x* m; Z
  59. #define ITCCHEN_SHIFT               23
    - f# Z3 s2 u5 r

  60. / n8 H4 p! V2 [5 m7 C
  61. static volatile int irqraised1 = 0;
    . i3 g& \7 K) o2 Q+ U
  62. static volatile int irqraised2 = 0;6 a1 U# N* o- v) N9 a

  63. : S" a0 F/ ^4 @, O$ j  E* b5 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b. [: C" y9 y0 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 f9 i$ ?# U5 v: U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' R% L+ Q4 r0 s7 g
  67. * M2 D8 W" d; h% J
  68. dma_addr_t dmaphyssrc1 = 0;* m4 V. A4 P7 k& J
  69. dma_addr_t dmaphyssrc2 = 0;
    , y' r5 x7 a0 z: {, x0 T: ?
  70. dma_addr_t dmaphysdest1 = 0;1 g' U6 M! T4 f5 D  _  k5 O
  71. dma_addr_t dmaphysdest2 = 0;7 s- E$ a+ x. u. J5 _5 i* w
  72. 8 o5 A$ V& O2 N
  73. char *dmabufsrc1 = NULL;( d3 k! ~2 {4 V+ M, Z
  74. char *dmabufsrc2 = NULL;; a$ k/ b$ i4 @) n3 b6 t, k$ b# t+ @% w
  75. char *dmabufdest1 = NULL;
    " I3 `* B& T* C! D9 H
  76. char *dmabufdest2 = NULL;- Q% r! J( }( ~% Q& |5 k5 t# i% Q0 ]

  77. : l/ `2 ^" ^+ U* q6 u# c, O+ I
  78. static int acnt = 512;0 {9 n: p# Q  d1 ]
  79. static int bcnt = 8;
    1 F6 T, N: Z3 q% G
  80. static int ccnt = 8;
    " `0 ~! I$ ]$ O) y; C" m7 W9 e
  81. + M; T9 ^8 f8 }0 M) @+ _
  82. module_param(acnt, int, S_IRUGO);
    0 Q" g/ g& S3 Y
  83. module_param(bcnt, int, S_IRUGO);) B9 p5 w% K2 l8 g/ w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& a/ y  x( S" w# }
' I* B- S  B/ ^8 |" L! D9 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 X! [5 w3 O$ X6 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! `( v6 a$ s! C: ]9 q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" g4 N" u2 ^! f& G  u! i, v
+ A7 r9 r, M+ n1 E
! h. Q) b& d' Z" q2 E; ?; e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 05:10 , Processed in 0.038400 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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