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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( h, n9 e& X& \
  1. [code]EDMA sample test application
    1 K! }; Z$ w0 l" `! l- ^2 E
  2. /*5 e: m/ e& Z0 I, x( Z
  3. * edma_test.c
    6 p! X& {+ D/ Y1 X; H$ ^: k  U
  4. *
    " {' [" Q/ a) V* e
  5. * brief  EDMA3 Test Application
    * b% ]/ {" {! b% ]* M
  6. *4 v" n& T+ @6 i& x
  7. *   This file contains EDMA3 Test code.$ ~6 a' H7 w5 ^9 |5 o
  8. *& M, t0 v0 s; \- J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 \1 |2 y- I$ |8 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 l4 s' G1 [" y9 }. X
  11. *         TO CHANGE.( u9 N. p' v' J. T- \; B
  12. *; X: f4 B  `6 n+ v, ]9 e$ r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( @8 K2 M+ P8 I1 ?6 r
  14. *
    6 }: W8 b$ ]* s% x5 n1 P, Y
  15. * This program is free software; you can redistribute it and/or" j  ?: B; [, v
  16. * modify it under the terms of the GNU General Public License as$ u/ _' d  x1 V% C" I
  17. * published by the Free Software Foundation version 2.
    ) Y6 ^2 Y* o+ p: \; Y1 K" j
  18. *! T, D/ C3 h+ I6 g5 n/ f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 q3 |% E9 F9 D( ~+ L; P
  20. * kind, whether express or implied; without even the implied warranty
    7 W+ s+ h  V, i# a3 L) G2 v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; D* U, C9 g# ?9 e3 M
  22. * GNU General Public License for more details.3 }* _6 i4 s; B3 l7 |
  23. */
    . f2 i3 [) }, e( ]( [* X
  24. + `, R% j7 Q2 B4 U2 |6 g2 G. F8 J
  25. #include <linux/module.h>
    ' b" x2 A! L' c! i" ]3 M, ]
  26. #include <linux/init.h>9 b. G7 e' @  b6 O6 Z
  27. #include <linux/errno.h>1 Q4 r5 K  Z* y! h( |) }: z: j3 k
  28. #include <linux/types.h>% _4 A/ @- R) T& g  J
  29. #include <linux/interrupt.h>; n' b' P# O8 D. S3 n6 v9 ^
  30. #include <asm/io.h>5 x8 n3 Q; U2 l4 N# w9 Z9 j" g) ~. T3 a
  31. #include <linux/moduleparam.h>& T5 M: q+ R- {, M. e* \$ \7 p4 _
  32. #include <linux/sysctl.h>4 z6 I/ E9 H. \- {5 P2 A
  33. #include <linux/mm.h>
    / |0 |: ~, G" ^6 d
  34. #include <linux/dma-mapping.h>  J, [7 {- h2 {/ L$ m8 U0 P

  35. ! b2 u, e8 b- u) L0 r* y3 t8 z+ U
  36. #include <mach/memory.h>
    " i6 f6 u  N6 Q% ~5 s5 P  w& V
  37. #include <mach/hardware.h>1 P( F2 x. [8 u" r$ C& L2 R4 q" h
  38. #include <mach/irqs.h>  J2 I6 H7 Z8 I! O- e
  39. #include <asm/hardware/edma.h>, w+ v7 Z& o* I! h7 N8 T
  40. ; T3 i9 |+ b, Z$ F# F  {1 n
  41. #undef EDMA3_DEBUG
    + e3 J) w' C( P# _* }4 P; _
  42. /*#define EDMA3_DEBUG*/
    : h- o( e4 _: |$ d$ \
  43. % w- O& @$ V. y4 }, W8 K8 F
  44. #ifdef EDMA3_DEBUG* y7 Q! Z" u1 ^4 v, m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 F2 ^5 e, x; q; u! ?( |! k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 C, X4 U! t/ l  o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 s& _5 s9 g* c, X! E  f" V4 V: a) T
  48. #else
    : p2 U  X& j' ]% x
  49. #define DMA_PRINTK( x... )+ m: ]$ W1 b( C2 w% Z* c; X  g
  50. #define DMA_FN_IN
    4 }2 K5 H+ P0 r$ W& ]) I8 @( |
  51. #define DMA_FN_OUT
    0 `1 t' i5 w1 }. S
  52. #endif( k0 R4 C& W5 E2 v9 M" h, y7 s: L
  53. ; p3 R, C& t4 i5 C7 [) Q6 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : [3 T4 G. I1 {; @! ~" p6 l, E
  55. #define STATIC_SHIFT                3
    ; N! _- j0 ^+ l# P- P1 A; Y0 G
  56. #define TCINTEN_SHIFT               20
    . I: m. b0 i$ y& T" E- a! C
  57. #define ITCINTEN_SHIFT              219 ~# E+ `9 Z! ]8 L
  58. #define TCCHEN_SHIFT                22
    . {5 _" u0 t* H$ v  g$ O' i' Y5 ^  p
  59. #define ITCCHEN_SHIFT               23: a6 @: z2 g  r5 _1 D! q
  60. " l" X! l* B/ ?
  61. static volatile int irqraised1 = 0;) D! e( t6 o- R
  62. static volatile int irqraised2 = 0;& d3 o! S( w1 t9 h7 \5 b1 a
  63. % {" m2 w4 `3 I1 K& C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. K) c$ z4 A( V/ V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & c: h6 G5 M" J$ B' ^" W" i3 W" m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 Z9 O2 Z5 w4 I3 q7 N4 `; r7 K

  67. 9 y4 k. f' _  c% d! {. K
  68. dma_addr_t dmaphyssrc1 = 0;
    5 T, I3 m. c) y$ c- c
  69. dma_addr_t dmaphyssrc2 = 0;
    ( U1 i  y" G& y: S9 F7 q0 M, J: @
  70. dma_addr_t dmaphysdest1 = 0;
    . s; w+ y5 I: e) V5 G/ H
  71. dma_addr_t dmaphysdest2 = 0;
    8 c6 M3 ^/ M  ~- {7 y

  72. ) w# f+ V* J! n- B3 ]- @, ]# S& p
  73. char *dmabufsrc1 = NULL;
    0 R' b2 z1 U4 z) j5 T% {* A
  74. char *dmabufsrc2 = NULL;
    3 N" g. j5 m5 b/ |: r
  75. char *dmabufdest1 = NULL;6 h# S) u+ Q; w3 R6 t8 n! j; M8 H# k1 t
  76. char *dmabufdest2 = NULL;: Q% A4 r% {) U  N0 I

  77. - g) b3 F; |4 g% j- y5 w5 L6 ~
  78. static int acnt = 512;; V5 S7 Q/ I, B" C/ m; w- k
  79. static int bcnt = 8;
    9 Y' D# c# U7 K6 w- W5 O# @1 ?
  80. static int ccnt = 8;+ v+ ?' ]+ j( v8 V' X% y3 _
  81. 5 a8 V8 @9 H8 O. B
  82. module_param(acnt, int, S_IRUGO);
    8 O' q  s8 P$ n( i2 S2 v7 _" `
  83. module_param(bcnt, int, S_IRUGO);
    ' m$ k# u' W2 P5 S+ t% |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& O1 \" b0 L1 n0 k

$ d5 E4 a5 i# d( _9 U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% ^8 A; {1 ]8 a0 r7 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" R' p1 {% N. @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* p6 ?- c- x3 ~
( d# W' ]+ e8 ]) a2 f
9 e& S% T( Y# S1 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-4 20:58 , Processed in 0.043633 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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