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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 O# a7 y8 D" G: G: U
  1. [code]EDMA sample test application( t4 v- [' L5 I" G/ h
  2. /*
    ; v9 C1 ~) ?; t- m
  3. * edma_test.c
    ) L( `( i4 v  y) X$ @" p
  4. *3 A, H  E& r3 r  `
  5. * brief  EDMA3 Test Application' m$ x0 E& Q0 k
  6. *# W7 P9 [: U7 |/ _, Q  c; W. m8 |
  7. *   This file contains EDMA3 Test code.5 [( f( a3 Y+ d, N, {( D. e
  8. *
    7 Z; i$ k" H+ g1 M& z8 |: T3 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / j5 [: H1 R, k" @+ ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' D+ S# {; b, A) ^( a  t3 n
  11. *         TO CHANGE.
    5 F# x7 z3 N( P7 c- a! V: N& j0 W, q
  12. *" a, ]- D1 u4 U5 D+ n0 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# J0 K6 @5 a7 R/ U
  14. *- O6 g/ h4 c; Q3 ]3 l2 Y
  15. * This program is free software; you can redistribute it and/or
    5 p) k* r6 l2 o# ]
  16. * modify it under the terms of the GNU General Public License as
    1 c- D8 R0 f8 \, C# b
  17. * published by the Free Software Foundation version 2.
    % g+ `" Q1 `3 _  h% ^7 u
  18. *; U! d2 F1 w, E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 R# R$ z; `9 I& l8 [( b: S
  20. * kind, whether express or implied; without even the implied warranty/ l3 W; M) x( z6 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ N& n) T3 b- j8 W2 u; _0 v% i
  22. * GNU General Public License for more details.
    ( q" L0 Y9 ?! E9 S: H0 m" l
  23. */
    & l' y9 w5 J$ y- G3 d
  24. 9 w0 m7 n$ `! R* k# k0 w& b2 l
  25. #include <linux/module.h>; m5 z1 w0 _7 a$ ^9 f2 @# ~7 d
  26. #include <linux/init.h>
    . m, O# g. @& `. o: ~0 P! X$ r
  27. #include <linux/errno.h>
    ( Y+ Z& n  J- y; T+ u
  28. #include <linux/types.h>' i* e8 n3 |( n
  29. #include <linux/interrupt.h>
    8 N9 A: S# s. I4 Q) F$ E' X
  30. #include <asm/io.h>: f* O" K  U6 n( `2 g
  31. #include <linux/moduleparam.h>
    ' @) n" G: c4 R7 C( B
  32. #include <linux/sysctl.h>
    & F5 e; I& t* V2 p1 }0 \6 e! |
  33. #include <linux/mm.h>
    % }- ~; J0 ^1 k/ _/ f1 Z- t
  34. #include <linux/dma-mapping.h>
    # F* C5 Y# A) F( B: n2 d  h% H

  35. . d" `7 r. v8 _
  36. #include <mach/memory.h>
    ) ~' p6 {0 m7 D$ s
  37. #include <mach/hardware.h>
    ) T% G9 Z! ]% M( w' I1 D) d; l
  38. #include <mach/irqs.h>
    & I6 R8 o+ N( _: n
  39. #include <asm/hardware/edma.h>
    / O$ d. I7 f9 [: n0 ~
  40. ( V2 H9 ^; b# T+ ~  i% L3 ^
  41. #undef EDMA3_DEBUG
    ) P0 W0 g" p% t/ [
  42. /*#define EDMA3_DEBUG*/
    3 `+ l/ ^6 |3 Y7 Z2 E2 ^, F

  43. ! U) A5 D4 J3 w$ S
  44. #ifdef EDMA3_DEBUG5 D, ?% u0 L! \3 a0 ]# @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # G5 E/ f- D& X) ]. c8 s: h: R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 o) b: r5 h* C0 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 I: m0 R% a0 F3 S  P4 g
  48. #else
    ; Z' \) V5 t2 M) ?. c
  49. #define DMA_PRINTK( x... )9 s2 Y6 t. B2 c1 I) k0 B
  50. #define DMA_FN_IN
    ; j, F$ u3 t, \5 h0 r9 P
  51. #define DMA_FN_OUT
    : E% K; I& Z" l, A& H1 ?
  52. #endif
    0 q! k: m8 @# l$ d" @) l) D
  53. 1 u. x" C6 Z  y3 ~  q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + ?* K% J! I( h
  55. #define STATIC_SHIFT                3+ ]2 d  o, [& A% c
  56. #define TCINTEN_SHIFT               209 \4 O2 {  G2 Z* B. G
  57. #define ITCINTEN_SHIFT              21( i  s% U1 o7 z
  58. #define TCCHEN_SHIFT                22
    " E, o& \9 I: s: w% C( u; f* j* o- x2 S
  59. #define ITCCHEN_SHIFT               23* ~; q- C5 j) |9 b( {
  60. 8 F* a' o0 Q6 n2 X9 o+ ?
  61. static volatile int irqraised1 = 0;4 U& p2 h& [& b& B( ^
  62. static volatile int irqraised2 = 0;
    1 K; y8 ~( I1 N& @7 D

  63. * @4 W4 ~! c6 Y. R2 j) ~4 A' |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ]; g2 W6 X8 P' W* a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 c+ F8 U$ M& f: [( w! f: ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 v" j% d" ?) e& O; a4 T

  67. + A" D/ }* H" d! e& P9 k
  68. dma_addr_t dmaphyssrc1 = 0;1 F3 d7 P. C5 V1 A/ M1 _
  69. dma_addr_t dmaphyssrc2 = 0;, X2 h! {" Z- B  O( E# `
  70. dma_addr_t dmaphysdest1 = 0;! d1 w! D: c& W4 j, D
  71. dma_addr_t dmaphysdest2 = 0;
    / j8 \! o6 t$ n( `& }
  72. 6 q- B: j2 J8 M, V: q
  73. char *dmabufsrc1 = NULL;, G( T% S3 z- K" \$ L/ x
  74. char *dmabufsrc2 = NULL;
    # b& l  c+ m( a: {
  75. char *dmabufdest1 = NULL;# ^: R+ g& I& |% T2 z0 s
  76. char *dmabufdest2 = NULL;1 d  e% P) Z0 C

  77. % F7 y% ~  ]8 e; R" p( X
  78. static int acnt = 512;
    $ f( V  _3 Z2 E- t! V2 [
  79. static int bcnt = 8;4 \% m# Z' Q. x0 s* F5 P( `
  80. static int ccnt = 8;
    4 g& n& n( a: H/ {
  81. & x! l9 V( h/ V! S
  82. module_param(acnt, int, S_IRUGO);
    ! e' s1 d) Q& x! T
  83. module_param(bcnt, int, S_IRUGO);' h4 ?" s4 O0 e  e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& }- r* B# ^# \# c8 q

! v. o( H, t  |- ]' F, ^% L0 [9 B, b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 |  N% w; V& [" r8 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, U  k' l" q8 D! `( Q. ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 F( O! @% C/ h* }/ b0 }
" J6 _: r( g6 A$ e

' c1 s" n! D. p5 @, E6 h: r. t0 ~+ E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-17 03:17 , Processed in 0.039903 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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